Skip to content

Instantly share code, notes, and snippets.

@skull-squadron
skull-squadron / gist:961989
Created May 9, 2011 03:08
haproxy security #fail
*deny parameters do not work!! #epicfail
admin uri will occasionally pass the admin uri itself to a backend randomly instead of displaying #fail
@skull-squadron
skull-squadron / gist:962053
Created May 9, 2011 04:27
torquebox 1.0.0 (gem vs packaged)
-FastInfoset.jar
-XmlSchema.jar
acl-spi-3.0.0.CR2.jar
activation-1.1.jar
-activation.jar
ant-1.7.1.jar
ant-launcher-1.7.1.jar
-antlr.jar
-apache-mime4j-0.6.jar
-asm.jar
@skull-squadron
skull-squadron / gist:1117362
Created July 31, 2011 23:58
a tastier beverage
# ping with UTC time
pint(){
local TIMEOUTOPT='W'
case "`uname -s`" in
Darwin) TIMEOUTOPT='t' ;; # -t (seconds) timeout for mac/bsd
Linux) TIMEOUTOPT='W' ;; # -W (seconds) timeout for linux
*) echo "pint() Unsupported system" ; return 1 ;;
esac
@skull-squadron
skull-squadron / gist:1172627
Created August 26, 2011 03:38
Customizing django admin
# models.py
from django.db import models
from django.contrib.sites.models import Site
class DomainField(models.TextField):
def valdiate(self, value):
" DNS domain names are always blah.something."
super(DomainField, self).validate(value)
if len(value.split('.')) < 2:
@skull-squadron
skull-squadron / which.py
Created August 26, 2011 07:14
which in Python
"""
(c) 2011 Barry Allard <barry@barryallard.name>
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
@skull-squadron
skull-squadron / who_you_gonna_call.py
Created August 26, 2011 07:21
Better subprocess.call
import subprocess
def better_call(args, check=False):
try:
if check:
return subprocess.check_call(args)
else:
return subprocess.call(args)
except:
# Fix: Ctrl-C while reading a password (stty -echo) doesn't restore stty echo.
@skull-squadron
skull-squadron / init_db.py
Created August 26, 2011 07:25
django postgres database/user initializer
#!/usr/bin/env python
"""
This creates the django postgres user and database, should be refactored as a manage.py plugin.
(c) 2011 Barry Allard <barry@barryallard.name>
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@skull-squadron
skull-squadron / install-nginx.sh
Created August 26, 2011 07:26
Install nginx on ubuntu
#!/bin/sh
if [ `id -u` != 0 ]; then
echo "Rerun as root"
exit 1
fi
apt-get install -y --no-install-recommends python-software-properties patch
add-apt-repository ppa:nginx/stable
apt-get update
@skull-squadron
skull-squadron / install-django-postgres-uwsgi-supervisor.sh
Created August 26, 2011 07:27
Install django on ubuntu 10.04 lts
#!/bin/sh
if [ `id -u` -ne 0 ]; then
echo "Rerun $0 as root"
exit 1
fi
# Install pip
apt-get install -y --no-install-recommends python-setuptools python-dev || exit 1
easy_install -U pip || exit 1
@skull-squadron
skull-squadron / id_rsa.pub
Created August 26, 2011 21:45
ssh rsa public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC0GKEFfEDG8FSZiJv6Z7zmnA48xcfdRCRro3yL7P9QR/AjVnjriBeIoSns3aigOyATZ1QNVtCeEP7A5diYiIK
ZuNaXzzjO9GXDUcspzY9sXW0w2ELy1PF+cYTLth6ZVFZa8znw8GK4LzW6t/UuiG+k3R+QbWwYQ3Frmb5o6iAmGF4POaB1Rc3GxeTAaL5VdBRPufbT4lA01YzgwN
4W9BTBowOO6mKLhtMWwx5pzBdIN4aY5fmyhhrdUcApfhOfZPUzo2Oo/IQ7qpyzfZLFW0ICcfPXkUeiD++is5BIzf4x11fv4Rqd04mSLSKZJJKqPqDmA/6uKPt32
8Q47g0+tmf7H36f16xy+DFEOBPrhXbBW+uovzdOv4SLtiUp8QfoK0FDFmcCAyFisGWV37Rzgo2qOD45AaWGYbzoGyZcUMF73a53bmb/d4x4ch4VbO1KUQzXPVsb
zUvF1KnRM9bw4l7yfW5qh550OJH6EUKgCMm2l6XO6LD5RpV+xF6pSGGjBEC39z4CafamTgU+sJGPtW2UHLOU0Ar8fURzXoZADnusaxtA23TaLDYu4+au5Ie50dp
j8Q7zhEsjdIDotiYKJeZb1L802160M3/U+PPpCmpFLpb0Gwr1Brjh4A8vXhU4GLYDPj/pGQytndZEP+xPvbNq7RGIgKTb6IcnRbAjawP9gQ== barry@barryal
lard.name