Skip to content

Instantly share code, notes, and snippets.

@jpzhu
jpzhu / process.txt
Created November 21, 2018 06:58
性能排查 thread process
ps -ef 看到对应进程号。
ps p 2664 -L
可以看到进程列表(第3列显示当前状态,第三列显示保持当前时间,分钟:秒 格式)
2664 3200 ? Sl 104:02 java -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:MaxTenuringThreshold=8 -XX
2664 3201 ? Sl 103:48 java -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:MaxTenuringThreshold=8 -XX
2664 3202 ? Sl 103:47 java -XX:-UseBiasedLocking -XX:AutoBoxCacheMax=20000 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:MaxTenuringThreshold=8 -XX
@jpzhu
jpzhu / sdkman
Created November 9, 2018 12:32
sdkman
$ curl -s "https://get.sdkman.io" | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk version ## 执行上面脚本后,sdk是一个function,加载在内存里
ref:https://sdkman.io/install
@jpzhu
jpzhu / mysql_analytics.txt
Last active November 14, 2018 10:23
MySQL 管理分析工具
慢查询优化:
mysql> show variables like "%long%"; //查看一下默认为慢查询的时间10秒
mysql> show variables like "%slow%"; //查看慢查询是否enable
mysql> set slow_query_log='ON'; //加上global,不然会报错的。
mysql> set global slow_query_log='ON'; //启用慢查询
[my.cnf]
long_query_time = 2
log-slow-queries = /usr/local/mysql/mysql-slow.log
@jpzhu
jpzhu / study.R
Created June 13, 2018 06:05
R note
> devices=read.table("test.csv",header=TRUE,sep=",")
读取数据
> country_table=with(devices,table(country))
计算频率
> as.data.frame(country_table[order(country_table,decreasing=TRUE)])
排序,列显示
> as.data.frame( prop.table(country_table[order(country_table,decreasing=TRUE)])*100)
@jpzhu
jpzhu / sort.sh
Created June 13, 2018 01:31
sort, keep order
cat -n file | sort -k2 | uniq -f1 | sort -k1 | cut -f2-
How it works:
On a GNU system, cat -n will prepend the line number to each line following some amount of spaces and followed by a <tab> character. cat pipes this input representation to sort.
sort's -k2 option instructs it only to consider the characters from the second field until the end of the line when sorting, and sort splits fields by default on white-space (or cat's inserted spaces and <tab>).
When followed by -k1n, sort considers the 2nd field first, and then secondly—in the case of identical -k2 fields—it considers the 1st field but as sorted numerically. So repeated lines will be sorted together but in the order they appeared.
The results are piped to uniq—which is told to ignore the first field (-f1 - and also as separated by whitespace)—and which results in a list of unique lines in the original file and is piped back to sort.
@jpzhu
jpzhu / test
Last active May 16, 2018 11:45
ⓆⓇⓅⓨⓣⓗⓞⓝ
ⓆⓇⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ
@jpzhu
jpzhu / bank.txt
Last active June 15, 2018 09:18
银行 电子回单
招商银行 https://app.cmbchina.com/cevs/checkmain.aspx 企业
招商银行 https://app.cmbchina.com/pevs/pccheck.aspx 个人
建设银行 https://b2bstatic.ccb.com/B2Bdzhd.HTM
中国银行 https://ebsnew.boc.cn/boccp/elecbillvalidate.html?lan=C
工商银行 https://mybank.icbc.com.cn/icbc/perbank/e_bill/ebill_verify_query.jsp?isClose=1
交通银行 http://www.bankcomm.com/BankCommSite/shtml/jyjr/cn/7924/9484/list.shtml?channelId=7158
兴业银行 https://corporatebank.cib.com.cn/firm/cash/receipt/receiptQuery!openPrint.do
平安银行 https://ebank.sdb.com.cn/corporbank/validateElectronicBillInput.do
浦发银行 http://ebank.spdb.com.cn/net/eBillValidateInput.do
@jpzhu
jpzhu / ethereum.txt
Last active February 9, 2018 05:17
ethereum public
每笔交易是有顺序的吗?
每个新生成的区块里包含的交易是一样的吗?
何时决定交易可以打包生成区块?
如何在链表的终端提取一个数据,比如账户值 ? 需要进行整个链条的校验吗?
一个合约对于某些代码功能比如网络,数学库等怎么支持
大型合约怎么部署,依赖的js库有变动怎么办
@jpzhu
jpzhu / sslocal.txt
Created December 28, 2017 02:59
shadowsocks
/usr/bin/sslocal -s 服务器域名或IP -p 服务器端口 -m aes-256-cfb -k hello,world -b 0.0.0.0 -l 1234
以上命令开放的是socks5端口,但部分应用只支持http代理,需要使用privoxy工具将其他http端口请求转到1234
service privoxy restart
### /etc/privoxy/config 内容
listen-address 0.0.0.0:8118
forward-socks5 / 127.0.0.1:1234 .
forward 192.168.*.*/ .
forward 10.*.*.*/ .
@jpzhu
jpzhu / mysql.txt
Created December 14, 2017 09:58
mysql chinese character
mysql> SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |