Skip to content

Instantly share code, notes, and snippets.

View henhal's full-sized avatar

Henrik Hall henhal

View GitHub Profile
@henhal
henhal / 01_setup_ssh.config
Created April 20, 2017 06:01
Transferring SSH keys to Elastic Beanstalk in order to access private gits (for npm etc)
Resources:
AWSEBAutoScalingGroup:
Metadata:
? "AWS::CloudFormation::Authentication"
:
S3Auth:
buckets:
- <my-bucket>
roleName:
? "Fn::GetOptionSetting"
@henhal
henhal / gist:90bbf9524bf3abc5cacc751810d49136
Created May 23, 2019 06:39
Convert ALL_CAPS to camelCase
const allCaps2CamelCase = s => s.toLowerCase().replace(/(_.?)/g, ([,c]) => c ? c.toUpperCase() : '')
@henhal
henhal / yatzy.js
Created April 20, 2020 12:33
Yatzy probability counter
function factorial(k) {
return (k === 0) ? 1 : k * factorial(k - 1);
}
function binomial(n, k) {
return factorial(n) / factorial(k) / factorial(n - k);
}
// Probability of k sixes from n dice
function prob(n, k) {