Skip to content

Instantly share code, notes, and snippets.

View linkerlin's full-sized avatar
🎯
Focusing

Halo Master linkerlin

🎯
Focusing
View GitHub Profile
@ngs
ngs / mroonga.mkdn
Created October 17, 2011 19:22
installing mroonga on Mac OS X Lion

Install MySQL + MeCab + Groonga using Homebrew

$ brew install mysql
$ brew install mecab
$ brew install groonga
$ cd /usr/local
$ sudo ln -s Cellar/mysql/5.5.15 mysql

Clone mroonga from Github

@marcelcaraciolo
marcelcaraciolo / callcommand.sh
Created August 14, 2012 18:01
call movieSimilarities
$ python moviesSimilarities.py ratings.csv > output.csv
@linkerlin
linkerlin / classpathhacker.py
Last active December 11, 2015 20:18
A jar loader for jython. If you want add some jars to JVM in Jython, you can use the following class. Modified from: http://www.jython.org/jythonbook/en/1.0/appendixB.html#working-with-classpath 这是一个修改版本的classPathHacker,用于在Jython里加载一个Jar给Java Code使用。不同于在sys.path里面添加jar。此方法可以让JavaCode也使用到新加载的Jar,而不仅仅是JythonCode. 添加sys.path的方法参见:http://my.oschina.…
class ClassPathHacker :
##########################################################
# from http://forum.java.sun.com/thread.jspa?threadID=300557
#
# Author: SG Langer Jan 2007 translated the above Java to this
# Jython class
# Modified by: Linker Lin linker.lin@me.com
# Purpose: Allow runtime additions of new Class/jars either from
# local files or URL
######################################################
@linkerlin
linkerlin / with_timer.py
Last active December 19, 2015 16:09
一个简单的Python计时器
class Timer(object):
def __init__(self, name):
print("%s: " % name, end="")
def __enter__(self):
self.t0 = time.time()
def __exit__(self, *args):
print("%.3fs" % (time.time() - self.t0))
with Timer("XXX"):
call_function()
(ns echo-server
(:import (java.net InetAddress DatagramPacket DatagramSocket)))
(def udp-server (ref nil))
(def port 12345)
(defn localhost [] (. InetAddress getLocalHost))
(defn message [text]
@journey-ad
journey-ad / bilibili_api.lua
Created June 15, 2017 11:34 — forked from mimosa/bilibili_api.lua
B站 api key 规则,每3小时轮换一个 :(
function string.fh(str)
return (str:gsub('..', function (cc)
return string.char(tonumber(cc, 16))
end))
end
function sort_nums()
return ("6337393836663535306539363566613865616264646435653033363665356466"):fh()
end
bit = require('bit')
@flyingnn
flyingnn / gist:4174171
Created November 30, 2012 06:45 — forked from ego008/gist:897638
GAE Nginx proxy
upstream ghs {
ip_hash;
server ghs.google.com;
server 72.14.203.121;
server 72.14.207.121;
server 74.125.43.121;
server 74.125.47.121;
server 74.125.53.121;
server 74.125.77.121;
server 74.125.93.121;
(messageGateway ? SendMessageToClientRequest (
id = id,
phoneNumber = pNumber,
msg = message
)).mapTo[SendMessageToClientResponse] onComplete {
case Success(res) => res match {
case SendMessageToClientResponse(true) =>
currentSender ! SendCustomMessageResponse(true)
case SendMessageToClientResponse(false) =>
currentSender ! SendCustomMessageResponse(false)
@ifels
ifels / golang_pipe_http_response.go
Last active February 1, 2023 19:19
golang pipe the http response
package main
import (
"io"
"net/http"
"os/exec"
)
var (
BUF_LEN = 1024
@jniltinho
jniltinho / myip.go
Created March 26, 2014 16:55
Get My IP Golang
package main
/*
URL: https://github.com/mccoyst/myip/blob/master/myip.go
URL: http://changsijay.com/2013/07/28/golang-get-ip-address/
*/
import (
"net"
"os"