Skip to content

Instantly share code, notes, and snippets.

[Event "Rated Bullet game"]
[Site "https://lichess.org/lMfUWjwH"]
[Date "2019.01.18"]
[Round "-"]
[White "akxonil"]
[Black "makokha"]
[Result "0-1"]
[UTCDate "2019.01.18"]
[UTCTime "00:52:58"]
[WhiteElo "1568"]
grammar ical {
rule TOP {
<vcalendar>
}
rule vcalendar {
<section>
\n?
}
# section does not end with a NL
rule section {
@bduggan
bduggan / pxdoc
Last active September 20, 2018 19:28
!/usr/bin/env perl6
# pxdoc
# requires: curl, lynx (or other browser), JSON::Fast
# See: https://www.reddit.com/r/perl6/comments/9h0xy6/pxdoc_quick_hack_for_command_line_docs/
use JSON::Fast;
#| Search for Perl 6 documentation and load it in a browser.
sub MAIN (
@bduggan
bduggan / pd.p6
Created September 17, 2018 13:49
quick p6 doc
#!/usr/bin/env perl6
use JSON::Fast;
sub MAIN($term) {
my $got = %*ENV<HOME>.IO.child('.p6index.json') or do
shell 'curl https://docs.perl6.org/js/search.js?v=3 > ~/.p6index.json';
my $js = $got.slurp.subst( /^ .* 'var items ='/, '' )
.subst(/';'\s* 'var results =' .* $/, '' )
.subst('category:','"category":',:g)
#!/usr/bin/env perl6
sub spinner() {
<\ - | - / ->[$++ % 6]
}
sub MAIN($expr, $filename) {
shell "tput 'civis'";
my $proc = Proc::Async.new:
<<tail -f $filename>>;
@bduggan
bduggan / tailgrep.p6
Last active September 11, 2018 22:33
#!/usr/bin/env perl6
use JSON::Fast;
use Terminal::ANSIColor;
my @frames = < / - | - \ - >;
sub spinner {
@frames[$++ % +@frames];
}
sub download-spinners {
<!DOCTYPE html>
<html lang="en" ng-app="moarProfApp" ng-controller="NavigationController">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MoarVM Profiler Results</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<style>
<!DOCTYPE html>
<html lang="en" ng-app="moarProfApp" ng-controller="NavigationController">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MoarVM Profiler Results</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css">
<style>
use nqp;
# see https://rt.perl.org/Public/Bug/Display.html?id=131530
# search for add_categorical in src/Perl6/Grammar.nqp
my $compiler = nqp::getcomp("perl6");
my $outer_ctx;
my $*MAIN_CTX;
sub reval($code) {
my $*CTXSAVE = class {
module := RDF-Turtle
version := $(shell jq -r .version META6.json)
test:
TEST_AUTHOR=1 prove -e'perl6 -Ilib' t/*
dist:
echo "Making $(version)"
git archive --prefix=$(module)-$(version)/ -o $(module)-$(version).tar.gz $(version)