Skip to content

Instantly share code, notes, and snippets.

View bahamas10's full-sized avatar

Dave Eddy bahamas10

View GitHub Profile
@bahamas10
bahamas10 / crypto.js
Created March 9, 2015 19:54
crypto loaf
var fs = require('fs');
var s = 'A sp0i g02 4m3 34v3m k0 wapx 02k qg ax3pkakg, Z2k ku4k al p0k iug a 4q u3m3; iu0 a 4q al 0w r3ll aqo0mk4py3 ku4p iu4k ak al ku4k a p33x k0 k3rr g02. Aw g02 a3m3 4zr3 k0 ym4ys kual y0x3 ku4p a 4q y3mk4ap ku4k qg apw0mq4ka0p iarr p0k w4rr apk0 ku3 im0pv u4pxl. A i1rr im1k3 g02 qg apw0mq4ka0p l00p, z2k z3y42a3 "ku3g" q4g z3 u0k 0p qg k4ar, a q2lk 2l3 g3k 4p0ku3m y0x3. Ku3 s3g w0m ku3 p3hk yaou3m iarr z3: R4as4ku3x3lkm0g3m. Lk4g l4w3 4px 4i41k qg p3hk q3ll4v3. ~s4qa'.toLowerCase();
var pivotword = 'apw0mq4ka0p';
// words with 11 characters
// http://www.litscape.com/words/length/11_letters/11_letter_words.html
var words = fs.readFileSync('./11letterwords', 'utf8').trim().split('\n');
@bahamas10
bahamas10 / system-zoneinit
Created March 12, 2015 22:58
smartos failing to provision
root - sjc1-srv-04 sunos /zones/0a4ba6d6-db53-464b-892f-cb7b7c99d8fe/root/var/svc/log # tail -50 system-zoneinit\:default.log
+ local EXITCODE=137
+ '[' 137 -gt 0 ']'
+ echo ': received exit status 137'
: received exit status 137
+ '[' -e /var/svc/provisioning ']'
+ mv /var/svc/provisioning /var/svc/provision_failure
ld.so.1: gmv: fatal: libc.so.1: version 'ILLUMOS_0.8' not found (required by file /opt/local/bin/gmv)
ld.so.1: gmv: fatal: libc.so.1: open failed: No such file or directory
/opt/local/lib/svc/method/zoneinit: line 44: 91098 Killed START_TIME=$(date +%s)
@bahamas10
bahamas10 / output.txt
Created March 24, 2015 05:02
locking users on illumos
# getent shadow foo
foo:NP:::::::
# passwd -l foo
passwd: password information changed for foo
# getent shadow foo
foo:NP:16518::::::
^ user not locked
@bahamas10
bahamas10 / 1-mail.txt
Last active August 29, 2015 14:20
cron logadm smartos gz
From root@datadyne.rapture.com Tue Apr 28 05:00:01 2015
Date: Tue, 28 Apr 2015 05:00:01 GMT
From: Super-User <root@datadyne.rapture.com>
Message-Id: <201504280500.t3S501gt017165@datadyne.rapture.com>
To: root@datadyne.rapture.com
Subject: Cron <root@datadyne> /usr/sbin/logadm
Content-Length: 127
logadm: Warning: /var/log/vm/vm.log: No such file or directory
logadm: Warning: /var/log/fw/fw.log: No such file or directory
function dosomething(cb) {
cb('done');
}
dosomething(function(msg) {
console.log(msg);
// => "done"
});
@bahamas10
bahamas10 / 00-README.md
Last active August 29, 2015 14:22
sockstat on FreeBSD vs Illumos

sockstat - Illumos vs FreeBSD

This compares sockstat(1) on FreeBSD (included by default with the OS) and sockstat(1) on Illumos (using https://github.com/bahamas10/illumos-sockstat) with regards to how this program can trace sockets that have been inherited using fork(2).

Comparison

@bahamas10
bahamas10 / output.txt
Created June 9, 2015 17:03
node-workflow-moray-backend install
dave.eddy - joyent-laptop darwin ~/joyent/node-workflow-moray-backend (git:master) $ rm -rf node_modules/
dave.eddy - joyent-laptop darwin ~/joyent/node-workflow-moray-backend (git:master) $ npm install
npm WARN deprecated tap-consumer@0.0.1: This module is not supported. Please use 'tap' instead.
npm WARN installMany tap-consumer was bundled with tap@0.3.3, but bundled package wasn't found in unpacked tree
npm WARN deprecated tap-results@0.0.2: This module is not supported. Please use 'tap' instead.
npm WARN engine libuuid@0.1.3: wanted: {"node":"0.2 || 0.4 || 0.5 || 0.6 || 0.8 || 0.10"} (current: {"node":"0.12.4","npm":"2.10.1"})
> libuuid@0.1.3 install /Users/dave.eddy/joyent/node-workflow-moray-backend/node_modules/moray/node_modules/libuuid
> node-gyp rebuild
@bahamas10
bahamas10 / 0-output.txt
Created July 1, 2015 19:30
strings in C
$ cc strings.c -o strings
$ ./strings
foo1 in main: "bar"
foo2 in func: "bar"
@bahamas10
bahamas10 / foo.js
Created July 6, 2015 21:39
example mike node
var i = 0;
function dosomething() {
http.get('/foo', function(res) {
// whatever you want
i += 20;
setTimeout(dosomething, 5 * 1000);
});
}
@bahamas10
bahamas10 / child_process_test.js
Last active August 29, 2015 14:26
node 10 child_process readable
var cp = require('child_process');
var child = cp.spawn('sysevent');
child.stderr.setEncoding('utf8');
child.stderr.on('readable', function () {
console.log('stderr readable');
var stderr = '';
var chunk;
while ((chunk = child.stderr.read()) !== null)