Skip to content

Instantly share code, notes, and snippets.

Stein Fletcher steinfletcher

Block or report user

Report or block steinfletcher

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
### Keybase proof
I hereby claim:
* I am steinfletcher on github.
* I am steinfletcher (https://keybase.io/steinfletcher) on keybase.
* I have a public key ASDzWzkc_Ofanv-eX8fDUDwc_lwB95A5YLB1xm1z-PrPqgo
To claim this, I am signing this object:
@steinfletcher
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
steinfletcher / team_clone.py
Last active May 14, 2017
Clone all repositories owned by a GitHub organisation team
View team_clone.py
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
steinfletcher / keygen.sh
Created Aug 20, 2016
Generate public and private key pair
View keygen.sh
#!/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
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
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
steinfletcher / immutableMerge.js
Created Aug 21, 2014
lodash merge that doesn't modify the source object
View immutableMerge.js
_.mixin({
'immutableMerge': function(src, dest) {
return _.merge(_.cloneDeep(src), dest);
}
});
// usage
var src = {
a: 1,
@steinfletcher
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
#!/bin/bash
# Author: Stein Fletcher <steinfletcher@gmail.com>
# 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
steinfletcher / jstree.py
Last active Aug 29, 2015
file system crawler to generate object tree json data for jsTree [http://www.jstree.com/]
View jstree.py
#!/usr/bin/env python
import os
import json
class Node:
def __init__(self, id, text, parent):
@steinfletcher
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": []
}
You can’t perform that action at this time.