Skip to content

Instantly share code, notes, and snippets.

View rtt's full-sized avatar
🚍
' DROP TABLE user_statuses; --

Rich Taylor rtt

🚍
' DROP TABLE user_statuses; --
View GitHub Profile
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)
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')]
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)
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]
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):
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):
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))))
@rtt
rtt / aoc-2020-python-day1.py
Created December 1, 2020 15:35
advent of code 2020 - day 1
def get_input():
with open('1.txt') as f:
inp = f.readlines()
return list(map(int, map(str.strip, filter(None, inp))))
def get_answer():
expenses = get_input()
seen = set()
while expenses:
@rtt
rtt / repo_unsub.py
Created February 20, 2020 17:17
mass github repo subscription delete
import os
import sys
import requests
def get_subscribed_repos_in_organization(organization, personal_access_token):
page = 1
has_more = True
while has_more:
print("GET https://api.github.com/user/subscriptions?per_page=100&page={}".format(page))
response = requests.get('https://api.github.com/user/subscriptions',

Keybase proof

I hereby claim:

  • I am rtt on github.
  • I am arrteetee (https://keybase.io/arrteetee) on keybase.
  • I have a public key ASCb73A1BIuNeI-pg6_hl8nwc-5dcK5_vtsQAXrqNzPhhwo

To claim this, I am signing this object: