Skip to content

Instantly share code, notes, and snippets.


Joshua Levy jlevy

View GitHub Profile
jlevy / simple-hash.js
Created Oct 23, 2019
Fast and simple insecure string hash for JavaScript
View simple-hash.js
// This is a simple, *insecure* hash that's short, fast, and has no dependencies.
// For algorithmic use, where security isn't needed, it's way simpler than sha1 (and all its deps)
// or similar, and with a short, clean (base 36 alphanumeric) result.
// Loosely based on the Java version; see
const simpleHash = str => {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = (hash << 5) - hash + char;
jlevy / pjson
Created May 28, 2019
Command-line JSON pretty-printer
View pjson
# Convenience script to pretty-print and browse colored JSON without remembering flags.
# Read from files or stdin.
jq -C . "$@" | less -R -m
jlevy / diffjson
Created May 28, 2019
Command-line JSON diff (colorized and with normalized key ordering)
View diffjson
set -euo pipefail
Usage: $(basename $0) file1.json file2.json
Show diff of JSON, normalizing key ordering.
jlevy /
Last active Nov 4, 2019 from AWS Re-Invent 2013 (export AWS security configurations)
#! /usr/bin/python
# This script is taken (unmodified except for this comment) from:
# Talk:
# Example code to output account security config
__author__ = 'Greg Roth'
import boto
import urllib