aboutsummaryrefslogtreecommitdiff
path: root/config/shell/func
blob: 7788689eac68a33e3d6b0cdb4855b000b1444a7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env zsh

proxy_connect=0
toggle_proxy() {
	if [[ "$proxy_connect" -eq 0 ]]; then
		export http_proxy="http://127.0.0.1:2081"
		export https_proxy=$http_proxy
		proxy_connect=1
		echo "vpn activated"
	else
		unset http_proxy
		unset https_proxy
		proxy_connect=0
		echo "vpn deactivated"
	fi
}

generate_pass() {
	local len=8
	if [ $# -eq 1 ]; then
		len=$1
	fi
	tr -cd '[:graph:]' < /dev/urandom | head -c $len | xargs -0
}