Skip to content

Instantly share code, notes, and snippets.

View hath995's full-sized avatar

Aaron Elligsen hath995

  • ScreenMeet
  • San Francisco
View GitHub Profile
@juj
juj / cube_folding.py
Last active January 9, 2023 22:26
Advent of Code 2022 Day 22 Cube folding solver
# Usage: python cube_folding.py input.txt
import math, sys
lines = open(sys.argv[1] if len(sys.argv) > 1 else 'input.txt', 'r').read().split('\n')
# Remove instructions line from input
lines = lines[:-1]
if len(lines[-1]) == 0: lines.pop() # Remove possible empty line between map and instructions
# Compute cube surface area
@tamoyal
tamoyal / gist:2ea1fcdf99c819b4e07d
Last active February 13, 2020 11:24
Upgrade Postgres 9.3 to 9.4 on Ubuntu
# Be sure to save your config files. Optional but I do:
sudo cp /etc/postgresql/9.3/main/postgresql.conf ~
sudo cp /etc/postgresql/9.3/main/pg_hba.conf ~
# Package repo (for apt-get)
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
# Also probably optional but I like to update sources and upgrade
sudo apt-get update