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
@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;
@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]
@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"
@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
@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')
@posener
posener / go-shebang-story.md
Last active March 29, 2024 08:38
Story: Writing Scripts with Go

Story: Writing Scripts with Go

This is a story about how I tried to use Go for scripting. In this story, I’ll discuss the need for a Go script, how we would expect it to behave and the possible implementations; During the discussion I’ll deep dive to scripts, shells, and shebangs. Finally, we’ll discuss solutions that will make Go scripts work.

Why Go is good for scripting?

While python and bash are popular scripting languages, C, C++ and Java are not used for scripts at all, and some languages are somewhere in between.