Skip to content

Instantly share code, notes, and snippets.

View shalk's full-sized avatar
🎯
Focusing

shalk(xiao kun) shalk

🎯
Focusing
View GitHub Profile
sudo rm -rf ~/.cache/ibus/libpinyin/
sudo ibus-daemon --restart
try {
InetAddress addr = InetAddress.getLocalHost();
if (addr.isSiteLocalAddress()
&& !addr.isLoopbackAddress()
&& !(addr instanceof Inet6Address)
) {
return addr.getHostAddress();
}
} catch (Throwable e) {
LOGGER.warn("InetAddress.getLocalHost() fail", e);
import java.io.*;
import java.util.*;
public class Add {
public static void main(String[] args) throws IOException {
BufferedReader reader1 = new BufferedReader(new FileReader("1.txt"));
BufferedReader reader2 = new BufferedReader(new FileReader("2.txt"));
//BufferedWriter writer = new BufferedWriter(new FileOutputStream("3.txt"));
while(true) {
int sum = 0;
@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
public class Test {
public static void main(String[] args) {
System.out.println("Hello DS");
}
}
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;
@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 <me@iyyang.com>
# The script comes with ABSOLUTELY NO WARRANTY.
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));
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进行登录
@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));