Skip to content

Instantly share code, notes, and snippets.

View scmorrison's full-sized avatar

Sam Morrison scmorrison

View GitHub Profile
@scmorrison
scmorrison / install-reaper-latest.raku
Last active November 5, 2021 01:30
Install latest Reaper on linux
#!/usr/bin/env raku
#
# File: install-reaper-latest.raku
# Summary: Download and install the latest
# version of Reaper from reaper.fm.
#
# Usage:
# ./install-reaper-latest.raku [--arch[=Any]] [--install_dir[=Any]] [--tmp_dir[=Any]]
use v6;
@scmorrison
scmorrison / install-uzu-deps.sh
Last active December 23, 2018 02:00
Reinstall all Uzu related dependencies
#!/bin/bash
zef install --force-install --/test \
File::Directory::Tree \
File::Find File::Temp \
Terminal::ANSIColor \
Template6 \
Template::Mustache \
Test::Output \
HTTP::Parser \
@scmorrison
scmorrison / main.p6
Last active December 7, 2018 10:45
Tests for 6Pad
my $input = 'While there was a brief hiatus in the development of the open firmware for Raspberry Pi, we can now boot Linux straight from bootcode.bin (note, this does require an initrd built in with zImage as there are still issues with eMMC working reliably at boot).';
my @input_arr = $input.comb;
my $i = 0;
my %working_set;
# example 1: rotor
my $now = now;
@input_arr.rotor(5 => -4).map: -> @set {
%working_set{'a', 'b', 'c', 'd', 'e'} = @set;
@scmorrison
scmorrison / multi-overrides.pm6
Created November 16, 2017 11:15
Module-wide multi overriding
use v6;
unit module Foo;
our proto sub bar(|) {*}
multi bar(
Hash $config,
*%sig where { is-overridden $config, $?PACKAGE, &?ROUTINE }) {
override($config<overrides>{ me }, :$config, :%sig);
}
@scmorrison
scmorrison / template-mustache-nested-hashes.pl6
Last active August 20, 2017 15:45
Perl 6 - Template::Mustache nested hash rendered ordering incorrect
#!/usr/bin/env perl6
use v6;
use Template::Mustache;
my %h = categories => [
category_pages => [{
title => "Perl 6",
url => "https://www.perl6.org"}, {
@scmorrison
scmorrison / mustache-hyper.pl6
Last active August 20, 2017 16:42
Perl 6 - Template::Mustache.render dies with hyper
#!/usr/bin/env perl6
use v6;
#use v6.d.PREVIEW;
use Template::Mustache;
my $html = q:to/EOF/;
<html>
{{> head }}
165 10736 RMD: try-load 0BDF8C54D33921FEA066491D8D13C96A7CB144B9: /tmp/.mount_y5cmQl/usr/share/perl6/site/sources/0BDF8C54D33921FEA0664[192/1719]
A7CB144B9
5 10736 RMD: Trying to load 0BDF8C54D33921FEA066491D8D13C96A7CB144B9 from /home/admin/.perl6/precomp
5 10736 RMD: Trying to load 0BDF8C54D33921FEA066491D8D13C96A7CB144B9.repo-id from /home/admin/.perl6/precomp
1 10736 RMD: Repo changed: 6B786C2998385EA82DE1BE33A57511DA188F37B7 ne E03253559C31895E3F13545D8B23A899E5973874. Need to re-check dependencies.
0 10736 RMD: Repo chain changed: 6B786C2998385EA82DE1BE33A57511DA188F37B7 ne E03253559C31895E3F13545D8B23A899E5973874. Need to re-check depende
ncies.
27 10736 RMD: dependency: 51E302443A2C8FF185ABC10CA1E5520EFEE885A1 /tmp/.mount_xD7kng/usr/share/perl6/sources/51E302443A2C8FF185ABC10CA
@scmorrison
scmorrison / bailador-caching.pl6
Last active February 27, 2017 15:30
Bailador + Cache::LRU
#!/usr/bin/env perl6
use v6;
use lib 'lib';
use Cache::LRU;
use Bailador;
Bailador::import(rootdir => "./examples");
my $cache = Cache::LRU.new(size => 1024);
@scmorrison
scmorrison / slide_through_string.pl6
Last active January 14, 2017 14:29
Step through string, x characters at a time, sliding rule
#!/usr/bin/env perl6
use v6;
my $input = 'While there was a brief hiatus in the development of the open firmware for Raspberry Pi, we can now boot Linux straight from bootcode.bin (note, this does require an initrd built in with zImage as there are still issues with eMMC working reliably at boot).';
my @input_arr = $input.comb;
my $i = 0;
my %working_set;
#!/usr/bin/env perl6
use v6;
use HTTP::UserAgent;
my $ua = HTTP::UserAgent.new;