Archive for March, 2009

OpenDNS

Mar 28 2009 Published by under Ubuntu,Web

opendns

I needed some good content filtering service (anti-pr0n, anti-phishing, anti-….). So, I googled for “open” (which I do a lot lately when looking for software or services :)), and “dns”. Was taken to OpenDNS and I fell in love with it immediately.

Their site looks really good and displays the most crucial information on a single page, which i like a lot.

I signed up for the account, and this is how I set up my computer to use OpenDNS.

Add OpenDNS nameservers to resolv.conf file

$sudo nano /etc/resolv.conf
# OpenDNS
nameserver 208.67.222.222
nameserver 208.67.220.220

My ISP DNS names are always forced to resolv.conf when I connect to Internet, so I had to protect this file from being overwritten by network manager (i – immutable)

$sudo chattr +i /etc/resolv.conf

Install ddclient (updates IP addresses at dynamic DNS services) on Ubuntu

$sudo apt-get install ddclient

Configure ddclient

$sudo dpkg-reconfigure ddclient
Dynamic DNS service provider: other
Dynamic DNS server: updates.opendns.com
Dynamic DNS update protocol: dyndns2
DynDNS fully qualified domain names: $label //this is actually a network "label" set on the OpenDNS "networks" page
Username for dynamic DNS service: $username
Password for dynamic DNS service: $password
Interface used for dynamic DNS service: ppp0 // I use network manager to connect to DLS provider, which creates a ppp0 interface
Run ddclient on PPP connect: yes
Run ddclient as daemon: yes
ddclient update interval: 300

Check that ddclient daemon is up and running

ps aux | grep ddclient

Make sure to add “ssl” option to ddclient config file, otherwise OpenDNS will not be updated

sudo nano /etc/ddclient.conf
# /etc/ddclient.conf
ssl=yes

Restart ddclient

$sudo /etc/init.d/ddclient restart

This setup will check if my IP address has been changed every 5 minutes. If changed, my account on OpenDNS will be automatically updated.

I switched both home and office computers to OpenDNS, and so far all I have are words of praise.

Comments Off

Arctic Silver 5

Mar 22 2009 Published by under Hardware

Arctic Silver 5

A fan on a CPU heatsink was causing me trouble lately. The fan made a weird noise while its operating temperature was low, as if someone was pressing a finger against it.

I pulled out the faulty part to get the part number and made an order of a new heatsink. While inspecting the faulty part, I noticed that a thermal paste on the bottom was in a really bad shape.

So, from another computer I googled up for a good thermal paste. Read a couple of the comparison tests, and it did not took long to reach the Arctic Silver 5 web page.

I ordered a small package of 3.5grams, and after applying it once, enough of it is left for at least five more coatings.

After applying the paste to a new heatsink (identical to a broken one), the temperature in processor cores immediately fell down by 10℃. I was more then impressed.

Detailed instructions for applying the paste per processor type can be found on their website in pdf, along with the reviews and comparison sheets on the review pages.

From now on, I am regular.

Comments Off

Regular expression “e” modifier

Mar 16 2009 Published by under PHP,Web

I was reading regular expressions docs to find a solution for a problem that I had. And like all the greatest discoveries (that are found accidentally), I found this neath little “escaping” trick.

The big idea behind it is to grab the matching elements in patterns section and create an escape sequence with PHP code in the replacement part.

Example


$txt = 'This is a test';
print preg_replace("/(\>)([\w\s]+)(\<)/e", "'\\1'.strtoupper('\\2').'\\3'", $txt); 

Pattern explanation

 (\>) //matches the greater than sign of the opening div element and ads this element to a first subpattern
([\w\s]+) //second subpattern will grab all word characters and any white space
(\<) //third subpattern matches the less than sign of the closing div tag

Replacement explanation

‘\\1′ is used to access a first subpattern, ‘\\2′ for accessing second etc… These subpatterns are naturally available as strings. Since PHP uses a dot (.) as a string concatenation operator, we add dots before and after PHP code, in this example strtoupper(‘\\2′)

To a “strtoupper” function (which converts all characters to uppercase) we pass a second subpattern, and we close the replacement part with a third.

So, what we are doing here is actually matching any text between the div tags and convert that text to uppercase letters.

The end result of this small example would be THIS IS A TEST

Comments Off

MenuetOS

Mar 08 2009 Published by under Misc

Menuet Menuet

I am not sure if this is the smallest operating system or not, but its size of only 1.4Mb is mind boggling. Yup, it fits onto a floppy drive (if you still use one). This operating system is called MenuetOs http://www.menuetos.net

You will be blown away with things they have packed in the system: system settings, text editor, internet browser, mail, ftp, chat and news clients, audio settings, graphics program, games and demos.

I have tried both 32 and 64 bit version and have to say that 64 bit version runs much smother.

You can download the latest version from here http://www.menuetos.be/download.php?CurrentMenuetOS. After that just unzip it and run with a qemu:

qemu-system-x86_64 -boot a -fda ./M64-090H.IMG

Comments Off

Sharing GPG keys between computers

Mar 02 2009 Published by under Security,Ubuntu

GnuPG

Until recently there was no reason for me to share my personal encryption keys between multiple computers. So, naturally, I got stuck when I tried to import keys I use at work to my home computer.

I use GnuPG http://www.gnupg.org/ for signing my emails. GnuPG can be used for encryption as well but I do not use this feature that much. When signing emails, I tend to create a key for every email account that I have. It is just a silly rule that I have :)

So, this is the procedure to create and copy encryption keys from one computer to another.

Start key generation and set encryption details:

$ gpg --gen-key
1
4096
0
y

Set personal details such as name, email address, comment and key password:

Haris
email@domain.com
comment goes here
o

To list generated keys, type:

$ gpg --list-keys

Now, export secret and public keys into human readable files:

$ gpg --export-secret-keys -a -o private.key "Haris "
$ gpg --export -a -o public.key "Haris "

These two keys can now be copied to another computer and imported there:

$ gpg --import private.key
$ gpg --import public.key

After the import you have to set the trust level for the key:

$ gpg --edit-key "Haris "
trust
5
quit

If for any reason you need to delete your keys do this:

$ gpg --delete-secret-keys "Haris "
$ gpg --delete-keys "Haris "

Comments Off

Performance Optimization WordPress Plugins by W3 EDGE