Skip to content

Instantly share code, notes, and snippets.

for ((;;)); do date "+%Y-%m-%d - %H:%M:%S:%N" ; done
@mxyq
mxyq / 99-sysctl.conf
Created January 15, 2023 04:08
[sysctl options to optimize network]
net.ipv4.neigh.default.base_reachable_time_ms = 600000
net.ipv4.neigh.eth1.delay_first_probe_time = 1
net.ipv4.neigh.default.mcast_solicit = 20
net.ipv4.neigh.default.retrans_time_ms = 250
net.ipv4.conf.all.rp_filter=0
net.ipv4.conf.eth0.rp_filter=0
net.ipv4.conf.eth1.rp_filter=0
net.core.default_qdisc=cake
net.ipv4.tcp_congestion_control=bbr2
@mxyq
mxyq / nftables.conf
Created January 15, 2023 02:40
[Linux Firewall Configuration]
#!/usr/sbin/nft -f
flush ruleset
table inet filter {
chain ports {
tcp dport 33333 counter accept
}
chain input {
@mxyq
mxyq / tc.sh
Created December 29, 2022 02:30
[tc 命令]
tc -s qdisc show dev eth0
tc qdisc replace dev eth0 root rtt 220ms cake ethernet besteffort
tc qdisc replace dev eth0 root cake rtt 150ms ethernet diffserv4
@mxyq
mxyq / profile
Last active August 24, 2023 01:24
Go环境变量
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin:~/go/bin
export GO111MODULE=on
export GOPROXY=https://goproxy.io,direct
@mxyq
mxyq / nginx.dockerfile
Created August 2, 2022 03:34
[Dockerfile] #Docker
FROM nginx:stable-alpine
ENV TimeZone=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone && export TZ=$TimeZone
ADD default.conf /etc/nginx/conf.d/
COPY --chown=nginx:nginx dist /usr/share/nginx/html
CMD ["nginx","-g","daemon off;"]
@mxyq
mxyq / docker_archivebox.sh
Last active August 1, 2022 10:02
[Docker startup scripts] #Docker
docker run --rm -v $PWD:/data -it archivebox/archivebox init --setup
docker run -it \
--name archive_box \
-p 48000:8000 \
-v /data/ArchiveBox:/data \
--restart always \
-e HTTP_PROXY=http://192.168.1.10:10811 \
-e HTTPS_PROXY=http://192.168.1.10:10811 \
-e TIMEOUT=120 \
@mxyq
mxyq / press any key to continue
Last active August 2, 2022 03:37
[Read from type] #Bash
read -n1 -r -p "Press any key to continue..."
@mxyq
mxyq / While; do case.sh
Last active August 1, 2022 09:05
[Getting options] #Bash
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
-V | --version )
echo $version
exit
;;
-s | --string )
shift; string=$1
;;
-f | --flag )
flag=1
@mxyq
mxyq / printf.sh
Last active August 1, 2022 09:09
[Log] #Bash #Log
_printargs() {
printf -- "%s" "$1"
printf "\n"
}
_info() {
_printargs "$@"
}