Skip to content

Instantly share code, notes, and snippets.

@zentooo
zentooo / 1
Created June 2, 2023 00:34
1
1
use strict;
use warnings;
use Net::DNS::Nameserver;
my $ns = Net::DNS::Nameserver->new(
LocalPort => 53,
ReplyHandler => sub { print "query" },
Verbose => 1,
) || die "couldn't create nameserver object\n";
use strict;
use warnings;
use LWP::UserAgent;
use File::Slurp;
use POSIX qw//;
my $ua = LWP::UserAgent->new;
my $resolv_conf_localhost = <<EOF;
@zentooo
zentooo / grunt.js
Created September 17, 2012 17:32
grunt.js for XXX
module.exports = function(grunt) {
var now = String(Date.now());
var jsResult = "<%= dirs.js %>/target/" + now + ".js";
var cssResult = "<%= dirs.css %>/target/" + now + ".css";
var jsGzipped = jsResult + ".gz";
var cssGzipped = cssResult + ".gz";
var compressFiles = {};
compressFiles[jsGzipped] = jsResult;
@zentooo
zentooo / node.js
Created February 27, 2012 15:01
NodeList and StaticNodeList
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<div class="a" onclick="this.parentNode.removeChild(this);">a - remove</div>
<div class="a" onclick="this.parentNode.appendChild(this.cloneNode(true));">a - clone</div>
<div class="a" onclick="this.appendChild(this.cloneNode(true));">a - appendChild</div>
<div class="b" onclick="this.parentNode.removeChild(this);">b - remove</div>
use strict;
use warnings;
use feature qw/say/;
our $_add = our $_remove = sub {
say "add and remove should be called in builder block!";
};
;(function($) {
var key = "__schema__";
var attrMap = {
required: "required",
pattern: "pattern",
step: "divisibleBy",
min: "minimum",
max: "maximum",
@zentooo
zentooo / mpan.xml
Created September 1, 2011 16:24
Firefox Search Plugin for metacpan
<?xml version="1.0" encoding="UTF-8"?>
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>mpan</ShortName>
<Description>metacpan search</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/vnd.microsoft.icon,%00%00%01%00%01%00%10%10%00%00%01%00%20%00h%04%00%00%16%00%00%00(%00%00%00%10%00%00%00%20%00%00%00%01%00%20%00%00%00%00%00%00%00%00%00%13%0B%00%00%13%0B%00%00%00%00%00%00%00%00%00%00%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%D7%D7%D7%FF%BE%BE%BE%FF%A6%A6%A6%FF%92%92%92%FFyyy%FFaaa%FFEEE%FF---%FF%10%10%10%FF%AA%AA%AA%FF%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%AA%AA%AA%FF%18%18%18%FF%14%14%14%FF%0C%0C%0C%FF%08%08%08%FF%08%08%08%FF%08%08%08%FF%04%04%04%FF%04%04%04%FF%04%04%04%FF(((%FF%CA%CA%CA%FF%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00%FF%FF%FF%00uuu%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%00%00%00%FF%08%08%08%FF%14%14%14%FF%C6%C6%C6%FF%FF%FF%FF%00%FF%FF%FF%00%E7%E7%E7%FFaaa%
@zentooo
zentooo / gist:1102845
Created July 24, 2011 17:24
git Smart HTTP with plackup
use strict;
use warnings;
use Plack::App::WrapCGI;
$ENV{GIT_PROJECT_ROOT} = "/path/to/parent/directory/of/git/repositories";
$ENV{GIT_HTTP_EXPORT_ALL} = 1;
Plack::App::WrapCGI->new(script => "/usr/lib/git-core/git-http-backend", execute => 1)->to_app;
@zentooo
zentooo / gist:1074484
Created July 10, 2011 11:57
Hapyrus MR for wordcounting Hamlet
offended 1
Well 2
you 5
cold 1
which 1
form 1
come 2
thanks 1
my 2
two 2