Skip to content

Instantly share code, notes, and snippets.

Avatar
🚍
' DROP TABLE user_statuses; --

Rich Taylor rtt

🚍
' DROP TABLE user_statuses; --
View GitHub Profile
@rtt
rtt / abu.sql
Last active Feb 4, 2021
foo bar baz
View abu.sql
-- table a:
create table a (
uid text primary key,
title text not null
);
create table u (
uid text primary key,
View aoc-2020-python-day9.py
from itertools import combinations
def get_input():
with open('./input9.txt') as inp:
return inp.read().strip().split('\n')
def part1():
inp = get_input()
View aoc-2020-python-day8-part2.py
import sys
def get_input():
with open('./input8.txt') as inp:
return inp.read().strip().split('\n')
def finishes(ops):
visited = set()
acc = 0
View aoc-2020-python-day5-part-1.py
def calc(ticket):
seat_id = 0
for i, instr in enumerate(ticket):
if instr in 'BR':
seat_id += 2**(9-i)
return seat_id
def part_1(data):
return max(calc(line) for line in data)
View aoc-2020-python-day3-part-2.py
import string
def get_input():
with open('input4full.txt') as f:
passwords = f.read()
return passwords.strip()
def run():
passports = [p.replace('\n', ' ').split(' ') for p in get_input().split('\n\n')]
View aoc-2020-python-day3-part-2.py
from operator import mul
from functools import reduce
def get_input():
with open('input3full.txt') as f:
passwords = f.readlines()
return map(str.strip, passwords)
View aoc-2020-python-day3-part1.py
def get_input():
with open('input3full.txt') as f:
passwords = f.readlines()
return map(str.strip, passwords)
def get_next(right, down, x, y, land_map):
x += right
y += down
line = land_map[y]
View aoc-2020-python-day2-part2.py
from collections import Counter
def get_input():
with open('2.txt') as f:
passwords = f.readlines()
return map(str.strip, passwords)
def get_password_specs(specs):
View aoc-2020-python-day2.py
from collections import Counter
def get_input():
with open('2.txt') as f:
passwords = f.readlines()
return map(str.strip, passwords)
def get_password_specs(specs):
View aoc-2020-python-day1-part-2-itertools.py
from itertools import combinations
from functools import reduce
from operator import mul
def get_input():
with open('1.txt') as f:
inp = f.readlines()
return list(map(int, map(str.strip, filter(None, inp))))