Skip to content

Instantly share code, notes, and snippets.

View shalk's full-sized avatar
🎯
Focusing

shalk(xiao kun) shalk

🎯
Focusing
View GitHub Profile
@shalk
shalk / gist:37a6564213a17ac89391
Created September 26, 2014 09:31
suse11sp3 to vcell
#!/bin/bash
# This script make suse11sp3 to vcell0901 + snapshot-bugfix
# shalk 2014-09-26
unzip -f vcell-extra.zip
unzip -f snapshot-bugfix.zip
cd extra
echo "install sugon extra rpm"
@shalk
shalk / gist:202d0862d7d3e0d884d8
Created October 10, 2014 03:30
expect example
#!/bin/bash
Ip='192.168.1.6' # 循环就行
RemoteUser='user' # 普通用户
RemotePasswd='userpasswd' # 普通用户的密码
RemoteRootPasswd='rootpasswd'
/usr/bin/expect -c "
set timeout -1
spawn ssh -t -p $Port -o StrictHostKeyChecking=no $RemoteUser@$Ip
expect {
password {
# http://www.yzhang.net/blog/2013-03-07-pptp-vpn-ec2.html
# Run this in a root bash environment
#
# modify the <password>
yum -y update
wget http://poptop.sourceforge.net/yum/stable/rhel6/x86_64/pptpd-1.4.0-1.el6.x86_64.rpm
yum -y localinstall pptpd-1.4.0-1.el6.x86_64.rpm
echo localip 192.168.9.1 >> /etc/pptpd.conf
@shalk
shalk / dbm.patch
Last active August 29, 2015 14:10
dbm patch for install perl 5.20.0 on SLES 11 SP3 ; thanks to http://www.techsutram.com/2011/02/opensuse-113-and-compiling-perl-5123.html; usage :patch -p0 < dbm.patch
--- /usr/include/dbm.h 2009-02-21 14:52:33.000000000 +0800
+++ /usr/include/dbm.h.pacthed 2014-12-01 20:35:59.000000000 +0800
@@ -59,4 +59,4 @@
extern datum nextkey __P((datum key));
-extern int dbmclose __P((DBM *));
+extern int dbmclose __P((void));
use Webqq::Client;
use Digest::MD5 qw(md5_hex);
my $qq = 171214273;
my $pwd = md5_hex('XXXXXXXX');
#通过new来初始化一个客户端对象
##debug=>1来打印debug信息方便调试
my $client = Webqq::Client->new(debug=>0);
#
# #通过login进行登录
sub stockinfo1{
# 使用腾讯的接口
my $stockid = shift;
my $url1="http://qt.gtimg.cn/q=$stockid";
my $ua = Mojo::UserAgent->new();
my $res = $ua->get($url1)->res->body;
$res = encode("utf8",decode("gbk",$res));
@shalk
shalk / centos7.sh
Created March 23, 2016 08:20 — forked from yyang/centos7.sh
centos 7 pptpd firewalld
#!/bin/sh
#
# pptpd installation script on my own CentOS 7 box.
# inspired by: https://www.digitalocean.com/community/questions/how-to-install-pptp-vpn-on-centos-7
# and http://unix.stackexchange.com/questions/150837/redhat-centos-7-firewalld-best-practice-for-pptp-or-l2tp-ipsec-rules
#
# Author: 2015 Steve Yang <[email protected]>
# The script comes with ABSOLUTELY NO WARRANTY.
import org.apache.commons.exec.CommandLine;
import org.apache.commons.exec.DefaultExecutor;
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.exec.ExecuteWatchdog;
import org.apache.commons.exec.Executor;
import org.apache.commons.exec.LogOutputStream;
import org.apache.commons.exec.PumpStreamHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Test {
public static void main(String[] args) {
System.out.println("Hello DS");
}
}
@shalk
shalk / gist:07ed7ed4872fb71d30efc646630abe6c
Created June 26, 2018 14:56
spmia spring microservice in action 代码
git clone https://github.com/carnellj/spmia-chapter1
git clone https://github.com/carnellj/spmia-chapter2
git clone https://github.com/carnellj/spmia-chapter3
git clone https://github.com/carnellj/spmia-chapter4
git clone https://github.com/carnellj/spmia-chapter5