Skip to content

Instantly share code, notes, and snippets.

@fuyufjh
fuyufjh / cheatsheet.py
Last active February 19, 2024 00:36
My Python Cheatsheet
Python Cheatsheet
=================
################################ Input & Output ###############################
name = input('please enter your name: ')
print('hello,', name)
ageStr = input('please enter your age: ')
age = int(ageStr)
@fuyufjh
fuyufjh / baguenaudier.cpp
Created July 23, 2016 18:19
Algorithm to solve Baguenaudier (aka. Chinese Rings)
#include <cstdio>
#include <algorithm>
const int MAX_N = 20;
int n;
bool state[MAX_N];
int count_op = 0;
void print_state()
{
@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 / nju-lan-route.sh
Last active October 10, 2020 12:04
南京大学内网路由设置
route add -net 114.212.0.0/16 gw 172.26.0.1
route add -net 172.16.0.0/12 gw 172.26.0.1
route add -net 210.28.128.0/20 gw 172.26.0.1
route add -net 58.192.32.0/20 gw 172.26.0.1
route add -net 58.192.48.0/21 gw 172.26.0.1
route add -net 202.38.2.0/23 gw 172.26.0.1
route add -net 202.38.143.0/24 gw 172.26.0.1
route add -net 202.119.32.0/19 gw 172.26.0.1
route add -net 210.29.240.0/20 gw 172.26.0.1
route add -net 219.219.112.0/20 gw 172.26.0.1
@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 / 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

Index: ppp-2.4.7/pppd/chap-md5.c
===================================================================
--- ppp-2.4.7.orig/pppd/chap-md5.c 2014-08-09 12:31:39.000000000 +0000
+++ ppp-2.4.7/pppd/chap-md5.c 2014-09-28 15:05:32.517737058 +0000
@@ -1,6 +1,12 @@
/*
* chap-md5.c - New CHAP/MD5 implementation.
*
+ * Modified for Damning China Telecom Campus Broadband Access.
+ *
@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 / readme.md
Created February 19, 2017 06:12
树莓派+shadowsocks实现科学上网