Skip to content

Instantly share code, notes, and snippets.

0x7ffff6f518b0 has 4 edges over 3 states; 0 small (0.00)
0x7ffff6f52388 has 237 edges over 95 states; 118 small (49.79)
0x7ffff6f523e0 has 230 edges over 97 states; 108 small (46.96)
0x7ffff6f526c8 has 10 edges over 6 states; 5 small (50.00)
0x7ffff6f529d0 has 5 edges over 3 states; 1 small (20.00)
Stage start : 0.000
0x7ffff6f5abc8 has 87 edges over 56 states; 43 small (49.43)
0x7ffff6f5b460 has 52 edges over 30 states; 20 small (38.46)
0x7ffff6f5b4b8 has 44 edges over 28 states; 18 small (40.91)
0x7ffff6f97168 has 5 edges over 3 states; 0 small (0.00)
@timo
timo / 01-output.txt
Last active July 18, 2020 23:45
a Seq's first .iterator call shall be recorded with backtrace to be outputted when .iterator is called a second time ("seq already had its iterator taken and got consumed" or whatever)
making patch
will create seq
seq has which Seq|66864704
0
first user:
0.5
1
1.5
second user:
iterator already taken for this seq:
@timo
timo / gist:6e8a259891326a16f0d62d4ae0d5d1fa
Created February 4, 2020 14:08
distribution of instruction counts in CORE.c.setting.moarvm (doesn't correspond directly to bytecode size in bytes)
grep -B1 "^ Frame_" /fileserver-data/new_stuff/work/core.c.setting.dump.txt | grep -A1 -- '^--' | grep -v '^--' | cut -b 1-6 | sort | uniq -c | sort -rn
1953 00007
1351 00004
389 00008
344 00034
330 00043
289 00017
262 00020
250 00040
235 00012
@timo
timo / Perl6-Github-Linkify.js
Last active September 3, 2020 14:48
linkify filename/line-number entries in github issues in a couple different formats
// ==UserScript==
// @name Perl6-Github-Linkify
// @namespace http://tampermonkey.net/
// @version 0.3.4
// @description Turns paths to perl6 source (core setting, grammar, actions) and moarvm code to clickable links on github issue/PR pages as well as gists
// @author Timo 'timotimo' Paulssen
// @match https://github.com/*/*/issues/*
// @match https://github.com/*/*/pull/*
// @match https://gist.github.com/*
// @match https://pastebin.com/*
@timo
timo / query
Created December 6, 2018 00:48 — forked from Whateverable/query
evalable6
my $l = Lock.new; my %h; for 1..10 { my $p = start { sleep rand; $l.protect: { say "-- ", $p.WHERE; say %h.elems; %h{$p.WHERE}:delete; say %h.elems } }; say "+", $p.WHERE; %h{$p.WHERE} = $p; }; await %h.values; note %h.elems
@timo
timo / currently-working.sql
Last active November 8, 2018 14:58
can i make the update part of this query use a "with recursive" expression?
-- for testing, completely reset highest_child_id columns
update calls set highest_child_id = NULL;
-- find rows where no other row has the row's id as its parent_id
-- those shall seed the progress with initial "highest child id"
-- values
with no_children as (select id from
(select c.id as id, count(children.id) as childcount
from calls c
left join calls children on c.id == children.parent_id
@timo
timo / HashyObject.p6
Created September 30, 2018 01:05
#perl6 use a hash as if it were an object
unit class HashyObject;
has %!storage;
submethod TWEAK(*%data) { %!storage = %data }
submethod FALLBACK($name, |c) is rw { %!storage{$name} };
method perl {
self.^name ~ ".new(" ~ %!storage.pairs.map(*.perl).join(", ") ~ ")"
@timo
timo / gist:b01c70e2f7ce4a40eddc19517e3aee87
Created September 26, 2018 21:29
hilarious-looking compilation result of allomorphs.pm6 &parse_win
BB 14 (0x7f030419cdf8):
line: 283 (pc 188)
Instructions:
[Annotation: Logged (bytecode offset 188)]
sp_getlex_o r6(20), lex(idx=0,outers=0,newval)
[Annotation: INS Deopt One (idx 8 -> pc 196; line 283)]
[Annotation: INS Deopt One (idx 9 -> pc 202; line 283)]
sp_guardconc r6(4), r6(20), sslot(1), litui32(196)
[Annotation: Logged (bytecode offset 354)]
sp_getlex_o r9(25), lex(idx=0,outers=0,newval)
@timo
timo / mutator-tunnel-operator.p6
Last active September 17, 2018 19:34
A little operator that lets you mutate an object in a one-liner without needing to use the mutator's return value!
"foobarbaz".comb.Array.splice(3,1,"X").join.say;
# Output: b
# Issue: splice returns what was cut out, not the result.
# Solution: Keep the array of characters around for later.
my @a = "foobarbaz".comb; @a.splice(3,1,"X"); @a.join.say;
# Output: fooXarbaz
# Don't want to introduce a local variable for this?
@timo
timo / pass-host-and-port-on-listen.patch
Created July 20, 2018 00:12
pass host and port to a "ListenSocket" in IO::Socket::Async
diff --git a/src/core/IO/Socket/Async.pm6 b/src/core/IO/Socket/Async.pm6
index 87dcf39a5..a86a9f08f 100644
--- a/src/core/IO/Socket/Async.pm6
+++ b/src/core/IO/Socket/Async.pm6
@@ -195,23 +195,32 @@ my class IO::Socket::Async {
$p
}
+ class ListenSocket is Supply {
+ has Promise $.socket-host;