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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function start_screen { | |
NAME=$1 | |
shift | |
screen -dmS "$NAME" -s bash # start screen | |
while test $# -gt 0 | |
do | |
TITLE="$1" | |
shift | |
CMD="$1"$'\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import copy | |
import math | |
import pprint | |
candidates = [ | |
"Green Mars", | |
"The Fifth Season", | |
"What If", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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: |