Skip to content

Instantly share code, notes, and snippets.

View zxkane's full-sized avatar

Meng Xin Zhu zxkane

View GitHub Profile
@zxkane
zxkane / ssh-tunnel0.sh
Created February 21, 2012 14:14
automatically create ssh tunnel to forward port
ssh -q -N -o stricthostkeychecking=no -R 10002:localhost:22 -R 5900:localhost:5900 -R 6500:localhost:6500 username@mydomain.gicp.net&
@zxkane
zxkane / embedded-jetty-osgi
Created March 5, 2012 11:22
Minimum bundle list of embedded Jetty in Equninox
javax.servlet
javax.transaction
org.eclipse.equinox.http.jetty
org.eclipse.equinox.http.servlet
org.eclipse.osgi.services
org.eclipse.osgi
org.mortbay.jetty.server
org.mortbay.jetty.util
@zxkane
zxkane / json_dump.java
Created March 14, 2012 16:00
dump a string that presents json data
public static void main(String[] args) throws JSONException {
JSONObject obj = new JSONObject(
"{}"); //$NON-NLS-1$
dump(0, "", obj);
}
private static void dump(int level, String name, Object obj) throws JSONException {
for (int i = 0; i < level; i++)
System.out.print("\t");
if (obj instanceof JSONObject) {
@zxkane
zxkane / brew_log_install_32bit_postgresql
Created September 1, 2012 11:46
log of installing 32bit postgresql on mac osx
ocalhost% brew unlink ossp-uuid && brew link ossp-uuid -- INSERT --
Unlinking /usr/local/Cellar/ossp-uuid/1.6.2... 8 links removed
Linking /usr/local/Cellar/ossp-uuid/1.6.2... 8 symlinks created
localhost% HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install postgresql --32-bit --universal -- INSERT --
==> Downloading http://ftp.postgresql.org/pub/source/v9.1.4/postgresql-9.1.4.tar.bz2
Already downloaded: /Library/Caches/Homebrew/postgresql-9.1.4.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/postgresql-9.1.4.tar.bz2
==> Patching
/usr/bin/patch -f -p1 -i 000-homebrew.diff
patching file src/pl/plpython/Makefile
@zxkane
zxkane / .gitignore
Last active December 18, 2015 20:29
A python program is intended to automatically order goods in second kill of Amazon.cn. Prerequisites: requests, lxml, selenium
*.pyc
.settings/
@zxkane
zxkane / mirror.sh
Created July 8, 2013 07:54
Use p2's ant task to mirror repository
./eclipse --launcher.suppressErrors -nosplash -data ws -application org.eclipse.ant.core.antRunner -buildfile mirror.xml
@zxkane
zxkane / TestResultHandler
Created November 7, 2013 09:43
open a file from Eclipse project after triggering a command on a Java method
package com.windriver.installer.testtool.handlers;
import java.io.File;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IProject;
@zxkane
zxkane / foundation-magellan-not-working.html
Last active December 30, 2015 13:49
Try to use Foundation Magellan on a normal div. It only works properly when the scrollable content is very long. It does not work if the content only exceeds size of window a bit.
<!DOCTYPE html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8" />
<!-- Set the viewport width to device width for mobile -->
<meta name="viewport" content="width=device-width" />
@zxkane
zxkane / batch_point_converter.html
Created December 22, 2013 10:39
convert points of Google map to Baidu map
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,300,700" />
<link rel="stylesheet" href="http://cdnjscn.b0.upaiyun.com/libs/foundation/5.0.2/css/normalize.min.css">
<link rel="stylesheet" href="http://cdnjscn.b0.upaiyun.com/libs/foundation/5.0.2/css/foundation.min.css">
<script src="http://cdnjscn.b0.upaiyun.com/libs/foundation/5.0.2/js/vendor/jquery.min.js"></script>
<script type="text/javascript"
src="http://api.map.baidu.com/api?v=2.0&ak=5aaddbae69513573cd7f693bbdcbe12a"></script>
<script type="text/javascript" src="http://developer.baidu.com/map/jsdemo/demo/changeMore.js"></script>
</head>
using System;
namespace Helpers {
public class LocConverter {
public static double pi = Math.PI;
//
// Krasovsky 1940
//
// a = 6378245.0, 1/f = 298.3