# Writes a big file with one line per key
> bash dump_keys.sh > all-the-keys
# Get stats on the state of the whole key list
> cat all-the-keys | perl ./aggregate_keys.pl
count:2228244 size:86.50% fetched:53.66% bytesize:1948.7MB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
organize_dir() { | |
date=`date +"(%Y-%m-01) Mobile Photos"` | |
base_dir="/cygdrive/c/Users/Danny/Documents/Mobile Photos" | |
dest_dir="$base_dir/$date" | |
source_dir="$base_dir/$1" | |
mkdir -p "$dest_dir" | |
cd "$source_dir" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CSRF = (function() { | |
window.addEvent('domready', function() { | |
/** | |
* Setup triggers on the .submit() function and the `submit` event so we | |
* can add csrf inputs immediately before the form is submitted. | |
*/ | |
$$('form').each(function(form) { | |
// Ensure all forms submitted via a traditional 'submit' button have | |
// an up-to-date CSRF input | |
form.addEvent('submit', function() { |
a minimal implementation
A demonstration of accepting unlimited-size uploads in PHP. The included
server.php
pipes the POST body directly to /dev/null
and returns a JSON
encoded hash of some useful stats. Using this method (streaming from stdin)
we are able to accept uploads of any size with little memory overhead.
Symlink apache config and reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.out | |
a.ser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$1" != "report" ]; then | |
echo "Usage:" >&2 | |
script="`basename $0`" | |
echo " nohup $script report > /var/log/memcache-stats.log &" >&2 | |
exit 1 | |
fi | |
GRAPHITE_SERVER=localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/danielbeardsley/strict-object | |
// Create a new person type | |
var Person = StrictObject.define('name', 'age', 'country'); | |
// Instatiate a Person | |
var pete = new Person(); | |
// set properties using functions | |
pete.name('Peter'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
SEARCH=$1 | |
REPLACE=$2 | |
function ConfirmOrExit() { | |
echo -n "Continue? (y / n) :" | |
read CONFIRM | |
if [ $CONFIRM != 'y' ] | |
then | |
exit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allows easy composition of a chain of connect.js-style middlewares in node.js | |
// given: | |
// function A(req,res,next){} | |
// function B(req,res,next){} | |
// composeMiddleware(A,B) will return a function(req,res,next) that passes the request | |
// through both handlers, just like Connect. If a next() is called with an error | |
// the call chain is stopped and the error is passed to the topmost next() | |
// If next() is called with the second parameter set to 'break' "next(null, 'break')" | |
// The chain is halted and route control is passed back to the original next() | |
function composeMiddleware(){ |
NewerOlder