Skip to content

Instantly share code, notes, and snippets.

View caorong's full-sized avatar
🎯
Focusing

caorong caorong

🎯
Focusing
View GitHub Profile
```
+--- org.projectlombok:lombok:1.18.12
+--- org.springframework:spring-context:5.2.3.RELEASE
| +--- org.springframework:spring-aop:5.2.3.RELEASE -> 5.2.0.RELEASE
| | +--- org.springframework:spring-beans:5.2.0.RELEASE
| | | \--- org.springframework:spring-core:5.2.0.RELEASE
| | | \--- org.springframework:spring-jcl:5.2.0.RELEASE
| | \--- org.springframework:spring-core:5.2.0.RELEASE (*)
| +--- org.springframework:spring-beans:5.2.3.RELEASE -> 5.2.0.RELEASE (*)
| +--- org.springframework:spring-core:5.2.3.RELEASE -> 5.2.0.RELEASE (*)
@caorong
caorong / gist:91dc2628229c96daed574de2299ae0f5
Created November 26, 2019 04:10 — forked from EvilFaeton/gist:2886922
Simulate heavy load CPU and IO on Linux
# CPU
for cpu in 1 2 ; do
( while true; do true; done ) &
done
# IO
for cpu in 1 2 ; do
( while true; do find / -type f -exec cp {} /dev/null \; ; done ) &
done
@caorong
caorong / resilio_sync_v2ray.md
Created November 21, 2019 15:45 — forked from wangyan/resilio_sync_v2ray.md
Resilio Sync 科学之路

“没有可用的跟踪程序连接”,现在 Resilio Sync 已经不可用了,原因是官方的 Tracker 服务器被和谐了。一个普遍方法是,通过 Zerotier 构建虚拟局域网来跳过 Tracker 服务器,甚至将 sync 降级到 1.4.111 版本来加入 DHT 网络,但最后的实际体验都非常不友好,所以科学连上 Tracker 服务器才是正道。

一、原因

Sync 启动后会从 https://config.resilio.com/sync.conf 或者 http://config.getsync.com/sync.conf 获取 trackers 和 relays 服务器列表,而这两个地址均已被屏蔽。

sync.conf 文件内容如下:

sync.conf

@caorong
caorong / ClassLoaderLeakExample.java
Created May 18, 2019 13:49
ClassLoader Leak Example
// modify from https://gist.github.com/dpryden/b2bb29ee2d146901b4ae
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
/**
## set
export http_proxy=http://localhost:8989
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
git config --global https.proxy http://127.0.0.1:8989
git config --global https.proxy https://127.0.0.1:8989

Git Diff

git diff                 // Look diff from previous commited version

git diff > temp.patch    // Output diff to patch file
git apply temp.patch     // Apply patch 'pk_xxx'

git reset --hard 6a137   // Force reset to version '6a137' will lost new commit

git format-patch HEAD^^^ // Patch to nth(^) previos version from HEAD, output multiple files

@caorong
caorong / GAME_MASTER_v0_1.protobuf
Created July 18, 2016 05:58 — forked from anonymous/GAME_MASTER_v0_1.protobuf
Pokemon Go decoded GAME_MASTER protobuf file v0.1
Result: 1
Items {
TemplateId: "BADGE_BATTLE_ATTACK_WON"
Badge {
BadgeType: BADGE_BATTLE_ATTACK_WON
BadgeRanks: 4
Targets: "\nd\350\007"
}
}
Items {
@caorong
caorong / gist:766aa78d9e0a3d40d28fd29fb3371f65
Created May 23, 2016 06:53 — forked from ties/gist:1424374
pcap/dpkt example that dumps (some) http request headers
#!/usr/bin/env python
import dpkt, pcap, socket
from ipaddr import IPv4Address, IPv6Address
import syslog
class HTTPRequest():
def __init__(self, host, uri, ip = None, user_agent = None):
self.uri = uri
self.user_agent = user_agent
self.host = host
@caorong
caorong / findfreeport.sh
Created May 13, 2016 15:37
find free port
#!/bin/bash
i=8031;
for (( ; ; ))
do
_="$((i++))"
# echo "Number: $((i++))"
#netstat -apn|grep 8001|wc |awk '{print $1}'
@caorong
caorong / china-unicom-cdn.md
Created April 2, 2016 08:24 — forked from lovemyliwu/china-unicom-cdn.md
使用联通cdn加速下载

120.52.72.*/original-uri

ip 地址获取脚本

window.success = [];
function test() {
    for(var idx=1;idx<255;idx++){
        var el = document.createElement('img');
        el.src = '//120.52.72.' + idx + '/41.media.tumblr.com/5cb6715c800c5b00969f33c162b317d1/tumblr_nzjh7dPKcD1ssbwqro1_540.png';