Skip to content

Instantly share code, notes, and snippets.

View bitristan's full-sized avatar
😀
happy coding everyday

Ting Sun bitristan

😀
happy coding everyday
View GitHub Profile
@bitristan
bitristan / init-elpy.el
Created April 12, 2014 06:37
emacs elpy configuration fragment
;; Elpa initialization.
(require 'package)
(setq package-archives
'(("gnu" . "http://elpa.gnu.org/packages/")
("marmalade" . "http://marmalade-repo.org/packages/")
("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)
;; Configuration of elpy for Python development.
;; https://github.com/jorgenschaefer/elpy.
@bitristan
bitristan / server.js
Last active January 31, 2018 23:50
open wechat verify with node js
var url = require('url'),
crypto = require('crypto'),
querystring = require('querystring'),
http = require('http'),
port = 18080;
var token = '***your token';
http.createServer(function(req, res) {
@bitristan
bitristan / init-company-mode.el
Created August 8, 2014 08:46
init-company-mode.el
(require 'company)
(setq company-idle-delay 0.3)
(setq company-tooltip-limit 20)
(setq company-minimum-prefix-length 2)
(setq company-echo-delay 0)
(setq company-auto-complete nil)
(global-company-mode 1)
(add-to-list 'company-backends 'company-dabbrev t)
(add-to-list 'company-backends 'company-ispell t)
(add-to-list 'company-backends 'company-files t)
@bitristan
bitristan / consumer-producer.go
Created August 15, 2014 08:31
golang consumer and producer pattern
package main
/* producer-consumer problem in Go */
import ("fmt")
var done = make(chan bool)
var msgs = make(chan int)
func produce () {
@bitristan
bitristan / select.go
Created August 15, 2014 08:39
go select tour
package main
import "fmt"
func fibonacci(c, quit chan int) {
x, y := 0, 1
for {
select {
case c <- x:
x, y = y, x+y
@bitristan
bitristan / xls_process.py
Last active August 29, 2015 14:05
use python to read and write xls
import xlrd
import xlwt
data = xlrd.open_workbook('input.xls')
table = data.sheets()[0]
nrows = table.nrows
ncols = table.ncols
print data.nsheets
@bitristan
bitristan / jni-build.gradle
Created March 23, 2015 15:11
use gradle to compile jni with custom Android.mk
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.your.application.id"
minSdkVersion 15
targetSdkVersion 21
@bitristan
bitristan / build-jar.gradle
Created March 26, 2015 12:08
build java project with gradle
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'
mainClassName = 'hello.HelloWorld'
// tag::repositories[]
repositories {
mavenCentral()
}
@bitristan
bitristan / TSMatrixState.java
Created May 14, 2015 04:39
OpenGLES2.0 矩阵变换工具类
import android.opengl.Matrix;
import android.util.Log;
/**
* 矩阵变换工具类
*
* @author tinker <sunting.bcwl@gmail.com>
*/
public class TSMatrixState {
private static final int MATRIX_F4V_SIZE = 16;
@bitristan
bitristan / Ball.java
Created May 14, 2015 04:43
使用OpenGlES2.0绘制球体
import android.opengl.GLES20;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.util.ArrayList;
import xyz.sunting.opengles.light.model.TSApplication;
import xyz.sunting.opengles.light.model.util.TSMatrixState;
import xyz.sunting.opengles.light.model.util.TSShaderUtil;