Skip to content

Instantly share code, notes, and snippets.

@gamefiend
gamefiend / kts.sh
Created March 18, 2014 18:42
kill all tmux sessions
tmux ls | awk {print $1} | cut -d: -f1 | xargs -I{} tmux kill-session -t {}
@gamefiend
gamefiend / mysql-cmp.pl
Created December 5, 2011 16:34
MySQL Statistic Comparison Script
# Mysql Comparison
# Compare two (or three) values pulled from a mysql show status command.
# compare (value 1)/(value 2) or (value 1)/(value 2+ value 3)
# represented by default as a percentage.
# representation coudl be tweaked however.
# also, you might need to tweak mysql commands to use username and password.
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
@gamefiend
gamefiend / qps_mytop.sh
Created January 6, 2012 03:19
Monitoring: grab Queries per second from mytop
PATH=$PATH:/opt/bin/
mytop -b | grep qps | cut -d':' -f 3 | cut -d' ' -f 3
@gamefiend
gamefiend / start_cron_agent.sh
Created January 6, 2012 03:38
Start Cron Agent
#!/bin/sh
# Initalizes ssh agent for use with cron jobs.
# I suggest you use a passphrase!
# Start the cron job agent
/opt/bin/ssh-agent | head -2 > .ssh/agent-info
source .ssh/agent-info
/opt/bin/ssh-add .ssh/cron_key
@gamefiend
gamefiend / ack_exclude_CVS
Created January 6, 2012 11:15
Ack search files excluding CVS files.
ack PATTERN
# seriously, that's it. ack automatically ignores .svn, CVS, binary files, and more from your search. No more useless filtering of your filtering.
@gamefiend
gamefiend / grep_sans_CVS
Created January 6, 2012 11:00
Grep through files excluding CVS files.
grep pattern $(find . -type f | grep -v 'CVS')
@gamefiend
gamefiend / ack_thpppt
Created January 6, 2012 11:29
Best commandline parameter ever
# I guess I am just old enough to really love this.
ack --thpppt
@gamefiend
gamefiend / ack_install_standalone
Created January 6, 2012 11:26
Install ack standalone via curl
curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 !#:3
@gamefiend
gamefiend / bash_top_ten
Created January 6, 2012 13:16
print top ten commands from bash history
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
@gamefiend
gamefiend / dancer
Created May 7, 2012 22:55
Dotfiles
# Dancer aliases to make life easier