Skip to content

Instantly share code, notes, and snippets.


Ry4an Brase Ry4an

View GitHub Profile
wolever /
Created Sep 14, 2014
Monkey patch for logging.LogRecord.getMessage so it will never, ever raise an exception
def monkeypatch_logging_getMessage():
""" Monkey patch logging.LogRecord.getMessage so it will never, ever raise an exception. """
from unstdlib import to_str
from logging import LogRecord
oldGetMessage = LogRecord.getMessage
def getMessage(self):
return oldGetMessage(self)
except Exception as e:
wolever /
Last active Aug 29, 2015
Monkeypatch Django 1.5's QuerySet adding a .first() method compatible with 1.6
def monkeypatch_queryset_first():
""" Monkeypatch QuerySet adding a `.first()` method which is compatible
with Django 1.6's `.first()`. """
from django.db.models.query import QuerySet
if hasattr(QuerySet, "first"):
import warnings
warnings.warn("QuerySet.first is already defined! "
"Monkey patch should be removed.")
def first(self):
Ry4an /
Created Jul 7, 2014
nag least recently updated issue for this release
import json
import pytz
import urllib2
import datetime
import dateutil.parser
import re
import sys
import humanize
munificent / gist:9749671
Last active Oct 20, 2020
You appear to be creating a new IDE...
View gist:9749671
You appear to be advocating a new:
[ ] cloud-hosted [ ] locally installable [ ] web-based [ ] browser-based [ ] language-agnostic
[ ] language-specific IDE. Your IDE will not succeed. Here is why it will not succeed.
You appear to believe that:
[ ] Syntax highlighting is what makes programming difficult
[ ] Garbage collection is free
[ ] Computers have infinite memory
[ ] Nobody really needs:
lelandbatey /
Last active Apr 6, 2021
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


wytten / agent
Last active Jan 3, 2016 — forked from anonymous/april_temp_sensor
Updated original april_temp_sensor to remove use of deprecated methods, to remove the use of pin2 for activating the lamp, and to use CSV format for communication with Also added agent code taken from to which I have made trivial modifications.
View agent
// Accept CSV from device, then format request to and accept response from
device.on("data", function(feedCSV) {
local xively_url = "" + FEED_ID + ".csv";
local request = http.put(xively_url, {"X-ApiKey":API_KEY, "Content-Type":"text/csv", "User-Agent":"Xively-Imp-Lib/1.0"}, feedCSV);
local response = request.sendsync();
if(response.statuscode != 200) {
wolever /
Created Jul 3, 2013
My bash script skeleton.
IFS="`printf "\n\t"`"
set -eux
cd "$(dirname "$0")"
Ry4an / irc-rant
Created May 10, 2013
My cranky-day rant about people /msg-ing in work IRC
View irc-rant
People keep /MSG-ing me non-secret things in IRC, so I assume everyone's doing it w/ one another too. Everytime someone /msg-s me I ask them to bring it up in the main channel instead, but that's not getting the message across, so: STOP IT.
The whole point of IRC is that there's huge benefit in everyone overhearing things that they're not currently working on. This is why IRC is 1000x better for a tech group than IM. There's incredible value in making things like "Oh, I did that at my last job, consider looking at X" or "Didn't I see you did something with Y last month?" possible, and all of that gets flushed down the drain when you /msg.
Don't worry about the channel getting too chatty. I'm in some channels w/ 200+ members and it works just fine. Your IRC client will figure it out.
There might be no immediate need for [Alice] to hear [Bob] and I discussing the finer points of dynamo throughput settings, but there's no harm in it and if at the end of the month the bill knocks her socks off she's goin
pepebe / gist:2955410
Created Jun 19, 2012
Ubuntu: Convert psd files with imagemagick
View gist:2955410
Imagemagick will by default convert a psd to multiple images:
convert file.psd file.png
will result in file-0.png, file-1.png etc for each layer. If you wanted a single image, use the flatten switch:
convert file.psd -flatten file.png
Imagemagick is available on osx, windows and linux. And iOS somehow.
zachwill / gist:2001993
Created Mar 8, 2012
Reload Google Chrome from Vim
View gist:2001993
" Reload Google Chrome on Mac from Vim.
" Adapted from:
function! ChromeReload()
python << EOF
from subprocess import call
browser = """
tell application "Google Chrome" to tell the active tab of its first window
end tell
tell application "Google Chrome" to activate