Skip to content

Instantly share code, notes, and snippets.

View umitanuki's full-sized avatar

Hitoshi Harada umitanuki

  • Alpaca
  • California
View GitHub Profile
// ==UserScript==
// @name Google no tracking
// @namespace umitanuki
// @description Disable Googe's search page tracking handlers
// @include http://www.google.co.jp/search*
// @include http://www.google.com/search*
// ==/UserScript==
(function(){
var ary = document.getElementsByClassName("l");
from twisted.internet import reactor
from twisted.internet.protocol import Factory, Protocol, ClientFactory
import sys
HOST = 'servername'
class ClientProtocol(Protocol):
def dataReceived(self, data):
self.server_protocol.transport.write(data)
// ==UserScript==
// @name Hacker News => target="_blank"
// @namespace umitanuki
// @include http://news.ycombinator.com/
// ==/UserScript==
(function(){
var ary = document.getElementsByClassName("title");
for(var i=0, l=ary.length; i<l; i++){
var as = ary[i].getElementsByTagName("a");
@umitanuki
umitanuki / outlook_extract_mail.vbs
Created May 31, 2010 15:21
extract mail information from outlook
Const olFolderInbox = 6
Const ForWriting = 2
Const MessageID = 1709179138
Const PR_INTERNET_MESSAGE_ID = &H1035001E
Set fs = WScript.CreateObject("Scripting.FileSystemObject")
Set ofile = fs.OpenTextFile("c:\tmp\mail.tsv", ForWriting)
Set ol = WScript.CreateObject("Outlook.Application")
Set myNameSpace = ol.GetNameSpace("MAPI")
/*=============================
* upperCase.ms
==============================*/
#command upperCaseKeyword "Keyword"
var FgKeyword = 8;
switch(command){
case "upperCaseKeyword":
upperCaseKeyword();
@umitanuki
umitanuki / gist:940429
Created April 25, 2011 12:17
levenshtein in scala
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package scalaapplication1
object Main {
def lv2(s1:String, s2:String, n1:Int, n2:Int):Int = {
@umitanuki
umitanuki / Sca2Main.scala
Created April 27, 2011 18:21
Tentative JSON pretty printer in Scala
import scala.io._
import scala.util.parsing.json._
object Sca2Main {
def main(args: Array[String]){
val url = "http://search.twitter.com/search.json?q=umitanuki"
val parsed = JSON.parseRaw(Source.fromURL(url).getLines.mkString)
parsed match{
case Some(x:JSONObject) => println("object")
case Some(y:JSONArray) => println("array")
@umitanuki
umitanuki / gist:950872
Created May 1, 2011 21:02
Join fix issue
create table size_m as select i as id, repeat(i::text, i % 100) as val from generate_series(1, 20000) i;
create table size_l as select i as id, m.id as m_id, repeat(i::text, i % 100) as val from generate_series(1, 1000000) i, size_m m where i.i / 10 = m.id;
--create index idx_m_id on size_l (m_id);
analyze size_m;
analyze size_l;
----
@umitanuki
umitanuki / switch-local.sh
Created May 25, 2011 08:41
switch ~/local/{foo}-{bar}
#!/bin/bash
base=$1
version=$2
if [ -z "$base" -o -z "$version" ]
then
echo "Usage $0 <base> <version>"
else
rm -f ~/local/$base
@umitanuki
umitanuki / pg-config.sh
Created May 25, 2011 08:42
run configure wrapper
#!/bin/bash
VERSION=`pwd | perl -ne 's/.+postgresql-([^\/]+).*/$1/;print'`
./configure CC="ccache gcc" CFLAGS=-pthread --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert
# planner dev
#./configure OPTIMZER_DEBUG=1 CFLAGS=-pthread --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert
# mac
#./configure CC="ccache gcc" CFLAGS='-pthread -arch x86_64' --prefix=$HOME/local/pgsql-$VERSION --enable-debug --enable-cassert --with-python