This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible | |
filetype off | |
filetype plugin indent off | |
set runtimepath+=$GOROOT/misc/vim | |
set encoding=utf-8 | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
set tabstop=4 | |
set shiftwidth=4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\nbenchmark.sh -n<number of requests> -c<number of concurrency> <URL1> <URL2> ..." | |
echo -e "\nEx: benchmark.sh -n100 -c10 http://www.google.com/ http://www.bing.com/ \n" | |
## Gnuplot settings | |
echo "set terminal png | |
set output 'benchmark_${1}_${2}.png' | |
set title 'ab ${1} ${2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# description: Tomcat Start Stop Restart | |
# processname: tomcat | |
# chkconfig: 234 20 80 | |
JAVA_HOME=/srv/java | |
export JAVA_HOME | |
PATH=$JAVA_HOME/bin:$PATH | |
export PATH | |
CATALINA_HOME=/srv/tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use 5.10.0; | |
use utf8; | |
use LWP::Simple; | |
use Encode 'encode'; | |
use Encode::MIME::Header; | |
use File::Slurp 'slurp'; | |
use Email::MIME; | |
use Email::Sender::Simple qw(sendmail); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 分頁 test | |
$subsids = array('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21'); | |
$page = 10; | |
if (count($subsids) > $page) { | |
$totle = ceil(count($subsids) / $page); | |
$subsidIn = ""; | |
for ($i=0; $i < $totle; $i++) { | |
$tmp = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://gist.github.com/1214011 | |
module WillPaginate | |
module ActionView | |
def will_paginate(collection = nil, options = {}) | |
options[:renderer] ||= BootstrapLinkRenderer | |
super.try :html_safe | |
end | |
class BootstrapLinkRenderer < LinkRenderer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Disable Rake-environment-task framework detection by uncommenting/setting to false | |
# Warbler.framework_detection = false | |
# Warbler web application assembly configuration file | |
Warbler::Config.new do |config| | |
# Features: additional options controlling how the jar is built. | |
# Currently the following features are supported: | |
# - gemjar: package the gem repository in a jar file in WEB-INF/lib | |
# - executable: embed a web server and make the war executable | |
# - compiled: compile .rb files to .class files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
. ~/.bashrc | |
mkdir ~/local | |
mkdir ~/node-latest-install | |
cd ~/node-latest-install | |
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
./configure --prefix=~/local | |
make install # ok, fine, this step probably takes more than 30 seconds... | |
curl http://npmjs.org/install.sh | sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rvm bootstrap | |
apt-get -q -y update | |
apt-get -q -y install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libmysqlclient-dev libmysqlclient16 | |
apt-get -q -y install git-core curl | |
apt-get -q -y install clang | |
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
rvm install ree |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function git_branch { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return; | |
echo "("${ref#refs/heads/}") "; | |
} | |
function git_since_last_commit { | |
now=`date +%s`; | |
last_commit=$(git log --pretty=format:%at -1 2> /dev/null) || return; | |
seconds_since_last_commit=$((now-last_commit)); | |
minutes_since_last_commit=$((seconds_since_last_commit/60)); |