Skip to content

Instantly share code, notes, and snippets.

@nielskou
nielskou / day15ac.py
Created December 15, 2023 21:54
Day 15 Allex Cuisine
class Santa:
boxes = {}
def __setattr__(self, key, value):
super(Santa, self).__setattr__("label", key)
self.boxes.setdefault(hash(self), {})[key] = value
def __getattr__(self, item):
super(Santa, self).__setattr__("label", item)
return self

Keybase proof

I hereby claim:

  • I am zweedeend on github.
  • I am kallgaard (https://keybase.io/kallgaard) on keybase.
  • I have a public key whose fingerprint is 4E5F 43AB 2F69 CFA9 C97B 268A B76E 6811 1AD3 2DE8

To claim this, I am signing this object:

import numpy as np
import matplotlib.pylab as pl
from scipy.optimize import curve_fit
import requests
import os.path
data_file = 'key-countries-pivoted.csv'
if not os.path.exists(data_file):
url = "https://raw.githubusercontent.com/datasets/covid-19/master/data/key-countries-pivoted.csv"
#!/usr/bin/env python3
from ncclient.manager import connect_ssh
# use unencrypted keys from ssh-agent or ~/.ssh keys, and rely on known_hosts
with connect_ssh("192.168.3.3", username="stuart") as manager:
assert(":url" in manager.server_capabilities)
with manager.locked("running"):
# create a new checkpoint
manager.copy_config(source="running", target="file:///new_checkpoint.conf")

Keybase proof

I hereby claim:

  • I am Zweedeend on github.
  • I am kallgaard (https://keybase.io/kallgaard) on keybase.
  • I have a public key whose fingerprint is 87DE 8D71 8BE6 0F5C 6926 CEED 0E31 A114 FF3E 2D04

To claim this, I am signing this object:

@nielskou
nielskou / datastructures.py
Created April 19, 2017 08:52
Data structures in Python3 for Coders of the Caribbean
import math
from operator import sub, add, mul
def hexagonal_to_cubic(col, row):
x = col - row // 2
z = row
y = 0 - x - z
return x, y, z