Irssi – Ignoring private messages from certain (annoying) people without ignoring their public messages on the channel.

Hi folks.

Some people don’t give a crappoli about the netiquette. They just do whatever they want to whenever they feel like it. The most common annoyance is PMing You out of the blue. I met a whole bunch of those pests in my days so I am gonna show You how I deal with them.

When connected to the server / channel type in:

/ignore NICKNAME MSGS

Don’t forget to replace NICKNAME with the actual nickname of the person that keeps sending You private messages without asking.

Let’s say I want to ignore a guy with a nickname Troll. The command will look like this:

/ignore Troll MSGS

After running it my Status window will tell me:

14:51 Ignoring MSGS from Troll

This way You can still read what Troll wrote in the channel but all private messages from this person will be ignore…

Now let’s say Troll has matured and stopped acting like a fool and You had a change of heart:

/unignore NICKNAME MSGS

will do the trick. Just remember to replace NICKNAME with the actual nickname.

After running:

/unignore Troll MSGS

Your status window will say:

14:52 -!- Irssi: Unignored Troll

I am pretty sure You will meet pests on IRC just like I did and I am pretty sure this command will come handy then.

Regards.

Andy

How to verify signature using .sig file.

Hi folks.

Downloading something from the internet CAN be risky… It can be very risky. I am sure You have heard about bad guys hacking into the server of some project and replacing their original download content with something dodgy. Dodgy as in containing backdoor or something just as nasty…

There is a way to minimize the risk of getting exploited by the evil dudes… Many of the projects online that are aware of this security risk are signing their downloads. I am sure You have seen it. You are going to a ftp or http server and You find the file that You are looking for and another file next to it with the exactly same name but with the .sig extension. This .sig file is the signature. You need to verify it in order to make sure that the content that You have downloaded is what the project members wanted You to download and not some fake / infected crap.

How do we go about it?

It’s really simple.

Today I have downloaded Arch Linux iso that I will be testing so I will use it as a example.

First I went to the Arch Linux Downloads site and chose the mirror closest to me. Then I have copied the download links for the iso and sig files and wrote a short “script”.

wget -c http://ftp.heanet.ie/mirrors/ftp.archlinux.org/iso/2012.10.06/archlinux-2012.10.06-dual.iso && wget -c http://ftp.heanet.ie/mirrors/ftp.archlinux.org/iso/2012.10.06/archlinux-2012.10.06-dual.iso.sig

Next I wanted to verify the iso file using the .sig file so I ran:

gpg --verify ./archlinux-2012.10.06-dual.iso.sig

but I got an error:

gpg: Signature made Sat 06 Oct 2012 03:28:53 PM IST using RSA key ID 9741E8AC
gpg: Can’t check signature: public key not found

So I started searching for the info and after a lot of research I finally combined something that works…

First You need to download the public key that corresponds with the RSA key ID:

gpg --no-default-keyring --keyring vendors.gpg --keyserver pgp.mit.edu --recv-key RSA_key_ID

You need to replace the RSA_key_ID with the actual RSA key ID. You got it when the verification failed remember?

So in my case the command will look like this:

gpg --no-default-keyring --keyring vendors.gpg --keyserver pgp.mit.edu --recv-key 9741E8AC

And the output of the command looked like this:

gpg: requesting key 9741E8AC from hkp server pgp.mit.edu
gpg: /home/andrzejl/.gnupg/trustdb.gpg: trustdb created
gpg: key 9741E8AC: public key “Pierre Schmitz ” imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)

Now that You have this Pierre’s public key in Your vendors.gpg file we can try verifying the iso file again.

This time command looks slightly different:

gpg --verify --verbose --keyring vendors.gpg ./archlinux-2012.10.06-dual.iso.sig

