Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
function load_var {
eval $(cat ${1} <( echo -e '\nset -o posix;set\n') | env - bash --noprofile --norc --posix | sed 's/^/'$2'_/')
if [ -n "$IF_IPSEC6" ]; then
PEER_ENDPOINT=$PEER_ENDPOINT6
SELF_ENDPOINT=$SELF_ENDPOINT6
fi
}
#!/bin/bash
keyserver=${KEYSERVER:-"hkp://sks.ustclug.org"}
gpghome=/home/mirrors-web-trustdb
if [ -d .git/ ]; then
commit=$(git cat-file commit HEAD | sed '/^gpgsig/,/-----END PGP SIGNATURE-----$/ D')
sig=$(git cat-file commit HEAD | sed -n '/^gpgsig/,/-----END PGP SIGNATURE-----$/ P' | sed 's/^gpgsig//; s/^ //')
if [ -e "$gpghome/trustdb.gpg" ]; then
@shankerwangmiao
shankerwangmiao / 60-stream.conf
Last active September 13, 2018 04:16
nginx-transp-proxy
stream {
log_format main '$remote_addr:$remote_port => $server_addr:$server_port'
' [$time_local] $protocol $status $bytes_sent $bytes_received '
'$session_time "$ssl_preread_server_name" $will_bind_local_addr';
server {
listen 127.0.0.1:3003 transparent;
proxy_pass $real_connect_to;
proxy_bind $will_bind_local_addr;
#!/bin/bash
function gen {
dd if=/dev/urandom 2>/dev/null | tr -dc a-f0-9 | fold -w $1 | head -n 1 | sed 's/^/0x/'
}
spi=`gen 8`
reqid=`gen 8`
auth_key=`gen 64`
enc_key=`gen 64`
#!/bin/bash
negative(){
tr '0123456789ABCDEFabcdef' 'FEDCBA9876543210543210'
}
key_derive(){
local mpk="$1"
local asn="$2"
echo "$(echo "$asn" | tdes_enc "$mpk")$(echo "$asn" | negative | tdes_enc "$mpk")"
This file has been truncated, but you can view the full file.
H4sIACnkc1wAA9T2A5RuTdcliKadJ23btm3b9knbtm3b9knbtm3bmX3e76+urq6v/+5bNUbdezvG
M0bsPddaM2astZ7YYWjhYExrZGtjCvC/btD/HazM9P+aGVgZ/svM8q/572BmYmIDYGBiZmJmY2Fi
YftrZ2BgoqcHwKf/X6jpvw5nRycDB3x8AMO/ifi/8/t/sv+/dBDhK5tbOOL//RngW1vYWFgbWOH/
0w4WZs4OBk4Wtjb4phZWJtT4ruYWRub4BlZWtq6O+E7mJvj/5APf2MDE+q+Lky3+P1l0giLCN3R2
wne1sLLCt7F1wjcycHY0wTewcXcyt7Axwzex+vv219fcwM7OxIYWiuivv7yVicFf1MHE1MThH9s/
1Ma2Rs7WJjZO/7G+hc1/XY/mrwXfzsDI0sDMBN/WAV9QQlEYX8XRxIHM8S+VmLOF8V/YBt/cycmO
k47unwhaGxMnV1sHS1ojDzp8078h1rYOJn8p/z5a/wf939//vt9/NP6L0sDG+C+fgbHxP4iDrbPT
P7Odg62TrZGtlSMt1F+jkLmBzV8RTv9Kns1f4e62zv9F0D8BfzcjIUyLL+FE9k9i/yqwMqZx/Uee
s42FvfNfBcZ/92dhamH0LxF/+WxN/4PhP4Kp8Z0dnf8m2/2vPJN/bP8B/yWTkHdh/keZg4mjo8lf
Kf9lMQtjfAYOdloWBloGenpaBq5/JCr/zZqwiYuFkcl/1f5Pnf8pjMHfhP8t9H+/tX8E/82+iaMN
Feb 27 06:44:10 101.6.8.227 4,27584,634001058486,-;WARNING: CPU: 0 PID: 0 at kernel/rcu/tree.c:2792 rcu_process_callbacks+0x4c5/0x500
Feb 27 06:44:10 101.6.8.227 4,27585,634001109697,-;Modules linked in:
Feb 27 06:44:10 101.6.8.227 4,27586,634001127944,c; tcp_diag
Feb 27 06:44:10 101.6.8.227 4,27587,634001140255,c; inet_diag
Feb 27 06:44:10 101.6.8.227 4,27588,634001153602,c; netconsole
Feb 27 06:44:10 101.6.8.227 4,27589,634001169636,c; reiserfs(O)
Feb 27 06:44:10 101.6.8.227 4,27590,634001185881,c; loop
Feb 27 06:44:10 101.6.8.227 4,27591,634001196759,c; ip_vs
Feb 27 06:44:10 101.6.8.227 4,27592,634001210249,c; veth
Feb 27 06:44:10 101.6.8.227 4,27593,634001221265,c; nf_conntrack_netlink
@shankerwangmiao
shankerwangmiao / Demo udeb
Last active February 3, 2021 15:13
Demo udeb
We couldn’t find that file to show.
#!/bin/bash
if [ -z "$IF_VXLAN_VNI" ]; then
exit 0;
fi
function prep_args {
add_args=()
if [ -n "$IF_VXLAN_PORT" ]; then
add_args+=("dstport" "$IF_VXLAN_PORT")
@shankerwangmiao
shankerwangmiao / gcj02towgs84.jq
Created April 24, 2021 11:17
GCJ-02 to WGS-84
def __out_of_china:
.lng > 73.66 and .lng < 135.05 and .lat > 3.86 and .lat < 53.55 | not;
def __PI: 3.1415926535897932384626;
def __transformlng:
300.0 + .lng + 2.0 * .lat + 0.1 * .lng * .lng + 0.1 * .lng * .lat + 0.1 * (.lng | fabs | sqrt) +
(20.0 * (6.0 * .lng * __PI | sin) + 20.0 * (2.0 * .lng * __PI | sin)) * 2.0 / 3.0 +
(20.0 * (.lng * __PI | sin) + 40.0 * (.lng / 3.0 * __PI | sin)) * 2.0 / 3.0 +
(150.0 * (.lng / 12.0 * __PI | sin) + 300.0 * (.lng / 30.0 * __PI | sin)) * 2.0 / 3.0;