This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
NAMESPACE=proxy | |
GATEWAY=172.16.1.15 | |
STATIC_IP= #172.16.1.97/24 | |
DNS_SERVER=172.16.1.1 | |
# check root permission | |
if [ "$(id -u)" != "0" ]; then | |
echo "Please run as root" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
NAMESPACE=nat | |
VETH_IP_HOST=10.0.0.1/24 | |
VETH_IP_NS=10.0.0.2/24 | |
# check root permission | |
if [ "$(id -u)" != "0" ]; then | |
echo "Please run as root" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
a () { | |
echo "invoke a" | |
} | |
b () { | |
echo "invoke b" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
if [ "$(id -u)" != "0" ]; then | |
echo "Please run as root" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# list pkgs | filter by dir | get first column | batch uninstallation | |
pip list --user | tail +3 | awk '{print $1}' | xargs pip uninstall -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sleep 1; xset dpms force off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source this file in shell | |
unset http_proxy https_proxy ftp_proxy rsync_proxy all_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY ALL_PROXY | |
echo "Proxy disabled" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source this file in shell or put in /etc/profile.d/ | |
#export http_proxy=socks5h://127.0.0.1:1080 | |
export http_proxy=http://127.0.0.1:8080 | |
export no_proxy="127.0.0.1,localhost,.localdomain.com" | |
export https_proxy=$http_proxy \ | |
ftp_proxy=$http_proxy \ | |
rsync_proxy=$http_proxy \ | |
all_proxy=$http_proxy \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
git filter-branch -f --env-filter ' | |
OLD_EMAIL=("stupid_name@gmail.com" "private@gmail.com" "temp@gmail.com") | |
NEW_NAME="foo" | |
NEW_EMAIL="foo@newdomain.com" | |
if [[ "${OLD_EMAIL[@]}" =~ "${GIT_COMMITTER_EMAIL}" || "${OLD_EMAIL[@]}" =~ "${GIT_AUTHOR_EMAIL}" ]] | |
then | |
export GIT_COMMITTER_NAME="${NEW_NAME}" | |
export GIT_COMMITTER_EMAIL="${NEW_EMAIL}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# https://gist.github.com/milanboers/f34cdfc3e1ad9ba02ee8e44dae8e093f#gistcomment-3222031 | |
curl -s -H "Authorization: token ghp_DY34*****************************KRQ" "https://api.github.com/user/repos?per_page=100" | | |
jq -r ".[].ssh_url" | | |
xargs -L1 git clone |