Small Hacks

GNS3 on Fedora 17

You need to download GNS3 and Dynamips. For GNS3 you would need to install PyQt4 and telnet which are not present in the standard F17 installation. After it’s installed, GNS3 itself ca be unpacked.

yum -y install PyQt4 telnet
tar -xjf GNS3-0.8.3.1-src.tar.bz2 
cd GNS3-0.8.3.1-src/
python2.7 setup.py build
sudo python2.7 setup.py setup

For linking GNS3 and dynamips you have to have the latter installed. Not an easy task on F17. You can’t just yum install dynamips, because it requires a legacy library libpcap.so.0.9 which couldn’t be found by myself.

[root@hp opt]# yum install dynamips-0.2.8RC2-1.i386.rpm 
Loaded plugins: langpacks, presto, refresh-packagekit
Examining dynamips-0.2.8RC2-1.i386.rpm: dynamips-0.2.8RC2-1.i386
Marking dynamips-0.2.8RC2-1.i386.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package dynamips.i386 0:0.2.8RC2-1 will be installed
--> Processing Dependency: libpcap.so.0.9 for package: dynamips-0.2.8RC2-1.i386
--> Finished Dependency Resolution
Error: Package: dynamips-0.2.8RC2-1.i386 (/dynamips-0.2.8RC2-1.i386)
           Requires: libpcap.so.0.9
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

But you could do the installation manually, and add symlink to the legacy lib just to be on a safe side

rpm -i --nodeps dynamips-0.2.8RC2-1.i386.rpm 
ln -s /usr/lib/libpcap.so.1.2.1 /usr/lib/libpcap.so.0.9

WordPress android app does not sync with standalone

Поставил андроид апп для вордпресса, создал отдельный акк на серваке, вбил креды, запустил, написал пост и… ничего не произошло. Иконка синхронизации дергается в конвульсиях, H+ моргает стрелками, ничего не происходит. чтобы что-то произошло, аккаунт должен быть с правами administrator, не работает по-другому. Несекурненько.

Bringing Cisco IOS CLI to Linux CLI

There are few people on the globe who loves to work with Cisco and Linux via CLI. These people might have issues with trying to apply Bash/Vim syntax to IOS and vice versa. I’m certainly one of them. That’s why I can do the followng in my Bash:

$ show .bashrc | i return
[[ "$-" != *i* ]] && return
#     return 0
#     [[ -z $adir ]] && return 1
#   [[ $? -ne 0 ]] && return 1
#     [[ $? -ne 0 ]] && return 0
#   return 0

It’s very handy for checking Cisco configs, stored on a Unix machines, without inverting your mind out. In fact, if you are in rush and tried to apply IOS syntax to Bash, you won’t be distracted by an error message, but you’d get a result you reqired.

$ show samle_conf.cfg | i spanning-tree
spanning-tree mode rapid-pvst
spanning-tree etherchannel guard misconfig
spanning-tree extend system-id
spanning-tree pathcost method long
 spanning-tree portfast
 spanning-tree portfast
 spanning-tree portfast
spanning-tree bpduguard enable
...

It’s achieved very easily. You need to add some aliases to your ~/.bashrc file and relogin:

echo 'alias show="cat"' >> ~/.bashrc
echo 'alias i="grep --color"' >> ~/.bashrc

Windows-like Behavior in Fedora

Fedora did a thing I hated in Windows. It collected enough system files to flood my root partition over the years of usage.

