HOWTO: Create VirtualBox Image from Disk

VirtualBox.png

Not quite sure what to backup from a computer I am currently fixing I decided to turn a virus laden XP install into a VirtualBox image on my desktop machine at home.

Enter dd, ssh, and VirtualBox.

After a little reading I came up with this single line to extract the live image from the disk, move it to my desktop machine, and convert it to a 20G VirtualBox image.  First I booted from a live disc, mounted the drive I wanted and ran the following:

sudo dd if=/dev/hda | ssh user@xxx.xxx.xxx.xxx vboxmanage convertdd stdin virusxp.vdi 21474836480

Now upon return if they find I’ve missed anything I can just boot it up and retrieve it for them, and after a month or so after they’ve verified they’re happy with it, just easily delete the machine.

Disable IPv6 in Arch Linux

Archlinux-icon.png

Since Arch’s official kernel26 package 2.6.16.2-1, IPv6 is no longer compiled directly into the kernel, but as a module. Many don’t require the features, and may benefit from added performance (many programs will query IPv6 addresses first, unaware that you don’t have an IPv6 connection) and free memory (250k, that’s a mighty big module).

The ipv6 module is loaded at boot. There are many programs which will load the ipv6 module if they detect that it’s available. In fact, they’re loading net-pf-10, which is an alias to ipv6. Adding the following line to /etc/modprobe.d/modprobe.conf will disable the automatic loading of ipv6, while also allowing you to load it manually, if needed.

# disable autoload of ipv6
alias net-pf-10 off

Increase mplayer’s volume by 300%

mplayer.png

Some videos you download might not have such a high audio volume, even with alsamixer set to 100%. There’s a trick for this. Start your video with

mplayer -softvol -softvol-max 300 video_file.avi

or

mplayer some.avi -aop volume:volume=300

to boost your volume 300%. Substitute 300 with any number ranging from 10 to 10000. Be careful not to break your speakers.

Source

Set wallpaper with Feh in Openbox menu

openbox.png

Create a entry in Openbox menu with:

feh --rcfile /home/me/.fehrcwall "/home/Me/MyWallpaper"

And create a file with name

.fehrcwall

and put in your Home.

This file is a copy of .fehrc with simple change. Just put this:

# Set the default feh options to be recursive and verbose
feh -qrNA "feh --bg-scale "%f"" --title "Wallpaper" -g 320x240

Now, when you click in openbox menu, an image will appear in small window. You can navigate with your mouse scroll wheel or left/right arrows.  To se the wallpaper  just press Enter.

User NERDtree to browse files from vim

vim.png

The NERD tree allows you to explore your filesystem and to open files and directories. It presents the filesystem to you in the form of a tree which you manipulate with the keyboard and/or mouse. It also allows you to perform simple filesystem operations.

Download NerdTree Here.

Install

Unzip the archive into your ~/.vim directory.
That should put NERD_tree.vim in ~/.vim/plugin and NERD_tree.txt in ~/.vim/doc.

Use retty in screen to attach already running applications

gnu.png

Ever left some longer running script/process/something at home and than wished you could control it via ssh and it wasn’t started in a screen session? Fear not, retty is here to rescue! To demonstrate this:

$ irssi
# switch to new terminal
$ screen -S irssi
$ retty `pgrep irssi`
/redraw

To explain what is going on here, first we start a normal application in one terminal, this could be any other thing, like a script doing heavyweight processing. In the new terminal we start the screen session, this is an optional step, it allows us to be able to later on detach/reattach the session at will. Inside the screen session we hijack the irssi PID. The last step, /redraw is only necessary because we are dealing with complex ncurses stuff which does weird stuff when it’s in operation . For the same reason you have to run “reset” in the first terminal if you want to keep using it normally. This by itself isn’t really useful, however you can use the exact same procedure to reattach something via ssh.

Chat with AIM, MSN, Gtalk, and Yahoo through Irssi with bitlbee

bitlbee.png

Bitlbee is a “console-based IRC to IM chatting gateway, including ICQ/MSN/Jabber”. Basically, it allows the user to interact with popular chat networks (ICQ, MSN, Jabber, AIM, YIM) within their IRC client.

The users’ buddies appear as normal IRC users in a channel and conversations use the private message facility of IRC.

Continue reading ‘Chat with AIM, MSN, Gtalk, and Yahoo through Irssi with bitlbee’ »

How to have Gnu Screen display number of updates for Arch linux

Archlinux-icon.png

1.   sudo vim /etc/cron.hourly/pacmansy

2.  and place this within

pacman -Sy

3.  then :wq the file and make it executable:

chmod a+x /etc/cron.hourly/pacmansy

4.   vim ~/bin/getupdates.pl

and place this within:

#!/usr/bin/perl
use strict;
use warnings;
print ((`pacman -Qu` =~ m/^[^\s]+\s\((\d+)\):/m) ? $1 : 0);

5.  vim ~/.screenrc and do this:  (relevant parts are bolded)

caption always “%{= KW}%-w%{= Gk}%n %t%{-}%+w %-=”

hardstatus alwayslastline “%{= kW} %-= %{= kC}Session:%u%{= kW} %5` | %{= kC}Host:%{= kW} %H | %1` |%{= kC} MEM:%{= kW} %2`MB /%{= kC} SW: %{= kW}%3`MB | %{= kC}Unread %{= kW}%4` | %{kC}Updates:%{kW} %7` | %m/%d %c”
#Backticks to display information in status bar
backtick 1 60 60 /home/username/bin/get_uptime
backtick 2 60 60 /home/username/bin/get_freemem
backtick 3 60 60 /home/username/bin/get_freeswap
backtick 4 60 60 /home/username/bin/get_gmail
backtick 5 60 60 /home/username/bin/get_sessionname
backtick 7 60 60 perl /home/username/bin/get_updates.pl

Now run screen and the number of updates awaiting for you in pacman should be displayed.  Enjoy.

Manually mount a USB flash drive in Linux

tux.png

I recently got hold of a 1 GB USB memory stick. It is a Kingmax 1 GB flash drive (U201G – U2GMHDWG) which is (believe it or not), half the size of my little finger. In fact, it is so small that there is a good chance I might misplace it somewhere if it was not tethered to a chain. Anyway, the USB stick has a FAT partition on it and contain some data which I wanted to access in GNU/Linux. I was using Ubuntu and it straight away detected the device as soon as I inserted it and it was automatically mounted in the /media/USB DISK location.

But when I tried to mount it in a bare bones Linux distribution (a distribution which has just enough software as is needed), it was not mounted automatically. This is because the auto mounting takes place by means of a program known as hotplug which detects the USB device that is inserted in real time and then mounts it in the desired location.
Continue reading ‘Manually mount a USB flash drive in Linux’ »

Shell Script To Rename File Name To Lowercase

terminal.png

This script use tr command to convert uppercase file name to a lowercase file name. The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters.

Continue reading ‘Shell Script To Rename File Name To Lowercase’ »

Pages: Prev 1 2 3 ...6 7 8 9 10 ...63 64 65 Next