Skip to content

Instantly share code, notes, and snippets.

Avatar

Josh Enders joshenders

View GitHub Profile
@joshenders
joshenders / pling.sh
Created Mar 4, 2011
Silly little script to detect when WWAN is being flakey
View pling.sh
#!/bin/bash
# WWAN can be flakey. This script pings your ISP's gateway. After 5 missed
# responses, this script produces an audible bell until the host starts
# responding again.
if [[ "$#" -ne '0' ]]; then
echo "Usage: $0" >&2
exit 1
fi
View vget-hosts
for vmhost in $(get-hosts oak-dev-vmhost); do
echo "$vmhost"
ssh root@$vmhost "virsh list --all" | \
sed -e '
/^\ I.*/d; # Id Name State
/^-.*/d; # ----------------------------------
/^$/d; # <blank lines>
' | \
tr -s ' ' | \
cut -d' ' -f3 | \
@joshenders
joshenders / partscan.sh
Created Aug 31, 2011
NTFS partition scanner
View partscan.sh
#!/bin/bash
start=1048576 # decimal offset of data on drive (past MBR, 1MB)
end=10485760 # decimal offset of data on drive (well past weird '...U...N.b..' structures, 10MB)
image=/mnt/seagate/wd_backup.img
mount=/mnt/wd
for ((offset=$start; offset<=$end; offset++)); do
echo "trying offset: $offset"
status="$(mount -o ro,offset=$offset,loop -t ntfs $image $mount >/dev/null 2>&1; echo $?)"
@joshenders
joshenders / history
Created May 15, 2012
environment variables relating to .bash_history
View history
# Unset bounds on history file. Disk is cheap, unlimited is fine until it's not
# and then rotate
export HISTFILESIZE=
export HISTSIZE=
# Add timestamps to .bash_history
# TODO: find someway to store the current working directory for forensics
export HISTTIMEFORMAT="%d/%m/%y %T "
# The "ignoreboth" setting ignores repeated lines as well as silently discards
@joshenders
joshenders / mdsetup.md
Last active Oct 11, 2015
Create mdraid mirror from an existing Wheezy installation
View mdsetup.md

Create mdraid mirror from an existing Wheezy installation

Throughout this guide, /dev/sda will be referred to as the old drive and /dev/sdb will be referred to as the new drive. If possible, I suggest disconnecting all other disks attached to the system while performing this maintenance.

Prerequisite software

apt-get install mdadm rsync

1. Partition the new drive.

sfdisk -d /dev/sda | sfdisk /dev/sdb 
sfdisk --change-id /dev/sdb 1 DA # change partition-type to, "0xDA" aka "non-fs data" as "linux raid auto" is deprecated
@joshenders
joshenders / gist:3976698
Last active Nov 7, 2015 — forked from vena/gist:2856490
How to install Netatalk 3.1.6 under Debian Wheezy
View gist:3976698

1. Install dependencies

apt-get install automake avahi-daemon build-essential checkinstall db5.1-util db-util git-core libacl1-dev libavahi-client-dev libdb5.1-dev libgcrypt11 libgcrypt11-dev libpam0g-dev libtool pkg-config

2. Download and unpack source

cd /usr/src/
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.1.6.tar.gz
tar -xvzf netatalk-3.1.6.tar.gz
@joshenders
joshenders / gist:3977873
Last active Mar 9, 2016
Install Unreal 2004 on Mac from Demo
View gist:3977873
@joshenders
joshenders / sabnzbdplus.default
Last active Dec 8, 2017
Installing sabnzbdplus on Debian Wheezy from source
View sabnzbdplus.default
# This file is sourced by /etc/init.d/sabnzbdplus
#
# When SABnzbd+ is started using the init script, the
# --daemon option is always used, and the program is
# started under the account of $USER, as set below.
#
# Each setting is marked either "required" or "optional";
# leaving any required setting unconfigured will cause
# the service to not start.
@joshenders
joshenders / virtual_box_hdd.md
Last active Dec 10, 2015
How to solve a "used exclusively by host" error in VirtualBox
View virtual_box_hdd.md

Yanked, from here: https://forums.virtualbox.org/viewtopic.php?f=2&t=24748

1. First, I used 'VBoxManage list usbhost' to get info on the device

VBoxManage list usbhost

VirtualBox Command Line Management Interface Version 3.0.10
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Host USB Devices: