All articles tagged pro tip

Image for The Joy of Upstart

The Joy of Upstart

Upstart is a ridiculously easy way to turn your scripts into daemons. Take this python script: /home/myuser/ez_daemon.py: import time while 1: print("I'm a daemon!") time.sleep(1) We’re going to turn it into a daemon with <strong>a single line</strong>: /etc/init/ez_daemon.conf: exec python …
Image for Realtime Replay Logs with Redis

Realtime Replay Logs with Redis

First off, realtime websites are hard. The current toolset is rudimentary. When I first started building Ginger, I thought I must be doing it wrong because of all the trial-and-error and pieces I was building from scratch. After watching Geoff …
Image for Quick Django Class Based View Decorator

Quick Django Class Based View Decorator

The recommended way to add decorators such as login_required to class based views in Django is a bit verbose. Here’s a little metaclass-producing function you may find handy: def DecoratedDispatchMethod(actual_decorator): """ If you want to decorate the Class-based View with, …
Image for Detecting File Moves & Renames with Rsync

Detecting File Moves & Renames with Rsync

Without patching, the rsync utility lacks support to detect when a file was renamed/moved across multiple directories inside the synced tree. There is a ––fuzzy option to save bandwidth by building upon similar files on the target side, but only …
Image for Filtering Results from Coverage.py

Filtering Results from Coverage.py

Coverage.py makes it easy to see how much of your code is covered by your test suite. It can be configured to spit out reports in XML (for consumption by a continuous integration server like Jenkins), in HTML (for human …
Image for Automated (No Prompt) Deployment with Pip

Automated (No Prompt) Deployment with Pip

We love pip and Fabric for Django deployment. You can see our boilerplate fabfile.py here. Pip, however, isn’t safe to run in an automated fashion. If you attempt to switch branches or repos for one of your editable requirements, you’ll …