From Fedora Project Wiki
(Created page with "== Bash! == On this sub-page, I will share my favorite bash setup")
 
(set proxy)
Line 1: Line 1:
 
== Bash! ==
 
== Bash! ==
 
On this sub-page, I will share my favorite bash setup
 
On this sub-page, I will share my favorite bash setup
 +
 +
==== Proxy ====
 +
This is how I set proxy on my terminal via bash. I have 2 function <code>setproxy</code> and <code>unsetproxy</code>. For example, Here I how I do to set proxy to my university network. Both function also will setup/reset my git config
 +
<pre>
 +
## set proxy (BASH only not systemwide)
 +
function setproxy() {
 +
export NO_PROXY='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
 +
export no_proxy='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
 +
export {HTTP,HTTPS,FTP}_PROXY='http://proxy.uthm.edu.my:8080/'
 +
export {http,https,ftp}_proxy='http://proxy.uthm.edu.my:8080/'
 +
 +
gsettings set org.gnome.system.proxy mode 'manual'
 +
gsettings set org.gnome.system.proxy.ftp host 'proxy.uthm.edu.my'
 +
gsettings set org.gnome.system.proxy.ftp port 8080
 +
gsettings set org.gnome.system.proxy.https host 'proxy.uthm.edu.my'
 +
gsettings set org.gnome.system.proxy.https port 8080
 +
gsettings set org.gnome.system.proxy.http host 'proxy.uthm.edu.my'
 +
gsettings set org.gnome.system.proxy.http port 8080
 +
 +
gnome-terminal -x bash -c "git config --global http.proxy \"proxy.uthm.edu.my:8080\""
 +
 +
echo -e "Proxy environment variable has been setup!"
 +
}
 +
 +
function unsetproxy() {
 +
unset {HTTP,HTTPS,FTP}_PROXY
 +
unset {http,https,ftp}_proxy
 +
unset no_proxy
 +
unset NO_PROXY
 +
 +
gsettings set org.gnome.system.proxy mode 'none'
 +
 +
gnome-terminal -x bash -c "git config --global http.proxy \"\""
 +
 +
echo -e "Proxy environment variable removed."
 +
}
 +
</pre>

Revision as of 19:27, 28 December 2020

Bash!

On this sub-page, I will share my favorite bash setup

Proxy

This is how I set proxy on my terminal via bash. I have 2 function setproxy and unsetproxy. For example, Here I how I do to set proxy to my university network. Both function also will setup/reset my git config

## set proxy (BASH only not systemwide)
function setproxy() {
	export NO_PROXY='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
	export no_proxy='localhost,127.0.0.0/8,::1,*.uthm.edu.my'
	export {HTTP,HTTPS,FTP}_PROXY='http://proxy.uthm.edu.my:8080/'
	export {http,https,ftp}_proxy='http://proxy.uthm.edu.my:8080/'

	gsettings set org.gnome.system.proxy mode 'manual'
	gsettings set org.gnome.system.proxy.ftp host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.ftp port 8080
	gsettings set org.gnome.system.proxy.https host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.https port 8080
	gsettings set org.gnome.system.proxy.http host 'proxy.uthm.edu.my'
	gsettings set org.gnome.system.proxy.http port 8080

	gnome-terminal -x bash -c "git config --global http.proxy \"proxy.uthm.edu.my:8080\""

	echo -e "Proxy environment variable has been setup!"
}

function unsetproxy() {
	unset {HTTP,HTTPS,FTP}_PROXY
	unset {http,https,ftp}_proxy
	unset no_proxy
	unset NO_PROXY

	gsettings set org.gnome.system.proxy mode 'none' 

	gnome-terminal -x bash -c "git config --global http.proxy \"\""

	echo -e "Proxy environment variable removed."
}