Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working remotely

Oren Fromberg orenfromberg

🏠
Working remotely
View GitHub Profile
View hashicorp.sh
#!/usr/bin/env bash
set -uo pipefail
set +x
FINGERPRINT="C874 011F 0AB4 0511 0D02 1055 3436 5D94 72D7 468F"
die() {
echo "FATAL: $1"
exit 1
@orenfromberg
orenfromberg / bin.rb
Created Aug 3, 2018
friday coding challenge
View bin.rb
def bin(num)
num === 1 ? "1" : num === 0 ? "0" : "#{bin(num/2)}#{bin(num%2)}"
end
(1..64).each { |x| puts bin(x) }
@orenfromberg
orenfromberg / bin.js
Created Aug 3, 2018
friday coding challenge one liner
View bin.js
const bin = (number) => Array(64).fill(1).map((val,i) => (2 ** (64 - i - 1)) & number ? 1 : 0).join('').replace(/^0+/g,'')
console.log(bin(14))
console.log(bin(15))
console.log(bin(52359823756))
@orenfromberg
orenfromberg / bin.js
Created Aug 3, 2018
friday coding challenge
View bin.js
const bin = (number) => {
let answer = '';
for (let i = 0; i < 64; i++) {
answer = `${number & (2 ** i)? 1 : 0}${answer}`;
}
return answer.replace(/^0+/g, '');
}
console.log(bin(14))
console.log(bin(15))
View keybase.md

Keybase proof

I hereby claim:

  • I am orenfromberg on github.
  • I am orenfromberg (https://keybase.io/orenfromberg) on keybase.
  • I have a public key whose fingerprint is EA37 35BE 6C5D A419 DB2E 0F0D 32F5 46E6 D9B6 D611

To claim this, I am signing this object:

View magstripe.js
// /////////////////////////////////////////////////////////////////////////////////
// JavaScript Magstripe (track 1, track2) data parser object
//
// Mar-22-2005 Modified by Wayne Walrath,
// Acme Technologies http://www.acmetech.com
// based on demo source code from www.skipjack.com
//
// USAGE:
// var p = new SwipeParserObj();
// p.dump(); -- returns parsed field values and meta info.