Random Wisdom

Linux

Proxy Bypass

by on Jan.10, 2006, under How To ..., Linux, Software

I guess it’s usual for every institution to have a central firewall/proxy that all internal traffic must go through to reach the outside world. I am by no means paranoid about security/privacy but it got me thinking.

… And once again, SSH to the rescue! It almost feels like the possibilites of a SSH tunnel with Local port forwarding are limitless 😀

I just picked up a public German proxy from this page:

http://www.publicproxyservers.com/index.html

And then setup a SSH connection to forward local port 8080 to proxy:port. Then for the browser I just set localhost:8080 as the proxy.

Well, the speed is a little short of astounding but it’s very much usable 😀 Now all that the central firewall/proxy should be seeing is a bunch of encrypted traffic.

Leave a Comment :, , , , , , more...


Command line search utility

by on Dec.27, 2005, under How To ..., Linux, Software

While studying for one of the finals this year, I felt the need for a CLI search utility that would search on Google, Wikipedia, Google Images, etc. I didn’t know of any tools that would already do this so I decided to write my own little bash script:

#!/bin/bash
#Needs the htmlview package

opt="$1"
str="$2"


#Create the search string
until [ -z "$3" ]
do
  str="$str+$3"
  shift
done

case "$opt" in
    "google"  )
    htmlview http://www.google.com/search?hl=en\&q="$str"&btnG=Google+Search &
    ;;

    "image"   )
    htmlview http://images.google.com/images?q="$str"\&safe=off &
    ;;

    "wpedia"  )
    htmlview http://en.wikipedia.org/wiki/Special:Search?search="$str" &
    ;;

    "scholar" )
    htmlview http://scholar.google.com/scholar?q="$str"\&ie=UTF-8\&oe=UTF-8\&hl=en\&btnG=Search &
    ;;

    "ieee"    )
    htmlview http://ieeexplore.ieee.org/search/searchresult.jsp?queryText=\%28\%28"$str"\%29\%3Cin\%3Emetadata\%29 &
    ;;

    *         )
    echo "Usage: search engine searchterm [searchterms]"
    echo
    echo "Engines: google    Basic Google websearch"
    echo "         image     Unfiltered Google image search"
    echo "         wpedia    Wikipedia (English)"
    echo "         scholar   Google Scholar"
    echo "         ieee      IEEE Xplore (needs subscription)"
    echo
    echo "Example: search image batman"
    ;;
esac

echo

exit 0

It makes use of the htmlview package to discover the default browser and display the results. The use of the script is quite straightforward:


[darkknight@darkworld bin]$ search image batman begins

As is, it considers all search terms. Fancy things like Boolean expressions are not supported (yet :)). A copy of the script can be found here.

1 Comment :, , more...

Time synchronization using NTP

by on Dec.27, 2005, under How To ..., Linux

I’ve been having some trouble getting the system clock to sync. with time servers using ntpd. The method that works at the moment is the use of the CLI utility ntpdate:

[darkknight@darkworld ~]$ sudo su -
[root@darkworld ~]# ntpdate time.nist.gov
27 Dec 12:25:17 ntpdate[5743]: adjust time server 192.43.244.18 offset 0.002806 sec
[root@darkworld ~]#

Unfortunately, the man page of ntpdate says that it’s set to be removed from the distro. — hopefully ntpd will work again once that happens.

[Update] It seems the ntpd daemon was missing. The RPM was installed but the daemon was no longer in /usr/sbin/. So, I reinstalled the ntp package and now time sync. works as is should.

Leave a Comment :, , more...

Console based MSN client

by on Nov.04, 2005, under Linux, Software

Earlier today I stumbled across a client for MSN Messenger that runs in a terminal! It’s called tmsnc.

The RPM had some dependencies that I could not solve so I decided to compile from source. Apart from a few minor issues, it looks great! There are some screenshots available here.

You might wonder why you need a text based MSN client; well, one can never have too many tools 🙂

Leave a Comment :, , , , more...

The wonders of gdmflexiserver

by on Oct.31, 2005, under How To ..., Linux, Software

If you’re using GDM, this is the easiest way to get the “Fast User Switching” seen on Windows XP. All you have to do is type:

[darkknight@darkknight ~]$ gdmflexiserver

and you get a brand new login on Virtual Terminal (VT) #8. Successive runs of gdmflexiserver will open up logins on VT#9, VT#10 and so on. Just in case you don’t know how to switch VTs, its done through the Ctrl+Alt+F<1-12> key combinations. The main login is on VT#7. Once you exit/logout from any of the sessions on VT#<8-12>, it will simply close. If you’re not automatically returned to the original session, just switch back manually using Ctrl+Alt+F7.

One useful option of gdmflexiserver is the ability to run in a nested X server. The command in that case is:

[darkknight@darkknight ~]$ gdmflexiserver -n

Now, instead of opening up a login in a brand-new VT, it will just open up a Xnest window with the login. The new X-Server is then a nested (child) server under the main X server on VT#7.

