tips

Your ATI Radeon very slow on Xorg X server 1.3?

This one has bothered me for a long time. The solution is, of course, simple. But, I still don't understand why was it necessary to force users to search so hard for this piece of information, where all the older X server releases worked OK out of the box?

If you find that after upgrading to X.Org 7.3 your display becomes very slow, and you own ATI Radeon, all you need to do is to put this line in the Device section of your xorg.conf:

Replaying terminal sessions with scriptreplay

OK, this is so cool and sexy, I really don't understand how I didn't find about this earlier. Possibly because it's the recent add-on to the well known script utility?

So, I suppose you all know about script. You type script, do your work, type exit, and you have your complete session logged in the file named typescript. Quite handy if you want to log everything you did in the shell for whatever reasons.

What you might not know is that script has an interesting switch which allows you to also save the exact timing data of the screen output you're capturing. And an additional utility called scriptreplay which can later replay your session in real-time. Like a movie. With perfect timing.

Two ways to force SSL on your website

Two solutions, both to be put in the .htaccess file, when you want to force your website visitors to go through SSL:

Solution A:

RewriteEngine On
RewriteCond %{SERVER_PORT} !443$
RewriteRule ^(.*)$ https://www.example.com/$1 [L,R]

Solution B:

RewriteEngine on
RewriteCond %{HTTPS} !^on$ [NC]
RewriteRule . https://%{HTTP_HOST}%{REQUEST_URI} [L]

Pick whatever solution looks nicer for you.

What to do if you forget root password?

Although this may seem like a small catastrophe to you, it's actually very easy to recover from that situation. What you need to do is to reboot (power on) your system, but on the LILO prompt you should type something like:

LILO: Linux init=/bin/sh rw

Where Linux is the example image name, you should supply the actual data, of course. And same parameters should be provided to GRUB or any other boot loader you might use.

How to grep for IP addresses using the GNU egrep utility

This is an useful regular expression if you're looking for IP addresses:

egrep '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'

Related:
How to sort IP addresses using the GNU sort utility

How to check when Daylight Saving Time (DST) will commence?

Using time zone dumper utility (zdump) like this:

zdump -v /etc/localtime | grep 2007

we can see that:

/etc/localtime Sun Mar 25 00:59:59 2007 UTC = Sun Mar 25 01:59:59 2007 CET isdst=0 gmtoff=3600
/etc/localtime Sun Mar 25 01:00:00 2007 UTC = Sun Mar 25 03:00:00 2007 CEST isdst=1 gmtoff=7200
/etc/localtime Sun Oct 28 00:59:59 2007 UTC = Sun Oct 28 02:59:59 2007 CEST isdst=1 gmtoff=7200
/etc/localtime Sun Oct 28 01:00:00 2007 UTC = Sun Oct 28 02:00:00 2007 CET isdst=0 gmtoff=3600

How to extract contents of an RPM package

Use the following procedure to extract contents of an RPM package:

rpm2cpio package.rpm | cpio -dimv

As the name implies, rpm2cpio takes an RPM package file and converts it to a cpio archive. The -i flag to the cpio command indicates that cpio is reading in the archive to extract files, and the -d flag tells cpio to construct directories as necessary. The -v flag tells cpio to list file names as files are extracted, and the -m flag tells cpio to retain previous file modification times when creating files.

How to sort IP addresses using the GNU sort utility

Need to sort list of IP addresses in shell? Here’s the invocation that works:

sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4

Thanks for this tip goes to Paul Heinlein.

Related:
How to grep for IP addresses using the GNU egrep utility

Syndicate content