Skip to content

Instantly share code, notes, and snippets.

@yinheli
yinheli / start-ss.sh
Created February 3, 2016 07:58
本地使用 ss
#!/bin/bash
# @author yinheli
workdir=$(cd $(dirname $0); pwd)
cd $workdir
wan_ip="104.224.129.180"
wan_port="1988"
dns_port="53"
ignore_list="ignore.list"
@yinheli
yinheli / zip_file.go
Created December 24, 2015 10:00
zip 打包文件, 向 zip 文件追加文件: 方式是创建新的, 拷贝旧的, 同时增加新的
// zip_file
package main
import (
"archive/zip"
"os"
"io"
)
func main() {
@yinheli
yinheli / download_jdk7.sh
Last active January 7, 2016 18:43
下载 jdk 最新版本
wget --no-check-certificate \
-O server-jre-7u80-linux-x64.tar.gz \
--header "Cookie: oraclelicense=a" \
http://download.oracle.com/otn-pub/java/jdk/7u80-b15/server-jre-7u80-linux-x64.tar.gz
@yinheli
yinheli / ssh_client.go
Created November 11, 2015 03:15 — forked from iamralch/ssh_client.go
SSH client in GO
package main
import (
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strings"
@yinheli
yinheli / sshtunnel.go
Created November 11, 2015 03:06 — forked from iamralch/sshtunnel.go
SSH tunnelling in Golang
package main
import (
"log"
"bufio"
"time"
"os"
"fmt"
"io"
"net"
@yinheli
yinheli / T.java
Created September 24, 2015 17:33
java 生成图片, 从资源文件加载字体, 并且抗锯齿
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
/**
* @author yinheli
*/
public class T {
@yinheli
yinheli / haproxy.conf
Last active September 6, 2015 17:00 — forked from nateware/haproxy.conf
HAProxy sample config for EC2
#
# This config file is a combination of ideas from:
# http://www.37signals.com/svn/posts/1073-nuts-bolts-haproxy
# http://www.igvita.com/2008/05/13/load-balancing-qos-with-haproxy/
# http://wiki.railsmachine.com/HAProxy
# http://elwoodicious.com/2008/07/15/nginx-haproxy-thin-fastcgi-php5-load-balanced-rails-with-php-support/
# http://upstream-berlin.com/2008/01/09/using-haproxy-with-multiple-backends-aka-content-switching/
# http://wiki.railsmachine.com/HAProxy
# http://gist.github.com/raw/25482/d39fb332edf977602c183194a1cf5e9a0b5264f9
#
@yinheli
yinheli / pi.go
Created May 27, 2015 07:06
pi 圆周率
package main
import (
"fmt"
"runtime"
"time"
)
var n int64 = 10000000000
var h float64 = 1.0 / float64(n)
@yinheli
yinheli / build.gradle
Created May 18, 2015 15:37
servlet 3 web, with jetty
buildscript {
repositories {
jcenter()
}
dependencies {
// https://github.com/Khoulaiz/gradle-jetty-eclipse-plugin
classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+')
}
}
# in case of conflict with local nginx:
# make sure in all *.confs (
# also in default and example to avoid error like
# 'nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)'
# )
# set for instance "listen 127.0.0.1:80" instead of "listen *:80"
# docker & network settings
DOCKER_IMAGE_NAME="maxexcloo/nginx-php" # build of nginx-php - for example
DOCKER_CONTAINERS_NAME="nginx_bridged" # our container's name