Skip to content

Instantly share code, notes, and snippets.

View tangnotes's full-sized avatar

James Tang tangnotes

View GitHub Profile
@tangnotes
tangnotes / LatLongPoint.java
Created May 26, 2015 07:38
Calculate distance between two point of Latitude and Longitude
public class LatLongPoint {
private double latitude;
private double longitude;
private double altitude;
public LatLongPoint(double latitude, double longitude) {
this(latitude, longitude, 0.0);
}
@tangnotes
tangnotes / multiprocessing-template-for-log.py
Created July 16, 2015 14:11
Python multiprocessing template for log processing
import sys
import os
import datetime
import multiprocessing
TMP_DIR='/tmp'
RAW_DIR='/raw_data/access'
def _print(msg):
print datetime.datetime.now().isoformat(), '-', msg
@tangnotes
tangnotes / uve-stats-log-parse-example.py
Last active August 29, 2015 14:26
A demo of parsing uve stats log and save to Graphite
import json
import socket
import sys
import datetime
def _print(msg):
print datetime.datetime.now().isoformat(), '-', msg
def parse_log(log):
parts = log.split('|')
@tangnotes
tangnotes / rst-demo.rst
Created January 22, 2016 05:03
RST Demo
@tangnotes
tangnotes / go-cmd-install.sh
Last active October 23, 2018 09:39
Install Go and common cmd tools.
#!/bin/bash
GOVERSION=1.11.1
GOPREFIX=/local/go
TMP=`pwd`/go-cmd-`date +%s`
GOX=src/golang.org/x
GOBUILD=go$GOVERSION.linux-amd64.tar.gz
mkdir -p $TMP/$GOX
@tangnotes
tangnotes / install-vimrc.sh
Last active April 13, 2016 07:05
Install Vim configuration
#!/bin/bash
wget http://lib.fwso.cn/james-vim.tar.bz2;
tar xjf james-vim.tar.bz2;
if [ -d ~/.vim ]
then
mv ~/.vim ~/_vim.old;
fi
@tangnotes
tangnotes / install-eclim.sh
Created April 29, 2016 06:59
Install eclim
#!/bin/bash
export ECLIPSE_PREFIX=/usr/local
export ECLIPSE_HOME=$ECLIPSE_PREFIX/eclipse
export WORK_USER=linhua
sudo yum install -y xorg-x11-server-Xvfb
wget http://mirrors.yun-idc.com/eclipse//technology/epp/downloads/release/mars/2/eclipse-java-mars-2-linux-gtk-x86_64.tar.gz # (Fast at the time testing)
#wget http://mirrors.ustc.edu.cn/eclipse/technology/epp/downloads/release/mars/2/eclipse-java-mars-2-linux-gtk-x86_64.tar.gz
package main
import "fmt"
func main() {
var i uint64 = 10
for ; i >= 0; i-- {
fmt.Printf("> %d\n", i)
}
}
@tangnotes
tangnotes / install-vim-lastest.sh
Last active July 13, 2021 07:38
Install latest vim version
#!/bin/bash
sudo yum install -y lua-devel ncurses ncurses-devel gcc gcc-c++ automake python36-devel
git clone https://github.com/vim/vim.git
cd vim
./configure --prefix=/usr \
--with-features=huge \
--enable-gui=no \
--without-x \
--enable-luainterp \
--with-lua-prefix=/usr/local \
@tangnotes
tangnotes / StatsParser.java
Created June 30, 2016 13:08
UVE Stats Log Parser
package io.uve.log;
import java.io.BufferedReader;
import java.io.FileReader;
import org.json.*;
public class StatsParser {
public static final String L1S = "\\x1A";
public static final String L1CS = "\\x1C";
public static final String L2S = "\\x01";