Skip to content

Instantly share code, notes, and snippets.

@thejoshwolfe
thejoshwolfe / random128.js
Last active September 5, 2019 05:57
Generates a 128-bit random number as a string.
/** random 128-bit number as a string */
function random128() {
var result = "";
for (var i = 0; i < 8; i++)
result += String.fromCharCode(Math.random() * 0x10000);
return result;
}
/** random 128-bit number in canonical uuid format. all bits are random. */
function random128Hex() {
@thejoshwolfe
thejoshwolfe / diff_json.py
Created January 25, 2013 05:08
json object diff
#!/usr/bin/env python
import sys
import json
def diff_objects(left, right):
if not (type(left) == type(right) == dict):
return right
result = {}
keys = set()
#!/usr/bin/env python
"""\
looks for non-utf8, windows-style encodings in filenames and fixes them.
"""
__version__ = "0.0"
import os, sys