RSSAmplifier

Blog

Mind Reference

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

mindref.blogspot.comRSS feed ↗25 posts

Latest posts

Debian: Clean up dpkg rc packages

rc means that the package is not completely removed. dpkg --list | grep "^rc" | cut -d " " -f 3 | \ xargs sudo dpkg --purge

Debian: Possible missing firmware

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/

Wheezy Projects Update

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

Python ASGI CLI

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

Authorization in Microservices Landscape

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

Asynchronous Python in Web Applications

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

wheezy template: static website generator

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"&

wheezy web: RESTful API Design

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

wheezy web: deploy nginx + uwsgi + memcached

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

memcached statistics status

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

How to build Python deb package from source

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

PostgreSQL Streaming Replication Hot Standby

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,

Python HTTP Client API

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

Keep FreeBSD up to date with subversion

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

Convenient Remote Access with SSH Config

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

How to manage Git or Mercurial repositories

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

wheezy web: Actors

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:

Thoughts on SQL vs ORM

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:

wheezy web: Quick Start i18n Project

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

wheezy web: Quick Start Empty Project

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

How to create Jail in FreeBSD

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

How to Send Mail in Python

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

How to ship eggs with pyo files only in Python

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

Python Web Frameworks Excessive Complexity

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

Lazy Attribute in Python

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