Basic vi tricks

vi - Turning off auto indent

Whenever I paste code into a vi session, it always adds crazy indenting. The easy way around this is to enter the command :set noautoindent. Simple!

vi - indenting a specific number of lines

If you want to indent a set number of lines using vi, try using the command :.,.+10s/^/ /. This will indent 10 lines with a space - or you could use tabs by changing the code to :.,.+10s/^/\t\t\t/.

.

Concatenate split files

Simple shell script to cat two files together

#!/bin/sh
IFS=$'\n'
for direc in films/*
do
if [ -d "$direc" ]
then
echo $direc
for myfile in $direc/*
do
if [ -d "$myfile" ]
then
echo "Its a directory"
else
if [ `echo $myfile | grep -c "Part 2"` = "1" ]; then
filename=`echo $myfile | awk -F '_Part 2' '{print $1}'`
echo "---------------------------------------------------------"
echo "cat $filename.VOB $myfile > $filename"
cat "$filename.VOB" "$myfile" > "$filename"
echo "deleting $filename.VOB"
rm -f "$filename.VOB"
echo "deleting $myfile"
rm -f "$myfile"
echo "mv $filename $filename.VOB"
mv "$filename" "filename.VOB"
echo "---------------------------------------------------------"
fi
fi
done
fi
done

Mount Freenas disks using Ubuntu

Mounting UFS disks from freenas is easy

mount -t ufs -o ufstype=5xbsd,ro /dev/sdb1 /mnt/usb/

Backup using ssh and rsync

Want to backup using rsync over ssh? Try this

rsync -avz -e ssh dirname user@remote:/desired/path

geekBliss Hardware Store

Bringing hardware together

The geekBliss store gathers products and prices from loads of different sources, filtering out PC and console related items, so it you're looking to buy a console or a cable, a PC or a latop, follow the link: geekBliss Hardware store