Skip to content

Instantly share code, notes, and snippets.

@boltronics
boltronics / vga
Created May 7, 2012 04:55
Mount VirtualBox Guest Additions to current Vagrant instance.
#!/bin/bash
#
# Adam Bolte <[email protected]>
#
# Description:
# Mount VirtualBox Guest Additions to current Vagrant instance.
declare -r option="${1}"
declare -r attach_to_instance=$(basename $(pwd))
declare guest_additions_iso="/usr/share/virtualbox/VBoxGuestAdditions.iso"
@boltronics
boltronics / vfix
Created May 7, 2012 05:01
Vagrant fix for instances getting stuck on boot due to DHCP failure.
#!/bin/bash
#
# Adam Bolte <[email protected]>
#
# Description:
# Run this if Vagrant gets stuck bringing up an instance due to DHCP failure.
declare -r fix_instance=$(basename $(pwd))
for instance in $(VBoxManage list runningvms | grep ${fix_instance} | \
@boltronics
boltronics / s3_full_region_backup
Created August 16, 2012 06:55
Makes a copy of all buckets in an S3 account, with the prefix being the destination region name (eg. "ap-southeast-1.").
#!/bin/bash
# Adam Bolte <[email protected]>
declare -r dstRegion="ap-southeast-1"
declare -r bucketList="$(s3cmd ls | sed -e 's/.*\ \ s3:\/\/\(.*\)$/\1/' | \
grep -E -v "^(${dstRegion}|s3hub|rightscale)" | xargs echo)"
declare -ri bucketTotal="$(echo ${bucketList} | wc -w)"
declare -r bucketBackupsList="$(s3cmd ls | \
sed -e 's/.*\ \ s3:\/\/\(.*\)$/\1/' | \
grep "^${dstRegion}\." | xargs echo)"
@boltronics
boltronics / steam_bootstrap.sh
Last active December 16, 2015 18:28 — forked from grindars/steam_bootstrap.sh
Steam installer for Debian GNU/Linux
#!/bin/bash
#
# Steam installer for Debian wheezy (32- and 64-bit)
#
# Place into empty directory and run.
#
download() {
local url="$1"
local filename="$(basename "$url")"
@boltronics
boltronics / build_ami
Last active December 18, 2015 15:19
Create Debian GNU/Linux instance-store-backed AMIs with minimum pain. Built Wheezy images well tested. Actual building (execution of this script) also tested on a Wheezy instance.
#!/bin/bash
###### Description
#
# This script creates an instance-backed instance.
#
# Please excuse the lack of error checking for now.
###### Variables
@boltronics
boltronics / mkcert.sh
Created January 29, 2014 06:54
User Signing Certificates for AWS
#!/bin/bash
# Based in instructions here:
# http://docs.aws.amazon.com/IAM/latest/UserGuide/ManagingUserCerts.html
declare -ri key_size=2048
declare -ri days=365
openssl genrsa ${key_size} > private-key.pem
openssl pkcs8 -topk8 -nocrypt -inform PEM -in private-key.pem \
@boltronics
boltronics / experimental-nvidia-amd64
Last active August 29, 2015 14:01
/etc/apt/preferences.d/experimental-nvidia for Debian GNU/Linux Wheezy (amd64 and i386)
Package: libcuda1 libgl1-nvidia-glx libgl1-nvidia-glx-i386:i386 libgl1-nvidia-glx:i386 libgl1-nvidia-glx libnvcuvid1 libnvcuvid1:i386 libnvidia-compiler libnvidia-encode1 libnvidia-encode1:i386 libnvidia-ifr1 libnvidia-ifr1:i386 libnvidia-ml1 libnvidia-ml1:i386 libvdpau1 libvdpau1:i386 nvidia-alternative nvidia-cuda-mps nvidia-driver nvidia-glx nvidia-kernel-dkms nvidia-kernel-source nvidia-opencl-common nvidia-opencl-icd nvidia-settings nvidia-smi nvidia-support nvidia-vdpau-driver nvidia-vdpau-driver:i386 nvidia-xconfig xserver-xorg-video-nvidia
Pin: release a=experimental
Pin-Priority: 950
@boltronics
boltronics / lua_detection.sh
Created May 19, 2014 14:21
Find lua .so name
#!/bin/bash
declare lua_soname
declare -r distro="$(lsb_release -is)"
declare pms
declare package
if [ -n "${distro}" ]
then
@boltronics
boltronics / youtube-dl.conf
Created August 20, 2014 16:17
~/.config/youtube-dl.conf
### Configuration for youtube-dl
### See: https://rg3.github.io/youtube-dl/documentation.html
## Video Selection:
# skip download for matching titles (regex or caseless sub-string)
#--reject-title FistShark
# Try to download the DASH manifest on YouTube videos (experimental)
#!/bin/bash
declare -r vout_dir="${0%/*}"
declare -r time_stamp="$(date +'%Y%m%d%H%M%S')"
declare -r file_name="recording-${time_stamp}"
declare -i capture_x_offset=0
# Check if both monitors are active
if [ "$(xrandr | head -n 1 | sed 's/.*current\ \([0-9]*\)\ .*/\1/')" = "3840" ]
then