Skip to content

Instantly share code, notes, and snippets.

@zengargoyle
zengargoyle / output.txt
Created January 30, 2012 07:20
metafilter206899
#!/usr/bin/env perl
use strict;
use warnings;
use File::Find;
# where to start?
my $root = shift @ARGV or die "Usage: $0 path\n";
# our list of files.
my @tree;
#!/usr/bin/env perl
use 5.010;
use strict;
use warnings;
use utf8::all;
our $VERSION = '0.01';
use Getopt::Long::Descriptive;
use Pod::Usage;
#!/usr/bin/env perl
use 5.014;
use warnings;
use Mojo::UserAgent;
use Mojo::DOM;
use Text::CSV_XS;
my $csv = Text::CSV_XS->new;
@zengargoyle
zengargoyle / strict.pm
Created April 16, 2012 16:11
from Ubuntu 5.10.1 /usr/share/perl/5.10.1/strict.pm
package strict;
$strict::VERSION = "1.04";
# Verify that we're called correctly so that strictures will work.
unless ( __FILE__ =~ /(^|[\/\\])\Q${\__PACKAGE__}\E\.pmc?$/ ) {
# Can't use Carp, since Carp uses us!
my (undef, $f, $l) = caller;
die("Incorrect use of pragma '${\__PACKAGE__}' at $f line $l.\n");
}
@zengargoyle
zengargoyle / drops_after.txt
Created September 14, 2013 21:49
the evils of drops
.--------------------------------------------------.
| Grape Drank [drops after] 18 mg/ml (70/30 PG/VG) |
+-------------------------------+--------+---------+
| Flavor | ml | Total |
+-------------------------------+--------+---------+
| PG | 3.40 | 3.40 |
+-------------------------------+--------+---------+
| VG | 3.00 | 6.40 |
+-------------------------------+--------+---------+
| 100 mg/ml Nicotine PG | 1.80 | 8.20 |
@zengargoyle
zengargoyle / Bookmarklets.txt
Last active October 22, 2016 00:05
Greasemonkey Kanji Bigifier
javascript:void%20function(){function%20e(e){try{var%20t,n;t=document.getElementsByTagName(%22head%22)[0],n=document.createElement(%22style%22),n.type=%22text/css%22,t.appendChild(n),n.innerHTML=e}catch(u){document.styleSheets.length||document.createStyleSheet(),document.styleSheets[0].cssText+=e}}var%20t=%22kanjibigifier%22,n=[%22.%22+t+%22%20{%22,%22font-size:%2024px;%22,%22}%22].join(%22%22),u=%22//text()[not(ancestor::script)%20and%20not(ancestor::style)]%22,a=/([\u2E80-\u2EFF\u2F00-\u2FDF\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\u31C0-\u31EF\u3200-\u32FF\u3300-\u33FF\u3400-\u4DBF\u4E00-\u9FFF]+)/g;e(n);for(var%20d=document.evaluate(u,document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null),o=d.snapshotLength-1;o%3E=0;o--){var%20s=d.snapshotItem(o);if(a.test(s.nodeValue)){var%20c=document.createElement(%22span%22),l=s.nodeValue;s.parentNode.replaceChild(c,s),a.lastIndex=0;for(var%20r=null,i=0;r=a.exec(l);){c.appendChild(document.createTextNode(l.substring(i,r.index)));var%20m=document.createElement(%22s
@zengargoyle
zengargoyle / README.txt
Last active July 23, 2016 17:58
metafilter youtube video snarfer
Metafilter youtube link snarfer
Requires:
Perl - :)
Mojolicious - http://mojolicious.org/ - Your distro probably has a package
for this (in Debian it's libmojolicious-perl), otherwise it's easy to
install.
zen@zim:~$ rakudobrew build moar-blead
... <snip build> ...
cp -- /opt/rakudobrew/moar-blead-nom/install/bin/perl6-m /opt/rakudobrew/moar-blead-nom/install/bin/perl6
chmod -- 755 /opt/rakudobrew/moar-blead-nom/install/bin/perl6
Rakudo has been built and installed.
Updating zef as well
Your branch is up-to-date with 'origin/master'.
===> Testing: zef:auth('github:ugexe')
t/00-load.t ........... ok
javascript:(function(){var%20newSS,%20styles='*%20{%20background:white%20!%20important;%20color:%20black%20!important;%20text-decoration:%20none%20!important%20}%20:link,%20:link%20*%20{%20color:%20#0000EE%20!important%20}%20:visited,%20:visited%20*%20{%20color:%20#551A8B%20!important%20}';%20if(document.createStyleSheet)%20{%20document.createStyleSheet("javascript:'"+styles+"'");%20}%20else%20{%20newSS=document.createElement('link');%20newSS.rel='stylesheet';%20newSS.href='data:text/css,'+escape(styles);%20document.getElementsByTagName("head")[0].appendChild(newSS);%20}%20})();
@zengargoyle
zengargoyle / filter-test.p6
Last active May 30, 2017 01:35
* ~~ /<$match> vs -> $x { $x ~~ /<$match>/ }
my @files = <foo bar baz>;
my @match-eq = <foo bar baz>.map( -> $s { * eq $s } ); # OK
my @match-rx = <foo ^ba>.map( -> $r { * ~~ /<$r>/ } ); # NOT OK
my @match-rx-pointy = <foo ^ba>.map( -> $r { -> $x { $x ~~ /<$r>/ } } ); # OK
sub match-it (@files, @matchers) {
return gather for @files -> $f {
take $f if @matchers.grep({ $_($f) });