Skip to content

Instantly share code, notes, and snippets.

@jbowdre
jbowdre / Filter_log_for_IPs
Created August 11, 2020 18:33
Ugly kludge for parsing a given log file and returning the most common IP-like strings.
grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' ACCESS_LOG.TXT | grep -v "127.0.0.1" | sort | uniq -c | sort -n -r | head -n 5
# Bonus kludge for parsing multiple gzipped logs for the same. Also prints the logfile datestamp for each file as well:
for i in {1..20}; do date -r ACCESS_LOG.$i.gz; zgrep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' \ACCESS_LOG.log.$i.gz | grep -v "127.0.0.1" | sort | uniq -c | sort -n -r | head -n 5; done
@jbowdre
jbowdre / Fossil_Watch_Debloat
Last active March 20, 2023 14:58
Debloating Fossil Group Wear OS watches for fun and profit...
# Reference https://www.reddit.com/r/WearOS/comments/en3989/debloat_the_fossil_smartwatch/
# Connect to the watch with 'adb connect IP_ADDRESS:PORT'
# Open an ADB shell with 'adb -s IP_ADDRESS:PORT shell'
# Then paste in all this stuff:
pm uninstall --user 0 com.dianping.v1
pm uninstall --user 0 com.google.android.wearable.smarthome
pm uninstall --user 0 com.sogou.map.android.maps
pm uninstall --user 0 com.mobvoi.wear.fitness.aw
pm uninstall --user 0 com.mobvoi.ticwear.sidewearvoicesearch
@jbowdre
jbowdre / Initialize-PowerCLIEnvironment_Custom.ps1
Last active August 7, 2020 17:14
Place this in the same directory as the default Initialize-PowerCLIEnvironment.ps1 to add functions to easily connect to multiple vCenters at once.
# Initialize-PowerCLIEnvironment_Custom.ps1
# Place this alongside the default 'Initialize-PowerCLIEnvironment.ps1' script.
# Usage:
# 1) Call 'Update-Credentials' to create/update a ViCredentialStoreItem to securely store your username and password.
# 2) Call 'Connect-VCs' to open simultaneously connections to all the vCenters in your environment.
# 3) Do PowerCLI things.
# 4) Call 'Disconnect-VCs' to cleanly close all ViServer connections because housekeeping.
$vCenterList = @("vcenter1","vcenter2","vcenter3","vcenter4")