Skip to content

Instantly share code, notes, and snippets.

View ggreer's full-sized avatar

Geoff Greer ggreer

View GitHub Profile
@ggreer
ggreer / digitalocean
Last active June 15, 2016 17:45
/etc/rc.d/digitalocean
#!/bin/sh
# PROVIDE: digitalocean
# REQUIRE: var
# BEFORE: netif hostname
. /etc/rc.subr
name="digitalocean"
start_cmd="${name}_start"
@ggreer
ggreer / braces.js
Last active January 27, 2016 05:47
"use strict";
const fs = require("fs");
let buf = "";
for (let i = 0; i < 1024 * 1024; i++) {
buf += Math.random() > 0.5 ? "{" : "}";
}
@ggreer
ggreer / scope.py
Last active November 24, 2015 05:49
ggreer@carbon:~/Desktop% ./scope.py
True
Can't perform mapping from offset (1241) to logical position even with complete soft wraps cache re-parsing
Details: prefix: 'none', allow caret inside tab: false, allow caret after line end: false, soft wraps: on, soft wraps data: appliance manager state: recalculation in progress: false; event being processed: null; soft wraps mapping info: Current cache: [], entries affected by current update: [], soft wraps affected by current update: []; soft wraps: []
folding data: []
document info: , intervals:
0: 0-25, 1: 26-26, 2: 27-63, 3: 64-106, 4: 107-107, 5: 108-129, 6: 130-130, 7: 131-195, 8: 196-227, 9: 228-261, 10: 262-266, 11: 267-307, 12: 308-328, 13: 329-350, 14: 351-384, 15: 385-420, 16: 421-454, 17: 455-490, 18: 491-586, 19: 587-608, 20: 609-641, 21: 642-653, 22: 654-749, 23: 750-771, 24: 772-803, 25: 804-873, 26: 874-887, 27: 888-899, 28: 900-952, 29: 953-1005, 30: 1006-1037, 31: 1038-1067, 32: 1068-1099, 33: 1100-1110, 34: 1111-1126, 35: 1127-1132, 36: 1133-1146, 37: 1147-1160, 38: 1161-1204, 39: 120
Can't perform mapping from offset (325) to logical position even with complete soft wraps cache re-parsing
Details: prefix: 'none', allow caret inside tab: false, allow caret after line end: false, soft wraps: on, soft wraps data: appliance manager state: recalculation in progress: false; event being processed: null; soft wraps mapping info: Current cache: [], entries affected by current update: [], soft wraps affected by current update: []; soft wraps: []
folding data: []
document info: , intervals:
0: 0-33, 1: 34-34, 2: 35-63, 3: 64-64, 4: 65-112, 5: 113-139, 6: 140-165, 7: 166-180, 8: 181-208, 9: 209-236, 10: 237-264, 11: 265-291, 12: 292-319, 13: 320-321, 14: 322-322,
font preferences: Effective font families: [Crisp]: Wrong offset: 325. Should be in range: [0, 322]
java.lang.IndexOutOfBoundsException: Wrong offset: 325. Should be in range: [0, 322]
at com.intellij.openapi.editor.impl.LineSet.findLineIndex(LineSet.java:140)
@ggreer
ggreer / ag.txt
Last active November 5, 2015 00:50
Searching linux kernel source with ag and sift
ggreer@lithium:~/Downloads/linux-4.3% time ag line_number
scripts/kconfig/zconf.lex.c_shipped
911:void zconfset_lineno (int line_number );
2221: * @param line_number
2224:void zconfset_lineno (int line_number )
2227: zconflineno = line_number;
scripts/genksyms/lex.lex.c_shipped
619:void yyset_lineno (int line_number );
1773: * @param line_number
@ggreer
ggreer / node_crash.js
Last active October 23, 2015 00:48
Node.js v4.2.1 crash on Linux. Tested with Ubuntu 15.04.
ggreer@lithium:~% node crash.js
node: ../src/node_buffer.cc:225: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding): Assertion `(data) != (nullptr)' failed.
zsh: abort (core dumped) node crash.js
@ggreer
ggreer / ag_bench.sh
Last active October 22, 2015 15:36
My ag benchmark script
#!/bin/bash
function benchmark_rev() {
REV=$1
git clean -f &> /dev/null
git checkout $REV &> /dev/null
git clean -f &> /dev/null
if [ $? -ne 0 ]; then
echo "Checkout of $REV failed!"
exit 1
@ggreer
ggreer / -
Created September 4, 2015 01:50
ggreer@carbon:~/code/leveldown% npm install --build-from-source --verbose --nodedir=~/Downloads/iojs-v3.3.0 --debug
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/iojs',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '--build-from-source',
npm verb cli '--verbose',
npm verb cli '--nodedir=~/Downloads/iojs-v3.3.0',
npm verb cli '--debug' ]
npm info using npm@2.13.3
@ggreer
ggreer / -
Created September 4, 2015 01:42
ggreer@carbon:~/code/leveldown% npm install --build-from-source --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/iojs',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'install',
npm verb cli '--build-from-source',
npm verb cli '--verbose' ]
npm info using npm@2.13.3
npm info using node@v3.3.0
npm verb readDependencies loading dependencies from /Users/ggreer/code/leveldown/package.json