This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
function part1(steps) { | |
const buf = [0] | |
let pos = 0 | |
for (let i=1; i<=2017; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
const EventEmitter = require('events') | |
class Program extends EventEmitter { | |
constructor(id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
const EventEmitter = require('events') | |
class Program extends EventEmitter { | |
constructor(id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
function main() { | |
const graph = parse(input) | |
resolve(graph) | |
const { acc, steps } = traverse(graph) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
function main() { | |
const particles = parse(input) | |
const idx = closestToOrigin(particles) | |
console.log(`Closest to origin: ${idx}`) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
const { compose, encode, decode, | |
rotr, rotl, flipX, flipY, print } = require('./util') | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
function main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
/** | |
* Day 22, Part 1 & 2 | |
* | |
* Usage: | |
* input >> stdin >> node day22.js $PART $ITERATIONS | |
* e.g. | |
* `cat input.txt | node day22.js 2 10000000` | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
const EventEmitter = require('events') | |
class Program extends EventEmitter { | |
constructor(id) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- node.jz -*- | |
let input = '' | |
process.stdin.on('readable', () => input += process.stdin.read() || '') | |
process.stdin.on('end', () => main()) | |
function main() { | |
const lines = input.split('\n\n') | |
const [begin, perform] = lines[0].split('\n') | |
const initState = begin.match(/begin in state ([A-Z]+)./i)[1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias cb="git status | head -n 1 | cut -d' ' -f 3" | |
alias pull='git pull origin $(cb)' | |
alias push='git push origin $(cb)' | |
alias g='git-10x' | |
alias b='g branch' | |
function _update_ps1() { | |
PS1="$(~/go/bin/powerline-go -cwd-mode dironly -error $?)" | |
} |