Skip to content

Instantly share code, notes, and snippets.

View souloss's full-sized avatar

souloss souloss

  • ChangSha
View GitHub Profile
@souloss
souloss / settings.json
Last active June 4, 2022 01:37
vscode-golang-setting
{
"editor.formatOnPaste": true,
"editor.quickSuggestions": {
"other": "on",
"comments": "inline",
"strings": "inline"
},
"editor.quickSuggestionsDelay": 0,
"editor.hover.delay": 0,
"editor.accessibilityPageSize": 10000,
@souloss
souloss / ua
Created April 17, 2022 07:59
User agent rotation
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36", // 13.5%
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36", // 6.6%
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0", // 6.4%
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0", // 6.2%
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.93 Safari/537.36", // 5.2%
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36" // 4.8%
@souloss
souloss / git-change-account.md
Last active May 18, 2023 06:30
git scripts.

用于批量更改 git log 中的用户名与邮箱:

git filter-branch -f --env-filter '
OLD_EMAIL="old@email.com"
CORRECT_NAME="new-username"
CORRECT_EMAIL="new-email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
 export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
@souloss
souloss / README.md
Created February 20, 2022 09:18 — forked from djfdyuruiry/README.md
WSL 2 - Enabling systemd

Enable systemd in WSL 2

This guide will enable systemd to run as normal under WSL 2. This will enable services like microk8s, docker and many more to just work during a WSL session. Note: this was tested on Windows 10 Build 2004, running Ubuntu 20.04 LTS in WSL 2.

  • To enable systemd under WSL we require a tool called systemd-genie

  • Copy the contents of install-sg.sh to a new file /tmp/install-sg.sh:

    cd /tmp
@souloss
souloss / latency.txt
Last active February 25, 2022 00:58 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@souloss
souloss / ssr-proxy
Last active May 18, 2023 06:28
wsl-ssr-proxy script
# 2021年12月22日 更新使得接受外部参数,参数 1 表示代理IP,参数 2 表示端口
set-proxy(){
export hostip=${1:- $(cat /etc/resolv.conf |grep -oP '(?<=nameserver\ ).*'|head -n1)}
export hostport=${2:- 1080}
export https_proxy="http://${hostip}:${hostport}"
export http_proxy="http://${hostip}:${hostport}"
}
unset-proxy(){