By default the Xnest window opened has a geometry of 1024×768 pixels. This can be changed by adding the -geometry option to the Xnest command in /etc/X11/gdm/gdm.conf :

...
# the X nest command
Xnest=/usr/X11R6/bin/Xnest -audit 0 -name Xnest -geometry 1280x1024+0+0
# Automatic VT allocation.  Right now only works on Linux.  This way
...

The geometry is specified as WidthxHeight+XCoord.+YCoord. After saving the modified gdm.conf, gdm must be restarted for the changes to take effect. This is done by logging in as root into one of the text VTs (VT#<1-6>) and issuing the commands:

[root@darkknight ~]# telinit 3; telinit 5; exit
Leave a Comment :, , more...

New GDM Theme

by on Oct.31, 2005, under Art, Linux, Software

Just designed my very first GDM theme. It’s based on the “Pixel Girl” theme and uses the “Blue Turbulence” wallpaper. Here’s a screenshot:

It can be downloaded from GNOME-Look.org or here.

To install and use, run the gdmsetup tool as root and look under “Graphical greeter”

Leave a Comment :, more...

The 64-bit browser and 32-bit plugins dilemma …

by on Oct.08, 2005, under Linux, Software

Although 64 bit OSs and hence browsers are (almost) commonplace these days, the same thing cannot be said of their plugin counterparts. To this date there are no 64bit Java and Flash plugins .. rendering a huge proportion of pages on the net inaccessible from a 64 bit browser ..

As of this moment, the popular solution to this problem is to have two browsers. A primary browser (e.g. 64 bit FireFox) and a seconday browser + plugins (32 bit). Opera seems to be a popular choice as the secondary browser since it’s quite easy to get installed and use…

nspluginwrapper is another option. It allows the loading of 32bit plugins on a 64bit browser.

Leave a Comment :, , , more...

Open files from a terminal

by on Oct.05, 2005, under How To ..., Linux, Software

There’s lot that can be learned from the conversations on the fedora-list. Today I learnt of a nifty little tool called gnome-open. Basically you just type something like:


[darkknight@darkworld ~]$ gnome-open file.cpp

and voila! It figures out the default application (under GNOME) for the files of type *.cpp and opens the file using that default editor. I haven’t verified, but it seems that instead of a file an URL can also be specified. Mmm .. it definitely creates the possibility of writing portable scripts; at least on GNOME systems anyway 🙂

Leave a Comment :, , , , , more...

Addressing Individual Audio Channels of a Multichannel ALSA System

by on Oct.03, 2005, under Hardware, How To ..., Linux, Software

At first I thought I could just use one of the audio editors to create a 5.1 channel sound file and blank all the channels that I don’t want. Sweep claims to be a multichannel audio editor but at the moment it’s not possible to edit the individual audio channels. So, I tried out Audacity. Although Audacity allows the editing of the individual channels, it’s not possible to save the edited file in a multichannel format – it’s invariably down-mixed to stereo. So, custom sound files were no longer an option ..

At this point, I started looking at the ALSA PCM plugins. The route plugin seemed like the perfect candidate. In order to use the plugin I had to create the plugin definitions in the file ~/.asoundrc:

[darkknight@darkworld ~]$ cat .asoundrc
pcm_slave.rt {
        pcm surround50
        channels 5
}

pcm.front_l {           #Front Left
        type route
        slave rt
        ttable.0.0 1
}

pcm.front_r {           #Front Right
        type route
        slave rt
        ttable.0.1 1
}

pcm.front_c {           #Front Center
        type route
        slave rt
        ttable.0.4 1
}

pcm.rear_l {            #Rear Left
        type route
        slave rt
        ttable.0.3 1
}

pcm.rear_r {            #Rear Right
        type route
        slave rt
        ttable.0.2 1
}

pcm.front_both {        #Front - Both
        type route
        slave rt
        ttable.0.0 1
        ttable.0.1 1
}

pcm.rear_both {         #Rear - Both
        type route
        slave rt
        ttable.0.2 1
        ttable.0.3 1
}

The plugins can be used with the aplay utility:

[darkknight@darkworld ~]$ aplay -D front_c /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

Of course it makes sense to use only Mono files with the plugins since the mappings are always carried out from channel 1. It’s the ttable entry that’s responsible for the mapping. The first value is the source channel (0 = channel 1, 1 = channel 2, etc.). The second value is the channel to route to. The third value controls the volume; a value of 0 means 0% volume and a value of 1.0 means 100% volume.

With the new plugin definitions, it’s even easier to balance the speaker levels. The following command will alternate between the front speakers and the center speaker until interrupted:

[darkknight@darkworld ~]$ while [ 1 ]; do /usr/bin/aplay -D front_both -q /usr/share/sounds/alsa/Noise.wav;
/usr/bin/aplay -D front_c /usr/share/sounds/alsa/Noise.wav; done
1 Comment :, , , , , more...