Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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");
}
#!/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;
#!/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;
@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;
@zengargoyle
zengargoyle / gist:1479829
Created December 15, 2011 04:21
simple weather
#!/usr/bin/perl
use 5.014;
use warnings;
use Weather::Google;
use Data::Dump qw(pp dd);
use LWP::UserAgent;
my $gw = Weather::Google->new('Glendale, CA');
my $current = $gw->current;
@zengargoyle
zengargoyle / gist:1479795
Created December 15, 2011 04:06
weather
#!/usr/bin/perl
use 5.014;
use warnings;
use Weather::Google;
use Data::Dump qw(pp dd);
use LWP::UserAgent;
my $gw = Weather::Google->new('Glendale, CA');
my $current = $gw->current;
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $cbrfile = $ARGV[0] or die "Usage: $0 <cbrfile>\n";
# get a verbose basic list of archive contents. (path/to/file.ext)
my $pid = open my $fh, '-|', rar => vb => $cbrfile
@zengargoyle
zengargoyle / eg.c
Created May 22, 2011 03:16
x86 assembly UTF-16 -> UTF-8 test (GAS Syntax)
int out2(unsigned short int t) {
unsigned char c[3];
unsigned char *b;
unsigned char l = 0;
b = c;
// 0000 0000 0xxx xxxx -> 0xxx xxxx
// 0000 0yyy yyxx xxxx -> 110y yyyy 10xx xxxx
// zzzz yyyy yyxx xxxx -> 1110 zzzz 10yy yyyy 10xx xxxx
if ( ! (t & 0xFF80) ) {
c[l++] = t & 0x007F;