Skip to content

Instantly share code, notes, and snippets.

View caorong's full-sized avatar
🎯
Focusing

caorong caorong

🎯
Focusing
View GitHub Profile
@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

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 / 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';
@caorong
caorong / AutowiringSpringBeanJobFactory.java
Created January 7, 2016 11:55 — forked from jelies/AutowiringSpringBeanJobFactory.java
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.
@caorong
caorong / pkilldemo output
Created November 10, 2015 08:08 — forked from willthames/pkilldemo output
Demo of pkill behaviour with Ansible
[will@fedora pkilldemo]$ ansible-playbook pkilldemo.yml
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [generate random process string] ****************************************
changed: [127.0.0.1]
@caorong
caorong / libaacplus.rb
Last active August 29, 2015 14:21 — forked from akarpenko/libaacplus.rb
llibaacplus formula for homebrew and Yosemite(10.10) Install with: brew install ./libaacplus.rb
require 'formula'
class Libaacplus < Formula
homepage 'http://tipok.org.ua/node/17'
url 'http://tipok.org.ua/downloads/media/aacplus/libaacplus/libaacplus-2.0.2.tar.gz'
sha256 '60dceb64d4ecf0be8d21661d5af2f214710f9d5b6ab389a5bdebf746baa7e1d7'
depends_on 'autoconf' => :build
depends_on 'automake' => :build
depends_on 'libtool' => :build
// phantomjs code to log in to Amazon
// based on the code from this Stackoverflow answer: http://stackoverflow.com/questions/9246438/how-to-submit-a-form-using-phantomjs
// I'm injecting jQuery so this assumes you have jquery in your project directory
var page = new WebPage(), testindex = 0, loadInProgress = false;
page.onConsoleMessage = function(msg) {
console.log(msg);
};