Skip to content

Instantly share code, notes, and snippets.


Carl Johnson carlmjohnson

View GitHub Profile
carlmjohnson / crypto-rand.js
Last active May 28, 2020 — forked from paragonie-scott/gist:c7a73fd0f759e451cf07
Javascript CSPRNG for Integers
View crypto-rand.js
function secureRand(min, max) {
let range = max - min;
if (range < 2) {
return min;
let bits_needed = Math.ceil(Math.log2(range));
if (bits_needed > 31) {
throw new Error("cannot generate numbers larger than 31 bits.");
carlmjohnson / tot
Last active Feb 28, 2020 — forked from zrzka/!
A shell script for Tot
View tot
#!/usr/bin/env bash
# Fork of gruber's
# which is a fork of chockenberry's
# WARNING some options have different & potentially destructive meaning, for example:
# -r gets the dot contents in original script, but this one REPLACES the dot contents
# and does use -p to get the dot contents
You can’t perform that action at this time.