Skip to content

Instantly share code, notes, and snippets.

View renormalist's full-sized avatar

Steffen Schwigon renormalist

View GitHub Profile
@renormalist
renormalist / math.asm
Created March 3, 2020 12:02 — forked from hausdorff/math.asm
mod and div implemented in 6502 asm
; load some data up
LDA #$7
STA $00 ; memory addr A
LDA #$05
STA $01 ; memory addr B
JMP Divide
;modulus, returns in register A
Mod:
LDA $00 ; memory addr A
@renormalist
renormalist / myapp-without-encode.pl
Created January 15, 2020 08:21
Mojo app with less Unicode clumsiness
#!/usr/bin/env perl
# myapp.pl -start it with:
# ./myapp.pl prefork -l http://localhost:8084
# The Unicode character used below is a small "umlaut letter a".
use utf8;
use 5.022; # should implicitely contain use feature 'unicode_strings'
use strict;
@renormalist
renormalist / myapp.pl
Created January 15, 2020 08:12
Mojo app with Unicode clumsiness
#!/usr/bin/env perl
# myapp.pl -start it with:
# ./myapp.pl prefork -l http://localhost:8084
# The Unicode character used below is a small "umlaut letter a".
use utf8;
use 5.022; # should implicitely contain use feature 'unicode_strings'
use strict;
@renormalist
renormalist / example.yaxmon
Last active January 15, 2020 08:56
Greatest Markup Language of All Time: YAXMON - Yet Another eXtensible Markup Object Notation
{ <name> : "Kent"</name>,
<firstname> : "Clark"</firstname>,
<hobbies> :
- { <title> : "saving people"
</title>,
<description> : "Fly high, spot problem, solve it."
</description>
}
- { <title> : "programming"
</title>,
@renormalist
renormalist / yamlish.t
Last active September 13, 2019 14:54
Comparing YAML parsers for edge cases between hash and scalar with empty value
use strict;
use warnings;
use Test::More;
use Test::Deep 'cmp_deeply', 'any';
use Iterator::Simple 'iter';
use TAP::Parser::YAMLish::Reader;
use Data::YAML::Reader;
use YAML::Tiny;
@renormalist
renormalist / deep-recursion.pl
Created July 4, 2019 12:22
Mojo deep recursion
#! /usr/bin/env perl
use 5.022;
use strict;
use warnings;
use Mojolicious::Lite;
use Time::HiRes 'usleep';
# global, used in event subs, is that ok?
@renormalist
renormalist / mojo-pg-insert-linear.pl
Created June 24, 2019 15:32
Mojo::Pg - linear insert speed
#! /usr/bin/env perl
# Mojolicious 8.17
# PostgreSQL 9.5.14
use 5.022;
use Mojo::Pg;
use Benchmark ':all';
my $id;
#! /usr/bin/env perl
# Mojolicious 8.17
# PostgreSQL 9.5.14
use 5.022;
use Mojo::Pg;
use UUID;
# as seen in https://metacpan.org/pod/Mojo::Pg
@renormalist
renormalist / create_table.sql
Created June 24, 2019 07:50
postgresql create table
CREATE TABLE tap_dom (
tap_dom_id BIGSERIAL PRIMARY KEY,
uuid UUID NOT NULL,
created TIMESTAMPTZ NOT NULL DEFAULT NOW(),
dom JSONB
);
for @els -> $t {
my $f = False;
given $t.WHAT {
when Perl6::String::Interpolation { print "INTERPOLATION"; $f=True}
when Perl6::Bareword { print "BAREWORD"; $f=True }
}
say " ({$t.content})" if $f;
}