A "Best of the Best Practices" (BOBP) guide to developing in Python.
- "Build tools for others that you want to be built for you." - Kenneth Reitz
- "Simplicity is alway better than functionality." - Pieter Hintjens
| from celery import chain | |
| from django.core.management.base import BaseCommand | |
| from . import tasks | |
| class Command(BaseCommand): | |
| def handle(self, *args, **kwargs): |
| files: | |
| "/opt/elasticbeanstalk/hooks/configdeploy/pre/99patchwsgi.py": &file | |
| mode: "000755" | |
| owner: root | |
| group: root | |
| content: | | |
| #!/usr/bin/env python | |
| import os | |
| import sys | |
| sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) |
| # Uncomment the next line if you have installed wkhtmltopdf | |
| # sudo apt remove wkhtmltopdf | |
| cd ~ | |
| # Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line | |
| wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz | |
| tar xvf wkhtmltox*.tar.xz | |
| sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin | |
| sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig |
The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech
Latest revision: 2025-07-24.
Tested on Ubuntu 24.04 Docker container. The Dockerfile is a single line FROM ubuntu:24.04. Alternatively, you can simply run docker run -it ubuntu:24.04 bash.
NOTE: stopping services didn't work for me for some reason. That's why there is kill $(pidof <service name>) after each failed service <service name> stop to kill it.
This post will describe how to set up a Django Channels solution using AWS Elastic Beanstalk [EB]. This guide is written in response to there being very little information on the combination of Channels and AWS. Mainly many solutions end with problems regarding websockets, which is a fundamental part of Channels. See here and here. This guide will consist of multiple step-by-step parts including
| files: | |
| "/opt/elasticbeanstalk/hooks/appdeploy/post/run_supervised_daemon.sh": | |
| mode: "000755" | |
| owner: root | |
| group: root | |
| content: | | |
| #!/usr/bin/env bash | |
| # Get django environment variables | |
| djangoenv=`cat /opt/python/current/env |
| $ git clone git@github.com:xxxxx/xxxx.git my-awesome-proj | |
| Cloning into 'my-awesome-proj'... | |
| ssh: connect to host github.com port 22: Connection timed out | |
| fatal: Could not read from remote repository. | |
| $ # This should also timeout | |
| $ ssh -T git@github.com | |
| ssh: connect to host github.com port 22: Connection timed out | |
| $ # but this might work |