Skip to content

Instantly share code, notes, and snippets.

@l0b0
l0b0 / gist:3217470
Created July 31, 2012 14:38
Simple merge example
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
cd "$(mktemp --directory)"
git init
cat > test.txt <<EOF
alfa
bravo
charlie
@hrldcpr
hrldcpr / tree.md
Last active January 6, 2025 22:43
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!

@nzjrs
nzjrs / gtk-theme-swatch.py
Created January 21, 2009 01:25
PyGtk widget that displays color swatches according you your Gtk theme
#!/usr/bin/env python
# gtk-theme-swatch: A PyGtk widget that displays the color swatches of all
# gtk.Styles, in all states. Useful for designing themes
# author: John Stowers <[email protected]>
import gtk
class ThemeSwatch(gtk.DrawingArea):
SWATCH_SIZE = 50 #swatch size