Skip to content

Instantly share code, notes, and snippets.

View yinheli's full-sized avatar
👋
我在寻找新的工作机会,欢迎和我联系

yinheli yinheli

👋
我在寻找新的工作机会,欢迎和我联系
View GitHub Profile
@yinheli
yinheli / bitmap.py
Created February 8, 2015 16:32
算 bitmap 小工具 python
[k+1 for k,v in enumerate(bin(int('0x003800010AC40014', 0))[2:].zfill(64)) if v == '1']
@yinheli
yinheli / start.sh
Last active August 29, 2015 14:17
start haproxy
#!/bin/bash
# reload haproxy
# @author yinheli
pid=$(ps -ef|grep haproxy|grep -v grep|awk '{print $2}')
if [ -z "$pid" ]; then
./haproxy -f conf
else
./haproxy -f conf -sf $pid
fi
# 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
@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.+')
}
}
@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 / 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 / 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 / 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 / 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 / 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