Skip to content

Instantly share code, notes, and snippets.

@ericksuryadinata
Last active August 13, 2021 08:27
Show Gist options
  • Save ericksuryadinata/c66905748d8e5e4d71415b9e9cd347fd to your computer and use it in GitHub Desktop.
Save ericksuryadinata/c66905748d8e5e4d71415b9e9cd347fd to your computer and use it in GitHub Desktop.
Proxyon and off, paired with netshare app on android
# if you want to use github/gitlab, put this on your .ssh/ folder
# github.com
Host github.com
Hostname ssh.github.com
ProxyCommand nc -X connect -x 192.168.49.1:8282 %h %p
# windows
#ProxyCommand connect -H 192.168.49.1:8282 %h %p
Port 443
ServerAliveInterval 20
User git
#And if you use gitlab as well the entry should be like:
# gitlab.com
Host gitlab.com
Hostname altssh.gitlab.com
Port 443
ProxyCommand /usr/bin/nc -X connect -x 192.168.49.1:8282 %h %p
# windows
#ProxyCommand connect -H 192.168.49.1:8282 %h %p
ServerAliveInterval 20
User git
if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root";
exit 1;
fi
gsettings set org.gnome.system.proxy mode 'none' ;
grep PATH /etc/environment > lol.t;
cat lol.t > /etc/environment;
printf "" > /etc/apt/apt.conf.d/95proxies;
rm -rf lol.t;
mv /home/erick/.ssh/config /home/erick/.ssh/config.bak;
if [ $(id -u) -ne 0 ]; then
echo "This script must be run as root";
exit 1;
fi
if [ $# -eq 2 ]
then
gsettings set org.gnome.system.proxy mode 'manual' ;
gsettings set org.gnome.system.proxy.http host '$1';
gsettings set org.gnome.system.proxy.http port $2;
grep PATH /etc/environment > lol.t;
printf \
"http_proxy=http://$1:$2/\n\
https_proxy=http://$1:$2/\n\
ftp_proxy=http://$1:$2/\n\
no_proxy=\"localhost,127.0.0.1,localaddress,.localdomain.com\"\n\
HTTP_PROXY=http://$1:$2/\n\
HTTPS_PROXY=http://$1:$2/\n\
FTP_PROXY=http://$1:$2/\n\
NO_PROXY=\"localhost,127.0.0.1,localaddress,.localdomain.com\"\n" >> lol.t;
cat lol.t > /etc/environment;
printf \
"Acquire::http::proxy \"http://$1:$2/\";\n\
Acquire::ftp::proxy \"ftp://$1:$2/\";\n\
Acquire::https::proxy \"http://$1:$2/\";\n" > /etc/apt/apt.conf.d/95proxies;
rm -rf lol.t;
mv /home/erick/.ssh/config.bak /home/erick/.ssh/config;
else
printf "Usage $0 <proxy_ip> <proxy_port>\n";
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment