Skip to content

Instantly share code, notes, and snippets.

View SqrtNegInf's full-sized avatar
Converting coffee to code...

David Hoekman SqrtNegInf

Converting coffee to code...
  • Seattle, WA
View GitHub Profile
@SqrtNegInf
SqrtNegInf / rakubrew-build-Windows.txt
Created September 8, 2020 23:53
'rakubrew build' on Windows log
PS C:\Users\David Hoekman> rakubrew build
Update git reference: rakudo
Ref dir: C:\rakubrew\git_reference
From git://github.com/rakudo/rakudo
* branch HEAD -> FETCH_HEAD
Update git reference: nqp
Ref dir: C:\rakubrew\git_reference
From git://github.com/perl6/nqp
* branch HEAD -> FETCH_HEAD
Update git reference: MoarVM
@SqrtNegInf
SqrtNegInf / Build-rakubrew.sh
Last active February 12, 2020 04:28
Build rakubrew for MacOS if default App-Rakubrew install isn't working (i.e. for older MacOS, 10.11 - 10.13)
#!/bin/sh
## make my own 'rakubrew' (avoid issues with 10.15, ____chkstk_darwin symbol not found)
## this is a simplified version of 'release-stuff/build-macos.sh'
#
# 2020-02-11
# start with: git clone https://github.com/Raku/App-Rakubrew.git
# afterwards, move 'rakubrew' to the appropriate location
cp resources/Config.pm.tmpl lib/App/Rakubrew/Config.pm
perl -pi -E 's/<\%distro_format\%>/macos/' lib/App/Rakubrew/Config.pm
@SqrtNegInf
SqrtNegInf / Filehandle ignored
Created April 26, 2019 14:25
File handle (given as suffix) ignored without warning
say 'stdout:';
say(1);
say 2;
3.say;
say '';
say '"b" should not be here:';
my $out = open('test.txt', :w);
$out.say: 'a';
'b'.say(:$out); # <======
@SqrtNegInf
SqrtNegInf / gist:a7838ffa90a3cbb3031dae15828bd460
Last active January 13, 2019 00:08
Anti-primes testing setup
ub18:~/perl6/Rosetta-Code>uname -a
Linux cosmic 4.18.0-13-generic #14-Ubuntu SMP Wed Dec 5 09:04:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
ub18:~/perl6/Rosetta-Code>sudo lshw -short | grep DIMM | grep -v empty
/0/25/0 memory 2GiB DIMM DRAM EDO
ub18:~/perl6/Rosetta-Code>stress --cpu 4 --vm 8 &
stress: info: [36187] dispatching hogs: 4 cpu, 0 io, 8 vm, 0 hdd
ub18:~/perl6/Rosetta-Code>(Anti-primes; Anti-primes;Anti-primes;Anti-primes;Anti-primes;Anti-primes;Anti-primes;Anti-primes;Anti-primes) | grep ok
@SqrtNegInf
SqrtNegInf / segfault-on-write-bytes.txt
Last active October 31, 2018 16:50
Rakudo segfault, goes away if MVM_SPESH_OSR_DISABLE=1
The error occurs with the call to crc32, from this line in Image::PNG::Portable:
$fh.write: bytes String::CRC32::crc32 @td;
After removing .race from the calling program, can further localize to this line in routine crc32:
$crc +^= 0xFFFFFFFF
================================================================================================
This is Rakudo Perl 6 running in the GNU debugger, which often allows the user to generate useful back-
@SqrtNegInf
SqrtNegInf / Prime_conspiracy.pl
Created October 27, 2018 14:41
Perl - Rosettacode Prime_conspiracy task
use ntheory qw/forprimes nth_prime/;
my $upto = 100_000_000;
my @freq;
my($this_digit,$last_digit)=(2,0);
forprimes {
($last_digit,$this_digit) = ($this_digit, $_ % 10);
$freq[$last_digit . $this_digit]++;
} 3,nth_prime($upto);
@SqrtNegInf
SqrtNegInf / Foo-on-all-this
Created October 16, 2018 00:40
Bad naming practices, illustrated
#!/usr/bin/env perl
## Some programs exist merely to serve as an object lesson to others...
package Foo {
our $F = qq{"Life, the Universe, and Everything" by DA};
our $O = 'Off by one error';
}
$f = ' is';
$o = ' the';
@SqrtNegInf
SqrtNegInf / task.txt
Last active October 16, 2018 19:55
Rosetta Code Perl 6 task status, 2018-10-15
This is Rakudo version 2018.09-445-ge1ebffeb8 built on MoarVM version 2018.09-125-g8c2dd3ad2
implementing Perl 6.c.
updating from RC…
+-------------> Moar: Good/Bad [958/13]
|+------------> JVM: Good/Bad [868/105]
||+-----------> smOke testing [871]
|||+----------> sKipping validation [96]
||||+---------> Interactive [52]
|||||+--------> Touched (modified by me) [212]
||||||+-------> Random seed [108]
@SqrtNegInf
SqrtNegInf / say-stdout-vs-file
Last active August 25, 2016 01:36
say: buffered vs unbuffered output?
say(1);
say 2;
3.say;
my $out = open('test.txt', :w);
$out.say(1);
$out.say: 2;
3.say(:$out);