Skip to content

Instantly share code, notes, and snippets.

View vangie's full-sized avatar

Vangie Du vangie

View GitHub Profile
@vangie
vangie / install-vagex-centos6.sh
Last active August 29, 2015 13:57
install vagex on bandwagonhost centos6
yum update -y
yum install php-cli -y
wget https://gist.githubusercontent.com/horsley/12a14498e02c994e0664/raw/a6e0dc785f2a17353860b02b163b5386a3823efa/VagexRobot.AllInOne.php
sed -i "s/240907/$1/" VagexRobot.AllInOne.php
screen -dmS vagex php VagexRobot.AllInOne.php
(crontab -u root -l; echo "@daily screen -X -S vagex quit; screen -dmS vagex php VagexRobot.AllInOne.php" ) | crontab -u root -
@vangie
vangie / vagex.php
Created March 6, 2014 11:55
vagex script by php
<?php
date_default_timezone_set('Asia/Shanghai');
define('DEFAULT_UA', 'Mozilla/5.0 (Windows NT 6.1; rv:25.0) Gecko/20100101 Firefox/25.0');
if (PHP_SAPI !== 'cli') {
die ("This is CLI only version!");
} else {
$v = new Vagex();
$v->set_userid('263378');
@vangie
vangie / install-vagex-ubuntu.sh
Last active July 28, 2020 08:03
install and run Vagex on Koding
sudo apt-get install php5-curl
wget https://gist.githubusercontent.com/horsley/12a14498e02c994e0664/raw/a6e0dc785f2a17353860b02b163b5386a3823efa/VagexRobot.AllInOne.php
sed -i "s/240907/$1/" VagexRobot.AllInOne.php
screen -S vagex -d -m php VagexRobot.AllInOne.php
@vangie
vangie / rmb.coffee
Created March 2, 2014 12:04
人民币小写转换为大写
#! /usr/bin/env coffee
# convert amount from figures to words
# @author vangie.du
# @url http://codelife.me/blog/2013/03/09/convert-amount-from-figures-to-words-by-coffeescript/
# @version 1.1
# @since 2013-03-09
if process.argv.length >= 3
n = parseFloat(process.argv[2]).toFixed(2)
@vangie
vangie / pptpd.sh
Created March 2, 2014 12:00
PPTPD一键安装 For CentOS 5 32bits/64bits
yum remove -y pptpd ppp
iptables --flush POSTROUTING --table nat
iptables --flush FORWARD
rm -rf /etc/pptpd.conf
rm -rf /etc/ppp
wget http://www.diahosting.com/dload/dkms-2.0.17.5-1.noarch.rpm
wget http://www.diahosting.com/dload/kernel_ppp_mppe-1.0.2-3dkms.noarch.rpm
wget http://www.diahosting.com/dload/pptpd-1.3.4-1.rhel5.1.i386.rpm
wget http://www.diahosting.com/dload/ppp-2.4.4-9.0.rhel5.i386.rpm
@vangie
vangie / toolbar-view.coffee
Last active December 11, 2015 16:58
coffeescript define function in loop
val = (x, ctx, args) =>
if _.isFunction x
x.apply ctx or this, args or []
else
x
[
openWith
replaceWith
closeWith
repaceHolder
@vangie
vangie / bash_default_value.sh
Last active October 10, 2015 15:07
bash:变量默认值
#!/bin/bash
#直观当繁琐的写法
if [ ! $1 ]; then
$1='default'
fi
#当变量a为null时则var=b
var=${a-b}
@vangie
vangie / FileExt.java
Last active October 10, 2015 14:07
java:获得文件扩展名
import org.apache.commons.io.FilenameUtils;
String extension = FilenameUtils.getExtension(fileName);
@vangie
vangie / gist:3174886
Created July 25, 2012 07:16
使用Spring初始化一个自己实例化的Bean
private View applyLifecycleMethods(String viewName, AbstractView view) {
return (View) getApplicationContext().getAutowireCapableBeanFactory().initializeBean(view, viewName);
}
//参考 UrlBasedViewResolver
@vangie
vangie / gist:3087862
Created July 11, 2012 03:44
text-overflow
white-space:nowrap;
overflow:hidden;
text-overflow: clip | ellipsis | ellipsis-word;