Skip to content

Instantly share code, notes, and snippets.

@bazzaar
bazzaar / gist:ed84ddc39e63d779222e5fdd87d13c61
Created December 7, 2020 15:57
Typo-grammatical stuff : Day 6 Raku advent 2020
"All called that is run until outer finishes can see that variable, including the inside of inner"
"All code that is run until outer finishes can see that variable, including the code inside of inner"
=======
"observes a directory tree, and you can configure it synchronize flies to another local," note #flies# mispelling also
"observes a directory tree, and you can configure it to synchronize files with another local directory,"
@bazzaar
bazzaar / gist:7a81009e383e6aff11594f1626c668f2
Last active May 16, 2020 16:51
Are prior regex captures supposed to be scrubbed once subst method is called?
> my $s = 'aaa123bbb'
aaa123bbb
> $s ~~ m/ ('a' **3) \d**3 ('b' **3)/
「aaa123bbb」
0 => 「aaa」
1 => 「bbb」
> my $regex = / ('a' **2) 'a' \d**3 'b' ('b' **2) /
/ ('a' **2) 'a' \d**3 'b' ('b' **2) /
> $s .= subst($regex, $0 ~ "x999y" ~ $1)
aaax999ybbb
@bazzaar
bazzaar / gist:c0d1a7c6bc5e310978e265bc2727e27b
Last active May 11, 2020 10:46
zef (install Digest::SHA256::Native) build failure
AMD64 system with Opensuse Leap 15.2 OS
bazzaar@linux:~> raku -v
This is Rakudo version 2020.05.1 built on MoarVM version 2020.05
implementing Raku 6.d.
-----------------------------------------
bazzaar@linux:~> zef --verbose install Digest::SHA256::Native
===> Searching for: Digest::SHA256::Native
===> Found: Digest::SHA256::Native:ver<0.03> [via Zef::Repository::LocalCache]
===> Building: Digest::SHA256::Native:ver<0.03>
[Digest::SHA256::Native] Command: /opt/rakudo-pkg/bin/rakudo -e require '/home/bazzaar/.zef/store/Digest-SHA256-Native-0.03.tar.gz/Digest-SHA256-Native-0.03/Build.pm'; ::('Build').new.build('/home/bazzaar/.zef/store/Digest-SHA256-Native-0.03.tar.gz/Digest-SHA256-Native-0.03') ?? exit(0) !! exit(1);
@bazzaar
bazzaar / gist:fb30f16b2623164e75b1c52c6360c74e
Created April 1, 2020 10:41
get_musicbrainz_release_info_by_specifying_discid
use Cro::HTTP::Client;
use JSON::Fast;
use Pretty::Table;
my $client = Cro::HTTP::Client.new(
headers => [
User-agent => 'HTTP::API::MusicBrainz/0.0.1'
]);
my $discid = 'M3ATxcfK.GATL5ED0AXxljjcva8-'; # obtained from libdiscid calculation
@bazzaar
bazzaar / gist:979b6e39f34526b60a697daf74bf1019
Last active March 30, 2020 21:25
get_musicbrainz_release_groups : browse_vs_lookup syntax
use Cro::HTTP::Client;
use JSON::Fast;
use LibUUID;
use HTTP::API::MusicBrainz;
use Pretty::Table;
my $client = Cro::HTTP::Client.new(
headers => [
User-agent => 'HTTP::API::MusicBrainz/0.0.1'
]);
@bazzaar
bazzaar / gist:4dda03bb5dab303b9cc6b43398478b04
Last active December 7, 2019 19:22
raku 2019.11 Inline::Python module zef install 'build failure'
bazzaar@linux:~> perl6 -v
This is Rakudo version 2019.11 built on MoarVM version 2019.11
implementing Perl 6.d.
(Opensuse Leap15.1 packaged install : Rakudo compiler only)
# --
excerpt from perl6 -V
----------------------
@bazzaar
bazzaar / Matplotlib_reduced.pm6
Last active October 10, 2018 21:04
Inline::Python - Testing call method with __builtin__ getattr - fails if called repeatedly on same object / attribute combination
use Inline::Python;
my $py = Inline::Python.new();
$py.run('import matplotlib.pyplot');
class Matplotlib::Plot {
method cm {
class {
# this getattr method, called like so : 'say $plt.cm.getattr($cmap, 'N');'
method getattr($obj, $name) {
@bazzaar
bazzaar / gist:914a5c3e6fd69e45de7ecce9d16e360b
Created September 5, 2018 20:19
for loop with .lines
use Slang::Tuxic;
use Text::CSV;
use File::Find;
my $csv_line = Text::CSV.new (eol => "\n");
my $cols = 49;
my @IO-object-list = find(:dir</home/user1/documents/animals>, :type<file>, :name(/armadillos_201<[4..8]>.*\.csv/));
for @IO-object-list -> $IO-object {
@bazzaar
bazzaar / gist:040af6a440c86201c3921a2740a82c69
Created January 30, 2018 21:49
IO spurt Cro http request response to file
# Import the client class.
use Cro::HTTP::Client;
my $client = Cro::HTTP::Client.new(
headers => [
User-agent => 'Cro'
]);
# Make the request
####
@bazzaar
bazzaar / gist:bb3eed14f700da73f1616c88535f68ae
Created November 28, 2016 17:46
problem installing rakudo-star-2016.11 on linux, panda install fails with File::Find error "Required named parameter 'name' not passed"
bazzaar@linux:~/rakudo/rakudo-star-2016.11> perl -v
This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-linux
(with 1 registered patch, see perl -V for more detail)
============================================
bazzaar@linux:~/rakudo> curl -O http://rakudo.org/downloads/star/rakudo-star-2016.11.tar.gz
bazzaar@linux:~/rakudo> tar -xvzf rakudo-star-2016.11.tar.gz
bazzaar@linux:~/rakudo> cd rakudo-star-2016.11/
bazzaar@linux:~/rakudo/rakudo-star-2016.11> perl Configure.pl --backend=moar --gen-moar