Skip to content

Instantly share code, notes, and snippets.

@ErikThorsell
ErikThorsell / day9.py
Created December 9, 2018 12:58
Day 9, AoC 2018
def task_1(players=9, last_marble_point=25):
scores = [0] * players
circle = [0]
p = 0
marble = 0
current_marble_idx = 0
while marble < last_marble_point:
p = (p + 1) % players
marble += 1
insert_at = (current_marble_idx + 2) % len(circle)
#!/bin/sh
############################### Backup Script #################################
# Backup script invoked by systemd (timer) to ensure hourly backups. #
# DATE is not appended to the file. This is because the server used as TRG #
# snapshots the data set and saves: hourly snapshots for a day #
# daily snapshots for a weekly #
# monthly snapshots for a year #
# #
# At the moment the script starts of by checking that the laptop is charging; # #
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
#
# Imports
#
from random import randint
###############################################################################
# MAIN #
###############################################################################
@ErikThorsell
ErikThorsell / speedtest.py
Last active April 10, 2018 10:06
Speedtest of internet connection to be run using cron/systemd.timer
#!Python3
# -*- coding: utf-8 -*-
#
# Imports
#
import os
import csv
import argparse
from speedtest_cli import Speedtest
import time
from random import randint
## Pre protocol ##
# n is the only variable in the program that needs touching, everything else is
# randomized!
n = 5 # Increase for more jobs!!!
dm = 0
jobs = []
@ErikThorsell
ErikThorsell / keybase.md
Last active September 18, 2016 06:22
keybase.md

Keybase proof

I hereby claim:

  • I am erikthorsell on github.
  • I am erikthorsell (https://keybase.io/erikthorsell) on keybase.
  • I have a public key whose fingerprint is 4C99 67A8 625E 816B D683 5D85 2B71 38D3 DA12 237B

To claim this, I am signing this object: