Oneliner to generate a Django Secret Key

Debian – Truly Unattended Upgrades

This will make sure you bypass those pesky questions, with the safest option. For when you want to do an upgrade in a script (such as from a Vagrant :shell provision)

Making Byobu Behave

I love byobu (the awesome screen/tmux wrapper). One of my pet peeves with byobu, is it takes over the Function keys (F-keys). There is very little to no documentation on how to disable that by default. Here is how …

For Tmux:

For Screen:

Avoid Hyphens in Puppet Class Names

We had been using hyphens in class names until I faced an issue that I wasn’t able to figure out. The issue is, if you have a class name with a hyphen, and then try to grab a fully qualified variable from the class, the puppet dsl parser thinks its a minus.

They seemed to fix the issue and should be released with puppet 3.5; but until then, use underscores if you need to but avoid the issue.

Here is the doc that briefly mentions the gotcha:

Hopefully this helps save some time if you hit this issue.

Enable HG Extensions for one command

Sometimes you want to enable an extension for just one command (either being on a different machine, or just don’t really want to clutter your hgrc for a one time thing) you can use –config directly on the command line, for example to enable the purge extension

Should you use underscore prefixes in python (private) variables?


especially not double underscores, never! … if you really really want and have an itch you want to scratch use one underscore, that’s more than enough to tell users that they shouldn’t change it.

Django OR Querysets using Binary Operator

One of Django’s cool (maybe the coolest) and undocumented feature is being able to OR and AND queries using bitwise (& and |) operators. It is a variation to the Q object that is documented.

Now this becomes really useful when you use related_managers:

while aTable and xTable are totally different instances yet they reference MyTable

Multiple ENV vars with UWSGI

To send in multiple environment variables using the uwsgi ini, you just need to pass in multiple env parameters for example:

Create a quick SMTP debug server

This creates a little server running on port 1025 to test if your apps are sending emails properly or not!

Installing HL 3040CN Brother printer in Debian 64-bit (The Real Manual)

Although the brother website has instructions for debian/ubuntu 64bit they only actually work for ubuntu (actually they might not even work with the latest ubuntu) … on debian the instructions should be more like this:

Enable multi-arch for 32bit

Install cups 32bit libs

Download the lpr and cups drivers from brother and install them:

You should be good to go if you device is connected via USB, otherwise you will need to go to your local cups and reconfigure the printer to the proper uri.