Skip to content

Instantly share code, notes, and snippets.

View yamatt's full-sized avatar

Matt Copperwaite yamatt

View GitHub Profile
@robrighter
robrighter / gist:897565
Created April 1, 2011 00:59
Walk a JSON/Javascript tree to grab all values for a given key
function traverse(obj,func, parent) {
for (i in obj){
func.apply(this,[i,obj[i],parent]);
if (obj[i] instanceof Object && !(obj[i] instanceof Array)) {
traverse(obj[i],func, i);
}
}
}
function getPropertyRecursive(obj, property){
@palfrey
palfrey / zero-punctuation.py
Last active September 25, 2015 00:48
Zero Punctuation downloader
#!/usr/bin/python
from urlgrab import Cache
from BeautifulSoup import MinimalSoup as BeautifulSoup
from re import compile
from os.path import exists, getsize, dirname, join
from urllib import urlretrieve, urlencode, quote
from sys import argv
import demjson
import zlib
@stchris
stchris / getimg.py
Created February 19, 2011 13:34
Improved version of getimg.sh - gets the 'image of the day' from NASA, writes the summary onto the image and sets it as the Gnome wallpaper.
#!/usr/bin/env python
"""
getimg.py
Gets the current image of the day from NASA and sets it as the
background in Gnome. The summary / description text is written
to the image.
Requires:
PIL (apt-get install python-imaging or pip install PIL)