Skip to content

Instantly share code, notes, and snippets.

View remorse's full-sized avatar

Ricky Morse remorse

  • MGH Biostatistics Center
  • Boston, MA
View GitHub Profile
@remorse
remorse / toggle_grayscale.pl6
Last active April 15, 2019 14:59
Perl 6 to toggle greyscale on macOS
#!/usr/bin/env perl6
# see <https://indiestack.com/2019/04/toggle-system-grayscale-mode/> for the background on this.
use v6;
use NativeCall;
sub UALib { "/System/Library/PrivateFrameworks/UniversalAccess.framework/UniversalAccess" }
sub UAGrayscaleIsEnabled returns int32 is native(&UALib) { * }
sub UAGrayscaleSetEnabled (int32 $status) is native(&UALib) { * }
UAGrayscaleSetEnabled(UAGrayscaleIsEnabled() == 0);
@remorse
remorse / gist:8db4a635e58f526a7ef43716a3b68964
Last active March 9, 2017 19:42
New version of download tumblr posts
#!/usr/bin/env perl6
use v6;
sub croak ($msg) { note $msg; exit(1); } # because Perl 6 doesn't have the Perl 5 "\n" magic for die
# retrieve network data
use HTTP::UserAgent;
use JSON::Tiny;
# template
use Template::Mustache;
#!/usr/bin/env perl6
use v6;
sub croak ($msg) { note $msg; exit(1); } # because Perl 6 doesn't have the Perl 5 "\n" magic for die
# retrieve network data
use HTTP::UserAgent;
use JSON::Tiny;
# template
use Template::Mustache;
#!/usr/bin/env perl6
my %p = (:date-gmt("XXX"), :id("XXX"), :slug("XXX"), :tags($["Galaxy", "Galaxy fan render", "planet"]), :type("photo"), :url("http://XXX"), :url-with-slug("http://XXX"));
my %post = (
'_post' => %p,
'_type' => %p{'type'},
'post_id' => %p{'id'},
'post_slug' => %p{'slug'} || %p{'type'},
@remorse
remorse / create_printable_xkcd.pl6
Created October 12, 2016 19:06
Create a printable nice version of XKCD comics
#!/usr/bin/env perl6
use v6;
use LWP::Simple;
use JSON::Tiny;
use Template::Anti;
my $outdir = '/Users/rem16/Pictures/comics/';
my $comic = '1053';
# get the JSON info