I've been using Linux for almost a decade now, so over the
years I've collected a number of digital notes on various
issues. Some of them could be out of date - they are
here mostly as an online reference for myself, but they may
also prove useful to others...

Simply add this line:
custom colors: ON,tridx:0000,colors: 000000,000000,FF0000,000000
in your .idx file. You might have to move the FF from the 3rd to
any of the other 3 values. If in doubt, permute :‑)

I prefer to use Perl regexps instead of grep's. Here is a supergrep
that uses Perl. It supports the '-i', '-n' and '-v' options that grep has (Update:
or you can use pcregrep).

Migrate to a RAID1 config:

My non-RAID config was simple: I had one (and only one!) Linux partition, which was of course,
my root partition: /dev/hda5. After adding a second (and much bigger) drive, I decided
to migrate to a RAID1 configuration. I first used fdisk -u -l /dev/hda, to find out
the size (in sectors) of my partition:

At this point, after a reboot, the kernel identified the /dev/md0 automatically,
and the boot process went fine... Only one thing remained: to add the /dev/hda5 to
the array /dev/md0, and allow it to automatically sync up:

home root# mdadm /dev/md0 -a /dev/hda5
home root# cat /proc/mdstat

The last command showed the process of synchronization. When it finished, my RAID1 setup
was completed. My fears for faulty drives were finally put to rest...

You can find our more examples (e.g. stripe(RAID0) and linear) in
the NTFS documentation that comes with the Linux kernel
(Documentation/filesystems/ntfs.txt) - look at the Device Mapper
section of the file.

Build histogram with Gnuplot:
Starting from a 'stats.txt' file, containing frames per second measurements, this
script will create 'bins' of size 5 (ie. it will accumulate all sample values from 0-5
into bin 1, 5-10 into bin 2, etc) and then plot the bin heights in a histogram.

This is better than spawning autoLogin.py from within cron, for various reasons:
You can attach to the screen (screen -r ...) and see what's happening - and also,
some scripts (e.g. using Python pexpect) may not run properly under cron, even
after setting the env to the same as the normal one (most likely, missing tty-stuff).

CLang,NERDTree,EasyMotion for VIM:
Install NERDtree and EasyMotion, by downloading from http://vim.org and unzip-ing
inside your .vim/ folder. For CLang autocompletion it's the same process,
with the added caveat that under Arch, I had to use the "libclang" based
mode of operation (spawning didn't work for some reason).

Edit /etc/ppp/pap-secrets and /etc/ppp/options
to fill-in the loginname/password info.
In /etc/ppp/pap-secrets add a line:
* * password
and in /etc/ppp/options, add a line:
lock
name loginname
usepeerdns

As is often the case, when I bring some burned CD/DVD
from work, I find out that its bad at some offset.
I came up with this Perl script:
---------------------------------------
#!/usr/bin/perl -w
use strict;
my $i=0;
select((select(STDOUT), $| = 1)[0]);
unlink("data");
system("dd if=/dev/zero of=zero bs=2K count=1");
my $step = 1;
print "Sector: ";
while(1) {
system("dd if=/cdrom/BadSector of=sector bs=2K skip=$i".
"count=1 >/dev/null 2>&1");
if ($? == 0) {
print sprintf("\b\b\b\b\b\b\b\b%08d", $i);
system("cat sector >> data");
$step = 1;
$i += $step;
} else {
system("cat zero >> data");
$step += $step;
$i += $step;
print "\nJumped over $step\nSector: ";
}
}
-----------------------------
With the CD/DVD mounted on /cdrom/, it will slowly but
effectively copy sector by sector of the file mentioned
in the 'dd' line into the file called 'data'. Reading
sector-sector proves to be enough to correct a multitude
of read-errors on my DVD reader, but even if that isn't
enough, it will quickly jump over the problem areas
in the DVD, writing blank 'sectors' to mark the jumps.
After that, rsync can save the day:
rsync -vvv -B 131072 -e ssh \
login@xxx.yyy.zzz.kkk:/path/todata data

Connect to the BSD console over a null cable:

slattach -p slip -s 19200 /dev/ttyS0 &
ifconfig sl0 192.168......

Password-less logins through SSH:
To allow no-password logins to a target account, (say, root :‑), you must add
the public key of the account you will login from, into the target
account's .ssh/authorized_keys file. To create the public/secret key pair
on the source account, use

ssh-keygen -t dsa -b 1024

To avoid break-ins if someone steals your private key, use a passphrase
when creating the key pair, and use ssh-agent to only type the passphrase
once per boot.

First, take a backup of all files in that partition, as the
undeletion process WILL mess up all existing files!
Then,
reiserfsck --rebuild-tree -S \
-l /var/tmp/recovery.log /dev/hda2
where /dev/hda2 is of course your own partition...

The comments on this website require the use of JavaScript. Perhaps your browser isn't
JavaScript capable or the script is not being run for another reason. If you're
interested in reading the comments or leaving a comment behind please try again with a
different browser or from a different connection.