Skip to content

Instantly share code, notes, and snippets.

@fuyufjh
fuyufjh / NeteaseMusicOversea.conf
Last active December 19, 2022 15:05
Unblock Netease Music oversea for Quantumult X. No need to set up a proxy server.
# Rewrite HTTPs request headers to add "X-Real-IP: <Any-IP-Addr-From-CN>"
# You may need: https://lite.ip2location.com/china-ip-address-ranges
[rewrite_local]
^https?://(\w+\.)?music\.163\.com/.* url request-header (\r\n)User-Agent: request-header $1X-Real-IP: 111.72.0.1$1User-Agent:
# MITM is required to decrypt the HTTPs traffics of Netease Music App
[mitm]
hostname = *.music.126.net, *.music.163.com
@fuyufjh
fuyufjh / postgres cheatsheet.md
Created December 6, 2018 06:04 — forked from apolloclark/postgres cheatsheet.md
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@fuyufjh
fuyufjh / LOG
Created July 26, 2018 02:40
RocksDB LOG of #4180
2018/07/26-10:37:02.433656 700001119000 RocksDB version: 5.14.2
2018/07/26-10:37:02.433730 700001119000 Git sha rocksdb_build_git_sha:5089e121166c46956a8a21c8ef967f1896c239de
2018/07/26-10:37:02.433733 700001119000 Compile date Jul 6 2018
2018/07/26-10:37:02.433735 700001119000 DB SUMMARY
2018/07/26-10:37:02.433781 700001119000 SST files in /Users/eric/Desktop/RocksDBTest dir, Total Num: 0, files:
2018/07/26-10:37:02.433784 700001119000 Write Ahead Log file in /Users/eric/Desktop/RocksDBTest:
2018/07/26-10:37:02.433786 700001119000 Options.error_if_exists: 0
2018/07/26-10:37:02.433790 700001119000 Options.create_if_missing: 1
2018/07/26-10:37:02.433791 700001119000 Options.paranoid_checks: 1
2018/07/26-10:37:02.433792 700001119000 Options.env: 0x1157c4a18
@fuyufjh
fuyufjh / akka.scala
Last active July 15, 2018 16:00
Scala Cheatsheet
import akka.actor._
import akka.pattern.ask
import scala.collection.mutable
import scala.concurrent.Await
import scala.concurrent.duration._
case class AddCount(word: String)
case class ReportCount(word: String)
class WordCountActor extends Actor {
@fuyufjh
fuyufjh / TestArrayBlockingQueuePerf.java
Last active February 2, 2020 20:46
Performance Test: BlockingQueue (Java) vs. Channel (Go)
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
public class TestArrayBlockingQueuePerf {
private static final int CHANNEL_NUM = 8;
private static final int CHANNEL_BUFFER_SIZE = 65536;
@fuyufjh
fuyufjh / SplitStringInCpp.cpp
Created April 4, 2017 13:30
split string in cpp
char *dup = strdup(str.c_str());
for (char *token = strtok(dup, " ,;"); token != NULL; token = strtok(NULL, " ,;")) {
// do something with token
}
free(dup);
@fuyufjh
fuyufjh / certbot_renew.sh
Created March 8, 2017 16:54
Certbot Renew
#!/usr/bin/env bash
printf "\nattempt to renew certificates at " >>/var/log/certbot_cron.log 2>&1
date >>/var/log/certbot_cron.log 2>&1
certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" --standalone-supported-challenges http-01 >>/var/log/certbot_cron.log 2>&1
printf "renew finished\n" >>/var/log/certbot_cron.log 2>&1
Regions for aws
* eu-west-2
* ap-south-1
* us-east-2
* ap-northeast-2
* us-west-2
* ap-southeast-2
* eu-central-1
* eu-west-1
* ca-central-1
@fuyufjh
fuyufjh / readme.md
Created February 19, 2017 06:12
树莓派+shadowsocks实现科学上网
@fuyufjh
fuyufjh / rpc.proto
Last active January 29, 2017 13:13
syntax = "proto3";
package protocol;
import "google/protobuf/empty.proto";
service SSMgrSlave {
rpc Allocate(AllocateRequest) returns (google.protobuf.Empty) {}
rpc Free(FreeRequest) returns (google.protobuf.Empty) {}
rpc GetStats(google.protobuf.Empty) returns (Statistics) {}