Skip to content

Instantly share code, notes, and snippets.

View kstrauser's full-sized avatar

Kirk Strauser kstrauser

View GitHub Profile
#!/usr/bin/env python
from collections import Counter
spammers = [
{"domain": "lewohner.top", "ip": "5.189.207.59", "asn": "AS50896", "mx": "mxsrv.mailasrvs.pw"},
{
"domain": "vesigarna.site",
"ip": "185.71.1.152",
"asn": "AS200557",
@kstrauser
kstrauser / advent2018_2.py
Created December 1, 2018 20:07
My solution for the December 1, 2018 Advent of Code question #2
#!/usr/bin/env python
import itertools
import pathlib
value = 0
seen = set()
for line in itertools.cycle(
int(line) for line in pathlib.Path("input/1.txt").read_text().splitlines()
@kstrauser
kstrauser / up_arrow.py
Last active May 31, 2019 14:09
A toy implementation of Knuth's up-arrow notation
#!/usr/bin/env python3
import pytest
def up_n(arrows, a, b):
"""Return a ↑(arrows times) b."""
if arrows == 1:
return a ** b
@kstrauser
kstrauser / pureenergy.json
Last active July 3, 2019 23:56
Drums for What's On Your Mind (Pure Energy) by Information Society
{
"name": "drumbit",
"metadata": {
"author": "",
"title": "",
"remarks": ""
},
"options": {
"tempo": 63,
"swing": 0,
---
:concurrency: 25
:queues:
- [default, 6]
- [push, 4]
- [mailers, 2]
- [pull]
version: '3'
services:
[...]
sidekiq_1:
build: .
image: tootsuite/mastodon
restart: always
env_file: .env.production
command: bundle exec sidekiq -c 25
volumes:
#!/usr/bin/env python
from functools import cache
real = True
with open("real_1.txt" if real else "test_1.txt") as infile:
data = infile.read().strip()