Posts from 2010-12

Secureley Erase Data

I have an old hard disk and I want to waste it. So I want to make sure there is no data left on the device:

  • shred
  • wipe

Overwrite the hard disk /dev/sdd using 1 run:

sudo shred -vn 1 /dev/sdd

A fast alternative:

sudo sh -c 'cryptsetup -d /dev/urandom -c aes-xts-plain...

Read on

Change the date of WordPress posts in an SQL Mass Update

When I programatically added most of the blog posts in this blog, I forgot to adjust the date and time of each post to its actual age. So I decided to set it via SQL directly in the database.

First I worked out a SELECT query to filter all the entries...

Read on

HowTo use the WP-PostRatings Plugin with the Suffusion Theme

http://www.aquoid.com/forum/viewtopic.php?f=4&t=2585

Make the file wp-content/themes/suffusion/single.php writable by running chmod 666 wp-content/themes/suffusion/single.php and go the the URL of your blog that ends with /wp-admin/theme-editor.php?file=/themes/suffusion/single.php&theme=Suffusion&dir=theme. Now look search the line with the content <?php suffusion_before_end_post(); ?> and add the following line below:

        <span...

Read on

Install WordPress on Ubuntu (Including Markdown Markup Support)

http://wordpress-deutschland.org/download/englisch/
http://www.weblogmatrix.org/show/Wordpress

cd /var/www/
wget http://wordpress.org/latest.tar.gz
tar -xf latest.tar.gz
rm latest.tar.gz

Markdown for Wordpress

http://michelf.com/projects/php-markdown/
also nice but not working yet (at least on my installation): http://brettterpstra.com/code/markdown-quicktags/

Markdown is a great markup language for publications such as technical blogs as it keeps the structure of the text very readable, is...

Read on

calculate pi to a 1000 digits

http://alien.slackbook.org/blog/calculating-pi/

Here is a shell / Bash script that calculates Pi to 1000 digits:

bc -l <<< 'scale=1000; 4*a(1)'
# which is shorter than the equivalent
echo "scale=1000;4*a(1)" | bc -l

One more calculation using bc: the golden ratio to 10 digits:

bc -l...

Read on

control BOINC using the CLI boinccmd

http://boinc.berkeley.edu/wiki/Boinccmd_tool

boinccmd --join_acct_mgr bam.boincstats.com user PASSWORD

If you get Authorization failure: -155 errors all the time, search for files named gui_rpc_auth.cfg and delete them if they are outside the /etc or /var directory.

...

Read on

Launch Ubuntu 10.10 maverick in the EC2 cloud

https://help.ubuntu.com/community/EC2StartersGuide
http://alestic.com/
http://uec-images.ubuntu.com/maverick/current/

sudo apt-get install ec2-api-tools
ec2-describe-regions
cat <<'EOM' >~/.bashrc
######## modifications by Philipp Klaus:
export EC2_URL=http://ec2.eu-west-1.amazonaws.com
export EC2_PRIVATE_KEY=$HOME/.ssh/amazon-x509_pk-ODKN47NWKLVFADJVDU2PJUEIFHLZSGFJ.pem
export EC2_CERT=$HOME/.ssh/amazon-x509_cert-ODKN47NWKLVFADJVDU2PJUEIFHLZSGFJ.pem
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
EOM
ec2-authorize default -p 22
ec2-run-instances ami-29b0855d --instance-type t1.micro --region eu-west-1 --key mykey
ec2-add-keypair ec2-keypair > amazon-ec2-keypair.pem
chmod 600 amazon-ec2-keypair.pem
ec2-describe-instances

you may now log in using

ssh -i ./amazon-ec2-keypair.pem ubuntu@ec2-46-1-198.eu-west-1.compute.amazonaws.com
...

Read on

Boot Info Script

T get the boot_info_script, run:

cd ~/Downloads
wget http://sourceforge.net/projects/bootinfoscript/files/bootinfoscript/0.55/boot_info_script055.sh/download -O boot_info_script.sh

To execute the boot_info_script and thus get information about your bootable partitions etc., run:

sudo bash ~/Downloads/boot_info_script.sh

Resources

...

Read on

Convert a String of Hex Values to its Binary Representation Using sed

Suggest you have data in a hex format that you want to convert back to binary (like an MBR) with newline characters in the middle:

eb58904d53444f53352e300002082200
0200000000f800003f00ff0000000000
0000f000e33b00000000000002000000
01000600000000000000000000000000
00002918d163804e4f204e414d452020
2020464154333220202033c98ed1bcf4
7b8ec18ed9bd007c884e028a5640b408
cd137305b9ffff8af1660fb6c640660f
b6d180e23ff7e286cdc0ed0641660fb7
c966f7e1668946f8837e16007538837e
2a007732668b461c6683c00cbb0080b9
0100e82b00e94803a0fa7db47d8bf0ac
84c074173cff7409b40ebb0700cd10eb
eea0fb7debe5a0f97debe098cd16cd19
6660663b46f80f824a00666a00665006
53666810000100807e02000f852000b4
41bbaa558a5640cd130f821c0081fb55
aa0f851400f6c1010f840d00fe4602b4
428a56408bf4cd13b0f9665866586658
6658eb2a6633d2660fb74e1866f7f1fe
c28aca668bd066c1ea10f7761a86d68a
56408ae8c0e4060accb80102cd136661
0f8254ff81c300026640490f8571ffc3
4e544c44522020202020200000000000
00000000000000000000000000000000
00000000000000000000000000000000
0000000000000000000000000d0a5265
6d6f7665206469736b73206f72206f74
686572206d656469612eff0d0a446973
6b206572726f72ff0d0a507265737320
616e79206b657920746f207265737461
72740d0a0000000000accbd8000055aa

Like this you can convert it back to its binary content:

cat datafile.txt | echo -n -e $(tr -d '[:space:]' | sed 's/../\\x&/g')

Resources

  • <a...

Read on