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
alias unzip-stream="python -c \"import zipfile,sys,StringIO;zipfile.ZipFile(StringIO.StringIO(sys.stdin.read())).extractall(sys.argv[1] if len(sys.argv) == 2 else '.')\"" |
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
import os.path | |
import contextlib | |
import hashlib | |
from flask import Flask | |
from flask.helpers import safe_join | |
# Injects an "h" parameter on the URLs of static files that contains a hash of | |
# the file. This allows the use of aggressive cache settings on static files, | |
# while ensuring that content changes are reflected immediately due to the | |
# changed URLs. Hashes are cached in-memory and only checked for updates when |
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
$.facebook = (id, {locale}={}, callback=->) -> | |
locale ?= 'en_US' | |
window.fbAsyncInit = -> | |
FB.init appId: id, status: true, cookie: true, xfbml: true | |
FB.Canvas.setAutoGrow() | |
FB.getLoginStatus callback | |
$('body').append $('<div>').attr('id', 'fb-root') | |
$('<script>').each -> |
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
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0 | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |
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
dpkg -l |egrep '^.. (linux|grub|initramfs)'| cut -d' ' -f3 | sed 's/$/ hold/' | sudo dpkg --set-selections |
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
ruby ralias.rb > .ralias | |
source .ralias |
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 | |
from sqlalchemy import Column, Integer, create_engine, case, func, String, cast | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm import sessionmaker, aliased | |
engine = create_engine('sqlite://', echo=True) | |
Base = declarative_base() | |
class Number(Base): |
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 bash | |
if [ -z "$1" ]; then | |
echo "usage> $0 database" | |
exit 1 | |
fi | |
cat <<-EOF | psql -d $1 | |
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = '$1' |
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/sh | |
if [ "$#" -ne 3 ]; then | |
echo "Usage: $0 host id pass" | |
exit 1 | |
fi | |
openssl s_client -connect $1:993 -quiet << EOF | |
a1 LOGIN $2 $3 | |
a5 LOGOUT | |
EOF |
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/sh | |
if [ -z "$1" ] | |
then | |
echo "usage> $0 DATABASE" >&2 | |
exit 1 | |
fi | |
# Cannot use pipe. Pipe produces an empty backup file when pg_dump has errors. | |
FILE_NAME="$1-`date +"%Y%m%d-%H%M%S"`.sql" |