Skip to content

Instantly share code, notes, and snippets.

Henry Stanley henryaj

Block or report user

Report or block henryaj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am henryaj on github.
  • I am henryaj (https://keybase.io/henryaj) on keybase.
  • I have a public key ASDYhCv2mChD8bYHRsEQyqe_4yKoSRp8BHzq-j5xvkvDYgo

To claim this, I am signing this object:

@henryaj
henryaj / fmt.rs
Last active May 25, 2018
Rust experiments
View fmt.rs
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
henryaj / main.go
Last active Dec 1, 2016
ASCII-armored RSA key generation in Golang
View main.go
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/pem"
"fmt"
)
View Sharing BOSH targets.md

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
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
end
midpoint = array.length / 2
lower = array[0..midpoint-1]
View SoRedisWow.py
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
henryaj / keepalive.applescript
Created Mar 10, 2016
AppleScript to keep a VPN connection alive
View keepalive.applescript
repeat
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.