Skip to content

Instantly share code, notes, and snippets.

@fooling
fooling / mysql-5.7.7-labs-json-linux-el6-x86_64-deploy-aliyun-ecs.sh
Created June 1, 2015 16:15
deploy mysql 5.7.7-labs-json on aliyun ECS el6
#!/bin/bash
tar zxvf mysql-5.7.7-labs-json-linux-el6-x86_64.tar.gz
path=`pwd`
root_path=$path/mysql-5.7.7-labs-json-linux-el6-x86_64
mkdir /opt/mysql
mkdir /opt/mysql/mysql
mkdir /opt/mysql/mysql/data
useradd mysql
@fooling
fooling / mplayer.sh
Last active August 29, 2015 14:22
Run MPlayerX through command line
#!/bin/bash
ps -A | grep MPlayerX | grep Application | awk {'print $1'} | xargs kill
if [ "$1" == "" ]; then
echo "Positional parameter 1 is empty"
exit 0
fi
if [[ $1 != /* ]];then
path=`pwd`
#!/bin/bash
#for loop in one line
for i in {1..10};do `nohup echo $i 0<&- &>>~/out.txt &` ;done
@fooling
fooling / log4j.xml
Created June 24, 2015 02:35
Java xmls
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="PHYSICAL_SLOW"
class="org.apache.log4j.FileAppender">
<param name="File" value="/home/fooling/slow_slow.log"/>
<param name="Threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"/>
</layout>
@fooling
fooling / 0_reuse_code.js
Last active September 21, 2015 08:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@fooling
fooling / PureJavaCrc32.java
Created April 29, 2016 02:44
CRC32 in java
import java.util.zip.Checksum;
/**
* A pure-java implementation of the CRC32 checksum that uses
* the same polynomial as the built-in native CRC32.
* <p>
* This is to avoid the JNI overhead for certain uses of Checksumming
* where many small pieces of data are checksummed in succession.
* <p>
@fooling
fooling / Sublime Text 3 Build 3103 License Key - CRACK
Last active May 15, 2018 03:50
Sublime Text 3 Build 3103 License Key - CRACK
—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
@fooling
fooling / get_cert.txt
Created August 1, 2016 09:24
Get cert
获取任意https的证书并加入java keystore
openssl s_client -connect 192.168.1.1:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > xxx.cert
keytool -import -v -trustcacerts -file /home/xxx/xxx.cert -keystore "$JAVA_HOME/jre/lib/security/cacerts" -keypass ""
@fooling
fooling / code line
Last active October 24, 2018 10:13
统计两次commit之间的代码量
git log --numstat --pretty="%H" 881579dd2569369f92104737d913629d4d6a6db5..branch_3.0.1 | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d,-%d\n",plus,minus)}'
git log --numstat --pretty="%H" 434868bb^..HEAD | grep bks | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
%s/\(addTenant(.*,\d*,\d*,\)\(\d*,\)\(\d*,\d*\)/\1\3/g