Skip to content

Instantly share code, notes, and snippets.

View ttlequals0's full-sized avatar
✈️
I may be slow to respond.

Dominick Krachtus ttlequals0

✈️
I may be slow to respond.
View GitHub Profile
mkisofs -o ks.iso -no-emul-boot -c boot.cat -boot-load-size 4 -hide boot.bin -b isolinux.bin -boot-info-table -R -J -v -T temp_image/
cat prod_sorted | sed -n '/01\/Sep\/2015:14:30:00/ ,/01\/Sep\/2015:15:35:00/p' >> outage.log
cat outage.log |awk {'print $1'} |sort |uniq -c | sort -k1nr | awk {'print $2'} >> outages_ips
for i in $(cat outages_ips); do whois $i |grep Organization: && echo $i && echo ------------------- ;done >> outage_matches.txt
ip addr |grep inet |grep 192 |awk {'print $2'} |sed 's/\/23//'
ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1
curl -s blog.ttlequals0.com | grep -P -o '(?<=href=")http:\S+(?=")'
sample output:
http://blog.ttlequals0.com/openvpn-endpoint-on-aws-in-10-minutes/
http://blog.ttlequals0.com/windows-10-build-10122-fun/
http://blog.ttlequals0.com/the-real-way-to-lock-mac-with-keyboard-shortcut/
http://blog.ttlequals0.com/adding-removing-users-to-mailing-lists-via-powershell/
http://blog.ttlequals0.com/home-network-personal-cloud/
http://blog.ttlequals0.com/openvpn-endpoint-on-aws-in-10-minutes/
@ttlequals0
ttlequals0 / gist:ebf6a9571d9d1dc6b0f9283ad5fae646
Created July 13, 2016 01:33
Ping with timestamps written to file with newest entry at top
echo -e "\n" > file ; ping 127.0.0.1 | while read l; do newline=$(echo "[$(date '+%H:%M:%S')] $l") ;sed -i "1s/^/$newline\n/" file ; done
[20:31:06] 64 bytes from 127.0.0.1: icmp_seq=7 ttl=64 time=0.075 ms
[20:31:05] 64 bytes from 127.0.0.1: icmp_seq=6 ttl=64 time=0.079 ms
[20:31:04] 64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.207 ms
[20:31:03] 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.077 ms
[20:31:02] 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.075 ms
[20:31:01] 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.108 ms
[20:31:00] 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.149 ms
[20:30:59] 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.070 ms
### Keybase proof
I hereby claim:
* I am ttlequals0 on github.
* I am ttlequals0 (https://keybase.io/ttlequals0) on keybase.
* I have a public key whose fingerprint is 85B0 C5C4 591E B464 05A6 BD6C 746C 85FA 1125 44E9
To claim this, I am signing this object:
@ttlequals0
ttlequals0 / snmpwalk_hp_power
Created October 6, 2016 23:53
Grab HP server power usage via snmp
for i in $(seq 31 70); do host="10.143.8.$i" ; rawwatts=$(snmpwalk -v1 -c <comstring> 10.143.8.$i .1.3.6.1.4.1.232.6.2.9.3.1.7.0.1 2>/dev/null); watts=$(echo $rawwatts | awk -F ":" '{print $4}'); echo "$host $watts Watts" ; done
output:
10.143.8.31 141 Watts
10.143.8.32 146 Watts
10.143.8.33 150 Watts
10.143.8.34 156 Watts
10.143.8.35 145 Watts
10.143.8.36 163 Watts
10.143.8.37 141 Watts
@ttlequals0
ttlequals0 / batch_gitpull.sh
Created December 8, 2016 03:56
Git pull on all git repos in current directory
for dir in $(ls -dl ./* |awk '{print $9}'); do cd $dir ; git pull ; cd ../ ; done
@ttlequals0
ttlequals0 / squid_access_log_counts
Created January 31, 2017 01:05
Scrape squid access logs for top requested sites.
awk '{gsub(/:443/," ",$7);print $7 }' <(find '/var/log/squid3/' -type f -name 'access.log.*.gz' | xargs sudo zcat ) <(find '/var/log/squid3/' -type f -name 'access.log*' -not -name '*.gz' | xargs sudo cat ) | cut -d '/' -f 3| sort | uniq -c |sort -nr
Output:
412451 c.signalsciences.net
206680 sigsci-agent-wafconf.s3.amazonaws.com
11483 us.archive.ubuntu.com
5659 api-62638203.duosecurity.com
3231 security.ubuntu.com
1904 archive.ubuntu.com