Skip to content

Instantly share code, notes, and snippets.

@velenux
velenux / raid1-from-single-disk.sh
Created January 11, 2011 13:56
Build and verify a raid1 array from a single disk
# format disk1, partition type fd
cfdisk /dev/vda
# copy partition table from disk1 to disk2
sfdisk -d /dev/vda | sfdisk /dev/vdb
# check partitions
fdisk -l 2>/dev/null | grep -B1 '^\/dev'
# build array with only disk1
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/vda1 missing
# check array
cat /proc/mdstat
@velenux
velenux / ati-streams-f13.patch
Created January 11, 2011 08:10
Patch for compiling ATI Streams SDK 2.3 on Fedora 13 64bit
diff -rupN ati-stream-sdk-v2.3-lnx64/samples/opencl/cl/app/BoxFilterGL/Makefile ati-stream-sdk-v2.3-lnx64-patched/samples/opencl/cl/app/BoxFilterGL/Makefile
--- ati-stream-sdk-v2.3-lnx64/samples/opencl/cl/app/BoxFilterGL/Makefile 2010-12-07 07:27:48.000000000 +0100
+++ ati-stream-sdk-v2.3-lnx64-patched/samples/opencl/cl/app/BoxFilterGL/Makefile 2011-01-11 08:17:52.575903890 +0100
@@ -24,6 +24,8 @@ CLFILES = BoxFilterGL_Kernels.cl
IMAGES = BoxFilterGL_Input.bmp
LLIBS += SDKUtil
+LLIBS += GL
+LLIBS += GLU
@velenux
velenux / howmany-today.sh
Created January 4, 2011 20:23
how many files today?
#!/bin/bash
FILES=$(find -name '*.ref' -ctime -1 -print)
N_FILES=$(find -name '*.ref' -ctime -1 -print|wc -l)
TIMESTAMP=$(stat -c %y $FILES | cut -b1-16 | sort | tail -n1)
DATE=${TIMESTAMP:0:10}
TIME=${TIMESTAMP:11:16}
echo $DATE $N_FILES files last $TIME
@velenux
velenux / watir-begin-rescue.rb
Created December 30, 2010 09:25
Watir begin/rescue encapsulation for teh lazy
class Element
attr_reader :description, :id, :xpath, :name, :value, :text
def initialize(opts={})
@description = opts[:description] || nil
@id = opts[:id] || nil
@xpath = opts[:xpath] || nil
@name = opts[:name] || nil
@value = opts[:value] || nil
@text = opts[:text] || nil
#!/usr/bin/perl
use strict;
use warnings;
my %rows;
my %published;
my $files_examined = 0;
# populate rows hash
#!/bin/bash
SRC=/home/velenux/c0ding/ # lots of small files, and some bigger ones mixed in
DEST=$1/velebench/
echo "Starting test: "
echo " - SRC: ${SRC}"
echo " - DEST: ${DEST}"
echo ""
root@ubuntu:/mnt/foodisk/benchmarks# grep -A3 real results-*
results-btrfs-sda+mmc-relatime,ssd.txt:real 12m31.455s
results-btrfs-sda+mmc-relatime,ssd.txt-user 0m58.168s
results-btrfs-sda+mmc-relatime,ssd.txt-sys 6m29.516s
results-btrfs-sda+mmc-relatime,ssd.txt-
--
results-btrfs-sdaonly-relatime,ssd_spread.txt:real 13m28.983s
results-btrfs-sdaonly-relatime,ssd_spread.txt-user 0m58.176s
results-btrfs-sdaonly-relatime,ssd_spread.txt-sys 6m31.064s
results-btrfs-sdaonly-relatime,ssd_spread.txt-
# encoding: utf-8
require 'rubygems'
require 'net/ping'
hosts = ['www.google.com',
'www.deviantart.com',
'www.facebook.com',
'www.twitter.com',
'www.yahoo.com',
<html>
<head>
<title>Simple javascript timed output</title>
<script language="Javascript">
var delay = 1000; // 1 second delay
function writeOut() {
// get content via xml http request or whatever
root@hiphop:~/wordpress3# gdb $HPHP_HOME/src/hphpi/hphpi
GNU gdb (GDB) 7.1-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...