Skip to content

Instantly share code, notes, and snippets.

View eiyaya's full-sized avatar

stephen zhen eiyaya

  • Beijing. China.
View GitHub Profile
@eiyaya
eiyaya / gist:4154490
Created November 27, 2012 14:26
count svn diff
#/usr/bin/env python
diff="""
-
-
-
-
@eiyaya
eiyaya / timeout.rb
Created December 9, 2012 10:13 — forked from lpar/timeout.rb
Run a shell command in a separate thread, terminate it after a time limit, return its output
# Runs a specified shell command in a separate thread.
# If it exceeds the given timeout in seconds, kills it.
# Returns any output produced by the command (stdout or stderr) as a String.
# Uses Kernel.select to wait up to the tick length (in seconds) between
# checks on the command's status
#
# If you've got a cleaner way of doing this, I'd be interested to see it.
# If you think you can do it with Ruby's Timeout module, think again.
def run_with_timeout(command, timeout, tick)
output = ''
import json,sys,os
import urllib2
url = 'http://x.x.x.x/job/x.x.x.x/lastBuild/api/json'
try:
u = urllib2.urlopen(url).read()
except:
exit(100)
baseim = json.loads(u)
baseim_revision = baseim["changeSet"]['revisions'][0]['revision']
@eiyaya
eiyaya / jenkins_api.py
Last active December 10, 2015 19:29
get info from jenkis
import json,sys,os
import urllib2
url = 'http://10.6.198.114/job/BaseIM_basicim4ml/lastBuild/api/json'
try:
u = urllib2.urlopen(url).read()
except:
exit(0)
try:
baseim = json.loads(u)
rem see http://commons.apache.org/daemon/procrun.html
set SERVICE_HOME=c:\hoge
%SERVICE_HOME%\service.exe //IS//Jenkins --DisplayName=Jenkins --StartPath=%SERVICE_HOME% --LogPath=%SERVICE_HOME%\logs --LogLevel=Debug --StdOutput=auto --StdError=auto --StartMode=Java --StopMode=Java --Jvm=auto ++JvmOptions=-jar ++JvmOptions=start.jar
#!/sbin/runscript
# GitLab init script for Gentoo Linux
# see https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md
GITLAB_BASE=/home/gitlab/gitlab
GITLAB_USER=gitlab
depend() {
need net mysql redis
}
@eiyaya
eiyaya / launch_jenkins_slave.sh
Created January 16, 2013 06:46
Launch Jenkins Slave On Mac at User Login, put org.jenkins.slave.plist in ~/Library/LaunchAgents
#!/bin/bash -l
export LANG=zh_CN.UTF-8
export com.apple.java.jvmTask=WebStart
javaws -verbose -wait http://10.10.86.44:1025/computer/QQCISERVER01/slave-agent.jnlp
# Two ENV variables control the 'gem' command:
#
# GEM_HOME: the single path to a gem dir where gems are installed
# GEM_PATH: a standard PATH to gem dirs where gems are found
#
# A gem directory is a directory that holds gems. The 'gem' command will lay
# out and utilize the following structure:
#
# bin # installed bin scripts
# cache # .gem files ex: cache/gem_name.gem
@eiyaya
eiyaya / remove_CLI_tools.sh
Created October 15, 2013 04:16
mac osx uninstall command line tools
RECEIPT_FILE=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
if [ ! -f "$RECEIPT_FILE" ]
then
echo "Command Line Tools not installed."
exit 1
fi
echo "Command Line Tools installed, removing ..."

Benchmarking Nginx with Go

Today I just wanted to know which of these options is faster:

  • Go HTTP standalone
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI

Hardware