Skip to content

Instantly share code, notes, and snippets.

@jlongman
jlongman / gulp-my-box.sh
Last active August 29, 2015 14:20
A Linux gulp box
DEV1=eth4
DEV2=eth5
###########################################################################
# install gulp
###########################################################################
apt-get install libpcap-dev
wget http://staff.washington.edu/corey/gulp/gulp.tgz
mkdir -p gulp
cd gulp && tar xvfz ../gulp.tgz
make
@jlongman
jlongman / wireplay_on_freebsd.sh
Created May 11, 2015 21:02
Build wireplay on FreeBSD
WIREPLAY_HOME=~/wireplay
cd /usr/ports/net/libnet11; make install
cd $WIREPLAY/libnids-1.23; ./configure --enable-shared --disable-libglib; make
cd /usr/ports/lang/ruby18; make install
cd $WIREPLAY
# uncomment the lib defn in include/config.h (or workaround)
# in src/wireplay.c, add #include <sys/socket.h>
cat << EOF > makefile.patch
Index: Makefile
===================================================================
@jlongman
jlongman / crun.sh
Created May 11, 2015 19:46
colour code stdout/stderr
#!/bin/bash
echo -en "\033[31m" ## red
eval $* | while read line; do
echo -en "\033[36m" ## blue
echo $line
echo -en "\033[31m" ## red
done
echo -en "\033[0m" ## reset color
@jlongman
jlongman / disk_clean.sh
Created May 11, 2015 19:37
VirtualBox drive cleaner, removes inaccessible references from hard drive management and boxes
#!/bin/bash
################################################################################
# closes all inaccessible drives that are not snapshots, and which dont exist
################################################################################
vboxmanage=VBoxManage
while read rawuuid; do
uuid=`echo $rawuuid| grep -Eo ' [a-f0-9-]+' | grep -Eo '[a-f0-9-]+'`
read rawlocation
location=`echo $rawlocation | grep -o "/.*"`
echo "$uuid" " to " "$location"
@jlongman
jlongman / looper.sh
Created May 11, 2015 19:35
line looper
#!/bin/sh
# use line-lite.sh: https://brianin3d.wordpress.com/2008/05/14/scripting-with-ansi-color-codes/
TMPFILE1=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
TMPFILE2=`mktemp /tmp/${tempfoo}.XXXXXX` || exit 1
while `true`; do
COLS=`stty size | awk '{print $2}'`
eval "$@" > $TMPFILE1
clear;
# diff -W$COLS -y $TMPFILE1 $TMPFILE2
diff --left-column -W$COLS -y $TMPFILE1 $TMPFILE2 | ~/bin/line_lite.sh ".*|.*" bright ".*<.*" green ".*>.*" red