gpg: assuming signed data in `./archlinux-2012.10.06-dual.iso’
gpg: Signature made Sat 06 Oct 2012 03:28:53 PM IST using RSA key ID 9741E8AC
gpg: using PGP trust model
gpg: Good signature from “Pierre Schmitz “
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 4AA4 767B BC9C 4B1D 18AE 28B7 7F2D 434B 9741 E8AC
gpg: binary signature, digest algorithm SHA1

In this case the verification gave me a mixed signals… Good signature… Not certified with a trusted signature… I wasn’t sure – so just in case I popped into the #archlinux IRC channel and asked…

23:34 AndrzejL: md5sum
23:36 [andrzejl@wishmacer Arch]$ md5sum ./*
23:36 aefd90da1ee49c745101179f50afa783 ./archlinux-2012.10.06-dual.iso
23:36 b4fcd64607a532afe1880f609bbfd141 ./archlinux-2012.10.06-dual.iso.sig
23:38 AndrzejL: i just need the content of the .sig file to match
23:38 AndrzejL: seems to be matched to the md5sum.txt
23:40 ceezer: so i should be ok using those isos?
23:40 AndrzejL: yes.
23:40 AndrzejL: you should be

and the helpful crowd sorted me out.

I think that the HOWTO explains well enough how to verify the downloaded files (iso, gz, zip etc.) if sig file is provided and hope You will find it useful.

Regards.

Andy

My 16 gigs Corsair Flash Voyager GT has died…

Hi folks.

My 16 gigs Corsair Flash Voyager GT has died… No biggie. I am not writing this to complain or cry out. It’s gonna be a happy ending story.

Sometime ago my other 16 gigs pendrive died on me too. It was long time after its warranty has expired. It was old. I had a spare one. No biggie. Why am I even mentioning it then? I am mentioning it simply because I want to mention the behavioral pattern. So the story is… It started few weeks before thumbdrive died completely. I had a video from a friends wedding copied onto the pendrive. I was watching it. All of the sudden SMPlayer closed – no errors – clean exit. I thought “What the hell…” and tried to play the video again. Well… No video to be played. And then I have noticed something far worse then missing video… “Holly crap where’s my pendrive…”. Yes. The dongle was not recognized by the system. I unplugged it and plugged it back in and everything worked fine again. I thought it was a USB port that was to blame. Maybe a software glitch. I remember thinking that maybe a motherboard of that lappy is going bad… Few days later I was watching some other video from this pendrive on another machine. Smplayer died again twice within 10 minutes… “Uhuh… that is not the usb / mobo problem…” I thought and I have copied all the data from the memory stick to he HDD on my main machine. I sensed the reaper coming after my old friend. After a while system was “loosing” the drive way to often – it became unreliable. I tried many things to recover it – nothing worked.

Last night I was watching a Ted.com talk from the Voyager and the SMPlayer closed. It closed again 20 minutes later… I know what’s going on and just finished copying data from the flash drive. I hear that Corsair has a great confidence in their products and they give long term warranty… 5 years or sometimes even lifetime… This pendrive is with me shorter then that… I went to the manufacturers site and reported a dying pendrive. I was told to send the Voyager to the Netherlands to be replaced. BUT… but… but… what about all my pr0n documents… I don’t want some curious dude at Corsair to be able to recover all my notes and photos and so on… How would I overwrite the drive with some useless random data that would make it harder or almost impossible to recover?

After a while of searching I have combined few commands for my convnience. Here they are:

Run these commands:

su

Now give it root’s password

Then run:

fdisk -l

That’s fdisk space dash lower case L.

This command will list all the hard drives available in Your system. Example:

[root@icsserver andrzejl]# fdisk -l

Disk /dev/sda: 40.0 GB, 40007761920 bytes
240 heads, 63 sectors/track, 5168 cylinders, total 78140160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xef08263a

Device Boot Start End Blocks Id System
/dev/sda1 * 63 73392479 36696208+ 83 Linux
/dev/sda2 73392480 78140159 2373840 5 Extended
/dev/sda5 73392543 75479039 1043248+ 82 Linux swap / Solaris
/dev/sda6 75479103 78140159 1330528+ 83 Linux
[root@icsserver andrzejl]#

This machine for example has only one HDD /dev/sda and it’s 40 gigs.

Now once You have found the correct drive run this:

dd if=/dev/urandom of=/dev/sdx & pid=$!

Remember to replace x with a correct drive letter… DO NOT MAKE A MISTAKE. DD does not ask. DD writes. If You make as mistake of writing random strings to a wrong drive You are the only one to blame…

In my case it’s /dev/sde drive that I want to “randomize” ;).

[root@wishmacer andrzejl]# dd if=/dev/urandom of=/dev/sde & pid=$!
[1] 20951
[root@wishmacer andrzejl]#

It gives me a process id and then runs in a background. You can then check the progress by issuing command:

kill -USR1 $pid

The result will look somewhat like this:

[root@wishmacer andrzejl]# kill -USR1 $pid
[root@wishmacer andrzejl]# 10171578+0 records in
10171577+0 records out
5207847424 bytes (5.2 GB) copied, 2710.78 s, 1.9 MB/s
[root@wishmacer andrzejl]#

It spits out a pretty useful info.

Sometimes it may not give You a prompt. It will look like it froze. Don’t worry. Punch enter. Prompt is back ;).

It will take a longer while but once it’s done You will see something like this:

[root@wishmacer andrzejl]# dd: writing to `/dev/sde‘: No space left on device
31719425+0 records in
31719424+0 records out
16240345088 bytes (16 GB) copied, 8522.4 s, 1.9 MB/s

