Skip to content

Instantly share code, notes, and snippets.

View scottjbarr's full-sized avatar

Scott Barr scottjbarr

View GitHub Profile
@scottjbarr
scottjbarr / nginx
Created January 7, 2010 07:28
Nginx startup script for Debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@scottjbarr
scottjbarr / install_nginx_on_debian.sh
Created January 12, 2010 03:51
Install nginx on Debian
#!/bin/bash
#
# Install nginx on Debian.
#
# Author : Scott Barr
# Date : 7 Jan 2010
#
VERSION=0.7.64
@scottjbarr
scottjbarr / install_ruby19_on_debian.sh
Created January 12, 2010 04:06
Install Ruby 1.9 from source on Debian
#!/bin/bash
#
# Install Ruby 1.9 on Debian.
#
# Author : Scott Barr
# Date : 7 Jan 2010
#
# TODO : Check that Ruby 1.8 is installed, as it is apparently a dependency for
# installing Ruby 1.9
@scottjbarr
scottjbarr / starling
Created January 19, 2010 07:55
Startling startup script
#!/bin/sh -e
#
# starling This init.d script is used to start starling.
# It basically just calls starling.
#
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
STARLING="/usr/local/bin/starling"
@scottjbarr
scottjbarr / install_starling_on_debian.sh
Created January 19, 2010 07:56
Install Starling on Debian
#!/bin/bash
#
# Install Starling on Debian.
#
# Author : Scott Barr
# Date : 19 Jan 2010
#
if [ ! `which ruby` ]; then
echo "Ruby required, installing..."
@scottjbarr
scottjbarr / install_python26_from_source.sh
Created January 21, 2010 01:53
Install Python 2.6 from Source
#!/bin/bash
#
# Install Python 2.6 from Source
#
# Author : Scott Barr
# Date : 21 Jan 2010
#
PYTHON_VERSION=2.6.4
From http://www.news.com.au/technology/the-ten-most-common-passwords-revealed/story-e6frfro0-1225822539186
The top 10 most common passwords
1. 123456
2. 12345
3. 123456789
4. Password
5. iloveyou
6. princess
def sanitize(s)
# escape double quotes
s.gsub('"', '\"')
end
s = 'hello"'
puts sanitize(s)
@scottjbarr
scottjbarr / new_years_bash.txt
Created January 6, 2011 06:45
New Year's Bash
# while [ true ]; do date ; sleep 1; done
Fri 31 Dec 2010 23:59:56 SGT
Fri 31 Dec 2010 23:59:57 SGT
Fri 31 Dec 2010 23:59:58 SGT
Fri 31 Dec 2010 23:59:59 SGT
Sat 1 Jan 2011 00:00:00 SGT
Sat 1 Jan 2011 00:00:01 SGT
Sat 1 Jan 2011 00:00:02 SGT
Sat 1 Jan 2011 00:00:03 SGT
@scottjbarr
scottjbarr / gist:1277173
Created October 11, 2011 03:09
Selecting record in mysql with overflowing integer
mysql> SHOW VARIABLES like "version";
+---------------+--------+
| Variable_name | Value |
+---------------+--------+
| version | 5.5.15 |
+---------------+--------+
1 row in set (0.00 sec)
mysql> select * from users where id in (29391170719191043234654437481914368);
Empty set (0.00 sec)