Skip to content

Instantly share code, notes, and snippets.

@mcgrew
mcgrew / Colors
Created March 21, 2009 10:14
Allows you to preview colors by moving 3 sliders and gives the hex value for the color you see.
#!/usr/bin/env python
import Tkinter
FONT = ('courier new',24,'bold')
def main():
mainWindow = Tkinter.Tk()
mainWindow.title("Color Preview")
mainFrame = Tkinter.Frame(mainWindow)
@mcgrew
mcgrew / vm
Created March 21, 2009 10:35
A script for running (and listing) virtual machine images with kvm/qemu
#!/bin/bash
DEFAULT_RAM=768;
SNAPSHOT="";
VGA="std";
VMDIR="${HOME}/vm";
VM="qemu-kvm";
#AUDIO_DRV="sdl"
AUDIO_DRV="pa"
RAM=$DEFAULT_RAM;
@mcgrew
mcgrew / .vimrc
Created September 24, 2009 15:25
.vimrc
" .vimrc
" Smart tabbing / autoindenting
set undolevels=100
set nocompatible
set autoindent
set smartindent
set smarttab
" Convert tabs to spaces
"set expandtab
#!/bin/bash
# from http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3
OUT_DIR="./mp3"
[ ! -d ${OUT_DIR} ] && mkdir -p ${OUT_DIR}
# modify the lame options to your
# preference
lame_opts=" --vbr-new -V 2 -B 256 "
pkgname=r-biobase
pkgver=2.6.1
pkgrel=1
pkgdesc="Biobase Library for the GNU R language"
arch=('i686' 'x86_64')
url="http://www.r-project.org/"
license=("Artistic-2.0")
depends=('r')
makedepends=('rpmextract')
source=(ftp://download.fedora.redhat.com/pub/fedora/linux/updates/12/SRPMS/R-Biobase-${pkgver}-1.fc12.src.rpm)
@mcgrew
mcgrew / build.xml
Last active August 7, 2017 03:52
A generic ant build script
<project name="PROJECT_NAME" basedir="." default="default">
<property name="author" value="" />
<property name="vendor" value="" />
<property name="version" value="" />
<property name="pkg_base" value="" />
<property name="jar_dir" value="dist" />
<property name="src_dir" value="src" />
<property name="build_dir" value="build" />
<property name="lib_dir" value="lib" />
<property name="class_dir" value="${build_dir}/class" />
@mcgrew
mcgrew / phonelookup.sh
Created July 7, 2010 18:20
Bash script for phone number reverse lookup
#!/bin/bash
userAgentList=(
"Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.86 Safari/533.4"
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3"
"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16"
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152;"
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727)"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.17) Gecko/20061201 Firefox/2.0.0.17 (Ubuntu-feisty)"
@mcgrew
mcgrew / mirrorlist.sh
Created January 4, 2011 23:39
Generates a new mirrorlist for Arch Linux
#!/bin/bash
curl -s "https://www.archlinux.org/mirrorlist/?country=US&protocol=http&ip_version=4&use_mirror_status=on" | sed -e 's/^#Server/Server/'
@mcgrew
mcgrew / lndupes.sh
Created January 19, 2011 19:57
Removes duplicate files in a directory, replacing them with hard links.
#!/bin/sh
dir=$1
if [ -z $dir ]; then
dir="."
fi;
# create a temporary file name
TMPFILE="/tmp/$(echo -n "$dir" | md5sum | awk '{print $1}' | tr -d '\n')_$(date +%Y.%m.%d.%H.%M)_dupes.txt"
@mcgrew
mcgrew / print_array.php
Created February 15, 2011 15:54
Debugging function for printing a php array in a readable format
<?php
function print_array($array)
{
echo "<div style=\"font-family: 'Courier New', Courier, monospace; font-size: 12px;\">\n";
print_array_recursive($array, '');
echo "</div>\n";
}
function print_array_recursive($array, $prefix)