Skip to content

Instantly share code, notes, and snippets.

View kendallm's full-sized avatar
🌰
It's your world squirrel, I'm just trying to get a nut.

Kendall Morgan kendallm

🌰
It's your world squirrel, I'm just trying to get a nut.
View GitHub Profile
### Keybase proof
I hereby claim:
* I am kendallm on github.
* I am kendallmorgan (https://keybase.io/kendallmorgan) on keybase.
* I have a public key whose fingerprint is 0135 AD57 37C2 A7D2 5891 A531 6C5C F33B EE49 DEDF
To claim this, I am signing this object:
@kendallm
kendallm / schedule_to_omnifocus.py
Created August 23, 2018 04:37
Add CS6200 schedule to omnifocus
import csv
import sys
import webbrowser
from urllib import parse
URL_FORMAT = 'omnifocus:///add?name=%s&due=%s&project=CS6200&note=%s'
def add_to_omni(title, date, note):
link = (URL_FORMAT % (title, date, note))
webbrowser.open(link, new=2)
@kendallm
kendallm / aoc_day_6.py
Created December 6, 2019 06:41
Advent of code day 6.
class Node:
def __init__(self, name):
self.name = name
self.orbitors = []
self.orbiting = None
def add_orbitor(self, node):
self.orbitors.append(node)
def orbit(self, node):
from textwrap import wrap
from math import inf
from collections import Counter
import cv2
import numpy as np
def get_layers():
with open('../input/input_8.txt') as f:
input = wrap(f.readline(), 25)
@kendallm
kendallm / closest_power_of_2.py
Created September 13, 2020 20:59
Calculate the nearest power of 2 that is >= n
from math import *
def nearest_power_of_2(n):
return 2 ** ceil(log2(n))
@kendallm
kendallm / exponentiation.py
Created October 18, 2020 03:26
Fast exponentiation
def pow(x, y):
if y == 0:
return 1
z = pow(x, y//2)
if y % 2 == 0:
return z * z
return x * z * z
@kendallm
kendallm / euclid.py
Last active October 18, 2020 04:05
Computes GCD of x,y
def euclid(x,y):
if x < y:
temp = y
y = x
x = temp
if y == 0:
return x
return euclid(y, x % y)
@kendallm
kendallm / plot_formula.py
Created October 20, 2020 23:48
Quickly plot a formula
import matplotlib.pyplot as plt
import numpy as np
import math
x = np.arange(1000)
y = np.log2(x)
plt.plot(x,y, label="log(x)")
plt.legend()
@kendallm
kendallm / setup_assignment_repo.sh
Created October 29, 2020 05:02
Setup student repo
git push --mirror {student_repo}
cd ..
git clone {student_repo}
git remote add upstream {class_repo}
@kendallm
kendallm / vs code extensions
Last active April 26, 2021 22:34
To install run `cat $filename | xargs -L 1 echo code --install-extension`
AdamCaviness.theme-monokai-dark-soda
alanz.vscode-hie-server
alexanderte.dainty-dark-plus-vscode
alexanderte.dainty-vscode
arcticicestudio.nord-visual-studio-code
dnlytras.nord-wave
Equinusocio.vsc-community-material-theme
Equinusocio.vsc-material-theme
equinusocio.vsc-material-theme-icons
fvclaus.sort-json-array