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:
@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);
@hrldcpr
hrldcpr / tree.md
Last active September 1, 2024 07:04
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!