This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat << EOF > /etc/systemd/system/observium_agent\@.service | |
[Unit] | |
Description=Observium Agent Service | |
After=network.target observium_agent.socket | |
Requires=observium_agent.socket | |
[Service] | |
Type=simple | |
User=root | |
# Note the - to make systemd ignore the exit code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
IFS=$'\n' | |
#/ Usage: dnsswitcher.sh | |
#/ Description: Change DNS service on Mac OS X | |
#/ Examples: ./dnsswitcher.sh | |
#/ Options: | |
#/ --help: Display this help message | |
usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; } | |
expr "$*" : ".*--help" > /dev/null && usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Better PROMPT (aka PS1) for zsh @ Mac OS X Catalina 10.15 | |
export PROMPT="╭─[%B%F{cyan}%n%f%F{red}@%f%F{magenta}%m%f:%b %F{green}%*%f] | |
╰─[%F{yellow}%~%f] | |
%(?.%F{green}.%F{red})%#%f " | |
export RPROMPT="%B%(?..%F{red}%? ↵%f)%b" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
############################################################ | |
# # | |
# Usage: ./Established_IP_on_port_80_and_443_v2.sh [all] # | |
# Show IPs TCP State Established, with argument show all # | |
# # | |
############################################################ | |
# Color variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true; do | |
clear | |
if [ $# -gt 0 ]; then | |
echo "All State: CLOSE_WAIT CLOSING ESTABLISHED FIN_WAIT1 FIN_WAIT2 LAST_ACK LISTEN SYN_RECV TIME_WAIT etc" | |
netstat -ant | awk '! /LISTEN $/ {split($4, a, ":", seps); if (a[2] == "80" || a[2] == "443") {m=split($5, b, ":", seps); print b[m-1]} }' | sort | uniq -c | sort -n | tail -20 | awk '{printf("%s -> ", $0); system("geoiplookup " $0 " | cut -d\\ -f4-")}' | |
else | |
echo "Only State: ESTABLISHED" | |
netstat -ant | awk '/ESTABLISHED$/ {split($4, a, ":", seps); if (a[2] == "80" || a[2] == "443") {m=split($5, b, ":", seps); print b[m-1]} }' | sort | uniq -c | sort -n | tail -20 | awk '{printf("%s -> ", $0); system("geoiplookup " $0 " | cut -d\\ -f4-")}' | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# For Mac OS X version (md5) | |
MD="md5 -r" | |
# For Linux version (md5sum) | |
MD="md5sum" | |
for i in ./*; do | |
mv "${i}" "./$($MD "$i" | awk '{print $1}').${i##*.}" |