Skip to content

Instantly share code, notes, and snippets.

View almic's full-sized avatar
😤
Just doing programmer things

Mick A. almic

😤
Just doing programmer things
  • Denver, CO
View GitHub Profile
@almic
almic / Halo MCC API (Node).js
Last active February 2, 2022 07:21
The Node.js way for getting into the Halo MCC API.
const request = require('then-request')
// This is your microsoft live account information
const LOGIN = process.env.LOGIN // typically an email address
const PASSWD = process.env.PASSWD // typically your xbox live password
// This is the "api" we'll be calling once we login
const endpoint = 'https://www.halowaypoint.com/en-us/games/halo-the-master-chief-collection/xbox-one/' +
'game-history?gamertags=Furiousn00b&gameVariant=all&view=DataOnly'
@almic
almic / csprng.js
Created February 16, 2018 01:09
A Node.js cryptographically secure pseudo-random number generator
const crypto = require('crypto')
function csprng(min, max) {
// Some credit to https://github.com/joepie91/node-random-number-csprng
/* Careful! This doesn't work with large ranges. Specifically, don't use
* this with ranges larger than 2^32 - 1 */
const range = max - min
if (range >= Math.pow(2, 32))