Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env raku
sub mk-thumb(IO::Path $src, Bool :$force) {
my $dst = "{$src.dirname}/thumb-{$src.basename}";
return False if $dst.IO.e && !$force;
(shell "gm convert -auto-orient $src -thumbnail '400x400>' $dst") == 0;
}
multi files(IO::Path $f where *.f) { $f }
multi files(IO::Path $f where *.d) {
#!/usr/bin/env python3
import threading
seen = {}
def get_client():
key = id(threading.current_thread())
if seen.get(key):
print(f'reusing id {key}')
pass
let as = document.getElementsByTagName('a')
let now = Date.now();
for (let item of as) {
let href = item.getAttribute('href');
let last = localStorage.getItem(href);
let days_ago = (now - last)/1000/60/60/24;
let h = 190;
// if (days_ago > 20) { h = 90; }
let s = days_ago > 1 ? 20 : 20 + 60 * (1 - days_ago);
say "hello, world"
[Event "Rated Blitz game"]
[Site "https://lichess.org/rWcdlWB6"]
[Date "2020.05.13"]
[Round "-"]
[White "makokha"]
[Black "Freddy13"]
[Result "1-0"]
[UTCDate "2020.05.13"]
[UTCTime "21:00:17"]
[WhiteElo "1861"]
#!/usr/bin/env raku
my @void = <area base br col command embed hr img input keygen link meta param source track wbr>;
grammar H {
rule TOP { <block> }
rule block {
| '<' <tag> '>' <block>* '</' $<tag> '>'
| '<' $<void>=[ @void '/'? ] '>'
| <text>
[Site "Lovett Library"]
[Date "2020.02.12"]
[Result "1-0"]
[White "Brian Duggan"]
[Black "Justin"]
1. d4 Nf6 2. Nf3 d6 3. Bf4 e6 4. Nbd2 b6
5. e3 Nh5 6. Bg3 Be7 7. Bd3 Nxg3 8. hxg3 h6
9. Qe2 Bb7 10. c4 Nd7 11. e4 O-O 12. O-O-O c5
13. d5 a6 14. Nh4 Bxh4 15. Rxh4 Ne5 16. Bb1 b5
[Event "Fischer - Spassky World Championship Match"]
[Site "Reykjavik ISL"]
[Date "1972.07.11"]
[EventDate "?"]
[Round "1"]
[Result "1-0"]
[White "Boris Spassky"]
[Black "Robert James Fischer"]
[ECO "E56"]
[WhiteElo "?"]
[Site "Lovett Library"]
[Date "2020.02.12"]
[Result "1-0"]
[White "Brian Duggan"]
[Black "Justin"]
1. d4 Nf6 2. Nf3 d6 3. Bf4 e6 4. Nbd2 b6
5. e3 Nh5 6. Bg3 Be7 7. Bd3 Nxg3 8. hxg3 h6
9. Qe2 Bb7 10. c4 Nd7 11. e4 O-O 12. O-O-O c5
13. d5 a6 14. Nh4 Bxh4 15. Rxh4 Ne5 16. Bb1 b5
[Event "Chess Olympiad"]
[Site "Tromso NOR"]
[Date "2014.08.08"]
[EventDate "2014.08.02"]
[Round "6.3"]
[Result "0-1"]
[White "Fabiano Caruana"]
[Black "Magnus Carlsen"]
[ECO "B01"]
[WhiteElo "2801"]