Skip to content

Instantly share code, notes, and snippets.

View localstatic's full-sized avatar

Morgan Terry localstatic

  • Salt Lake City, Utah
View GitHub Profile
const crypto = require('crypto');
function randomChars(len) {
const numBytes = len / 2;
return crypto.randomFillSync(Buffer.alloc(numBytes), 0, numBytes).toString('hex');
}
randomChars(256);

Keybase proof

I hereby claim:

  • I am localstatic on github.
  • I am localstatic (https://keybase.io/localstatic) on keybase.
  • I have a public key ASA-jW2XRKf8jTVcB5HpKET-rAJtbdIEk8Baypu37DPSUAo

To claim this, I am signing this object:

@localstatic
localstatic / gist:5905137
Created July 1, 2013 22:19
Vim - format XML using xmllint as filter. This assumes that xmllint is installed and in your PATH.
:silent 1,$!xmllint --format --recover - 2>/dev/null
@localstatic
localstatic / gist:5905122
Created July 1, 2013 22:18
Convert list of items (one item per line) to single CSV line
cat input.txt | sed 's/\(.*\)/\1,/' | tr \\n ' ' | sed 's/, $//'