Skip to content

Instantly share code, notes, and snippets.

View alandotcom's full-sized avatar

Alan Cohen alandotcom

View GitHub Profile
@alandotcom
alandotcom / keybase.md
Created January 4, 2015 16:19
keybase

Keybase proof

I hereby claim:

  • I am lumberj on github.
  • I am 0x00 (https://keybase.io/0x00) on keybase.
  • I have a public key whose fingerprint is 68BF 6F42 9BCA 67B5 9520 3750 FB3D EFB3 272B 9393

To claim this, I am signing this object:

# fetch a pull request locally
# git pr REMOTE PR#
pr = "!f() { git fetch $1 pull/$2/head:pr-$2 && git checkout pr-$2; }; f"

Keybase proof

I hereby claim:

  • I am lumberj on github.
  • I am 0x00 (https://keybase.io/0x00) on keybase.
  • I have a public key whose fingerprint is F01D 24C9 4CCD 9F30 D84D 5A84 4C49 D755 E94C 41E1

To claim this, I am signing this object:

Verifying that +0x00 is my openname (Bitcoin username). https://onename.com/0x00
@alandotcom
alandotcom / example.md
Created November 12, 2015 20:22
Node IPC
var cluster = require('cluster');
var http = require('http');

if (cluster.isMaster) {
  var worker = cluster.fork();

  cluster.on('exit', function(worker, code, signal) {
    console.log('worker ' + worker.process.pid + ' died');
 });
@alandotcom
alandotcom / client.md
Last active December 2, 2015 00:45
rippleAPI JSON RPC server over HTTP port 3000

Using a simple javascript client

const jayson = require('jayson');
const Promise = require('bluebird');

// create a client
const client = jayson.client.http({
  port: 3000,
  hostname: 'localhost'
set normal (set_color normal)
set magenta (set_color magenta)
set yellow (set_color yellow)
set green (set_color green)
set red (set_color red)
set gray (set_color -o black)
# Fish git prompt
set __fish_git_prompt_showdirtystate 'yes'
set __fish_git_prompt_showstashstate 'yes'
@alandotcom
alandotcom / multiple_ssh_setting.md
Created October 28, 2016 20:06 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@alandotcom
alandotcom / logstash-mysql-query-parse.md
Created November 15, 2016 00:46 — forked from jordansissel/logstash-mysql-query-parse.md
parsing mysql's bullshit query log format with logstash

parsing mysql query logs with logstash

The problem is that some lines in the file are missing timestamps when they aren't continuations of any previous line. It's dumb, really.

The mysql query log is seriously bullshit format, but nothing logstash can't unscrew.

The main goal here is to show how we can fix the 'missing timestamp' problem.

% ruby bin/logstash agent -e '

// Hours [0, ...23]
function offsetHour (hour, offset) {
return (((hour + offset) % 24) + 24) % 24
}