[root@hp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 15G   14G  403M  98% /
udev                  996M  316K  996M   1% /dev
tmpfs                1004M  1.5M 1003M   1% /dev/shm
/dev/sda2              15G   14G  403M  98% /
/dev/sda1             485M  166M  294M  37% /boot
/dev/mapper/luks-6e55a54f-c3c6-45d9-99d3-a6d8015b2baa
                       97G   16G   76G  18% /home
/dev/sda6             117G  105G  5.9G  95% /home/t1/media

Top space consumers are:

[root@hp ~]# du -sh /*
156M    /boot
370M    /lib
7.3G    /usr
5.3G    /var
[root@hp ~]#  du -sh /usr/*
550M    /usr/bin
1.2G    /usr/lib
1.9G    /usr/lib64
3.4G    /usr/share
[root@hp ~]# du -sh /var/*
3.9G    /var/cache
890M    /var/lib
407M    /var/spool
[root@hp ~]# du -sh /var/cache/*
1.1G    /var/cache/abrt-di
2.8G    /var/cache/yum

A workaround:

[root@hp ~]# rm -rf /var/spool/abrt/*
[root@hp ~]# rm -rf /var/cache/abrt-di/usr/lib/debug/.build-id/*
[root@hp ~]# rm -rf /var/cache/yum/*
[root@hp ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
rootfs                 15G  9.3G  4.5G  68% /

Enough for preupgrade now!

Lingvo dictionaries in Linux. Stardict way.

There is a version of Lingvo dictionaries for Stardict available on the net. I do not think it’s legal, so do not forget to purchase you Lingvo license before proceeding with the following instructions.

At first, install stardict and archiver:

yum -y install stardict p7zip

At second, download the dictionaries. Beware that original Lingvo dictionaries shipped with product will not work. You have to use special ones“.
Copy downloaded folders to /usr/share/stardict/dic. Now unpack them:

 cd /usr/share/stardict/dic; 7za e \*.7Z;

You’ll get a list of files and dirs. dirs are not needed, delete them:

for dir in *; do if [ -d $dir ]; then rm -rf $dir; fi  done

At last, kill all instances of Stardict and star one up. Go to “Manage dictionaries”: you shall see a list of added dictionaries there. If you see no any new dictionary, it means you have done something wrong. Go to the second tab (Manage Dict), choose query dict group, press [+] button, select all available (needed to you) dictionaries and press enter. Now you have to have the full list of dictionaries searchable.
Test it. Enjoy.

Linux random passwords generation

This post is more a note to myself than a message I want to deliver to me struggling readers. There are two utilities for generating random passwords and one hack-around.

pwgen

Generates MANY passwords simultaneously. Very handy if somebody is behind your back watching you.

[root@hp ~]# pwgen
OVo4jiev Cohkah0r Iesev0ec thefuz0F asho6Zai em3tok5I Quoogh2k leeRuhi1
Eica7gie aew1ieTh Ukeewie3 Tee3aesa zasiCie7 iey9Ugho Eex5phae aip2ohHe
uL8AGee2 bux8rohX Aiv1voo2 AeS5thie uli1Shai aeWee0ai sha6aeV2 ni2Oong4
ahji7AiW rei0za9A uK1eih8a phoo4Aih taiGh0ab uod2ho8I tooX9coh jeeC5pie
ohxiCh7u oluif8Co OhTieC7e Phuro0sh eeca7Atu yee3Aeve Iwi1nige aiyu3Ein
AiCee0ba eC5Saehi voa2Aina ge4eiWee che8EeD2 Ait5ohth aQuahp4o oosou2Si
wa3aitiZ fah2oGhu do8oor5A Ied9Erob Caizei5a meeFai6b roh8WooW Lah8ieph
Eixoh6zi Cee8eidi eeChah6I eMohrij7 Zeisu0ha oech6Ae9 cioreT6p ee2Ohsha
Uu6yae5V zohShea8 Eizubo9r Reek2eiv Aak0veb7 phei3Ife onaeh7Oo jaiMopi9
Phohm9vi Ai3EeYie aequeeN8 eCiug9ei keiRee6I Aikei9wo tugh5Pae yie4maTu
eiH5Jei4 aeChia4I ahs3seeS eeg6Pa7M pei8Jooy ih1phiDu jee1ai4U uuY6eRai
wee5si4I ui2AhSoa Shee9EeB ahV4oof9 cei3pheZ iB5daw3u saegh4Lo Waroo1ah
aeth1Loo ohReesh4 Saidae7o meB7tha6 Eetae9Oh meiyiR5e AeTooc3c Bu0ou0se
Ahree5Of eiwuJie9 Cuogh7ae eekeeB8V ruu0Yoqu angie1Ki Oang3eeb Oobe9jiP
Loo3Oova yieNee0n moo2aiSh aem6ooD3 Paehoh2w xee6Ooph acahph2A kooGu5Ie
hag2Buon chah4Bii xaequ4In Ooy9Lohk oophoh4N Oo5Roh4a Phe8choo xa2Thoo4
XahBoo4j eeHah2ai Quaico6D Lauh0eiF Eiv9ga9c ih9pooPh aedeLaS3 ohleiGo2
aPh7wivi le4Xah9d lahl4Hei shu2Kuch OhfeDi7z Aengaej7 Phie4oom eige6Fae
Xaesh2Ju iN7Coh3S The8Ij4z kae0OGhi Shei6ohp RooReim6 Pheih3Ai Aikah8sh
taiph4Ei kaoRoh1f om0moh3S uaphee7E lab4Xu9k kahh3saZ ain8Zeic Uu1fohvo

apg

Generates few random passwords.

[root@hp ~]# apg
johebud6
VuwejThig1
TegtuIdNi
FlabEpNeec
bytjeewk
voyHatadd5

Unix hacker’s way.

This way is considered to be insecure, but Jesus! Who would know you have used this freaking way!

for ((n=0;n<10;n++)); do dd if=/dev/urandom count=1 2> /dev/null | base64 | sed -ne 2p | cut -c-8; done

Fast appending files to tar archive is impossible.

Eventually, tar is very slow for appending files to the existing tarball. I’m particularly talking about following options:

-r – append files to the end of an archive
-u – only append files newer than copy in archive

Logically thinking, for -u to work, it should accomplish linear search through the archive. Than bigger the archive, than slower the search. Moreover, if you’ll try to append in the loop, it will accomplish search as many times as many iterations you loop has. I would advice to use in the most exceptional case ONLY. Try avoiding

# -u. slow inefficient approach of taring multiple files
for file in $(ls -A)
do
    tar -uf tarball.tar $file;		#traverses all archive to append the file.
done

You’d think that -r option usage forces tar application to append files to the end of the archive, getting the position of the archive’s end from archive’s index. It doesn’t. Tar format is designed in a way that it has no index.

# -r approach is also slow and inefficient
for file in $(ls -A)
do
    tar -rf tarball.tar $file;		#traverses all archive to append the file.
done

However, TAR supports several formats for its archive. But they are not well-documented. I had a brief overview of them, and looks like
–format=gnu is the most recent and featured one. And It still has no index. I no longer understand why tar is even used. Despite of that, below is a workaround, allowing for packing unlimited amounts of files right instant. I recommend to never use append function with tar format. Instead, get to know what are you going to archive, prepare necessary files, and archive them all.

# faster approach for taring multiple files. No appending
ls -A >> list.txt
tar -cT list.txt -f backup.tar

Over the phone spelling for IT people.

I’ve created my own over the phone letter to word substitution list. It’s simple, non-ambiguous, easy to spell. I was achieving following design goals:

– no acronyms
– short words
– common computing-related words
– no similar sounding in words
– less brand names is better
– less syllables is better
– fist letter of the word should sound in accordance to standalone alphabet letter
– i-e; c-s; v-w; j-g; m-n sounding confusion should be avoided

Analog
Band
Cable
Data
Ethernet
Fiber
Gigabit
Hacker
Identity
Jitter
Kilobit
loop
Modem
Network
Outage
Port
Query
Router
Simplex
Trunk
Uplink
Video
Wire
Xerox
Yahoo
Zero

Linux Terminal (BASH) Keyboard shortcuts. Readable presentation.

Linux terminal shortcuts are extremely handy. They can speed-up your everyday tasks significantly. Additionally, most commends are applicable to Cisco telnet/SSH sessions and any other terminals. A very little amount of people aware that your terminal can cut/paste strings and words. It can, all shortcuts are there.

There are thousands of pages out there with the list of same shortcuts. What is the reason for me to duplicate widely spread information? Simple – all list around there are organized in a random unreadable way. I’ve put some effort and organized stuff according the functionality. I believe that my version of the list is much more usable than the rest out there. Enjoy.

Read More »

Search engines

If Google suddenly dies, I won’t be lost in the Internets. There are some good search engines around, some of them are even capable to find stuff I’m looking for. (Not Bing). There is always Russian Yandex around, who can find Windows 2003 server product key and print show it to you without even forcing you to open the page containing the key: