Skip to content

Instantly share code, notes, and snippets.

@zed9h
zed9h / raw-partition-vmdk.sh
Created May 11, 2010 15:33
VirtualBox using a RAW partition on a MacBook with BootCamp: Snow Leopard and Ubuntu 9.10
#!/bin/bash
# as far as I can remember, this is the procedure for creating a vmdk:
mkdir -p /var/root/Library/VirtualBox/HardDisks
VBoxManage internalcommands createrawvmdk -filename /var/root/Library/VirtualBox/HardDisks/ubuntu.vmdk -rawdisk /dev/disk0 -partitions 1,3,4,5 -register
dd if=/dev/disk0 of=/var/root/Library/VirtualBox/HardDisks/ubuntu-pt.vmdk bs=512 count=40
@zed9h
zed9h / backup-desktop
Created April 24, 2010 18:48
backup/mirror one or more dirs, with progress bar and logging
DISK=sdc
PART=$(grep $DISK[0-9] /proc/partitions | sed -n "s/.*[0-9][0-9] $DISK\([0-9]\+\)/\1/p")
for i in $PART
do
grep -q $DISK$i /proc/mounts || { mkdir -p /mnt/$DISK$i && mount /dev/$DISK$i /mnt/$DISK$i ; }
done
DEV=$(df | grep $DISK | sort -rn -k 4 | head -1 | awk '{ print $1 }')
for i in $PART
@zed9h
zed9h / regression-virtuoso.sh
Created April 13, 2010 03:19
[WIP] openlink virtuoso regression test script
#!/bin/bash
for t in test/*.isql
do
for v in /usr/local/virtuoso-opensource*
do
echo -n "$t $v "
killall virtuoso-t &> /dev/null
for i in 1 2 3 4 5 6 7 8 9 ; do pidof virtuoso-t &> /dev/null || break ; sleep 1 ; done
killall -9 virtuoso-t &> /dev/null
@zed9h
zed9h / track-upload.sh
Created February 17, 2010 15:41
track file upload progress on firefox or any other single-threaded linux browser
#!/bin/bash
export FILE=$1
export BROWSER=firefox
export PID=$(ps aux | sed -n "/grep/d;s/^$USER *\([0-9]\+\) .*\<$BROWSER.*/\1/p")
export FD=$(ls -l /proc/$PID/fd/ | sed -n "s/.* \([0-9]\+\) -> [^ ]*$FILE$/\1/p") # FIXME convert file to pattern
watch "cat /proc/$PID/fdinfo/$FD | sed -n 's/pos:\t//p' ; stat -L /proc/$PID/fd/$FD -c %s"
@zed9h
zed9h / .Xresources
Created January 5, 2010 03:13
Ubuntu 9.10 and ArchLinux config (Fluxbox 1.1.1-2 and others)
*.foreground: grey90
*.background: black
!*.faceName: DejaVu Sans Mono
!*.faceSize: 10
*.charClass: 35:48,36-38:48,40-43:48,43:48,45-47:48,58:48,61:48,63-64:48,92:48,95:48,126:48
*.scrollTtyOutput: false
*.scrollKey: true
*.saveLines: 5000
@zed9h
zed9h / oraclient.pl
Created October 30, 2009 23:35
simple SQL client to Oracle
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use DBD::Oracle;
use Text::ASCIITable;
use Term::ReadLine;
my $dbh;
BEGIN {
@zed9h
zed9h / dh-ddns.sh
Created October 10, 2009 23:28
DreamHost Dynamic DNS script for OpenWRT
#!/bin/sh
# DreamHost Dynamic DNS script for OpenWRT
# by Rodrigo Damazio <[email protected]>
# updated by Kyle Bassett <[email protected]>
# ported by Carlo 'zED' Caputo <[email protected]>
[email protected]
PASS=xxxxxx
ACCOUNT=123456
@zed9h
zed9h / virtuoso_sparql.user.js
Created October 10, 2009 01:02
Greasemonkey to improve the Virtuoso's SPARQL endpoint form
// ==UserScript==
// @name virtuoso sparql
// @namespace http://*/sparql
// @description melhorar a tela de query sparql do virtuoso
// @include http://*/sparql
// ==/UserScript==
document.getElementById("query").rows = 22;
document.getElementById("header").style.display = "none";
var e = document.getElementById("main").firstChild;
@zed9h
zed9h / cruisecontrol-flipcolors.user.js
Created July 22, 2009 04:15
greasemonkey script to invert colors of cruise control builds view every 7 seconds
// ==UserScript==
// @name cruisecontrol-flipcolors
// @namespace cruisecontrol-flipcolors
// @description invert colors of cruise control builds view every 7 seconds
// @include http://*cruisecontrol*/dashboard/tab/builds
// ==/UserScript==
function addGlobalStyle(css) {
var head, style;
head = document.getElementsByTagName('head')[0];
@zed9h
zed9h / sql_client.asp
Created July 18, 2009 20:08
asp vb sql client, configured to access mdb
<% option explicit %>
<%
' TO DO:
' - remove navigation and col '#' in forwardonly recsets (e.g. sp_help (?)
' - use RS.NextRecordset for multiple queries, instead of GO
on error resume next
'---- CursorTypeEnum Values ----
Const adOpenForwardOnly = 0
Const adOpenKeyset = 1