Skip to content

Instantly share code, notes, and snippets.

@pgwillia
pgwillia / gist:5961568
Created July 9, 2013 21:45
find Linux OS and version
cat /etc/redhat-release
cat /etc/issue
@pgwillia
pgwillia / archive_4deep.sh
Created July 26, 2013 17:06
To archive directories 4 deep
find . -mindepth 4 -maxdepth 4 -type d -exec tar cvzf $(basename {}).tar.gz -C {} . \;
@pgwillia
pgwillia / git_clone.template
Created July 29, 2013 16:23
How to clone a private repository where username/password is required
git clone https://username:password@github.com/username/repository.git
@pgwillia
pgwillia / xwindows_cygwin.sh
Created August 27, 2013 22:23
start X in cygwin
startxwin
DISPLAY=localhost:0.0
export DISPLAY
ssh -X yourserver
@pgwillia
pgwillia / unarchive_4deep.sh
Created August 27, 2013 22:26
To unarchive directories 4 deep. (The inverse of archive_4deep.sh)
find -name *.tar.gz -exec bash -c 'sudo mkdir -p $(dirname {})/$(basename {} .tar.gz) && sudo tar zxf {} -C $(dirname {})/$(basename {} .tar.gz)' \;
@pgwillia
pgwillia / LogDIH.js
Last active June 20, 2019 15:09
how to log in Solr DIH ScriptTransformer
function transformer(row){
var log = java.util.logging.Logger.getLogger("transformer");
var LEVEL = java.util.logging.Level.INFO;
log.log(LEVEL, "hello world")
}
@pgwillia
pgwillia / verify-packages.sh
Created December 19, 2013 22:39
Verify that your installed packages are still intact
rpm -V -a # to verify all
debsums -l | grep -v dbgsym
@pgwillia
pgwillia / inaccessible_vagrant.sh
Last active December 31, 2015 22:59
Unregister inaccessible vms
# get list of registered vms
VBoxManage.exe list vms
# unregister the inaccessible
VBoxManage.exe unregistervm <uid>
# get list of running vms
VBoxManage.exe list runningvms
# gets the status of the VMs Vagrant knows about
@pgwillia
pgwillia / gist:8545452
Created January 21, 2014 18:30
Where is a directory mounted?
df -P file/goes/here | tail -1 | cut -d' ' -f 1
@pgwillia
pgwillia / benchmark.sh
Last active August 29, 2015 13:55
calculates average qtime and counts errors from a Tomcat log file
#!/bin/bash
# calculates average qtime and counts errors from a Tomcat log file ($CATALINA_HOME/logs/catalina.out)
if [ -z "$1" ] ; then
echo "requires a Tomcat log path"
exit 1
fi
grep -v "^map entry" $1 | paste - - |
awk -v start="$2" -v end="$3" 'BEGIN{