Skip to content

Instantly share code, notes, and snippets.

View hoov's full-sized avatar

Tom Hoover hoov

View GitHub Profile
@hoov
hoov / gist:2473171
Created April 23, 2012 19:13
virtualenv autoactivate
#!/usr/bin/env zsh
__virtualenv_activate()
{
export __virtualenv_activate_lock
: __virtualenv_activate_lock:${__virtualenv_activate_lock:=0}
: __virtualenv_activate_lock:$((__virtualenv_activate_lock+=1))
if (( __virtualenv_activate_lock > 1 ))
then return 0 # no nesting
fi
@hoov
hoov / colortrans.py
Created July 19, 2012 22:12 — forked from MicahElliott/colortrans.py
Convert values between RGB hex codes and xterm-256 color codes.
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@hoov
hoov / foo.py
Created December 16, 2015 18:42
Weird...
#!/usr/bin/env python
import time
from contextlib import contextmanager
from itertools import repeat
def way_one():
count = 0
#!/usr/bin/env python
import argparse
import sys
import requests
def trace(s, *n):
print(str(s) % n)
#!/usr/bin/env python
import argparse
import sys
import requests
def trace(s, *n):
print(str(s) % n)
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn web server
# Description: starts gunicorn using start-stop-daemon
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn web server
# Description: starts gunicorn using start-stop-daemon
#!/usr/bin/env python
import argparse
import logging
import ssl
import select
import urllib3.contrib.pyopenssl
from OpenSSL import SSL

Keybase proof

I hereby claim:

  • I am hoov on github.
  • I am hoov (https://keybase.io/hoov) on keybase.
  • I have a public key ASBbuS-B2M6LiLPq3gaxI4cA3K7S8ly6ElrHUl7ytqGSnwo

To claim this, I am signing this object:

#!/usr/bin/env python
import httplib
import urllib2
import requests
def trace(s, *n):
print(str(s) % n)