Skip to content

Instantly share code, notes, and snippets.

@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
@zentooo
zentooo / winpath_to_cifs.js
Created June 10, 2011 09:11
Replace windows file server path with cifs URL
// ==UserScript==
// @id winpath_to_cifs
// @author zentooo
// @name winpath_to_cifs
// @include http://example.com/*
// ==/UserScript==
var textNodes = document.evaluate("/html/body//text()", document, null, XPathResult.UNORDERED_NODE_ITERATOR_TYPE, null);
var textNode = textNodes.iterateNext();
@zentooo
zentooo / array.html
Created June 5, 2011 13:17
benchmark for Array.prototype.forEach and for-loop
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
html {
font-size: 200%;
}
</style>
let PLUGIN_INFO =
<VimperatorPlugin>
<name>instant previews</name>
<description>This script allows you to use Instant Viewer feature of Google Search with Vimperator.</description>
<version>0.1.0</version>
<author>zentooo</author>
<license>Creative Commons</license>
<detail><![CDATA[
== Subject ==
This script allows you use Google's Instant Viewer with Vimperator.
var util = require('util'),
colors = require('colors'),
twitter = require('./node-twitter');
var twit = new twitter({
consumer_key: '',
consumer_secret: '',
access_token_key: '',
access_token_secret: ''
});
URxvt.geometry: 84x27
URxvt.font: xft:VLGothic:pixelsize=15
URxvt.imFont: -*-medium-r-*-15-*
URxvt.preeditType: OverTheSpot
URxvt.scrollBar: false
URxvt.foreground: white
URxvt.background: black
URxvt.tintColor: black
URxvt.cursorColor: white
URxvt.cursorColor2: #000000
use strict;
use warnings;
use YAML::XS;
use JSON::XS;
use Path::Class;
use Encode;
my $path = shift @ARGV;
my $obj = Load(decode('utf8', file($path)->slurp));
def dir(name, dir = nil)
dir ||= name
task name do
sh "tmux new-window -n #{name}";
sh "tmux send-keys -t:#{name} 'cd #{dir}; clear' C-m";
end
end
def perl(name, dir = nil)
dir ||= name