Instantly share code, notes, and snippets.

View gobgp_viper.go
func setupAndRunViper(path, format string, viperCh) {
sigCh := make(chan os.Signal, 1)
signal.Notify(sigCh, syscall.SIGHUP)
cnt := 0
for {
v := viper.New()
v.SetConfigFile(path)
v.SetConfigType(format)
var err error
View gist:7020780
from ujson import dumps
import pprint
class Test:
def __init__(self):
self.data = "foobar"
self._data = "barfoo"
class Test2(Test):
def toDict(self):
View gist:3368661
URLS="https://raw.github.com/git/git/master/contrib/completion/git-completion.bash https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh"
DONE=0
which "wget" >> /dev/null
if [ $? -eq 0 ]; then
for url in $URLS; do
OUT=$(echo $url | cut -f9 -s -d/)
wget $url -q -O ~/.$OUT
done
DONE=1
fi
View Join model assoc
Class match:
has_many :match_maps
has_many :maps, :through => :match_maps, :conditions => {'match_maps.veto' => false}, :source => :map, :class_name => "Map"
has_many :vetos, :through => :match_maps, :conditions => { 'match_maps.veto' => true}, :source => :map, :class_name => "Map"
m = Match.find(1)
m.vetos << Map.find(1)
m.map << Map.find(2)
View protheme.dvtcolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0 0 0 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>Menlo-Bold - 11.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0 0 0 1</string>
View xcode3_theme_to_xcode4.py
"""
Script to convert a Xcode3 Color theme into a Xcode4 one.
Example:
bash# python xcode3_theme_to_xcode4.py Twilight.xcolortheme
It will write a new file: Twilight.dvtcolortheme into the same folder as the script is residing in.
"""
import plistlib,sys
""" Define boilerplate of the color theme """
defaultConfig = {
View git_install.sh
function get_latest_html()
{
URL=$1
PATTERN=$2
TYPE=$3
LATEST=`curl -s ${URL} | egrep -o '<a href="([^\"]+)"' | awk -F\" '{print $2 }' | egrep ${PATTERN} | egrep ${TYPE} | egrep -v '(diff|sig)' | sort -nr | head -n1`
curl -s "${URL}/${LATEST}"
}
function get_latest_text()