Skip to content

Instantly share code, notes, and snippets.

set -s escape-time 0
set -g base-index 1
set -g bell-action any
set -g default-command "exec ${SHELL} -l"
set -g history-limit 10000
set -g prefix C-t
set -g pane-active-border-fg black
set -g pane-active-border-bg black
set -g status-bg black
set -g status-fg white
source-file /home/will/.tmux.conf
set-option -g status-right " "
new-window -dk -nMAIL -tmeta:1 'TERM=vt100 mutt'
new-window -d -nCOMMS -tmeta:2 'TERM=vt100 irssi'
new-window -d -nTRIAGE -tmeta:3 'triage ~/.triage/incoming'
new-window -d -nTODO -tmeta:4 'vi ~/.triage/incoming'
new-window -d -nSHELL -tmeta:5
new-window -d -nWWW -tmeta:6 'elinks -session-ring 1'
@whilp
whilp / unrolling-wtf.rb
Created November 18, 2010 20:38
I'd expect the following to produce output like this: >>> a [{:type=>"a"}, {:type=>"a"}] >>> b [{:type=>"b"}] Instead, I get: >>> a [{:type=>"b"}, {:type=>"a"}, {:type=>"a"}] >>> b [{:type=>"b"}, {:type=>"a"}, {:type=>"a"}] W
before = {
"key1" => {:type => "a"},
"key2" => {:type => "a"},
"key3" => {:type => "b"},
}
after = Hash.new([])
before.each{|k,v| after[v[:type]] <<= v}
after.each{|k,v| puts ">>> #{k} #{v.inspect}"}
@whilp
whilp / gist:992003
Created May 25, 2011 21:15
Minimal optparse+logging in Python
import optparse
import logging
import sys
log = logging.getLogger("your-logger")
# Usual logging boilerplate, unnecessary in Python >= 3.1.
try:
from logging import NullHandler
except ImportError:
@whilp
whilp / gist:1023222
Created June 13, 2011 17:18
Percentage bars
<html>
<head>
<title>IP Tracker</title>
<style>
.bar {
border: 1px solid #ccc;
width: 600px;
background: white;
display: block;
}
@whilp
whilp / gist:1024678
Created June 14, 2011 10:56
Test if an IP is active
>>> import socket
>>> s = socket.socket(socket.AF_INET)
>>> s.bind(("127.0.0.1", 0))
>>> s.bind(("10.0.0.1", 0))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in bind
socket.error: [Errno 22] Invalid argument
@whilp
whilp / gist:1070435
Created July 7, 2011 20:11
Pattern: distributed, deterministic kicks
$ dsh -gHOSTGROUP 'echo /sbin/service foo restart | sudo at now + $(hostname | hashrange 60) minutes'
@whilp
whilp / gitconfig
Created March 29, 2012 22:30
gitconfig
[alias]
st = status -s
ci = commit
ca = commit -a
glog = log --oneline --decorate --graph
tags = tag -l
man = ls-files
bare = config --bool core.bare true
[mergetool]
prompt = false
@whilp
whilp / formatter.py
Created August 11, 2012 22:10
Data formatting
#!/usr/bin/env python
# unicode_literals + unittest2 will give you handy diffs when the test methods fail.
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
Processing WelcomeController#index (for 10.0.2.2 at 2013-01-14 22:13:27) [GET]
Parameters: {"controller"=>"welcome", "action"=>"index"}
ActiveRecord::StatementInvalid (PG::Error: ERROR: relation "settings" does not exist
LINE 4: WHERE a.attrelid = '"settings"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"settings"'::regclass