This means that the process has finished. This should be sufficient – data on Your HDD has been overwritten with “random” gibberish. IF You are paranoid and You want to make the recovery process even more difficult – run the dd command few times. You don’t have to format the disk or anything. Just re-run the command in the terminal. 5 – 10 times should do it.

Regards.

Andy

Ok… SO…. How much electricity / money devours my computer?

Hi folks…

I was looking for an answer to this question for a while now and thanks to some websites and thanks to my colleagues on the #pclinuxos-pl channel I finally figured it out. It’s not difficult.

When You are paying for the electricity You are paying for the amount of kilowatt hours (also called “units”) that You have used in the billing period. This is all great BUT how do I know how many of those kilowatt hours is my machine using?

This is not very difficult to calculate (approximately).

First we have to know how much electric power does Your machine needs. Sometimes You know exactly (or You can read on the label on the back of Your computer) that Your machine has X Watts adapter. This is what You need. I was not so lucky with my laptop. Label on the adapter states:

Output: 16V, 4.5A

I had to calculate the power (watts) myself. To do so I had to use this formula:

P(t) = V(t) * I(t)

where:

P(t) is the instantaneous power, measured in watts.

V(t) is the potential difference (or voltage drop) across the component, measured in volts

I(t) is the electric current, measured in amperes

Ok so the output values of 16 volts and 4.5 amperes multiplied by each other will give me the power (watts) of my laptop’s ac/dc adapter:

P = 16V * 4.5A = 72W

My laptop’s power pack uses 72 watts. This is a very simplified / approximate value. Why? Because it’s a maximum power that the power pack can provide when laptop is using 100% of it. This means screen is on and on full brightness, WiFi, Bluetooth and all other devices are on…

What can I do with those watts then? I can convert to kilowatts. How? Divide it by 1000. This means that You take the power of the device in watts and You divide it by 1000:

72W / 1000 = 0.072kW

Now… Knowing the amount power in kilowatts and multiplying it by the amount of hours You will get the result in kilowatt hours. Let’s say that my laptop runs 24/7. All the time. 365 days per year… Ok… First I am gonna find out how many kilowatt hours it uses in one day. To do that I am gonna multiply the amount of kilowatts and the number of hours.

0.072kW * 24 = 1.728kWh

So my laptop is using 1.728 kilowatt hours during a one day. My bills are sent to me approximately every 60 days. This means that if I multiply the daily usage times 60 I will get the rough estimate of how many kilowatt hours this machine will eat in one billing period.

1.728kWh * 60 = 103.68kWh

So my machine will consume roughly 103.68kWh in 60 days right? Right. Now if I will multiply that with the current price of the kWh unit I will know approximately how much money will I have to pay for the electricity devoured by this little devil.

103.68kWh * €0.15 = €15.55

This means that if this machine was running full speed, with fully bright screen, with WiFi, Bluetooth etc. enabled, 24/7 then it would cost me approximately €16 / 2 months to power it up. This is a very pessimistic estimate. If You use power saving features of the laptop ie. if You disable screen when it’s not used, if You are scaling CPU frequency down and if You disable devices like WiFi or Bluetooth when they are not needed – You can bring that estimate down to 1/3.

You can use info from this post to calculate the price of electricity used by any other electric device over any chosen period of time. It will work provided that the device is not faulty and that it does not leaks power.

Regards.

Andy

Upgrade eggdrop 1.8 and force it to use UTF-8 encoding. [VIDEO]

Hi folks.

