The Road to Elysium

November 26, 2009

Removing your Master Boot Record (MBR)

Filed under: Snippets — jorge @ 09:42

Removing MBR (including the partition table):

# dd if=/dev/null of=/dev/sdX bs=512 count=1

Removing MBR (excluding the partition table):

# dd if=/dev/null of=/dev/sdX bs=446 count=1

sdX is the device you want to remove the MBR of (like a USB-stick).

August 31, 2009

Generate a htpasswd password without installing Apache

Filed under: Snippets — jorge @ 16:23

A oneliner with Perl does the trick:

$ perl -le 'print crypt("password", "salt")'

Your htpasswd-file should then look like so:

UserName:EncryptedPassword:YourComment

August 13, 2009

How to join multiple .avi or .mpg files – part two

Filed under: Snippets — jorge @ 09:41

25th of May 2008 I wrote a post about how you could join multiple files that looked something like movie.avi.001, movie.avi.002 and so on. I found a new tool that does the job a bit easier, lxsplit. The syntax of lxsplit is like so:

[jorge@ashitaka ~]$ lxsplit 
LXSplit v0.2.4 by Richard Stellingwerff, O. Sezer.
Home page: http://lxsplit.sourceforge.net/
 
Usage: lxsplit [OPTION] [FILE] [SPLITSIZE]
 
Available options:
 -j : join the files beginning with the given name
 -s : split the given file.  requires a valid size
Splitsize examples: 15M, 100m, 5000k, 30000000b
 
Examples:
	lxsplit -s hugefile.bin 15M
	lxsplit -j hugefile.bin.001

So to join all our files, we execute:

$ lxsplit -j movie.avi.001

And it will join all files named movie.avi.00{1,2,3} and so on. :)

July 24, 2009

Converting an avi to the Nokia E71 size

Filed under: Snippets — jorge @ 08:09

This is a oneliner to convert an avi-file to the correct dimensions of a Nokia E71. The screen is small, but sure beats to buy an iTouch if your cell already can play movies for you. :)

$ ffmpeg -y -i input.avi -acodec libfaac -ab 72k -s 320x176 -aspect 16:9 -vcodec libx264 -b 300k -qcomp 0.6 -r 25 -qmin 16 -qmax 51 -qdiff 4 -flags +loop -cmp +chroma -subq 7 -refs 6 -g 250 -keyint_min 25 -rc_eq 'blurCplx^(1-qComp)' -sc_threshold 40 -me_range 12 -i_qfactor 0.71 -directpred 3 output.mp4

May 27, 2009

Easy reloading of Varnish

Filed under: Snippets — jorge @ 09:23

A co-worker of mine made a nice little script to make reloading of the default VCL that Varnish uses a bit easier. Not wanting to telnet or use varnishadm manually, this script does the trick. This was taken from http://kristian.blog.linpro.no/2009/02/18/easy-reloading-of-varnish-vcl/:

#!/bin/bash
# Reload a varnish config
# Author: Kristian Lyngstol
 
FILE="/etc/varnish/default.vcl"
 
# Hostname and management port
# (defined in /etc/default/varnish or on startup)
HOSTPORT="localhost:6082"
NOW=`date +%s`
 
error()
{
    echo 1>&2 "Failed to reload $FILE."
    exit 1
}
 
varnishadm -T $HOSTPORT vcl.load reload$NOW $FILE || error
varnishadm -T $HOSTPORT vcl.use reload$NOW || error
echo Current configs:
varnishadm -T $HOSTPORT vcl.list
Older Posts »

Powered by WordPress