Skip to content

Instantly share code, notes, and snippets.

View earthboundkid's full-sized avatar

Carlana Johnson earthboundkid

View GitHub Profile
@earthboundkid
earthboundkid / crypto-rand.js
Last active June 22, 2021 19:14 — forked from paragonie-scott/gist:c7a73fd0f759e451cf07
Javascript CSPRNG for Integers
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.");
}
@earthboundkid
earthboundkid / tot
Last active February 28, 2020 15:12 — forked from zrzka/!IMPORTANT.md
A shell script for Tot
#!/usr/bin/env bash
# Fork of gruber's tot.sh https://gist.github.com/gruber/b18d8b53385fa612713754799ed4d0a2
# which is a fork of chockenberry's tot.sh https://gist.github.com/chockenberry/d33ef5b6e6da4a3e4aa9b07b093d3c23
#
# 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
#