I am running my bot MISIASTY on my #pclinuxos-pl IRC channel. I am using it as a greeter, infobot, antiabuse etc. etc etc. I am using eggdrop in the 1.8 version for a couple of reasons SSL encryption being one of them. I want to keep it updated – simply because updates bring bug fixes and security patches.

Every time I was upgrading my bot I had two choices – do it manually or automatically and loose UTF-8 encoding. What is it and why do I need this UTF-8 thingy? Well here is what wikipedia has to say about what UTF-8 is. And I need it so the special characters from Polish alphabed (ie. żółćęśąźń) are properly displayed. Without UTF-8 support bot is using some weird characters (ie. 〈ש€§) in their place and the whole text becomes unreadable.

Why would I loose UTF-8 encoding when upgrading automatically? To force UTF-8 encoding support in eggdrop You need to edit the source code before compiling. My script was very simple and it wasn’t doing a very good job. Today I said enough. I re-wrote a script. I asked Enlik to help me with two commands – and He did. Thanks Dude.

Now my script is upgrading the eggdrop to the latest version and I get to keep UTF-8 support.

The script is located here. And here is a transcript of the script at work. Here is a short video of the script at work.

Regards.

Andy

Disney anti-open-source propaganda [VIDEO].

Hi folks.

I was browsing one of my favorite sites Niebezpiecznik.pl today and in their *ptr blog I have found a very disturbing post entitled “Disney tells children that open-source is evil…” and full of viruses…

I said it must be a fool’s day prank… but no today is not 1st April… Disney really says so… Do not believe me. Watch the “Disney anti-open-source propaganda.” video Yourselves.

That’s just wrong… Now I have only one comment. “No You wise ass little brat. I have paid 300 bucks for an exe file from Microsoft and I have no idea what was inside coz those asshats do not share the code…”. Now that would be a rookie mistake…

I think my soul just vomited a little bit after watching this video…

Cheers.

Andy

OMG OMG OMG… I have lost my grub!1!1…

Hi folks…

I have heard this sort of whining on many occasions… The most often cases of grub borkage that I have heard about are “I had a problem with Windows and I had to reinstall it and I can only boot to Windows now and not to my PCLinuxOS…”. Second one is “I have installed a second distro on my HDD and it comes with Grub 2 and now it shows both OSes as choice but it only boots to one…”.

Today I will try to show You how to fix the first case.

1. Boot to PCLinuxOS LiveCD.
2. Check what partitions are listed on Your HDD

A) Open terminal
B) Type in su
C) Type in root’s password: root
D) Type in fdisk -l (fdisk space dash lowercase L)

The output will look somewhat like this:

[root@icsserver andrzejl]# fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x24502450

Device Boot Start End Blocks Id System
/dev/sda1 * 63 97691264 48845601 7 HPFS/NTFS
/dev/sda2 52420095 312576704 130078305 5 Extended
/dev/sda5 63 52420094 26210016 83 Linux
/dev/sda6 52420158 56613059 2096451 82 Linux swap / Solaris
/dev/sda7 56613123 77577884 10482381 83 Linux

This tells us that the HDD is a 160 GB one. And that it has Windows (red one) and Linux (green and blue) partitions on it. Partition sda1 is NTFS formatted. Partitions sda5 and sda7 are formatted with some Linux file system (ext4 more then likely) and sda5 is formatted as swap. If it only shows Windows partitions – I am afraid I have bad news… If it shows both Windows and Linux partitions – You’re good to go.

Now we need to install the Grub in the MBR (Master Boot Record).

In the same terminal type in:

A) grub and press ENTER
B) This will open (after a while) the grub command line editor with a prompt:

GNU GRUB version 0.97 (640K lower / 3072K upper memory)

[ Minimal BASH-like line editing is supported. For the first word, TAB
lists possible command completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub>

C) Now type in find /boot/grub/menu.lst and press ENTER

D) This will return some value (different for everyone) in my case:

grub> find /boot/grub/menu.lst
(hd0,0)

This means that the menu.lst file is located on the first (hd0) hard drive and on the partition number 1 (grub sees the partitions in a “weird” way – always -1 so if it shows 0 – it means first partition). So hd0 – disk 1, 0 – partition 1. Now this also tells us one more thing hd0,0 is (more then likely) our / (root) partition.

Soooo knowing all this You need to type in two commands (modified to reflect the output of the find command):

root (hd0,0)

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

setup (hd0)

