Discover Snippets

joe / Created at Thu Jun 27 12:59:23 CDT 2019
Anonymize IP Addresses in a File

HELP="Usage: ipanon [OPTION…]\n
'IP Anonymizer' removes the last two octets from IP addresses
in text files using 'sed'.

  ipanon                # Start the script normally.
  ipanon -f [ARG]       # Where [ARG] is a text file path. Anonymizes IP addresses in the given file.
  ipanon -h             # Display this help information.
joe / logrotate-test Created at Thu Jun 27 11:05:04 CDT 2019
Test logrotate Configuration
To test what logrotate will do when running the file at "/etc/logrotate.d/nginx" you would enter the following:
    logrotate -dfv /etc/logrotate.d/nginx

To test what logrotate would do NOW rather than if being forced to run you would enter the following:
    logrotate -dv /etc/logrotate.d/nginx
"-d" = debug    "-f" = force    "-v" = verbose
joe / Update All Local Git Branches From Remote Created at Thu Apr 11 04:18:43 CDT 2019
I was having an issue where Atom wouldn't list all the branches in a repository I cloned. This updates every local branch from it's remote tracking branch. Credit to Wookie88 on stackoverflow
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
joe / View Hyper-V Snapshot Merge Status Created at Tue Apr 09 07:47:38 CDT 2019
Run in PowerShell
get-wmiobject -namespace “root\virtualization” -Query “select * from Msvm_ConcreteJob” | Where {$_.ElementName -eq ‘Merge in Progress’}