Skip to content

Instantly share code, notes, and snippets.

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

yinheli yinheli

👋
我在寻找新的工作机会,欢迎和我联系
View GitHub Profile
// Copyright 2012 Junqing Tan <ivan@mysqlab.net> and The Go Authors
// Use of this source code is governed by a BSD-style
// Part of source code is from Go fcgi package
// Fix bug: Can't recive more than 1 record untill FCGI_END_REQUEST 2012-09-15
// By: wofeiwo
package fcgiclient
import (
@yinheli
yinheli / grace.go
Created February 23, 2014 05:07 — forked from rcrowley/grace.go
package main
import (
"log"
"net"
"os"
"os/signal"
"sync"
"syscall"
"time"
@yinheli
yinheli / update_qqwry_ip.sh
Last active August 29, 2015 13:56
定时更新 qqwry 纯真 ip 的 shell 脚本
#!/bin/bash
# update qqwry ip data
# suggest cron:
# 30 5 * * 3,5 /full_path/update_qqwry_ip.sh >> /full_path/update_qqwry_ip.log
# @author yinheli
# @update 2014-02-23
script_dir=`dirname $0`
# check unrar
@yinheli
yinheli / gist:35ae411758692a609890
Created June 5, 2014 17:55
beego orm 数据的配置文件
链接数据库 uri
username:passworkd@tcp(host:port)/dbname?charset=utf8&loc=Asia%2FShanghai
// Package leakybuf provides leaky buffer.
// It's based on the example in Effective Go.
package main
type LeakyBuf struct {
bufSize int // size of each buffer
freeList chan []byte
}
// NewLeakyBuf creates a leaky buffer which can hold at most n buffer, each
@yinheli
yinheli / AESUtil.java
Created July 7, 2014 02:29
AES/ECB/PKCS5Padding
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
/**
* @author yinheli
*/
public class AESUtil {
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "your@email.to.match" ]
@yinheli
yinheli / simditor-replay.coffee
Last active August 29, 2015 14:05
http://ziranzhi.com/ 写的 Simditor 插件, 解决回复 @ 的问题
class ReplayPlugin extends Plugin
constructor: (@widget) ->
super @widget
@editor = @widget
$('.bbp-admin-links a').on 'click', (e) =>
node = $(e.currentTarget).parent().parent().find('.bbp-author-name').clone()
node.text '@'+node.text()
@editor.trigger 'focus'
@editor.selection.insertNode node.append('&nbsp;&nbsp;')
package socks5
import (
"net"
"time"
"bytes"
"errors"
"bufio"
"strconv"
"strings"
if (/(10\.\d{1,3}\.\d{1,3}\.\d{1,3})|(172\.(1[6789]|2[0-9]|3[01])\.\d{1,3}\.\d{1,3})|(192\.168\.\d{1,3}\.\d{1,3})/.test(ipAddr)) {
// Successful match
} else {
// Match attempt failed
}