-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashfunctions.sh
More file actions
92 lines (78 loc) · 2.32 KB
/
bashfunctions.sh
File metadata and controls
92 lines (78 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# Functions!
#TODO:
#MAKE A FUNCTION TO DISABLE IPV6
function disable_ipv6() {
printf "net.ipv6.conf.all.disable_ipv6 = 1\n\
net.ipv6.conf.default.disable_ipv6 = 1\n\
net.ipv6.conf.lo.disable_ipv6 = 1" \
| sudo tee /etc/sysctl.d/60-ipv6disable.conf ;
sudo sysctl -p -f /etc/sysctl.d/60-ipv6disable.conf ;
cat /proc/sys/net/ipv6/conf/all/disable_ipv6 ;
test -f /proc/net/if_inet6 && echo "Running kernel is IPv6 ready"
};
#SOMECOLORS for bash maybe??
norm="$(printf '\033[0m')" #returns to "normal"
boldred="$(printf '\033[0;1;31m')" # set bold and set red.
boldgreen="$(printf '\e[1;32;40m')"
yellowitl="$(printf '\e[3;30;43m')"
function show_colorz() {
for x in {0..8}; do
for i in {30..37}; do
for a in {40..47}; do
echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m "
done
echo
done
done
echo ""
};
function gimmeIPinfo() {
curl -s --url "https://ifconfig.co/json" > $HOME/IpAddrInfo.json ;
jq -j .ip $HOME/IpAddrInfo.json | xclip -i ;
printf "Copied IP address to clipboard! use Shift+Insert to paste, your IP INFO\n" ;
jq . $HOME/IpAddrInfo.json ;
};
function gimmeSystemInfo() {
printf "UNAME TIME!!\n\n========\n\n" ;
uname -a ;
printf "\n\n==========\n\nLSB-RELEASE INFO:\n==========\n" ;
lsb_release -a ;
printf "==========\nISSUES???:\n" ;
cat /etc/issue ;
cat /etc/issue.net ;
printf "ARE WE ON DEBIAN?\n" ;
cat /etc/debian_version ;
};
##Unixisms For debugging
#TimeTool
function epochconvert() {
thedate=$(date -d @$1);
thedateutc=$(date -u -d @$1);
printf "\t\n Epoch Seconds ==> "
printf "%s" "$boldred";
printf "$1";
printf "%s" "$norm";
printf "\n\tis the following time locally:\n";
printf "%s" "$boldgreen";
printf "%s " "$thedate";
printf "%s" "$norm";
printf "\n\n\tUTC TIME is:\n";
printf "%s" "$yellowitl";
printf "%s " "$thedateutc";
printf "%s" "$norm";
printf "\n";
};
#Text viewing functions
function json_explorer() {
jq -C . $1 | less -R ;
};
function on_desktop() {
source desktop_aliases
source desktop_functions.sh
};
function viewfunctions() {
echo "Functions were Loaded! View the functions by running a declare:"
typeset -F | grep -v 'declare -f _'
};
viewfunctions
printf "\n\nRun 'on_desktop' if you are on a desktop/workstation\n"