Skip to content

Instantly share code, notes, and snippets.


Keybase proof

I hereby claim:

  • I am henryaj on github.
  • I am henryaj ( on keybase.
  • I have a public key ASDYhCv2mChD8bYHRsEQyqe_4yKoSRp8BHzq-j5xvkvDYgo

To claim this, I am signing this object:

henryaj /
Last active May 25, 2018
Rust experiments
use std::fmt;
struct Matrix(i32, i32, i32, i32);
impl fmt::Display for Matrix {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let result = format!(
"{0}, {1}, {2}, {3}",
self.0, self.1, self.2, self.3
henryaj / main.go
Last active Dec 1, 2016
ASCII-armored RSA key generation in Golang
View main.go
package main
import (
View Sharing BOSH

A pain no more!

  1. Run bosh-get-targets to dump your saved BOSH targets as YAML.
  2. Run bosh-save-targets <TARGETS> (where <TARGETS> is the output of step 1) to merge the targets into your existing targets.
henryaj / binary_search.rb
Last active Nov 1, 2016
Binary search in Ruby
View binary_search.rb
def binary_search(array, target)
return false if array.length == 0
if array.length == 1
return true if array.first == target
return false
midpoint = array.length / 2
lower = array[0..midpoint-1]
import sys
def main():
sys_write = sys.stdout.write
entries = 3.2 * 1e8 # Modify to increase disk usage, this is ~15GB at default
for i in xrange(int(entries)):
sys_write('SET Key%i Value%i\r\n' % (i, i))
henryaj / keepalive.applescript
Created Mar 10, 2016
AppleScript to keep a VPN connection alive
View keepalive.applescript
tell application "System Events"
tell current location of network preferences
set myConnection to the service "YOUR_VPN_NAME"
if myConnection is not null then
if current configuration of myConnection is not connected then
connect myConnection
end if
end if
end tell
You can’t perform that action at this time.