This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Update or add copyright headers to source files. | |
# John Stowers | |
import os | |
new_licence = """ * | |
* This file is part of wasp, some code taken from paparazzi (GPL) | |
* | |
* wasp is free software; you can redistribute it and/or modify |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[submodule "documents/latex-makefile"] | |
path = documents/latex-makefile | |
url = git://gist.github.com/503886.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dict_diff1(first, second, NO_KEY='<KEYNOTFOUND>'): | |
""" Return a dict of keys that differ with another config object. If a value is | |
not found in one fo the configs, it will be represented by NO_KEY. | |
@param first: Fist dictionary to diff. | |
@param second: Second dicationary to diff. | |
@return diff: Dict of Key => (first.val, second.val) | |
""" | |
diff = {} | |
# Check all keys in first dict | |
for key in first.keys(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/a/10031877 | |
import numpy | |
import cairo | |
import math | |
from gi.repository import Gtk,Gdk | |
data = numpy.zeros((200, 200, 4), dtype=numpy.uint8) | |
surface = cairo.ImageSurface.create_for_data( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Animated Gtk+ StatusIcon | |
Given an icon name or path, animates the icon in a number of ways, rotating, | |
shrinking, saturating it, etc. | |
Inspiration from: | |
http://groups.google.com/group/sage-devel/browse_thread/thread/f9aeba22ac171082 | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Character set for the Squeezebox display | |
00 | |
00000 | |
00000 | |
00000 | |
00000 | |
00000 | |
00000 | |
00000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Prints the memory usage (including private and dirty) for a given PID | |
# | |
import sys | |
import re | |
def permute(args): | |
ret = [] | |
if args: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## http://emilics.com/blog/article/python_time.html | |
## http://www.saltycrane.com/blog/2008/11/python-datetime-time-conversions/ | |
###################################################################### | |
# CURRENT AWARE LOCAL DATETIME | |
###################################################################### | |
from datetime import datetime |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import random | |
import glob | |
import os.path | |
import time | |
from gi.repository import Gio | |
class Changer: | |
def __init__(self, directory, interval): | |
self._pics = glob.glob(os.path.join(directory,"*.jpg")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#get the current directory. from | |
#http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in | |
pushd . > /dev/null | |
DIR="${BASH_SOURCE[0]}"; | |
if ([ -h "${DIR}" ]) then | |
while([ -h "${DIR}" ]) do cd `dirname "$DIR"`; DIR=`readlink "${DIR}"`; done | |
fi | |
cd `dirname ${DIR}` > /dev/null | |
DIR=`pwd`; | |
popd > /dev/null |