Skip to content

Instantly share code, notes, and snippets.

View jfly's full-sized avatar

Jeremy Fleischman jfly

View GitHub Profile
# bad: [a9bf124c46ef298113270b1f84a164865987a91c] Merge pull request #273232 from SuperSamus/wine-update
# good: [beec1fafb2b207130f657b9719805888762ead34] commitizen: 3.12.0 -> 3.13.0
git bisect start 'a9bf124c46ef298113270b1f84a164865987a91c' 'beec1fafb2b207130f657b9719805888762ead34'
# skip: [c8cdc3999e773edcdae8a24f396704e23c11c143] libgcrypt: 1.10.2 -> 1.10.3
git bisect skip c8cdc3999e773edcdae8a24f396704e23c11c143
# good: [80288e8f921523a5d0daa4607ad68b9e393b66f0] Merge pull request #273513 from fabaff/setupmeta-bump
git bisect good 80288e8f921523a5d0daa4607ad68b9e393b66f0
# skip: [1426cf3d090b1de44d550087f249fd841a17172f] Merge #271001: mkosi: drop patches backported to systemd 254.6
git bisect skip 1426cf3d090b1de44d550087f249fd841a17172f
# skip: [a18b35ae5bba71286ecde1bf7abe157106fc69ab] perl536: 5.36.1 -> 5.36.3
@jfly
jfly / nix.log
Last active December 13, 2023 20:12
aacgain build failure
$ nix build -L nixpkgs/a9bf124c46ef298113270b1f84a164865987a91c#aacgain
this derivation will be built:
/nix/store/lkkpqfx0vqihnnfjwdnxqwrb0z68p61y-aacgain-2.0.0.drv
building '/nix/store/lkkpqfx0vqihnnfjwdnxqwrb0z68p61y-aacgain-2.0.0.drv'...
aacgain> Running phase: unpackPhase
aacgain> unpacking source archive /nix/store/61vh48r45v36l8mc6pixvdpdsgk2zanb-source
aacgain> source root is source
aacgain> Running phase: patchPhase
aacgain> Running phase: updateAutotoolsGnuConfigScriptsPhase
aacgain> Updating Autotools / GNU config script to a newer upstream version: ./3rdparty/mp4v2/autoaux/config.sub
@jfly
jfly / lazy.py
Last active October 25, 2019 16:30
def memoize(func):
memod = {}
def wrapper(*args):
if args not in memod:
memod[args] = func(*args)
return memod[args]
return wrapper
@memoize
def unpack(func):
from cli_helpers.tabular_output import TabularOutputFormatter
formatter = TabularOutputFormatter(format_name='simple')
headers = ("Column A", "Column B")
so_much_b_data = "\n".join(str(i)*50 for i in range(10))
data = [ ("some a data", so_much_b_data) ]
format = "ascii"
print("\n".join(list(formatter.format_output(data, headers, format))))
@jfly
jfly / rich_comparisons.py
Created April 3, 2018 23:06
Playing around with python's rich comparison operators
from __future__ import print_function
import functools
@functools.total_ordering
class Comparable():
def __init__(self, value):
self._value = value
def __lt__(self, o):
return self._value < o._value
@jfly
jfly / comp_count_stats.md
Last active September 9, 2017 21:29
Number of WCA competitions people attended in various years

2016

irb(main):016:0> year=2016; id_counts = ActiveRecord::Base.connection.execute("SELECT Results.personId, COUNT(DISTINCT Competitions.id) FROM Results INNER JOIN Competitions ON Competitions.id = Results.competitionId WHERE (YEAR(Competitions.start_date)=#{year}) GROUP BY Results.personId").to_a; (1..100).each { |comp_count| people_count = id_counts.sort_by { |id_count| id_count[1] }.select { |id_count| id_count[1] >= comp_count }.length; puts "#{people_count} person(s) went to >= #{comp_count} comps in #{year}"; break if people_count == 0 }
   (6745.6ms)  SELECT Results.personId, COUNT(DISTINCT Competitions.id) FROM Results INNER JOIN Competitions ON Competitions.id = Results.competitionId WHERE (YEAR(Competitions.start_date)=2016) GROUP BY Results.personId
27630 person(s) went to >= 1 comps in 2016
9900 person(s) went to >= 2 comps in 2016
5080 person(s) went to >= 3 comps in 2016
2907 person(s) went to >= 4 comps in 2016
1798 person(s) went to >= 5 comps in 2016
@jfly
jfly / start_screen.sh
Last active August 23, 2017 05:54
bash function to start a screen session with multiple named windows running specified commands
function start_screen {
NAME=$1
shift
screen -dmS "$NAME" -s bash # start screen
while test $# -gt 0
do
TITLE="$1"
shift
CMD="$1"$'\n'
@jfly
jfly / hugo.py
Created November 30, 2016 19:11
hacky implementation of hugo runoffs
#!/usr/bin/python3
import copy
import math
import pprint
candidates = [
"Green Mars",
"The Fifth Season",
"What If",
@jfly
jfly / dns tricks
Last active August 29, 2015 13:56
dns tricks
# figure out authoritative dns server for domain
~ @localhost> nslookup -querytype=soa jpi.jflei.com
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
*** Can't find jpi.jflei.com: No answer
Authoritative answers can be found from: