Saturday, March 2, 2013

Python, Glade and comboBox ...

If you are getting an error saying:

attributeerror 'combobox' object has no attribute ' append_text '

You probably want to use a comboBoxText object instead :)

Monday, February 18, 2013

Checking your link speed/duplix on (open)solaris

On an openindiana server, i needed to find the link speed of the ethernet card, this is a reminder if i need it again:

This machine is:
$ uname -a
SunOS openindiana 5.11 oi_151a7 i86pc i386 i86pc Solaris

$dladm show-ether bge0

LINK            PTYPE    STATE    AUTO  SPEED-DUPLEX                    PAUSE
bge0            current  up       yes   100M-f                          bi

Where bge0 is the interface name (from ifconfig)

Separate your trash into biodegradable and non-biodegradable, even if you don't have compost or your trash all ends in one place, reduce by a tiny bit mixing poisonous stuff with what can become good soil. and btw FUCK ZIONISM http://www.youtube.com/watch?v=prVS4KI3Nrg!

Tuesday, February 5, 2013

Tools for monitoring disk activity in linux

This is a quick note for self:

iotop
inotify-tools

Sunday, February 3, 2013

Uninstall cpan perl module

Well, cpan is not really a package management system; cpan is more of a package installer, it can resolve dependencies as well, but apparently not in a way that allows it to know if it can safely remove a package or not.

Never the less, there is hope!

There is a cpan package that can actually remove packages :) it installs a tool to remove packages, I'm not sure it does it in an intelligent way actually; but it did it for me.

So, what is it?

The module is App::pmuninstall ; it stands for Perl Module Uninstall. To install pmuninstall just do:

sudo cpan -i App:pmuninstall

then use it to remove modules as it provides a command which is "pm-uninstall":

pm-unistall

for example:

pm-uninstall XML::SAX

FUCK RELIGIOUS NATIONALISM; FUCK ISLAMISM, FUCK ZIONISM, FUCK DOMINIONISM!

Saturday, January 26, 2013

How to convet Months names into numbers in bash

So, today i needed a quick way to rename files and folders with names that include month name into a more computer readable numerical presentation.

I wrote a small shell one-liner that does that for me; i pass the file name as a parameter to a script; the script would remove the month name (whether its short (ex Jan) or long (ex November) and would replace it with a two digit number (from 01 to 12) using sed. the script also matches the names regardless of their capitalization (case insensitive) as sed understands "i" for "insensitive".

the script is below:

#!/bin/bash
echo $1 | sed "s/Jan\|January/01/gi;s/Feb\|February/02/gi;s/Mar\|March/03/gi;s/Apr\|April/04/gi;s/May\|May/05/gi;s/Jun\|June/06/gi;s/Jul\|July/07/gi;s/Aug\|August/08/gi;s/Sep\|September/09/gi;s/Oct\|October/10/gi;s/Nov\|November/11/gi;s/Dec\|December/12/gi;"


The script has been auto generated pretty quickly as well, i had a list of the names of months:

January
February
March
April
May
June
July
August
September
October
November


i piped it ino a small loop that matches the first three characters:

echo January | sed "s/^\(...\)/\1\\\|\1/g"

to output
Jan\|January

a shell variable ($cnt) was set to 0 ; and incremented to print the numerical value corresponding to the month (months are in correct order); and was printed using printf:

printf "%02d" $cnt

a while loop glued it togather:

cnt=0
while read line ; cnt=`expr $cnt + 1` ; do echo -n s/ ;echo -n $line |sed "s/^\(...\)/\1\\\|\1/g" ; echo -n / ;printf "%02d" $cnt ; echo -n /gi\; ; done

and the list was pasted as input! viola! a sed pattern is created :)

Now, Egyptians, Syrians, Palestinians, Iraqis and Bahrain's people are being oppressed for the same reason, INEQUALITY imposed by those who do not believe in equality! call it racism, greed, capitalism ...etc.