Skip to content

Instantly share code, notes, and snippets.

View fpGHwd's full-sized avatar
🎯
Focusing

Melt fpGHwd

🎯
Focusing
View GitHub Profile
@fpGHwd
fpGHwd / autossh.service
Created December 24, 2020 13:54 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@fpGHwd
fpGHwd / gist:30f7b4931c4f5dbc7362ec497841de31
Created November 22, 2020 15:09
automatically modified aria2.conf’s bt-tracker value with "https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_best.txt" when startup (sleep several seconds for internet connection, recomended)
#!/usr/bin/env bash
# set -euo pipefail
# aria2
# aria2c --conf-path=/home/wd/.aria2/aria2.conf -D
# update tracker list
# last_run_timestamp=Fri Nov 20 09:25:58 PM CST 2020
tracker_lists=`curl https://cdn.jsdelivr.net/gh/ngosang/trackerslist/trackers_best.txt | grep -v '^\s*$' | sed ":a;N;s/\n/,/g;$!ba"`
# echo $tracker_lists
@fpGHwd
fpGHwd / chinese_wc.py
Last active November 22, 2020 07:21
count chinese words in a specific directory (default depth 3) and specfic file extension
#!/usr/bin/env python3
#
import io
import re
import os
import sys
import pdb
# filename = "/home/wd/wordcount.log"
@fpGHwd
fpGHwd / vmess-url-outbound-to-given-v2ray-config-json-file.sh
Last active November 11, 2020 02:03
replace your v2ray config.json outbounds part with corresponding part in vmess url
#!/usr/bin/env bash
set -euo pipefail
vmess_file_path=$1
config_file_path=$2
vmess_line=$3
line=`sed -n ${vmess_line}p $vmess_file_path`
result=`v2ray-tools vmess2config --port 8080 --url $line`
outbound=`echo $result | jq '.outbounds[0]'`
@fpGHwd
fpGHwd / .ctags.sample
Created July 17, 2020 07:49 — forked from redguardtoo/.ctags.sample
my ~/.ctags. Please note this is configuration for Exuberant Ctags. If you use Universal Ctags, you need run `ctags --options="$HOME/.ctags" -e -R` in shell at least once and fix all the warnings.
--c++-kinds=+p
--fields=+iaS
--extra=+q
--exclude=*/.hg/*
--exclude=.hg/*
--exclude=*/.cvs/*
--exclude=.cvs/*
--exclude=*/.svn/*
--exclude=.svn/*
--exclude=*/.git/*
@fpGHwd
fpGHwd / Raider of 吞食天地2 威力加强版
Created October 25, 2019 03:02
吞食天地威力加强版的攻略
// todo
// https://www.5fun.com/game-detailed/2720125713.html
@fpGHwd
fpGHwd / leetcode047
Last active October 16, 2019 12:44
permutation with lexicographical order
//
// Created by Administrator on 2019/10/16.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
@fpGHwd
fpGHwd / QuicksortIteration
Last active August 29, 2019 02:00
迭代版的快速排序(递归可以用栈来代替,所以写成迭代没有问题)
//
// Created by suzumiya on 8/29/19.
//
#include <stack>
using namespace std;
int partition(int * a, int left, int right)
{
@fpGHwd
fpGHwd / git 设置和取消代理
Created June 16, 2018 04:25 — forked from laispace/git 设置和取消代理
set and cancel git proxy
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@fpGHwd
fpGHwd / autoproxy.pac
Created June 15, 2018 09:04
pac for ubuntu
/**
* genpac 2.0.1 https://github.com/JinnLynn/genpac
* Generated: 2018-04-11 16:48:55
* GFWList Last-Modified: 2018-04-09 12:19:42
* GFWList From: online[https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt]
*/
var proxy = 'SOCKS5 127.0.0.1:1080';
var rules = [
[