Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
# kudos to https://github.com/drewlesueur | |
# stolen from here: https://github.com/blog/266-fast-forward-your-fork#comment-11535 | |
git checkout -b upstream-master | |
git remote add upstream git://github.com/documentcloud/underscore.git | |
git pull upstream master | |
git checkout master // [my master branch] | |
git merge upstream-master | |
git push origin master |
# 0 is too far from ` ;) | |
set -g base-index 1 | |
# Automatically set window title | |
set-window-option -g automatic-rename on | |
set-option -g set-titles on | |
#set -g default-terminal screen-256color | |
set -g status-keys vi | |
set -g history-limit 10000 |
#!/usr/bin/python | |
# All SSH libraries for Python are junk (2011-10-13). | |
# Too low-level (libssh2), too buggy (paramiko), too complicated | |
# (both), too poor in features (no use of the agent, for instance) | |
# Here is the right solution today: | |
import subprocess | |
import sys |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
rsync (Everyone seems to like -z, but it is much slower for me)
#! /usr/bin/env python | |
import os | |
import sys | |
import re | |
import tempfile | |
def getVideoDetails(filepath): | |
tmpf = tempfile.NamedTemporaryFile() | |
os.system("ffmpeg -i \"%s\" 2> %s" % (filepath, tmpf.name)) | |
lines = tmpf.readlines() |
/** | |
* "Google Now" Card | |
*/ | |
body { | |
background: #e1e1e1; | |
min-height: 100%; | |
margin: auto; | |
} | |
ul.gNow { | |
width: 450px; |
# coding=utf-8 | |
""" | |
LICENSE http://www.apache.org/licenses/LICENSE-2.0 | |
""" | |
import datetime | |
import sys | |
import time | |
import threading | |
import traceback | |
import SocketServer |