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
(function ($) { | |
var oldUpload = $.fn.upload; | |
jQuery.fn.upload = function( options ) { | |
if ( this.prop('tagName') !== "INPUT" || this.attr('type') !== 'file' ) { | |
throw new Error("Cannot call upload function for given element type. Only works for <input type='file' />"); | |
} | |
var files = this.prop('files'); | |
var defaultCallback = function() { }; |
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
import zmq | |
protocol = "tcp" | |
host = "tidmarsh.media.mit.edu" | |
port = "1305" | |
host = "127.0.0.1" | |
port = "5556" | |
# Socket to talk to server |
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
git log --oneline --graph --color --decorate --all |
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
package util; | |
/** | |
* Creates a pair of two objects | |
* | |
* @param <T1> the type of object 1 | |
* @param <T2> the type of object 2 | |
*/ | |
public class Pair<T1, T2> { | |
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 http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
function wrapHTML(html) { | |
return "<!DOCTYPE html><html><body>" + html + "</body></html>\n"; | |
} | |
function serveIndex(response, rootPath, localPath, cb) { |
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 | |
# Get the PID of a process matching the pattern specified | |
# in the first argument as displayed in ps axf | |
# This line can be used in any script, just replace $1 with the match string: | |
PID=$(ps axf | grep "$1" | grep -v grep | awk '{print $1}' | head -n1) | |
echo "$PID" |
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
@everywhere const exact = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092 | |
@everywhere function approx_pi(n::Integer) | |
current_term = 0.5 | |
sum = current_term | |
for i=1:n | |
current_term *= (2 * i) * (2 * i - 1) / (16 * i * i) * (2 * (i - 1) + 1) / (2 * i + 1) | |
sum += current_term | |
end | |
return 6 * sum |
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
print "Hello world!" |
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 | |
DIR=$(pwd) | |
DELIMETER="\t" | |
DOWNLOADS_FILE=$1 | |
DOWNLOAD_TO=$2 | |
MY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
PRIVATE_KEY=$MY_DIR/mitKeyStore.pem |
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 | |
# Based on http://stackoverflow.com/questions/4643438/how-to-search-contents-of-multiple-pdf-files | |
find $(pwd) -name '*.pdf' -exec sh -c "pdftotext '{}' - | grep --with-filename --label='{}' --color '$1'" \; |
OlderNewer