Skip to content

Instantly share code, notes, and snippets.

View jrabbit's full-sized avatar
🍡

Jack Laxson jrabbit

🍡
View GitHub Profile
@jrabbit
jrabbit / gist:468298
Created July 8, 2010 16:56
Keith Olbermann's closing simulator
import time
daynum=int(time.strftime('%j'))
year=int(time.strftime('%y'))
composite=(year*365)+daynum
def ordinal(n):
if 10 <= n % 100 < 20:
return str(n) + 'th'
else:
return str(n) + {1 : 'st', 2 : 'nd', 3 : 'rd'}.get(n % 10, "th")
#thanks http://stackoverflow.com/questions/739241/python-date-ordinal-output/739301#739301
@jrabbit
jrabbit / gist:507352
Created August 3, 2010 23:20
Quick and dirty script to set SDL env for Alien::SDL
#!/usr/bin/env python
from subprocess import *
import os
sdlconf = Popen(['sdl-config', '--prefix'], stdout=PIPE).communicate()[0]
pkgconf = Popen(['pkg-config','sdl', '--libs'], stdout=PIPE).communicate()[0]
if sdlconf:
prefix = sdlconf
elif pkgconf:
def progress_bar(iterable, fill='=', empty='.', size=60):
count = len(iterable)
def show(i):
x = int(size * i / count)
sys.stdout.write('[{0}{1}] {2}/{3}\r'.format(fill * x, empty * (size - x), i, count))
sys.stdout.flush()
show(0)
for i, item in enumerate(iterable):
yield item
show(i + 1)
@jrabbit
jrabbit / gist:559913
Created August 31, 2010 22:47
download youtube comments
import gdata.youtube
import gdata.youtube.service
from BeautifulSoup import BeautifulSoup
yt_service = gdata.youtube.service.YouTubeService()
# The YouTube API does not currently support HTTPS/SSL access.
yt_service.ssl = False
yt_service.developer_key = "AI39si6sDAt4km6PVp3cw5U4MIoUAVKi-R0hVSALYdjz7EIH_Leik-7s_fxeHQZKpx6fXilSx5PvYqhk16Gg1APQFJDRncXh6g"
yt_service.client_id = "yt comments"
def get_comments():
@jrabbit
jrabbit / Round Clock.py
Created October 5, 2010 04:31
Kilosecond Clocks.
import Image, ImageDraw
import time
im = Image.open("kilosec_round.PNG")
draw = ImageDraw.Draw(im)
def kiloseconds():
tm = time.localtime()
return (tm.tm_hour*3600+tm.tm_min*60+tm.tm_sec)/1000.0
#http://github.com/api/v2/json/blob/show/bavardage/kiloseconds/03fac33ed6be1f0a004319cf7b8449d6d5fb10f3
@jrabbit
jrabbit / gist:789415
Created January 21, 2011 08:22
Clean the $PATH then return it to normal. Make homebrew more harmonious with Fink et al.
diff --git a/bin/brew b/bin/brew
index 4ec64f0..79a1fb4 100755
--- a/bin/brew
+++ b/bin/brew
@@ -11,7 +11,11 @@ require 'pathname'
HOMEBREW_LIBRARY_PATH = (Pathname.new(__FILE__).realpath.dirname.parent+"Library/Homebrew").to_s
$:.unshift(HOMEBREW_LIBRARY_PATH)
require 'global'
-
+def path_clean

Timeline. Include what you plan to have accomplished by the end of:

Community bonding period (May 23) -

  • Buildbot stuff done (should take a week[end])

  • Hpkg-Build is in a good place with packages. (No work may need to be done, I haven't stayed on top of how well it works with the package manager implementation.)

Quarter-term (June 13) -

@sanguis
sanguis / .gitconfig
Last active June 2, 2017 14:41
my .gitconfig file minus my name and email
[color]
ui = on
[core]
whitespace= fix,-indent-with-non-tab,-indent-with-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[alias]
df = !git diff --no-prefix && git diff --staged --no-prefix
clear = reset --hard
st = status
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
<!DOCTYPE html>
<html>
<style type='text/css'>
object{
display: block;
margin-left: auto;
margin-right: auto;
}
html{
background: #0E0E0E;
@buzztaiki
buzztaiki / gjs-io-sample.js
Created December 16, 2011 20:18
gjs-io-sample.js
const GLib = imports.gi.GLib;
const Gio = imports.gi.Gio;
let [res, out, err, status] = GLib.spawn_command_line_sync('ls -la');
print(out);
let [res, out] = GLib.spawn_command_line_sync('ls -la');
print(out);
let [res, out] = GLib.spawn_sync(null, ['/bin/ls', '-la'], null, 0, null);