Skip to content

Instantly share code, notes, and snippets.

@Geekfish
Geekfish / counters.py
Last active October 13, 2015 23:57
Create a dictionary of counters that defaults to 0 with defaultdict
from collections import defaultdict
counters = defaultdict(int)
counters['foo'] += 1
counters['foo']
# Out: 1
counters['bar']
# Out: 0
@matt-mcmahon
matt-mcmahon / node-on-ubuntu-with-git.sh
Last active July 9, 2016 21:20 — forked from isaacs/node-and-npm-in-30-seconds.sh
My procedure for installing node.js on ubuntu server.
# Prerequisites:
sudo apt-get install g++ make libssl-dev git-core pkg-config
# pkg-config: is needed so that configure will be able to verify that openssl is
# installed.
# curl: is handy, but not needed for node.js to work.
# Install into user-specific local bin:
mkdir ~/local
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc