Skip to content

Instantly share code, notes, and snippets.

View zhpjy's full-sized avatar
🎯
Focusing

zhpjy

🎯
Focusing
View GitHub Profile
#!/usr/bin/bash
CIDR_LIST=${CIDR_LIST:-}
CIDR_URL=${CIDR_URL:-"https://www.cloudflare.com/ips-v4"}
fping_shuf=
fping_interval=1
fping_count=3
fping_period=1000
st_url=https://speed.cloudflare.com/__down?bytes=125000000
#tempory hosts set for one comdline
#为一行命令设置设置一个临时的指向sni服务器的hosts
#example:
# tmphosts wwww.github.com curl https://www.github.com
function tmphosts(){
local sni_ip="192.168.2.254"
# create temporary file
# https://unix.stackexchange.com/questions/181937/how-create-a-temporary-file-in-shell-script
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
exec 3>"$tmpfile"
@zhpjy
zhpjy / gist:67f0c55162a6fd8f24fca797839f2b4c
Last active May 20, 2023 04:47
文件头部添加bom,解决某些csv文件用Excel打开乱码的问题。file add bom. useage: add-boom <fliename>
function add-bom(){
[ -z "$1" ] && echo "need filename" && return 1
printf '\xEF\xBB\xBF' > $1.tmp
cat $1 >> $1.tmp
mv $1.tmp $1
}
@zhpjy
zhpjy / gist:1e6fc87d5c6964a2b27f06bc4e138d0a
Created April 2, 2021 07:27
maven 打包时拷贝文件
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>copy-resource-one</id>
<phase>install</phase>
<goals>
<goal>copy-resources</goal>
</goals>