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 Data.Bits | |
modExp :: Integer -> Integer -> Integer -> Integer | |
modExp b 0 m = 1 | |
modExp b e m = t * modExp ((b * b) `mod` m) (shiftR e 1) m `mod` m | |
where t = if testBit e 0 then b `mod` m else 1 |
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
Use like: | |
sha1_attack --bytes 2 --type preimage | |
sha1_attack --bytes 4 --type collision | |
sha1_attack --bytes 3 --type both | |
--bytes is the number of bytes to consider (i.e. the number of bytes to which the SHA-1 digest will be truncated) | |
--type can be preimage, collision, or both |
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 | |
# Usage: git-reset-to-date date repo1 repo2 ... | |
# Example: git-reset-to-date "7/14/2013 14:00" repo1 repo2 repo3 | |
require_clean_work_tree () { | |
# Update the index | |
git update-index -q --ignore-submodules --refresh | |
err=0 |
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
/** | |
* @author James Baicoianu / http://www.baicoianu.com/ | |
* Originally from http://threejs.org/examples/js/controls/FlyControls.js | |
* Simplified to only obey gamepad | |
*/ | |
THREE.FlyControls = function(object) { | |
this.object = object; | |
// API |
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
// Each of these takes just a few milliseconds | |
app.get('/js/main.js', browserify('./public/js/main.js', { | |
external: ['three'], | |
detectGlobals: false | |
})); | |
app.get('/js/three.js', browserify(['three'], { | |
noParse: ['three'], // doesn't parse to look for global vars OR calls to require; just includes as-is | |
cache: true, // instructs browser to cache, even in dev, because this won't be changing |
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
<?php | |
require 'PHP-Parser/lib/bootstrap.php'; | |
ini_set('memory_limit', '512M'); | |
// Feeds the given file to the PHP parser to be parsed and analyzed | |
function analyze_file($path, $parser, $traverser, $visitor) { | |
$code = file_get_contents($path); | |
$visitor->setFile($path); | |
$stmts = $parser->parse($code); | |
$stmts = $traverser->traverse($stmts); |
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
Show hidden characters
[ | |
{ | |
"args": | |
{ | |
"characters": "\"" | |
}, | |
"command": "insert" | |
}, | |
{ | |
"args": null, |
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
doc.addPage | |
size: 'legal' | |
layout: 'landscape' |
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
/* | |
Relies on jQuery, underscore.js, Async.js (https://github.com/caolan/async), and zip.js (http://gildas-lormeau.github.com/zip.js). | |
Tested only in Chrome on OS X. | |
Call xlsxParser.parse(file) where file is an instance of File. For example (untested): | |
document.ondrop = function(e) { | |
var file = e.dataTransfer.files[0]; | |
excelParser.parse(file).then(function(data) { | |
console.log(data); |
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 separator = ','; | |
} | |
start | |
= comma | |
comma | |
= & { return separator = ','; } sv:sv { return sv; } |