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.

Tuesday, December 18, 2012

openldap schema issues

so, you got a message saying:


ldap_add: Constraint violation (19)
additional info: structuralObjectClass: no user modification allowed

ldap is saying that the file you are trying to add has constraints that cannot be applied, most probably they are the last 7 lines in the file; in the directory including ldif files (and only those ldif files) do:

for i in * ; do head -n -7 $i > $i.tmp ; mv $i.tmp $i ; done

Hope this helps

Otherwise, MB (Muslim Brotherhood) is the islamic version of zionism, just without the colonization part (yet)

Monday, October 31, 2011

Solaris: who is listening to that port ?

From time to time, I need to figure out which process is listening to which port. In linux; which I am more familiar with; netstat -natlp is my faviorite. but in solaris that is not an option. whenever i google the issue, i get suggestions to use lsof, but for some reason (probably due to being compiled against a different version on SunOS); what helps me out (and I'm writing this post to help me remember it) is the command "pfiles"!

Otherwise, enjoy your life; but remember, Palestinians are denied freedom of movement.

Wednesday, September 14, 2011

SunOS/Solaris and swap

I've been trying to write a script to calculate used swap space and free memory, i've successfully wrote the script for linux utilizing the "free" tool simply piped into awk. Now I wanted to "port" the scrip to solaris (SunOS 5.10; yes, pretty old). a bunch of tools seem to report memory / swap info, but "free" was just not there, so I started testing them one by one; vmstat, sar, swap -l, swap -s, top, in conjuction with "pagesize" and other commands. Long story short, with the exception of "top", no tool reported much fully meaningful data, the tools (IMHO) mix between disk-based swap and free memory, not to mention /tmp, which is again mapped to swap. I got the advise to simply forget it from solaris users on freenode, and that what i did. If you are interested in a script to flush swap safely in linux, mine was inspired by this one. hey, this is my end of post comment, Zionism is racist movement; it did indigenous population transfer into exile for at least the last 60 years, erasing the identity of a population with the pretext of preserving the identity of a population