Skip to content

Instantly share code, notes, and snippets.

@cdaringe
cdaringe / nested-vs-inline-fns
Created January 23, 2017 17:16
nested-vs-inline-fns
var ITCOUNT = 1e6
function a () {
return function b (z) { return z + 1 }
}
var sum1 = 0
for (var i = 0; i < ITCOUNT; ++i) {
var toAdd1 = Math.random()
var start1 = process.hrtime()[1]
@cdaringe
cdaringe / get-vagrant-box-ip.sh
Created December 30, 2016 17:08
get vagrant box ip
vagrant ssh w1 -c "ip address show eth0 | grep 'inet ' | sed -e 's/^.*inet //' -e 's/\/.*$//'"
@cdaringe
cdaringe / kuberenetes-no-nodes
Created December 29, 2016 17:16
kuberenetes-no-nodes
$ kubectl describe pod kubernetes-dashboard-3543765157-94gj9 --namespace="kube-system"
Name: kubernetes-dashboard-3543765157-94gj9
Namespace: kube-system
Node: /
Labels: k8s-app=kubernetes-dashboard
pod-template-hash=3543765157
Status: Pending
IP:
Controllers: ReplicaSet/kubernetes-dashboard-3543765157
Containers:
@cdaringe
cdaringe / pouchy-web-bundled.js
Created November 30, 2016 21:28
pouchy-web-bunlded.js
// index.js
const Pouchy = require('./src/index')
const db = new Pouchy({ name: 'kittens' })
db.save({ name: 'meow' })
.then(() => db.all())
.then(docs => console.log(docs))
// browserify index.js -o bundle.js
// load bundle.js into a <script src="...></script>, and you get
@cdaringe
cdaringe / gist:99c4a02d92cb71a666508a64cdc2b634
Created November 19, 2016 18:17
mdp-reward-discount-exp
T 1 1 1 1 1 1 1 1 1
9 0 0 0 0 0 0 0 0 1
9 0 0 0 0 0 0 0 0 1
9 0 0 0 0 0 0 0 0 1
9 0 0 0 0 0 0 0 0 1
9 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 1
S 1 1 1 1 1 1 1 1 1
@cdaringe
cdaringe / 8.4.0-joi-profile-slow.txt
Created June 5, 2016 03:18
8.4.0-joi-profile-slow.txt
Statistical profiling result from isolate-0x102800000-v8.log, (4205 ticks, 405 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
448 10.7% /usr/local/bin/node
23 0.5% /usr/lib/system/libsystem_platform.dylib
16 0.4% /usr/lib/system/libsystem_malloc.dylib
8 0.2% /usr/lib/system/libsystem_pthread.dylib
2 0.0% /usr/lib/system/libsystem_c.dylib
@cdaringe
cdaringe / 8.0.5-joi-profile-fast.txt
Last active June 5, 2016 03:16
8.0.5-joi-profile-fast.txt
Statistical profiling result from isolate-0x102004a00-v8.log, (885 ticks, 90 unaccounted, 0 excluded).
[Shared libraries]:
ticks total nonlib name
70 7.9% /usr/local/bin/node
6 0.7% /usr/lib/system/libsystem_platform.dylib
2 0.2% /usr/lib/system/libsystem_c.dylib
[JavaScript]:
ticks total nonlib name
@cdaringe
cdaringe / promise-queue-with-chained-settle-detection.js
Created June 3, 2016 00:14
promise-queue-with-chained-settle-detection
var bluebird = require('bluebird');
var queue;
var queueLen = 0;
function queueUp(fn) {
if (!queue) {
console.log('start');
queue = bluebird.resolve();
}
++queueLen;
@cdaringe
cdaringe / leveldown-rebuild-issue
Created April 25, 2016 19:00
leveldown-rebuild
🛰 cdieringer:~/node/coinstac-client-core$ export ATOM_SHELL_INTERNAL_RUN_AS_NODE=1 && ../coinstac-ui/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron /Users/cdieringer/node/ionizer/node_modules/npm/bin/npm-cli.js rebuild leveldown --runtime=electron --target=0.37.7 --arch=x64 --verbose --debug
npm info it worked if it ends with ok
npm verb cli [ '/Users/cdieringer/node/coinstac-ui/node_modules/electron-prebuilt/dist/Electron.app/Contents/MacOS/Electron',
npm verb cli '/Users/cdieringer/node/ionizer/node_modules/npm/bin/npm-cli.js',
npm verb cli 'rebuild',
npm verb cli 'leveldown',
npm verb cli '--runtime=electron',
npm verb cli '--target=0.37.7',
npm verb cli '--arch=x64',
npm verb cli '--verbose',
@cdaringe
cdaringe / coinstac-simulator-dang-it-worked
Created March 26, 2016 00:11
coinstac-simulator-dang-it-worked
CHA-CHING! CEEZ is runnin' Darwin 15.3.0 64-bit (64)
🛰 cdieringer:~/edu/sdp/6300Spring16Team83/Project2$ cd
🛰 cdieringer:~$ cd node/
🛰 cdieringer:~/node$ mkdir coinstac-fresh-sim-test
🛰 cdieringer:~/node$ cd coinstac-fresh-sim-test/
🛰 cdieringer:~/node/coinstac-fresh-sim-test$ git clone [email protected]:MRN-Code/coinstac-simulator
Cloning into 'coinstac-simulator'...
remote: Counting objects: 152, done.
remote: Compressing objects: 100% (106/106), done.
remote: Total 152 (delta 62), reused 130 (delta 44), pack-reused 0