Skip to content

Instantly share code, notes, and snippets.

View jdorfman's full-sized avatar

Justin Dorfman jdorfman

View GitHub Profile
@jdorfman
jdorfman / gist:2571878
Created May 1, 2012 22:15
Find the version number of nginx on a cluster
for i in 01 02 03 04 05; do echo "${i}" && ssh web${i}.yourdomain.com '/usr/local/nginx/sbin/nginx -v'; done
# Output:
# 01
# nginx version: nginx/1.0.11
# 02
# nginx version: nginx/1.0.11
# 03
# nginx version: nginx/1.0.11
Sometimes a certain theme won't allow CDN integration with a particular plugin. Here is a list of plugins you can try:
http://wordpress.org/extend/plugins/ossdl-cdn-off-linker/
http://wordpress.org/extend/plugins/cdn-sync-tool/
http://wordpress.org/extend/plugins/wordpress-cdn-rewrite/
http://wordpress.org/extend/plugins/w3-total-cache/
http://wordpress.org/extend/plugins/wp-super-cache/
mysql> update wp_database.wp_posts set post_content = replace(post_content,'find_this_string','replace_with_this_string');
# If a uri has spaces e.g. /all/files/preview-images/May/aws%20blocks.png
# Make sure you have $request_uri before $is_args$args or the file will 404
proxy_pass http://$backend$request_uri$is_args$args;
find /path/to/folder -size +1M -print0 | xargs -0 du -h | sort -nr
#NetDNA API Sample Code - Python
#Version 1.0a
# Thanks to @sajal from TurboBytes.com for getting this script started
# Contributed: @jdorfman & the @netdna family
import oauth.oauth as oauth
import httplib2, json
import pprint
<?php
/*
* NetDNA API Command Line Utility - PHP
* Version 1.0a
*/
// Get it here: https://raw.github.com/gist/2791330/64b7007ab9d4d4cbb77efd107bb45e16fc6c8cdf/OAuth.php
require_once("OAuth.php");
#crontab
@reboot /usr/local/bin/nagircbot -C -f /usr/local/nagios/var/status.dat -e -s irc.yourserver.com:9999 -p s3cur3|>@$$\/\/d -c \#channelname -n BotNickName -U UserName -I 900 > /dev/null 2>&1
$ yes >> foo.log #20 seconds or so
$ ll -h foo.log
-rw-rw-r-- 1 jdorfman jdorfman 666M May 25 15:09 foo.log # I swear that was the actual size of the file
$ pv foo.log |gzip > foo.log.gz
666MB 0:00:11 [57.4MB/s] [=====================================>] 100%
<?php
// vim: foldmethod=marker
/* Generic exception class
*/
class OAuthException extends Exception {
// pass
}
class OAuthConsumer {