Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/usr/bin/env python | |
""" | |
PIP can stand for PIP Installs packages Programmatically, too! | |
(and here's how) | |
Requires: | |
* Python 2.6 or higher (for print-as-a-function) | |
* PIP 0.8.2 | |
""" |
#!/usr/bin/env python | |
#-*- mode: python -*- | |
from subprocess import Popen, PIPE | |
import sys | |
syntax_checker = "pyflakes" | |
def run(command): | |
p = Popen(command.split(), stdout=PIPE, stderr=PIPE) |
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
require 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'uri' | |
# usage: ruby import.rb my-blog.xml | |
# my-blog.xml is a file from Settings -> Basic -> Export in blogger. | |
data = File.read ARGV[0] |
import itertools | |
class Dictionary(object): | |
def __init__(self): | |
self.words = {} | |
def insert(self, word): | |
letters = "".join(sorted(word)) | |
if letters not in self.words: | |
self.words[letters] = [word] |
;; -*- coding: utf-8 -*- | |
;; starcraft.el -- track user APM (actions per minute) while using Emacs | |
;; | |
;; Copyright 2010 by Michael Steder | |
;; Author: Michael Steder ([email protected]) | |
;; Created: 2010 | |
;; Version: 1.0 | |
;; Keywords: Actions per minute | |
;; | |
;; Inspired by a love of Starcraft and someones offhand comment |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash |
# coding: utf-8 | |
# # this is an ipython notebook | |
# | |
# This is a markdown block that I can use to describe whatever I want to talk about. | |
# In[1]: | |
POSTGRES_URI = "postgresql+psycopg2://localhost:5432/steder" |