My Toolbox

This page holds some of my useful tools and commands.


generate epoch.

date +%s

convert epoch to human readable time.

# where 11111111 is your epoch
date -d @11111111


# start a screen.
screen -S screen_name
# detach from a screen.
ctrl+a d
# show running screens.
screen -r
# reattach to a running screen.
screen -r screen_name

unlock user account.

pam_tally2 -r -u username

check the exit code of the last command in a linux terminal.

echo $?

fork bomb (DANGER! DO NOT RUN THIS! - it will crash your system)

:(){ :|: & };:

debug core dumps with gdb.

gdb -c core.xxxx
# backtrace
(gdb) bt
# list instructions/code
(gdb) list

find files that were most recently modified.

find . -type f | xargs stat --format '%Y :%y %n' | sort -nr | cut -d: -f2- | head

track installed from an rpm

rpm -ql openvpn

ps1 generator


tcpdump listen for all traffic on port 5000

tcpdump -i eth0 port 5000

tcpdump listen for all traffic from a specific source on port 80

tcpdump -i eth0 src and port 80

tcpdump listen for all traffic on port 80 and write to file to view later in wireshark

tcpdump -i eth0 src and port 80 -w /tmp/server.pcap

read pcap tcpdump file

tcpdump -r /tmp/server.pcap

test ssl

openssl s_client -showcerts -connect

ssl checker

netcat to test connection

nc -znv 443


creates a new line with “newtext” in the line above the matching pattern.

sed '/quartzSchedulerControl/inewtext' /path/to/file

creates a new line with “newtext” 3 lines after the matching pattern.

sed '/quartzSchedulerControl/!{p;d;};n;n;n;a newtext' /path/to/file


Physical Volume

# create the physical volume(s)
pvcreate /dev/xvdf
# show the attributes of the physical volume(s)

Volume Group

# creates volume group called “data” using the physical volume(s) shown
vgcreate data /dev/xvdf
# show attributes of “data” volume group
# show attributes of “data” volume group
vgdisplay -s
# scan physical volumes

Logical Volume

# create the logical volume named “data” from the “data” volume group
lvcreate --name data --size 99G data (leave 1% out)
# show attributes of the logical volume(s)
# show attributes of the logical volume(s)
lvdisplay -C
# show attributes of the logical volume(s)

Create Filesystem

# create ext4 filesystem on logical volume(s)
mkfs.ext4 /dev/data/data
# create mount point(s)
mkdir -p /data
# mount logical volume(s)
mount /dev/data/data /data/log
# check!
df -h

Add Logical Volumes to /etc/fstab

# add logical volume(s) to /etc/fstab so they are mounted automatically on reboot
echo "/dev/data/data /data ext4 defaults 0 0" >> /etc/fstab


take java thread dump.

jmap -dump:format=b,file=$(hostname).hprof <pid>
kill -3 <pid>


adjusting php-fpm children nginx


remove all containers.

docker rm $(docker ps -aq)

set docker-machine environment.

docker-machine env

find if you are in a docker container.

grep docker /proc/1/cgroup > /dev/null
if [ $? == 0 ]; then
  echo "we're in a docker container!"


After updating vagrant you should also update the guest additions You can find them here:

sudo mv VBoxGuestAdditions_5.0.4.iso /Applications/


undo almost anything with git

pretty format

git log -1 --pretty=format:"%nCommit: %H%nAuthor: %an%nDate: %ad%nTag: %d%nSubject: %s%n%n"

get starred repositories rss pages for a user

curl -s | jq -r .[].html_url | sed 's/$/\/releases.atom/'

rewriting the most recent commit message

git commit --amend


list databases


switch databases

\connect database_name

list all tables in current database


quit / log out



show max connections

show max_connections;

Dev Tool Links

Homebrew -
RescueTime - - tracks your time and productivity
Atom - - desktop editor (plugins: vim mode, markdown, minimap, git diff)
Mou - - markdown editor (now I use the markdown plugin for atom)
shiftit (mac osx) - - window shifting manager
Evernote - - note taking
KeePassX - - encrypted password manager
Virtualbox - - virtual machines
Docker - - containers
Jenkins - - automation
Chef - - configuration management
Ansible - - configuration management
Packer - - image management
Terraform - - infrastructure as code
Requestdiff - - diff’s http requests
HTTP Statuses - - simple list of http status codes
Google Power User - - image of how to use google
rss bot (mac osx) -
EC2 Instances
Disk Inventory X - - graphical way to visualize disk space on your mac
saws - - A supercharged AWS command line interface
ipcalc - brew install ipcalc
jxplorer - - java ldap browser

Fun Stuff

Daniel H.C. Peterson aka dhcp
Bastard Operator From Hell aka BOFH -
ya blew it gif -
I don’t always test my code -
99 problems 0 bitches -
99 little bugs in the code -
John Cena SS -
When someone tells me how to do my job -