GeistHaus
log in · sign up

Mind Reference

Part of feedburner.com

Simplicity and elegance are unpopular because they require hard work and discipline to achieve and education to be appreciated. — Edsger W. Dijkstra

stories
Debian: Clean up dpkg rc packages
aptdebian
rc means that the package is not completely removed. dpkg --list | grep "^rc" | cut -d " " -f 3 | \ xargs sudo dpkg --purge
tag:blogger.com,1999:blog-8404509726009905633.post-2713042401346269798
Extensions
Debian: Possible missing firmware
debiankernel
If you encounter issue like the following, you need to download/update firmware files. W: Possible missing firmware /lib/firmware/i915 The script below recursively downloads all available firmware for i915, (as example) copies files related to kernel 5.19 and updates initramfs which should now be without warnings. wget -r --no-parent https://anduin.linuxfromscratch.org/sources/
tag:blogger.com,1999:blog-8404509726009905633.post-7979811058243501214
Extensions
Wheezy Projects Update
pythonwheezy.templatewheezy.web
All libraries related wheezy.web and wheezy.template have been recently migrated from bitbucket to github. As a part of this migration there have been provided the following major benefits: Established build process with travis-ci Dependecy updates with dependabot Integrated with covereall.io, 100% test coverage Release process to pypi per tags with github actions Replaced Makefile
tag:blogger.com,1999:blog-8404509726009905633.post-5810124195289407273
Extensions
Python ASGI CLI
benchmarkpythontools
Call ASGI Python application module from command line (without an application server), just like CURL. Interested? You need to install asgi-cli package: pip install asgi-cli Usage asgi-cli --help usage: asgi-cli [-h] [--version] [-X COMMAND] [-I] [-H HEADER] [-d DATA] [-b] [-n NUMBER] [-v] app [url] positional arguments: app an
tag:blogger.com,1999:blog-8404509726009905633.post-8454095931679044815
Extensions
Authorization in Microservices Landscape
azuresecurity
Overview This article outlines a high-level design of authentication and authorization options in Azure per a typical SPA use case interacting with multiple microservices. Compares API gateway pattern versus a direct client-to-API communication in microservices environment. Use Case A user should be able to request the following information: User profile via Azure Graph API. User documents
tag:blogger.com,1999:blog-8404509726009905633.post-4555413197749618979
Extensions
Asynchronous Python in Web Applications
pythonwheezy.web
Asynchronous or non-blocking IO allows worker to process other requests before current request has finished. That is possible in case a processing of current web request is related to an operation that is IO bound. Prerequisites What is important to understand about applicability of async pattern for IO bound operations, they must: Utilize the same event loop, in this case worker's event
tag:blogger.com,1999:blog-8404509726009905633.post-2301877459770505015
Extensions
wheezy template: static website generator
pythonwheezy.template
Sometimes you need a quick way to generate a static web site and put it up on a server. Here is how you can generate a static website with wheezy.template. Let's suppose the following structure of the site: content/ `- index.html - main.html shared/ `- master.html snippet/ `- script.html - widget.html shared/master.html: <!DOCTYPE html> <html lang="en"&
tag:blogger.com,1999:blog-8404509726009905633.post-4066803882897401061
Extensions
wheezy web: RESTful API Design
pythonwheezy.web
In this article we are going to explore a simple RESTful API created with wheezy.web framework. The demo implements a CRUD for tasks. Includes entity validation, content caching with dependencies and functional test cases. The source code is structured with well defined actors (you can read more about it here). Design The following convention is used with respect to operation, HTTP method (verb
tag:blogger.com,1999:blog-8404509726009905633.post-5607717232105561992
Extensions
wheezy web: deploy nginx + uwsgi + memcached
debianmemcachednginxpythonuwsgiwheezy.web
wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will deploy quick start with nginx, uwsgi and memcached to clean debian stable installation. Before proceeding ensure you have quick start empty or quick start i18n up and running. We will use the following names for installation: master - a user
tag:blogger.com,1999:blog-8404509726009905633.post-1827130883898952622
Extensions
memcached statistics status
linuxmemcached
Here is a "top" emulator for memcached statistics: watch -n 5 "echo stats | socat unix-connect:/var/tmp/memcached.sock -" The screen will be refreshed every 5 seconds and display results of memcached stats command. Here is a sample output: STAT pid 16779 STAT uptime 131077 STAT time 1394862592 STAT version 1.4.13 STAT libevent 2.0.19-stable STAT pointer_size 64 STAT rusage_user 667.997747
tag:blogger.com,1999:blog-8404509726009905633.post-425205573409468903
Extensions
How to build Python deb package from source
aptdebianpython
You need a newer python version that is not available with the Debian package management system. You can compile it from source and install but that usually takes a lot of time. It would be better to build a deb instead and install it on as many machines as you need. You can use checkinstall for this. apt-get install checkinstall The instruction how to compile python from source is here. Once
tag:blogger.com,1999:blog-8404509726009905633.post-8312344604380363619
Extensions
PostgreSQL Streaming Replication Hot Standby
debianpostgresqltroubleshooting
Streaming replication allows a standby server to stay up-to-date with primary. The standby connects to the primary, which streams WAL records to the standby as they're generated. Hot standby is the term used to describe the ability to connect to the server and run read-only queries. This method of replication is completely transparent to the client, it doesn't require any changes to database,
tag:blogger.com,1999:blog-8404509726009905633.post-2509704903912839633
Extensions
Python HTTP Client API
algorithmspythonwheezy.core
The modern web services expose public API to the world and JSON is de-facto standard in this communication. Here is a simple use case that integrates with buildbot public API. Lets setup a virtual environment and install wheezy.core package: virtualenv env env/bin/easy_install wheezy.core Launch python from virtual environment (env/bin/python) and try this: >>> from wheezy.core.httpclient
tag:blogger.com,1999:blog-8404509726009905633.post-5611762461217877418
Extensions
Keep FreeBSD up to date with subversion
freebsd
The freebsd ports tree is quite big and sometimes you need just few packages. You can do that with subversion sparse checkouts. pkg_add -r subversion Checkout only immediate top level. The list of svn mirrors is here. svn checkout --depth=immediates \ http://svn0.eu.freebsd.org/ports/head /usr/ports Update tree on as needed basis: cd /usr/ports # common svn up --set-depth=infinity Mk
tag:blogger.com,1999:blog-8404509726009905633.post-6320586557355546015
Extensions
Convenient Remote Access with SSH Config
securityssh
If you are working with a lot of remote ssh hosts it becomes hard to remember all that host specific information: username, ip address, identity file, non-standard port or local/remote port forwarding. ssh_config to rescue. Here is a sample to give you an idea (file ~/.ssh/config): Compression yes IdentityFile ~/.ssh/id_rsa LogLevel ERROR Port 22 Host h1 HostName 192.168.91.57 User
tag:blogger.com,1999:blog-8404509726009905633.post-100822536281927149
Extensions
How to manage Git or Mercurial repositories
pythonsecuritytools
Managing version control repositories can be a challenge in multi-user environment especially when simplification of user collaboration is your goal. There are usually two primary concerns while considering enterprise deployment for version control repositories: access control and safety of your data. Both are not directly addressed by version control itself, thus a sort of security facade is
tag:blogger.com,1999:blog-8404509726009905633.post-6243163948220796649
Extensions
wheezy web: Actors
pythonwheezy.web
The application design of wheezy.web application consists of several actors, each playing its unifying role. Actors are grouped into packages, e.g. models, repository, service, web, content, tests, etc. These packages (or layers) shape a subsystem. The diagram below visualizes relations between actors, boundaries between packages, subsystems and application, giving a better picture of whole:
tag:blogger.com,1999:blog-8404509726009905633.post-4995712350380010644
Extensions
Thoughts on SQL vs ORM
pythonwheezy.corewheezy.web
The question of persistence implementation arise often. I found repository pattern very valuable due to separation of concerns, mediate between domain model and data source (mock, file, database, web service, etc). The database data source is somewhat specific since you can proceed with SQL functions or ORM. Here are some thoughts why you might prefer SQL functions over ORM in your next project:
tag:blogger.com,1999:blog-8404509726009905633.post-1248493015208968868
Extensions
wheezy web: Quick Start i18n Project
pythonwheezy.web
wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will use an i18n (multilingual internationalization) project quick start to build a new project. Download quickstart-i18n.zip and extract. Rename extracted directory `quickstart-i18n` to meet your project name, e.g. mysite and open terminal in that
tag:blogger.com,1999:blog-8404509726009905633.post-250365355946995838
Extensions
wheezy web: Quick Start Empty Project
pythonwheezy.web
wheezy.web is a lightweight, high performance, high concurrency WSGI web framework with the key features to build modern, efficient web. Here we will use an empty project quick start to build a new project. Download quickstart-empty.zip and extract. Rename extracted directory `quickstart-empty` to meet your project name, e.g. mysite and open terminal in that directory. The empty project
tag:blogger.com,1999:blog-8404509726009905633.post-6985447282786963213
Extensions
How to create Jail in FreeBSD
freebsdsecurity
Operating system virtualization is the most effective way to utilize your system resources, jails let you setup isolated mini-systems. Jails are explains well in handbook however, from practical standpoint of view, the presented material is incomplete. Here we will setup few scrips that follow handbook's 'Application of Jails' article and enhance with few missing features. Let note preliminary
tag:blogger.com,1999:blog-8404509726009905633.post-7273923490663102948
Extensions
How to Send Mail in Python
algorithmspythonwheezy.core
There are several use cases how you can send an email message using Python: Plain Mail: an email message with plain text or html content. Mail with Attachment: an email message with attached document. Alternative Mail Views: you provide a convenient way to email recipients to view your message in plain text or html with optional rich content including images, etc. Here is an example of
tag:blogger.com,1999:blog-8404509726009905633.post-5195612948061883643
Extensions
How to ship eggs with pyo files only in Python
pythonsetuptoolstricks
There is sometimes a need to ship python egg distribution with pyo files only. There is confusion using bdist_egg command since it doesn't have any options to do that; instead, you can instruct install_lib command. Here is what you need in setup.cfg file: [install_lib] compile = 0 optimize = 2 [bdist_egg] exclude-source-files = 1 Issue the following command to build egg. python setup.py -q
tag:blogger.com,1999:blog-8404509726009905633.post-9123540027014001216
Extensions
Python Web Frameworks Excessive Complexity
benchmarkdjangopython
Cyclomatic (or conditional) complexity is a metric used to indicate the complexity of a source code. In this post we will take a look at web frameworks source code and estimate excessive complexity, something that is beyond recommended level of 10 (threshold that points to the fact the source code is too complex and refactoring is suggested). Here is a list of web frameworks examined: bottle
tag:blogger.com,1999:blog-8404509726009905633.post-910826835935929467
Extensions
Lazy Attribute in Python
algorithmspythonwheezy.core
A lazy attribute is an attribute that is calculated on demand and only once. Here we will see how you can use lazy attribute in your Python class. Setup environment before you proceed: $ virtualenv env $ env/bin/pip install wheezy.core Let assume we need an attribute that is display name of some person Place the following code snippet into some file and run it: from wheezy.core.descriptors
tag:blogger.com,1999:blog-8404509726009905633.post-2692561528968248338
Extensions