-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions
More file actions
51 lines (43 loc) · 1.47 KB
/
Copy pathfunctions
File metadata and controls
51 lines (43 loc) · 1.47 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
function onport {
ps -ef $(lsof -n -i4TCP:$1 | grep LISTEN | awk '{print $2}')
}
function tell {
first_arg="$1"
shift
echo "$@" > $first_arg
}
function popup {
osascript -e -e 'display alert "Alert" message "'"$1"'" '
}
function speak {
kill $oldpid 2>/dev/null
tail -fn0 $me | \
while read line ; do
if [ $? = 0 ]
then
#say $line
popup $line
fi
done
}
oldpid=`cat ~/.pid`
echo $! > ~/.pid
function sysinfo() {
figlet -f digital "System Information" | lolcat
echo -n "${RED}Internal IP:${NC} $(ipconfig getifaddr en0) ${RED}WiFi SSID:${NC} "
networksetup -getairportnetwork en0 | awk -F': ' '{print $2}'
export wifiname=`/Sy*/L*/Priv*/Apple8*/V*/C*/R*/airport -I | awk '/ SSID:/ {print $2}'`
export IP_INFO=$(curl -s ipinfo.io/json)
EXTERNAL_IP=$(echo "$IP_INFO" | jq -r '.ip')
CITY=$(echo "$IP_INFO" | jq -r '.city')
REGION=$(echo "$IP_INFO" | jq -r '.region')
COUNTRY=$(echo "$IP_INFO" | jq -r '.country')
GPS=$(echo "$IP_INFO" | jq -r '.loc')
ORG=$(echo "$IP_INFO" | jq -r '.org')
POSTAL=$(echo "$IP_INFO" | jq -r '.postal')
TIMEZONE=$(echo "$IP_INFO" | jq -r '.timezone')
echo "${GREEN}External IP:${NC} $EXTERNAL_IP ${GREEN}Org:${NC} $ORG"
echo "${BLUE}Location:${NC} $CITY, $REGION, $COUNTRY $POSTAL ${BLUE}GPS:${NC} $GPS"
echo "${MAGENTA}Timezone: ${TIMEZONE}"
curl 'wttr.in/'$POSTAL'?0u'
}