Skip to content

Instantly share code, notes, and snippets.

View wimglenn's full-sized avatar
💭
🦡🦡🦡🦡🍄🍄🦡🦡🦡🦡🦡🦡🐍

Wim Jeantine-Glenn wimglenn

💭
🦡🦡🦡🦡🍄🍄🦡🦡🦡🦡🦡🦡🐍
View GitHub Profile
@wimglenn
wimglenn / q02.py
Created December 2, 2016 05:55
advent of code day 2
data = '''UULDRRRDDLRLURUUURUURDRUURRDRRURUDRURRDLLDRRRDLRUDULLRDURLULRUUURLDDRURUDRULRDDDUDRDLDDRDDRUURURRDDRLRLUDLUURURLULLLRRDRLDRLRDLULULRDRDDUURUDRRURDLRRDDDLUULDURDLDLLRLRLLUDUDLRDDLUURUUDDRDULDDLDLLDULULRLDDDUDDDRLLRURLRDUUUDUUDDURRDLDDLRDLLUDDLDRLDULDRURLUUDLURLUDRULRLRUUUURLUUUDDULLRLLURDRURLLRLRLDDRURURULRULLUUUULUDULDDDRDDLURLUURRLDDRDRUDDRRLURRDURRLDUULRRLLRDLLDDUURULLRUURRRRDRRURLULLRLRDDULULRDLDDLULLD
UUDUDDRRURRUDDRLDLURURLRLLDRLULLUURLLURDRLLURLLRRLURDLDURUDRURURDLRDRRDULRLLLRDLULDRLLDLDRLDDRUUUUULRLDUURDUUUURUUDLRDLLDRLURULDURURLDLLRDLULLULLLLLUDUDDLRLLLUDLRUUDDUUDUDDDLULDDUDUULUUDUDRRULRRRURUDUUULDDRURLLULLULURLUDRDLUUUDLDRRLRRRULLRRURRUDDDRDLDDDLDUDLLDRRDURRURRURRLDLURUULRLDLUDUDUUULULUUDDDLDDULRDULLULDRDDURRURRRULRDURULUDURRDLLUURRUURLLLULDRRULUUUURLRLRDDDDULLUUUDRRLRRLRRLLLUDDDLRDDURURRDULLLUDLUDURRLRDURUURURDRDUUURURRUDRURRULLDDURRLRRRUULDRLDRRURUDLULRLLRRDLDDRLRRULDDLLUURUDDUDRLUD
DDDUDDRRDRRRUULDRULDLDLURRRUURULRUDDRLLLLURRLRULDLURRULDRUDRRLLLLDULRDLUUURDDLDLURRLLUUURLLUDLUDRRDDULLULUR

Keybase proof

I hereby claim:

  • I am wimglenn on github.
  • I am wimglenn (https://keybase.io/wimglenn) on keybase.
  • I have a public key whose fingerprint is FD35 51BB 264F 7282 95CB F681 C127 F552 CFFF C6DE

To claim this, I am signing this object:

@pytest.fixture(autouse=True, scope='session')
def inject_test_settings(tmpdir_factory):
# cleans environment vars, sets up some temp space and data, etc
@pytest.fixture(autouse=True, scope='session')
def test_db(inject_test_settings):
# creates the test database [once] at the beginning of the test suite.
# drops it at the end of the suite.
@wimglenn
wimglenn / speed.py
Created November 2, 2017 18:05
Human readable data rates
class Speed:
"""
For human-readable bitrates
>>> now = datetime.utcnow()
>>> then = now - timedelta(seconds=4)
>>> speed = Speed(n_bytes=200e6, start_time=then, end_time=now) # e.g. transferring approx 200 meg in 4 seconds
>>> print(speed)
50000000.0 bytes/s
>>> f'{speed:MBps}' # specify units in the format mini language
@wimglenn
wimglenn / gold tag badgers (22 Jun 2018)
Created June 22, 2018 22:24
gold tag badgers (22 Jun 2018)
{
"c#": 595,
"java": 531,
"javascript": 447,
"python": 422,
"c++": 404,
"php": 272,
"android": 268,
"jquery": 247,
"c": 175,
@wimglenn
wimglenn / numpy wat
Created June 26, 2018 20:10
numpy wat
>>> import numpy as np
>>> import builtins
>>> np.random.randn(3,3)
array([[-0.24401213, -0.19773938, 0.47278806],
[-0.6083566 , -0.65160561, 0.78145811],
[ 0.14546934, -0.86849935, 2.07570471]])
>>> np.empty((3,3)) # sign loss
array([[0.24401213, 0.19773938, 0.47278806],
[0.6083566 , 0.65160561, 0.78145811],
[0.14546934, 0.86849935, 2.07570471]])
@wimglenn
wimglenn / intcomputer.py
Created December 9, 2019 18:46
IntComputer class for Advent-of-Code 2019
import logging
from collections import defaultdict
from collections import deque
# logging.basicConfig(level=logging.INFO, format=" %(message)s")
log = logging.getLogger(__name__)
# "parameter modes"
POSITION = 0
@wimglenn
wimglenn / quine_aoc2019-9.log
Created December 9, 2019 21:54
AoC 2019 day 9 quine
AoC 2019 day 9 quine: 109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99
0 op_offset ip=0 opcode=00109 offset=0 args=[1] {0: 109, 1: 1, 2: 204, 3: -1, 4: 1001, 5: 100, 6: 1, 7: 100, 8: 1008, 9: 100, 10: 16, 11: 101, 12: 1006, 13: 101, 14: 0, 15: 99}
1 op_output ip=2 opcode=00204 offset=1 args=[0] {0: 109, 1: 1, 2: 204, 3: -1, 4: 1001, 5: 100, 6: 1, 7: 100, 8: 1008, 9: 100, 10: 16, 11: 101, 12: 1006, 13: 101, 14: 0, 15: 99}
2 op_add ip=4 opcode=01001 offset=1 args=[100, 6, 100] {0: 109, 1: 1, 2: 204, 3: -1, 4: 1001, 5: 100, 6: 1, 7: 100, 8: 1008, 9: 100, 10: 16, 11: 101, 12: 1006, 13: 101, 14: 0, 15: 99}
3 op_eq ip=8 opcode=01008 offset=1 args=[100, 10, 101] {0: 109, 1: 1, 2: 204, 3: -1, 4: 1001, 5: 100, 6: 1, 7: 100, 8: 1008, 9: 100, 10: 16, 11: 101, 12: 1006, 13: 101, 14: 0, 15: 99, 100: 1}
4 op_jump_f ip=12 opcode=01006 offset=1 args=[101, 14] {0: 109, 1: 1, 2: 204, 3: -1, 4: 1001, 5: 100, 6:
@wimglenn
wimglenn / share_markdown.user.js
Created February 19, 2020 16:08 — forked from kms70847/share_markdown.user.js
For each Stack Overflow question, adds an additional box to the "share" button, containing a link with markdown
// ==UserScript==
// @name Share Markdown (Stack Overflow)
// @namespace about:blank
// @include http://stackoverflow.com/questions/*
// @include https://stackoverflow.com/questions/*
// @version 6
// @grant none
// ==/UserScript==
function make_input(text){
@wimglenn
wimglenn / share_markdown.user.js
Created February 19, 2020 16:08 — forked from kms70847/share_markdown.user.js
For each Stack Overflow question, adds an additional box to the "share" button, containing a link with markdown
// ==UserScript==
// @name Share Markdown (Stack Overflow)
// @namespace about:blank
// @include http://stackoverflow.com/questions/*
// @include https://stackoverflow.com/questions/*
// @version 6
// @grant none
// ==/UserScript==
function make_input(text){