grub> setup (hd0)
Checking if “/boot/grub/stage1” exists… yes
Checking if “/boot/grub/stage2” exists… yes
Checking if “/boot/grub/e2fs_stage1_5” exists… yes
Running “embed /boot/grub/e2fs_stage1_5 (hd0)”… 17 sectors are embedded.
succeeded
Running “install /boot/grub/stage1 (hd0) (hd0)1+17 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst”… succeeded
Done.

and then type in quit to go back to normal terminal prompt.

That’s it – You have just reinstalled Your grub. Now type in reboot press ENTER and keep Your fingers and toes crossed :).

Hope this helps.

Regards.

Andrzej

Incompatible Firefox Nightly / Aurora add-on? Stop cussing. Don't panic. Put that knife / gun down… There is a simple fix.

Hi all.

To enable incompatible add-on on Nightly / Aurora disable extension compatibility check. To disable extension compatibility checking on trunk builds:

A) type in about:config in the address bar.
B) Click “I will be careful I promise
C) Right-click in page and choose New
D) Choose Boolean
E) Type in or paste extensions.checkCompatibility.nightly
F) Set the value to False.

For Aurora use extensions.checkCompatibility.aurora.

There. Problem solved.

Regards.

Andy

NO. Thunderbird project is NOT dead / inactive / abandoned…

Hi.

I have heard something today that made my heart stop for a moment… “Thunderbird is no longer developed…”

That’s not true… I went to the #thunderbird channel on the irc.mozilla.org server and asked… As a reply I got a very interesting link.

Thunderbird’s future from the inside.

So I asked just to clarify:

14:37 pfeeeeew… so basically Thunderbird wont be adding new things unless they are really needed and will just be “developped” in the meaning of security patches and bug fixes rather then adding new shiny stuff?

14:37 AndrzejL: something like that

So… No guys – Thunderbird is not going to die anytime soon. It’s gonna be developed in a slightly different way.

Thanks for reading.

Andy

Edit 01: Another good link: About the future of Thunderbird.
Edit 02: And another one: No, that’s not “it” for Thunderbird…

Update Your LastPass to version 2.0!

Hi folks!

LastPass has just released LastPass 2.0… With new and exciting features! As they stated on their blog:

We’re super excited to announce the release of LastPass 2.0! We’re expanding the core functionality of our password manager while adding significant improvements, both on the front-end and behind-the-scenes.

LastPass 2.0 features:

– Attachment support for documents and images,
– Free credit monitoring alerts for users in the United States,

Want to read the entire blog post? Click here.

I really _do_ recommend LastPass addon for storing, managing and generating Your passwords:

For those that want to find out more about LastPass:

Our Latest Video Introduces LastPass Basics
Just getting started with LastPass? Want to recommend our product to family, friends, or colleagues? Our new introductory video gives you an overview of our essential features, including:

Logging in to your account,
Saving and autofilling a site,
Managing your sites in your Vault,
Generating a new password with LastPass,
Creating a form fill profile for online shopping,
Syncing to new computers, and
Upgrading to Premium for mobile access.

Getting Started with LastPass. [YouTube VIDEO]

I use it in my Firefox Nightly browser. Has yet to disappoint me… So far it’s been a pure pleasure.

I recommended it to many people and one of my Friends recently told me that I was right… Once You get used to LastPass it’s just irreplaceable… He hated it at first. I remember it pretty well as I was getting the “hate updates” via IM :D.

Some people in the past reacted in a weird way when I told them about LastPass… Their comments were usually orbiting around something like “Why on earth would I give my passwords to a third party…?”. The answer is – You are not giving them to anyone. The passwords ARE being stored on a LastPass servers – yes BUT they are not being sent / stored in a plain text. This would be stupid / reckless / dangerous and trust me paranoid person like myself would never ever do stupid thing like that and neither would I recommend doing so to any of You. The passwords are encrypted using state of the art crypto with the key that only You have access to and they are being sent to the LastPass server as a blob of meaningless data that no one can decrypt but You. For more technical info I invite You to watch, read or listen to Steve and Leo in episode 256 of the Security Now! podcast where Steve explains in details security features behind the LastPass project. I am sure You will be satisfied with the amount of info and technical details provided.

LastPass… _Very_ security aware, very safe, very user friendly, very very very handy.

I hope You will at least try it.

Regards.

Andy