Skip to content

Instantly share code, notes, and snippets.

View snipe's full-sized avatar
😩
So jetlag. Much tired.

snipe snipe

😩
So jetlag. Much tired.
View GitHub Profile
@snipe
snipe / mysql-strict
Created November 26, 2013 23:17
Turn on mysql strict mode for Mac OSX mysql/MAMP
As priv'd user,
SET @@global.sql_mode='STRICT_TRANS_TABLES';
SET @@global.sql_mode='STRICT_ALL_TABLES';
@snipe
snipe / gist:5512408
Created May 3, 2013 18:25
ASCII Goatse
* g o a t s e x * g o a t s e x * g o a t s e x *
g g
o / \ \ / \ o
a| | \ | | a
t| `. | | : t
s` | | \| | s
e \ | / / \\\ --__ \\ : e
x \ \/ _--~~ ~--__| \ | x
* \ \_-~ ~-_\ | *
g \_ \ _.--------.______\| | g
@snipe
snipe / fizzbuzz
Last active February 6, 2022 17:15
By request, a PHP fizzbuzz that prints the numbers from 1 to 100. But for multiples of three print “Fuck You” instead of the number and for the multiples of five print “Choke on a Bag of Dicks”. For numbers which are multiples of both three and five print “Fuck You Choke on a Bag of Dicks”.
foreach (range(1,100) as $i)
echo (''==($x=($i%3==0?"Fuck You ":"").($i%5==0?"Choke on a Bag of Dicks":""))?$i:$x)."\n";
@snipe
snipe / googleform2email
Last active November 16, 2017 21:37
Script to get the contents of a Google form submission emailed to you.
function sendFormByEmail(e)
{
// Remember to replace this email address with your own email address
var email = "you@example.com";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var message = "";
var subject = "New Hire: ";
@snipe
snipe / inputrc
Created April 17, 2013 16:44
~/.inputrc for nice bash history up-arrows. This allows you to search through your history using the up and down arrows … i.e. type "cd /" and press the up arrow and you'll search through everything in your history that starts with "cd /". Create ~/.inputrc and fill it with this:
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@snipe
snipe / dqh+aws
Last active September 11, 2019 15:06
DeployHQ+AWS Autoscalers
#!/bin/bash
# Set these variables
USER_NAME="you@example.com"
API_KEY="XXXXXXXX_YOUR_DHQ_API_KEY_XXXXXXXXXXXXX"
START_REV='SOME_ARBITRARY_GIT_REVISION_HASH_TO_START_FROM'
DHQ_API_PROJ="your-project-shortname"
DHQ_BASE_URL="https://yoursite.deployhq.com/"
DHQ_SERVER_GROUP="YOUR_SERVER_GROUP_UUID"
DHQ_SERVER_USERNAME="your-server-username"
@snipe
snipe / goatse
Created March 14, 2013 08:03
Goatse ASCII art that won't break your W3C validation. (The original used double-hyphens inside the HTML comment, which would not validate.)
<!--
* * * * * * * * * * * * * * * * * * * * * * * * *
* *
* / \ \ / \ *
*| | \ | | *
*| `. | | : *
*` | | \| | *
* \ | / / \\\ ____ \\ : *
* \ \/ ___~~ ~____| \ | *
* \ \__~ ~__\ | *
@snipe
snipe / asia-block.htaccess
Created February 25, 2013 11:01
Block asian traffic. :( SItes are getting slammed with bad bots and spammers.
<Files *>
order deny,allow
# Cambodia (KH)
deny from 114.134.184.0/21
# Chinese (CN) IP addresses follow:
deny from 1.192.0.0/13 1.202.0.0/15 14.144.0.0/12 14.208.0.0/12 27.8.0.0/13 27.16.0.0/12 27.36.0.0/14 27.40.0.0/13 27.54.192.0/18 27.106.128.0/18 27.115.0.0/17 27.152.0.0/13 27.184.0.0/13 36.248.0.0/14 58.16.0.0/15 58.20.0.0/16 58.21.0.0/16 58.22.0.0/15 58.34.0.0/16 58.37.0.0/16 58.38.0.0/16 58.40.0.0/16 58.42.0.0/16 58.44.0.0/14 58.48.0.0/13 58.56.0.0/15 58.58.0.0/16 58.59.0.0/17 58.60.0.0/14 58.68.128.0/17 58.82.0.0/15 58.100.0.0/15 58.208.0.0/12 58.242.0.0/15 58.246.0.0/15 58.248.0.0/13 59.32.0.0/13 59.40.0.0/15 59.42.0.0/16 59.44.0.0/14 59.51.0.0/16 59.52.0.0/14 59.56.0.0/13 59.72.0.0/16 59.108.0.0/15 59.174.0.0/15 60.0.0.0/13 60.11.0.0/16 60.12.0.0/16 60.24.0.0/13 60.160.0.0/11 60.194.0.0/15 60.208.0.0/13 60.216.0.0/15 60.220.0.0/14 61.4.64.0/20 61.4.80.0/22 61.4.176.0/20 61.48.0.0/13 61.128.0.0/10 61.135.0.0/16 61.136.0.0/18 61.139.0.0/16 61.145.73.208/28 61.147.0.0/16 61.152.0.0/16 61.160.0.0/16
@snipe
snipe / ant-build
Created February 16, 2013 04:41
Sample ant target block
<target name="build" depends="prepare,lint,phploc,phpmd,phpcpd,phpcs,phpunit"></target>
@snipe
snipe / gist:4965565
Created February 16, 2013 04:39
Reload jenkins
java -jar jenkins-cli.jar -s http://localhost:8080 reload-configuration