Category Archives: Meh Practices

Meh Practices Mental Note: Add Category

My did to help me remember what I did

This article was making the rounds this week: did.txt file. Lately, I’ve been having trouble remember what I did, so the timing of that post was perfect.

In the past, I’ve been able to do this in git like git reflog --since yesterday --decorate --author $(git whoami), but these days I’m in many Git repos and a lot of my work isn’t code, so the `did.txt` solution looked great. But following my slogan, “do the same thing you’ve already done, unless you can do it lazier”, I came up with an even lazier method. In my dotfiles, I have this bash function:

# Inspired by
did () {
 mkdir -p ~/Documents/did
 if [ -n "$*" ]; then
   touch ~/Documents/did/"$*";
 find ~/Documents/did -type f -printf "%TY-%Tm-%Td %TH:%TM\t%P\n" | sort -nr | head -n 10

You use it like:

$ did Printed my TPS report
$ did Re-printed my TPS report with the new cover sheet

And you use the same command with no arguments to get what you did:

$ did
2018-07-18 10:59 Re-printed my TPS report with the new cover sheet
2018-07-18 10:27 Printed my TPS report


Eventually, I’ll have to clean out my ~/Documents/did, but that’s just deleting old files. It’ll be fun to relive what I was doing. If it actually becomes a problem, it can be automated too.

A duplicate update erases the earlier entry. In real life, this won’t happen much. And if it does happen, you don’t want the duplicates anyways. I see this as a feature.

OSX users

find on OSX doesn’t have -printf, so you’ll need brew install findutils. I recommend just running it like brew install findutils --with-default-names so find just works the way you expect it to.

Meh Practices Nerd Patterns

Django management commands and verbosity

Ren and Stimpy

[update: This post has been corrected, thanks to my commenters for your feedback]

Every Django management command gets the verbosity option for free. You may recognize this:

optional arguments:
  -h, --help            show this help message and exit
  -v {0,1,2,3}, --verbosity {0,1,2,3}
                        Verbosity level; 0=minimal output, 1=normal output,
                        2=verbose output, 3=very verbose output

We rarely use it because doing so usually means lots of if statements scattered through our code to support this. If you’re writing quick n’ dirty code, this may look familiar in your management commands:

if options.get('verbosity') == 3:

In a recent Django project, I came up with a few lines of boilerplate to support the verbosity option, assuming you’re using also the logging library and not relying on print:

import logging
class Command(BaseCommand):
    def handle(self, *args, **options):
        verbosity = options.get('verbosity')
        if verbosity == 0:
        elif verbosity == 1:  # default
        elif verbosity > 1:
        if verbosity > 2:

So what does this do?

At the default verbosity, 1, I display INFO logging statements from my command. Increasing verbosity to 2, I also display DEBUG logs from my command. And going all the way to verbosity 3, I also enable all logging statements that reach the root logger.

Go forth and log!

Meh Practices Nerd

Autobuilding Sphinx Docs With inotify

So tonight I decided I’ve been putting it off far enough, and started my first Sphinx documentation project. Read The Docs’s Getting Started guide wasn’t bad, but it really bothered me that there wasn’t a good way to autobuild the docs.

I ended up just adding this to the makefile:

# If you don't have inotify-tools, install it first: `apt-get install inotify-tools`
    @while true; do \
    inotifywait --recursive -e modify -e move -e create -e delete \
    --exclude $(BUILDDIR) . && $(MAKE) --silent html; done

This blog post by JKM is often cited as a way to do it too, but the install_requires section of watchdog’s was longer than I felt like sitting through.

There’s a promising project, sphinx-autobuild, but the readme currently says “sphinx-autobuild relies on a not-yet-released version of python-livereload” and it also uses watchdog; so forget that. If I end up spending a lot of time writing docs, it’s worth getting this up and running though because it comes with LiveReload.

Meh Practices pics plz

Winter Tips

Here are some winter tips from a Texan who was in Chicago that one time:

  • Don’t layer. If it’s below 40 degrees F (4 degrees C), forget layers. Just wear a T-shirt and your good winter coat. That is seriously all you need. Don’t have a coat warm enough? Well, then you should probably layer. Would you rather put on and peel off a dozen layers as you transition from indoors to outdoors and back indoors; or just throw on a coat?
  • Forget gloves. Put your hands in your pockets.
  • I lied, get gloves.My point is: don’t depend on them (unless you’re biking, but that’s another story). Be prepared to lose your gloves. Ideally, the gloves you buy have clasps, hooks, and/or velcro so you don’t lose them. I actually have a glove/coat combo where I can peel off my gloves and stick them onto a velcro strip on the coat. Ski jackets usually have good glove storage.
  • Learn how to put on and take off your gloves with your teeth. True story: If you’re walking down the street eating your ice cream and you need to answer your phone, you don’t want to have to put down your ice cream to mess with a glove.
  • Your nose will run. Don’t use tissues. I always carry a washcloth for this. Bicyclist will know that winter gloves are designed to have a patch for wiping your nose.
  • No hats. All you need are ear warmers. Even on bike. I got these foldable ear wamers on woot a loooong time ago: You can fold them for easy storage, and you can also carry them by wrapping them on your arm, freeing up valuable pocket space. Besides, hats mess up your hair.
  • Do use scarves and hoods. Hoods are useful for dealing with wind, and scarves can be equivalent to wearing a whole layer. Learn the different way of tying a scarf. You can tie a scarf different ways to deal with different degrees.
  • Pants: it doesn’t matter, and you don’t need long underwear. You can wear the same pants you wore in summer. Same goes for socks and shoes. Your jacket will cut the wind and cover the important bits. I don’t know what magic girls use to walk around in leg warmers. Maybe it’s the Uggs.

And there you have it. With that wardrobe, I was biking around Chicago all winter in 5 degree F weather. The only modification I made for biking was I had to invest in some serious gloves. Another modification you might want is if you’re going to be standing still outdoors for a long time (why?), then you should add layers.

Finish Writing Me Plz Life=Boring Meh Practices

GTA IV 1.0.7 bootstrap guide

There are lots of websites and youtube videos all trying to tell you how to mod GTA IV. Unfortunately, they’re almost all out of date, or youtube videos.

I’m using steam installed Grand Theft Auto IV 1.0.7

A decent guide:

Prepping the Game

Install This:

Xliveless (v0.999b7 md5: F7FD7512F6AC8959CDDA6A2B2E014C68)

SparkIV (v0.7.0b1)

The original tool, currently trying OpenIV below instead of this.

 OpenIV (v1.5.0)

Seems to be much newer than SparkIV. Still testing it out. It actually installs (as opposed to SparkIV, which you just unzip and run) and is more difficult to set up that it needs to be. Some mods require OpenIV.

Installing a simple mod

Most mods will tell you exactly what to do in their readme.txt. I’ll only give installation highlights.

No Intro Screen

Who has time to look at intro screens? This mod is easy to install and well worth it. Just copy loadingscreens_pc.dat to common/data. It’s plaintext so you can see what changes it makes.

Rockstar Social Club

I couldn’t find a way to disable it. I added these to my hosts file anyways:

At least the time saved taking off the intro screens make up for having to click through the Social Club screens.

Installing some intermediate mods

scripthook.dll (v0.5.1 md5: 7260B388AAC8329C3CF615084AA7DB83)

You may need to dig around for this download; the download link in the homepage is dead. Sometimes it’s redistributed inside a mod. Just copy it into root GTAIV directory.


inGame Trainer (v1.9.0)

This is the trainer you see most often in youtube videos. You can change the weather, teleport, change your wanted level, enable god mode, and enable cheats. It’s not an open sandbox game without a little god mode.


CarSpawner In-Game Menu

The thing about this mod is that for some reason, the readme is a word doc. Don’t worry though, the text on the homepage is the exact same as what the readme says. This mod defaults to taking over F1 to open the gui, just like inGameTrainer, so you’ll need to edit at least one of them.

Installing an advanced mod

Iron Man IV (v1.2)

See the readme.txt. It’s an involved process but detailed nicely. Remember to make backups!


Other noteworth mods:

  • iCEnhancer

Other hacks


Meh Practices Nerd

A few virtualenv tips

If you’re doing any development in Python, odds are you’re using virtualenv. And if you’re using virtualenv, odds are you’re using virtualenvwrapper. I came up with a few tricks to make my life easier, and I thought I ought to share them. And as a disclaimer: although I am obsessed with discovering best practices, these are definitely not. So I’m adding a new category called “Meh Practices”.

Set an $IPYTHONDIR environment variable.

According to the IPython documentation, IPython stores settings in a profile, and it looks for that profile in $IPYTHONDIR. So in my global virtualenv postactivate, I have:


Now why would anyone want a separate profile for every virtualenv? I do this so every virtual’s IPython gets its own history database. I also used to run IPython 0.10.X and 0.11.X side by side, and the two had incompatible profile formats. All my tools support the new IPython so this isn’t an issue for me anymore, but I still do it for the separate history.

Maintain the same IPython configuration for every profile

Because now I’m running around with N IPython profiles with N configurations when I really only want 1 configuration, I symlink all the profile configurations from a master one I keep in source control. The gist of it looks like:

mkdir -p $DST
cd $DST
ln -s -f $SRC

But my actual one currently looks like this and I run it in my global postmkvirtualenv, which now looks like:


Where mkipythonconfig is the snippet above.

Add an alias to maintain your environment variables

I got really sick of cdvirtualenv then vi bin/postactivate, so in my postactivate, I have this line:

alias vivirtualenv="$VISUAL $VIRTUAL_ENV/bin/postactivate"

in my virtualenv’s postactivate. Now when I need to edit my postactivate, it’s a few tab complete-able keystrokes away. I stole the naming convention from visudo, and I tried naming it vipostactivate, but I think vivirtualenv is just so catchy. Now if your immediately reaction is to make a comment telling me I should just use autoenv; too bad, I already thought about that. Right now, issue#28 is preventing me from adopting autoenv. I also can’t go around adding .env to the .gitignore of collaborated projects. And there’s one project I know of where the Procfile for foreman is not in the project root. #everythingisterrible

Use setvirtualenvproject

I don’t take advantage of virtualenvwrapper’s mkproject, nor do I really know what to do with them, but there is one thing I do use from that… setvirtualenvproject. I never use mkproject because I rarely name my projects and virtualenvs the same, and I haven’t bothered to set up any project templates. But I am lazy, and I like how if you tell virtualenv that your current working directory is the project root using setvirtualenvproject, every time you workon it, you’ll automatically cd into it. But what if you don’t want that to happen? You can jump back to the directory you were just in with cd -. For me, the extra time it takes to go back is more than made up by all the time saved not having to cd in.

So putting everything together, I have a makefile for bootstrapping a new install so virtualenvwrapper and IPython are set up the way I like. It may seem like I have to do a lot of work to get up and running, but I’ve got it down to one make now.