Skip to content

Instantly share code, notes, and snippets.


Stein Fletcher steinfletcher

View GitHub Profile
View Keybase
### Keybase proof
I hereby claim:
* I am steinfletcher on github.
* I am steinfletcher ( on keybase.
* I have a public key ASDzWzkc_Ofanv-eX8fDUDwc_lwB95A5YLB1xm1z-PrPqgo
To claim this, I am signing this object:
steinfletcher / model.ts
Last active Jul 13, 2018
React Redux Typescript Template
View model.ts
import * as React from 'react'
import * as Redux from 'redux'
import { MyReduxState } from './my-root-reducer.ts'
export interface OwnProps {
propFromParent: number
interface StateProps {
steinfletcher /
Last active May 14, 2017
Clone all repositories owned by a GitHub organisation team
import base64
import json
import optparse
import os
import urllib2
from subprocess import call
from threading import Thread
"""Script to clone all GitHub repositories owned by an organisation team
steinfletcher /
Created Aug 20, 2016
Generate public and private key pair
#!/usr/bin/env bash
# generate a 2048-bit RSA private key
openssl genrsa -out private_tmp_key.pem 2048
# convert private Key to PKCS#8 format (so Java can read it)
openssl pkcs8 -topk8 -inform PEM -in private_tmp_key.pem -out private_key.pem -nocrypt
# generate a public key from the private one
openssl rsa -pubout -in private_tmp_key.pem -out public_key.pem
steinfletcher / alias.bash
Last active Aug 29, 2015
git aliases (taken from zsh)
View alias.bash
alias g='git'
alias gst='git status'
alias gd='git diff'
alias gdc='git diff --cached'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gl='git pull'
alias gup='git pull --rebase'
alias gp='git push'
alias gd='git diff'
alias gdt='git difftool'
steinfletcher / words.hs
Last active Nov 4, 2019
Count words in file in Haskell
View words.hs
import Control.Exception
import System.Environment (getArgs)
catchAny :: IO a -> (SomeException -> IO a) -> IO a
catchAny = Control.Exception.catch
parseArgs :: [a] -> a
parseArgs args
| (length args) == 1 = head args
| otherwise = error "Invalid args. \nUsage: words <file>"
steinfletcher / immutableMerge.js
Created Aug 21, 2014
lodash merge that doesn't modify the source object
View immutableMerge.js
'immutableMerge': function(src, dest) {
return _.merge(_.cloneDeep(src), dest);
// usage
var src = {
a: 1,
steinfletcher / change_mac_address.bash
Last active Aug 29, 2015
Change the mac address of a device (useful for various spoofing, e.g. for extending limited access on public wifi networks). Tested in OSX
View change_mac_address.bash
# Author: Stein Fletcher <>
# Purpose: Changes the mac address for the en0 device
# get the current mac address
old_addr=`/sbin/ifconfig en0 | awk '/ether/ {print $2}'`
# Generates a random new mac address using openssl
new_addr=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
steinfletcher /
Last active Aug 3, 2020
file system crawler to generate object tree json data for jsTree []
#!/usr/bin/env python
import os
import json
class Node:
def __init__(self, id, text, parent):
steinfletcher / traverse.js
Last active Nov 17, 2018
Object tree traversal in javascript (with lodash)
View traverse.js
var data = {
"name": "root",
"contents": [
"name": "A",
"contents": [
"name": "fileA1",
"contents": []