This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import os | |
JSON_CONFIG = { | |
"indent": 2, | |
"sort_keys": True, | |
"ensure_ascii": False, | |
"allow_nan": False, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def echo(s): | |
... print s | |
... | |
>>> funcs = [] | |
>>> for i in range(3): | |
... funcs.append(lambda: echo(i)) | |
... | |
>>> for func in funcs: | |
... func() | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Analyze a log of a text communication, looking for distinct discussions.""" | |
from collections import Counter, deque | |
import re | |
import string | |
import sys | |
LINE_RE = re.compile(r"^(?P<timestamp>[\d:]+)\s" | |
r"<\W?(?P<nick>[\w|^`[\]]+)>\s" | |
r"(?P<message>.*)$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
MOSH_IP="$(host -cIN "$1" | cut -d' ' -f4)" | |
MOSH_CONNECT_INFO="$(ssh -t "$1" -- "mosh-server" | grep "MOSH CONNECT" | tr -d '\r' | cut -d' ' -f3,4)" | |
read MOSH_PORT MOSH_KEY <<<"$MOSH_CONNECT_INFO" | |
MOSH_KEY="$MOSH_KEY" exec mosh-client "$MOSH_IP" "$MOSH_PORT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Let us control the passage of time (magic!) | |
wall_time = 0 | |
class Comment(object): | |
# Used for quick and dirty unique IDs. | |
# In a real system, the IDs probably wouldn't be | |
# this simple, but it doesn't matter what they are | |
# as long as they're unique. | |
_instance_counter = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
trap "echo ' Batman!'; exit 0" SIGINT | |
while true; do echo -n Na; sleep 0.1; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Command(object): | |
command_name = None | |
# ... | |
class FooCommand(Command): | |
command_name = "foo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Add this theme in Stylish or the like. | |
Set it for 'Pages on the domain plus.google.com' | |
*/ | |
#contentPane > div { | |
text-align: center !important; | |
} | |
#contentPane > div > div > div { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 2.6.7 (r267:88850, Dec 2 2011, 20:27:26) | |
[GCC 4.4.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> a = -1 | |
>>> b = -2 | |
>>> hash(a) == hash(b) | |
True | |
>>> hash(a) | |
-2 | |
>>> hash(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import optparse | |
import os | |
import subprocess | |
import sys | |
def gitdir(): |
NewerOlder