Skip to content

Instantly share code, notes, and snippets.

@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 / 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)
@mcgrew
mcgrew / ObjNode.py
Created March 25, 2011 17:02
A python class that mimics javascript object behaviour
class ObjNode( object ):
def __init__( self, value=None ):
object.__init__( self )
self.__dict__[ "value" ] = value
def __setattr__( self, attr, value ):
if ( attr[ 0 ] == '_' ):
self.__dict__[ attr ] = value
elif self.__dict__.has_key( attr ):
@mcgrew
mcgrew / performance.c
Created March 23, 2012 17:04
quick performance tester for testing memory read/write speeds
// To compile: gcc -std=gnu99 -O2 -o performance performance.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define arrcpy(dest,src,size) for(size_t zz=0;zz<size;zz++)dest[zz]=src[zz]
#define dalloc(size) (test_t*)malloc(sizeof(test_t)*size)
@mcgrew
mcgrew / linux-ralus.patch
Last active October 12, 2015 06:48
Patch for the linux kernel to maintain compatibility with Symantec Remote Backup Agent (ralus)
diff --git a/net/core/dev.c b/net/core/dev.c
index e5942bf..c2461b1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5262,6 +5262,9 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
* Not applicable in our case */
case SIOCSIFLINK:
return -ENOTTY;
+ /* For SYMANTEC BACKUP AGENT */
+ case SIOCGIFCOUNT:
@mcgrew
mcgrew / filter.py
Created March 16, 2011 15:16
Some 1d & 2d fft filters
"""
filter.py
Author: Thomas McGrew
License:
MIT license.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
@mcgrew
mcgrew / colors.sh
Created January 4, 2013 19:20
Script which prints out a chart of the ANSI color codes, showing their appearance
#!/bin/bash
#
# This file echoes a bunch of color codes to the
# terminal to demonstrate what is available. Each
# line is the color code of one forground color,
# out of 17 (default + 16 escapes), followed by a
# test use of that color on all nine background
# colors (default + 8 escapes).
#
# Taken from the Bash Prompt HOWTO: