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* locate(low, high) { | |
var mid; | |
if (high === Infinity || high === undefined) { | |
mid = 1; | |
for (;;) { | |
if ((yield mid) > 0) { | |
mid <<= 1; | |
} else { | |
high = mid << 1; | |
break; |
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
#!/usr/bin/env node | |
var fs = require('fs'); | |
var path = require('path'); | |
var hasOwn = Object.prototype.hasOwnProperty; | |
// seaches recursively upwards to find the package.json | |
function load(start, name) { | |
var exists, full; | |
do { |
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
#!/usr/bin/env node | |
var crypto = require('crypto'); | |
var chars = parseInt(process.argv[2], 10) || 32; | |
var blockSize = 1024 * 1024; | |
function sync(count) { | |
console.log(crypto.randomBytes(Math.ceil(count / 2)).toString('hex').slice(0, count)); | |
} |
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
/tmp$ mkdir gittest | |
/tmp$ cd gittest | |
/tmp/gittest$ git init | |
/tmp/gittest$ echo test > test | |
/tmp/gittest$ git add test | |
/tmp/gittest$ git commit -m test | |
/tmp/gittest$ git diff-index --quiet HEAD | |
/tmp/gittest$ echo $? | |
0 | |
/tmp/gittest$ echo "another test" >> test |
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 | |
pushd . >> /dev/null | |
top="$(git rev-parse --show-toplevel 2>/dev/null)" | |
if [ "$top" != '' ]; then | |
cd "$(dirname "$top")" | |
fi | |
for dir in * | |
do | |
if [ -d "${dir}" ] && [ -d "${dir}/.git" ]; then | |
pushd . >> /dev/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
concurrent=1 algo=sha256 type=asc encoding=ascii len=2 api=legacy: 0.000098569 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=2 api=stream: 0.0000081394 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=2 api=digest: 0.000032721 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=1024 api=legacy: 0.030183 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=1024 api=stream: 0.0044764 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=1024 api=digest: 0.019793 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=102400 api=legacy: 1.5514 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=102400 api=stream: 0.36778 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=102400 api=digest: 1.2178 | |
concurrent=1 algo=sha256 type=asc encoding=ascii len=1048576 api=legacy: 2.0210 |
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 append(dest) { | |
for (var i = 1, n = arguments.length; i < n; i++) { | |
var src = arguments[i], offset = dest.length; | |
dest.length += src.length; | |
for (var j = 0, l = src.length; j < l; j++) { | |
dest[offset++] = src[j]; | |
} | |
} | |
return dest; | |
} |
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 | |
# arrange outputs in order of name | |
params=() | |
prev='' | |
verbose=0 | |
if [ "$1" == '-v' ] || [ "$1" == '--verbose' ]; then | |
verbose=1 | |
shift | |
fi |
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 | |
header("content-type: application/json"); | |
$output = array("classes" => array(0, 1, 2, 3, 4), "rooms" => array(0, 1, 2, 3, 4)); | |
echo json_encode($output); // {"classes":[0,1,2,3,4],"rooms":[0,1,2,3,4]} |
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/lib/stickshift/{REDACTED}/app-root/data/bin/node: line 3: 12992 Segmentation fault NODE_PATH=$OPENSHIFT_DATA_DIR/lib/node_modules PORT=$OPENSHIFT_INTERNAL_PORT C9_PORT=$OPENSHIFT_INTERNAL_PORT IP=$OPENSHIFT_INTERNAL_IP HOME=$OPENSHIFT_DATA_DIR $OPENSHIFT_DATA_DIR/bin/node-openshift "$@" |
OlderNewer