Skip to content

Instantly share code, notes, and snippets.

View chrisxaustin's full-sized avatar

Chris Austin chrisxaustin

  • Somerville, MA, US
View GitHub Profile
@chrisxaustin
chrisxaustin / findjar
Created April 28, 2016 22:04
Bash script for searching jars under a set of directories
#!/bin/bash
# Usage: findjar <class name or pattern> <directories>
# Example: findjar StringUtils .
class=$1
shift
for f in `find $* -type f -name "*.jar"`; do
match=$(jar tf $f 2>/dev/null| grep $class);
@chrisxaustin
chrisxaustin / jgrep
Created April 28, 2016 22:06
grep within all .java files within this directory and all child directories
#!/bin/sh
# Usage: jgrep foo
# Searches all java files under the current directory
grep -i "$*" `find . -name '*.java'`
@chrisxaustin
chrisxaustin / log inbound syslog sources
Last active May 10, 2017 17:07
log inbound syslog sources
sudo tcpdump -ntlp port 514 2>/dev/null| perl -ne 'next unless /^IP (.*).[0-9]* >/; print $1,$/ if !$d{$1}++'
@chrisxaustin
chrisxaustin / gpom
Created June 20, 2016 21:04
gpom - grep within pom.xml in this directory and in subdirectories
#!/bin/sh
grep $* pom.xml */pom.xml
@chrisxaustin
chrisxaustin / dns-fix
Created June 20, 2016 21:05
osx - reload dns service
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.discoveryd.plist
@chrisxaustin
chrisxaustin / tshark-syslog
Last active October 5, 2023 14:35
tshark - extract src and syslog message
# To read foo.pcap
tshark -ln -r foo.pcap -q -d udp.port==514,syslog -T fields -E separator=" " -e ip.src -e syslog.msg
# To listen on eth0
tshark -ln - eth0 -q -d udp.port==514,syslog -T fields -E separator=" " -e ip.src -e syslog.msg
# To listen on eth0
tshark -ln -i eth0 -q -d udp.port==17019,syslog -T fields -E separator=" " -e ip.src -e syslog.msg -f 'udp port 17019'
# Older versions supported this syntax:
tshark -ln -i eth0 -q -d udp.port==17019,syslog -T fields -E separator=" " -e ip.src -e syslog.msg udp port 17019
@chrisxaustin
chrisxaustin / lsof-deleted
Created May 18, 2017 16:06
lsof command to show deleted files
lsof -a +L1 / | grep deleted | wc -l
@chrisxaustin
chrisxaustin / headers.py
Created April 20, 2018 16:10
Salt module to clean out /boot and call pkg.autoremove
import logging
import os
from glob import glob
from distutils.version import LooseVersion
log = logging.getLogger(__name__)
def __virtual__():
'''
Restrict this to Ubuntu minions
@chrisxaustin
chrisxaustin / start minikube
Last active January 9, 2019 15:17
start minikube on windows with hyper-v
minikube start --vm-driver hyperv --hyperv-virtual-switch "minikube" -v=10
# Also needed to add an external "minikube" virtual switch
# Network performance was poor until I updated my wireless network driver