Skip to content

Instantly share code, notes, and snippets.

View treyharris's full-sized avatar

Trey Harris treyharris

View GitHub Profile
<div id="qr">
<img src="http://chart.apis.google.com/chart?cht=qr&chs=120x120&chld=L&choe=UTF-8&chl=http%3A%2F%2Fgoo.gl%2FXXXXXX" alt="QR code to http://goo.gl/XXXXXX">
<p>For a downloadable copy of this c.v., scan above or go to <a href="http://goo.gl/XXXXXX">http://goo.gl/XXXXXX</a>.</p>
</div>
#!/usr/bin/env perl6
use v6;
grammar MyRule {
token TOP {
[<my-rule> \n+]*
}
proto token my-rule {*}
# -*-shell-script-*-
function title () {
case $TERM in
screen*) echo -ne "\ek$*\e\\"
;;
tmux*) printf '\033]2;%s\033\\' "$*"
;;
*) echo -ne "\033]0;$*\007"
;;
esac
#!/usr/bin/env perl6
class Guy {
has $!who;
method who() is rw {
return $!who;
}
}
@treyharris
treyharris / 00-main-multi-example
Last active March 9, 2016 23:16
Examples of argument processing with MAIN
#!/usr/bin/env perl6
=NAME 00-main-multi-example
=DESCRIPTION Original multi-less version
unit sub MAIN(
Str $action, #= One of: add|div|mult
Numeric $x,
Numeric $y,
% ansible-galaxy login -vvv --github-token=$(cat ~/.ansible-galaxy-github-token)
Using /Users/trey/.ansible.cfg as config file
Opened /Users/trey/.ansible_galaxy
Validate TLS certificates: True
Connecting to galaxy_server: https://galaxy.ansible.com
Base API: https://galaxy.ansible.com/api/v1
ERROR! Unexpected Exception: HTTP Error 400: BAD REQUEST
the full traceback was:
Traceback (most recent call last):
# Actually in lib/Homebrew/Formulas.pm, but gist doesn't support directories....
use JSON::Name;
use JSON::Class;
class Homebrew::Formulas does JSON::Class {
class Versions does JSON::Class {
has Bool $.bottle;
has Str $.stable;
has Any $.head;
has Any $.devel;
}
use v6;
# I want the following behavior:
# >> Foo.hrm(3)
# "hrm, 3"
# >> my $f = Foo.new
# >> $f.hrm(3)
# "hrm, 3"
# >> $f.minimum = 3
# >> $f.hrm(3)
% perl6 -M Inline::Perl5
To exit type 'exit' or '^D'
> use Proc::ProcessTable:from<Perl5>;
Nil
> Proc::ProcessTable.fields
Must call fields from an initalized object created with new.
in method invoke at /home/trey/.rakudobrew/moar-nom/install/share/perl6/site/sources/7BC432EE8BA86C668B768F7607B720EDD8E1528B (Inline::Perl5) line 785
in method FALLBACK at /home/trey/.rakudobrew/moar-nom/install/share/perl6/site/sources/7BC432EE8BA86C668B768F7607B720EDD8E1528B (Inline::Perl5) line 1264
in method fields at /home/trey/.rakudobrew/moar-nom/install/share/perl6/site/sources/7BC432EE8BA86C668B768F7607B720EDD8E1528B (Inline::Perl5) line 1390
# /lib/systemd/system/apt-daily.timer
[Unit]
Description=Daily apt activities
[Timer]
OnCalendar=*-*-* 6,18:00
RandomizedDelaySec=12h
AccuracySec=1h
Persistent=true