Skip to content

Instantly share code, notes, and snippets.

@chx
chx / nato
Last active December 29, 2015 10:39
Dump anything with the nato spelling: save it in a file called nato, put in your PATH, chmod +x nato and then nato foobar will print: Foxtrot Oscar Oscar Bravo Alpha Romeo
#!/bin/bash
declare -A nato
nato[A]=Alpha
nato[B]=Bravo
nato[C]=Charlie
nato[D]=Delta
nato[E]=Echo
nato[F]=Foxtrot
nato[G]=Golf
nato[H]=Hotel
#!/bin/bash
TMP="/tmp"
DB_USER="root"
DB_PASSWD="password"
SITES_DIR="/var/www"
S3_BUCKET="s3://bucket-name"
DATE=$(date +%Y-%m-%d)
# Backup all databases to S3
for DB in $(mysql --user=$DB_USER --password=$DB_PASSWD -e 'show databases' -s --skip-column-names|grep -Ev "^(information_schema|performance_schema|mysql)$");
@kenoir
kenoir / gist:3618577
Created September 4, 2012 08:37
Proxy stuff for reith
> cat ~/proxies_off
#!/bin/sh
echo "Proxies OFF"
unset HTTP_PROXY
unset ALL_PROXY
unset http_proxy
unset HTTPS_PROXY
unset https_proxy
@jelder
jelder / newrelic.h
Created July 28, 2010 12:10
Add X-Request-Start header so we can track queue times in New Relic RPM beginning at Varnish.
/*
* Add X-Request-Start header so we can track queue times in New Relic RPM beginning at Varnish.
*
*/
#include <sys/time.h>
struct timeval detail_time;
gettimeofday(&detail_time,NULL);
char start[20];
@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')