Skip to content

Instantly share code, notes, and snippets.

View jdorfman's full-sized avatar

Justin Dorfman jdorfman

View GitHub Profile
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 {
# First do a fresh install of CentOS 5.7 i386, server configuration (no GUI)
# This should be performed as root since it's going to be installing a bunch of stuff
# --- Update things to make sure we have the latest patches ---
# Add EPEL so we can get reasonably recent packages
rpm -Uvh "http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm"
yum update # This takes quite a while for a fresh install
# --- Install Whisper - Graphite's DB system ---
wget "http://launchpad.net/graphite/0.9/0.9.7/+download/whisper-0.9.7-1.noarch.rpm"
## Sample initialization file for GNU nano.
##
## Please note that you must have configured nano with --enable-nanorc
## for this file to be read! Also note that this file should not be in
## DOS or Mac format, and that characters specially interpreted by the
## shell should not be escaped here.
##
## To make sure a value is disabled, use "unset <option>".
##
## For the options that take parameters, the default value is given.
#!/bin/bash
DATE=$(date +"%m-%d-%y")
REQUEST=5
URL=http://cdn4.example.com/stylesheets/style.css?1337
LOGPATH=/tmp
LOGNAME=example
SLEEP=30 ## Number of seconds till the next AB test ##
while true
#!/bin/bash
URL=http://justindorfmancom.jdorfman.netdna-cdn.com/wp-content/themes/portfolio-press/images/justindorfman-logo-2.png
LOGPATH=/tmp
LOGNAME=curl5
while true
do
curl -D - -so /dev/null -w "Status Code: %{http_code}\nDNS: %{time_namelookup}\nConnect: %{time_connect}\nPre-Trans: %{time_pretransfer}\nStart-Trans: %{time_starttransfer}\nTotal: %{time_total}\nSize: %{size_download}\nSpeed: %{speed_download}\n\n" $URL >> $LOGPATH/$LOGNAME.log
sleep 5