start Ubuntu in text mode only

A short command on how to change Ubuntu so that it will only start in text mode, no X11 (graphical) mode. The following removes the graphical greeter from the runlevels :

sudo update-rc.d -f gdm remove

Write a disk full with files with random or zero data

I wanted to test a hard-drive that halted when its internal temperature raised above its safety level. hdparm is one option but the script below creates different files with a certain given size.

#!/bin/bash
COUNTER=0
while [ true ]; do
dd if=/dev/zero of=file$COUNTER bs=$1 count=1024
let COUNTER=COUNTER+1
done

You can replace /dev/zero with /dev/random if you want random data. Call the script with one argument, the file size.

Set the default height and width of a gnome-terminal

Launch it with gnome-terminal –geometry 135×30 (edit the menu or create a new launcher).

Adjust the launchsettings in ~/.xbindkeysrc

“gnome-terminal –geometry 135×30”
  m:0x10 + c:116

Show comment box / comments on a WordPress Page

Just include this in your theme / template for the WP-pages :
 <?php comments_template(); ?>

If you’re not happy with the default then just edit the file comment.php

WordPress, printing ParentChild menus

Worpress allows you to print parent menu’s with different child-menus. Implementation is easy, just add this to your themes.

In the file that creates the header of your page, normally header.php, add this code:

     <?php   $args = array(
            'title_li' => '',
            'sort_column'=>'menu_order',
            'depth' => 1
                  );
    wp_list_pages($args);
    ?>

Then in the file that creates your child menu (normally this should be sidebar.php) add this code:

   <?php
  if($post->post_parent) {
    $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
  }
  else {
    $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
  }
  if ($children) { ?>
    <ul>
      <?php echo $children; ?>
    </ul>
  <?php } ?>

The selected menus are li.current_page_parent and li.current_page_item so you should adjust their style in your stylesheet.