Skip to content

Instantly share code, notes, and snippets.

View umitanuki's full-sized avatar

Hitoshi Harada umitanuki

  • Alpaca
  • California
View GitHub Profile
@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: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 = {
/*=============================
* upperCase.ms
==============================*/
#command upperCaseKeyword "Keyword"
var FgKeyword = 8;
switch(command){
case "upperCaseKeyword":
upperCaseKeyword();
@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")
// ==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");
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 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");