Linux Blog

Awesome Piping

Filed under: General Linux,Quick Linux Tutorials — Kaleb at 8:01 am on Wednesday, April 23, 2008

Have you ever wanted to try a tiling window manager. But maybe you don’t want to deal with DWM and its bad config setup that forces you to recompile the app each time you change the config.

I suggest to you AwesomeWM. It was originally based on DWM, however now it is completely on its own. For those of you who don’t know, tiling window mangers are window managers that basically allow you to use ALL of y
our screen. If screen landscape is scarce on your box i suggest a tiling window manager. How do they do this? Its all about managing windows baby. What they do is they make every window you open full screen. that
s right FULL screen and if you open up more then one window in one virtual desktop it cuts them in half so that they are each using half the screen, and so on.

But this article is not about tiling window managers exactly it is about piping in awesome. The AwesomeWM has a status bar that you can edit which by default holds a list of your “tags” (virtual desktops however with a little bit different technique) and a window list of all the windows open on your current tag. However you can edit what is on this status bar with the .awesomerc. Now your asking yourself what can I put on i
t, does it have special keywords like conky or something? The answer is no. it works nothing like conky, however if you do it right you can completely replace conky.

Now how to do this. Open up your .awesomerc file with your favorite editor (i suggest vi or vim, and if you don’t know those why are you even at this site). Now you will see a bunch of lame stuff right, well you need to scroll down to the “status bar” section, this section strangely holds all the things that you will place on your status bar (the status bar section is repeatable so you can have more then one status bar as long as the name is changed).

Now with me I do not like having a list of running windows on my status bar, so I just remove that section,but I do like to have a clock on my status bar, I would assume you would like it to however I don’t know.

At first look it will seem a little complicated to make just a simple clock, but its actually not that bad once you get the hang of it.

What you need to do, for a clock, is create a “textbox” section (yes the time is TEXT strange eh).
It should look something like

textbox clock
{
text=” ”
}

the space between the “” is supposed to be a space so don’t worry about that. Now after you have this set up you are done messing with your .awesomerc. “clock” is now a keyword that you can use to pipe the clock t
o that part of your status bar.

Next what your going to want to do is create a little shell script for rendering your clock it should look something like:

#!/bin/bash

echo “0 widget_tell mystatusbar clock text `date +”%A %B %d, %Y %l:%M %p”`” | awesome-client

Now that is really complicated right. Well not really.

Honestly I have no idea what “0 widget_tell” does, I am assuming is just telling the status bar what to do.

Next in the list you have “mystatusbar” that is the name of your status bar, you should probably know the name of it.

Next should be obvious “clock” is the section of your status bar you want the data to be ported to.

After that comes “text” this just tells it that it is text and not some other type of data.

Then, inside the “ is the command you want to run. This is just the date command that has been modified to output the date in a specific format, it will output the date and time like this “Friday April 18, 2008
2:23 PM”

If you want it in a different way look at “man date” for help (its really simple).

Finally in the command you have “| awesome-client” this will pipe the command to awesome.

Now you need to have this script run on a regular basis, some people do this as a “while true” thing in there .xinit or something however since this is just a clock that only tells me minutes I use the crontab to
run this script every minute. A crontab to run this every minute should look like:
*/1 * * * * ~/scripts/clock.sh
Do all of this and you should have an up and running clock in no time. And like I said before you can put anything you want into this. Even graphics. So now that you know the basic stuff go make a pretty status bar.

Kaleb Porter

porterboy55@yahoo.com

http://kpstuff.servebeer.com (website is temporarily down)

RSS Feeds

Filed under: Shell Script Sundays — Kaleb at 11:43 am on Sunday, April 20, 2008

The other day I was playing around with AwesomeWM and I wanted to have the newest article from digg.com/linux_unix to be displayed in the statusbar. I thought to myself:

“I roughly know how RSS works, so I should be able to do this.”

It turns out it was extremely easy to do.

First how does RSS work. It’s easy just an xml file that gets downloaded with a list of the articles on the site. Well that’s pretty simple so I wrote a little script that will do all the things I need.

First I needed to download the list

wget -c http://digg.com/rss/indexlinux_unix.xml

done with that. Now for what I wanted and to make it a little cleaner i moved this file:

mv indexlinux_unix.xml ~/.news

this way it was in a file that i can easily access.

After that it was just some simple editing of the file using sed. If you don’t know much about sed I suggest you read up on it. It is an extremely powerful tool for quick editing and scripting. For the editing of
the file it was actually quite simple:

cat ~/.news | grep “<title>” | sed -e ‘s/<[/]title>//’ | sed -e ‘s/<title>//’ | sed -e ‘2,2 !d’

now no worries I will explain this its actually quite simple.

I will assume you know what cat ~/.news does but if you don’t, it outputs the contents of the file until the end of the file.

| grep “<title>” is a very important part of the command. As I looked at the xml file i realized that i would get a simple list of all the articles if I greped the title. However thats not all.

It was a very messy output with <title> at the beginning and </title> at the end. Nobody wants to look at that, what I wanted was the text in between. | sed -e ‘s/<[/]title>//’ will get rid of the </title> in the line. I am almost certain that | sed -e ‘s/<\/title>//’ would have done that same thing but you can test that if you want. It needs to be done like this because “/” is a special character so it needs to be escaped.

The next part | sed -e ‘s/<title>//’ should be self explanatory. Basically it just gets rid of the <title> in the line. So now using the first 3 pipes you will get a nice pretty list of all the articles.

This is not what we wanted though. We wanted the newest article. so that’s why we use | sed -e ‘2,2 !d’. This command will cut out everything except the second line in the list. “Hmm but why the second line Kaleb?”
well because while creating this script I found that the first <title> line was the line that told me where I was getting this information from. So it was http://digg.com/linux_unix now I don’t want that. so I went with the second line for the first article. Easy right.

Now as I mentioned at the begining of this article, I wanted to make this give me a clickable link for the awesome statusbar. I will go over awesome piping later this week but basically the only information you will need. Is to go threw your xml file for your RSS feed and find out between what tags the link for your article is and use the above command to show you that link instead of the title then have Firefox open that
link (or whatever browser you use). It was a very simple thing to do.

Kaleb Porter

porterboy55@yahoo.com

http://kpstuff.servebeer.com (website currently down)

Using SSH as a Proxy

Filed under: General Linux,Quick Linux Tutorials — TheLinuxBlog.com at 2:46 pm on Tuesday, April 15, 2008

A helpful reader left a comment on this blog about using SSH as a Socks Proxy. Here is how to do it.

ssh -D [source port] [host]

Thats it, once your logged in you are good to go.

Now, the problem I ran into was making Firefox use this proxy. I found a great extension called SwitchProxy which can be installed from the extensions site. Once installed, you can easily switch between proxies. This is really useful to use while at a coffee shop.

Check out the screenshot of the toolbar that it installs (click for a larger image):

Using SSH as a proxy on Linux

It makes it really easy to turn the proxy on or off. One day if there is interest I might try to extend this to establish the SSH connection.

Why I Love Open Source Software

Filed under: General Linux — TheLinuxBlog.com at 10:32 pm on Thursday, April 10, 2008

Have you been looking for a piece of software that does exactly what you want it to? Perhaps its a tool for a client, or an application that would just make your life easier. On a daily basis I always am thinking of new things that I would like my favorite applications to do.

I am going to be writing within the next couple of days about my favorite CHM tools. One of the useful ones I use is a great little tool and it gets the job done, but it doesn’t do EXACTLY what I want. This is why I love open source. I can simple grab the source and change it if I need to. That is the freedom you are given.

Well, I’m not exactly the best C coder in the world but, given time if the application is that critical to me I can make the changes. I can get help from communities when needed and read free information on the web all day long to help me get the job done. If I can’t figure out how to do it in the language the application was written in its not a problem, I can analyze the source code and possibly find a work around. One powerful work around for the CHM application is the Shell.

This is one of the reasons I love open source software. There are many others, feel free to chip in and say why you love open source!

Linux Wireless Morals

Filed under: General Linux — TheLinuxBlog.com at 2:40 pm on Monday, April 7, 2008

Is it moral for some one who uses Linux to borrow some ones Wireless?

Lets say you are at a hot spot and you need to jump online really quickly but some the internet house your are at charges for wireless. Is it moral to connect to some one else’s wifi?

Maybe you just moved and the internet has not arrived at your house yet. Is it moral to use a neighbors for an undefined amount of time before you are settled in and have the internet set up?

If you answered yes to any of these questions then you may either be cheap (like me) or have low morals. Either way, there are ways to protect your identity and information while borrowing wireless by using Linux.

A good way to protect your self while borrowing some one else’s wireless is to tunnel with SSH. You can use a squid proxy on a port and set up your SSH to forward a local port to the squid server. Once this is done your unencrypted http traffic is now tunneled through an encrypted SSH session. If the person who owns the wireless network (or any one else) were to sniff the packets they would just see the destination address and not the full traffic information.

Use SSH for everything that is unencrypted. SSH to a known host and use these protocols here. FTP and POP are good examples of protocols that can be used by SSH. Don’t use an instant messenger through the internet, it is very easy to sniff the packets. Some times a friend may give out incriminating information which could get you in trouble.

A good device to help with protecting your information while using some one else’s wireless is DD-WRT. Once installed on a supported device it has many functions that can be used. Bridging mode, VPN passthru, advanced routing can all be used to protect your information. DD-WRT would be especially good if set up as a bridge to the other persons wireless. You could use a NAT firewall to hid how many devices you really have connected and change the mac addresses of the clients.

In the future I’ll be showing you more ways to hide your privacy while using wireless technologies so stay tuned!

Ubuntu a generic distro

Filed under: General Linux — Kaleb at 2:04 pm on Friday, April 4, 2008

Ok so I was checking my daily digg news and i came across one of the more popular things dug that day which was Is Ubuntu becoming the generic Linux distro?

Ok now aside from the fact that this guy has had a total of like a year of Linux use and is not very well formed to actually express his opinion on the statement, I agree with his opinion. I suggest you read his blog to understand fully what this article will entail but to sum it up, he thinks that Ubuntu is becoming Linux and that to some new users Linux is Ubuntu.

I think he is right in this aspect. Many new users that I have talked to seem to think that Ubuntu is Linux and Linux is Ubuntu which you may or may not know is not true. Ubuntu is Linux yes, but Linux is not Ubuntu. I do not think that Ubuntu being a “generic” Linux distro is a bad thing. However I think it is a bad thing when new Linux users use Ubuntu and only Ubuntu because it does not express the actual power of Linux which is the community and the openness. Some new Ubuntuers (Ubuntu users) seem to think that by using Ubuntu they are getting the full Linux experience and that all Linux distros are the same or worse. So why change? Now you should all know that all Linux distros are not the same, and that they are definitely not worse. The thing about Linux is that one distro is not for everybody. Each distro has its uses and different users may like different distros for what they do. For example I use Gentoo and Arch Linux because I think Gentoo gives you the best performance and options for software packages, and that Arch gives you a very clean and fast operating system. Very fast (if you haven’t tried arch I suggest you do, it has the fastest package manager I have seen). And Owen likes Slackware for his reasons. That right there sums up the power of Linux.

I think that having a generic Linux distro is a good thing in some areas, for example, like what Ubuntu has been doing so far it brings lots of new users to the Linux world from both Windows and Macintosh worlds. However like I previously stated. Linux is not Ubuntu, so what do we need to do, show these new Ubuntuers the way. Show them out into the openness of the Linux world and express to them that Ubuntu is not the only way to go. What I suggested on my comment to this guys post was that (I know it will never happen because Ubuntu wants users and does not care about the other distros) Ubuntu should have some kind of a post install pop-up that has something like “Ubuntu is not for everyone, try out some of these other Linux distros…” and have it list some other distros that Ubuntu has partnered with. Doing something like this, I think would drastically increase the power of the Linux community as it continues to bring new users to the Linux world.

Now with that said, I think that us non-Ubuntu users should not poke fun of those Ubuntuers, like I have seen countless times on IRC and forums and what not. What we should express for them is that there may be another, better way to go, which may be in the form of a different Linux distro.

This has been my rant on Ubuntu as a generic Linux distro, thanks for reading

Kaleb Porter

porterboy55@yahoo.com

IRC: magma_camel (find me in the #archlinux channel on chat.freenode.com)

http://kpstuff.servebeer.com (my website is undergoing hardcore maintenance so it is currently offline)

If Windows Sucks, Why do people use it?

Filed under: General Linux — TheLinuxBlog.com at 11:34 am on Wednesday, April 2, 2008

As you may know from previous posts I read Garry Conn‘s blog on a regular basis. When he wrote an article on Microsoft Windows I couldn’t help but comment. You can read the post in full here.

Below is one of the comments I left for him. I think I covered everything but you should check out his post and chime in your thoughts. If you have any questions as always you can leave me a comment and I will answer them. I’ve added links in this post to highlight everything I mentioned to make it easier to find what I’m talking about.

Hey there,

Ubuntu is probably the best for new new users. There are different flavors to choose from this too. You have Ubuntu which ships with Gnome, Kubuntu which is KDE based and Xubuntu which has Xfce. I like Xfce because it is light weight but it doesn’t have the best file manager. Therefore I would recommend Ubuntu. I think that the setup is a little easier now, it has automatic partitioning and all of that.

One advantage to Mac OSX / Linux while running Firefox is that you only get 1 instance for Firefox. Open it up on Windows (Even when you press CTRL+N for a new window) you get a separate Firefox instance taking up resources. This is not the case with Linux or OSX, it runs off of the same process which means it uses less resources.

Ubuntu has a nice program called Automatix which is great to install stuff like Video Player Plug-Ins and PDF readers.

The only thing you will have trouble with Garry is Photoshop. There is NO Photoshop for Linux. Some may argue that The GIMP (GNU Image Manipulation Program) is the replacement but it is far less sophisticated and difficult to use for the Photoshop user. I have got older versions of Photoshop working with Wine but they are a little buggy and sometimes crash, which is understandable since .exe files were never suppose to run on Linux.

You can use Pidgin for your instant messaging and it supports AIM, Yahoo, GTalk, Jabber and a bunch of others. That knocks out a couple of applications if you were to install each of them on Windows

Grahpics support is one of the things that really needs to be set up properly to enjoy Linux. The easiest to install by far is the NVIDIA graphics driver, I always try and make sure my hardware has a GeForce video card for this reason. ATI has some well supported 3d accelerated cards but all of the GeForces I have used have been much easier to set up.

I like my Toshiba Tecra M2 and Linux runs great on it. Mostly everything works with the exception of the SD card reader, Infrared and Modem, but I don’t use those and they apparently can be made to work. I have suspend when I close my lid and can also use Hibernate if I wish.

For my Windows Apps I can run VMWare and Windows XP and you could not tell the difference from running Windows on bogged down machine in my opinion. I showed a professor Office 2007 running in a full screen Virtual Machine and he was amazed at how much quicker my Virtual Machine was then the 2.6GHz+ with over a gig of ram computers in the Lab. I have a 1.7GHz with 768MB of memory. So you could probably run Photoshop in that, I’ll try to get a video cast up some time if possible.

Again, Linux isn’t for everyone. It does break and its quite possible that when it breaks that you could spend a lot of time Fixing it. I have had it break right at the most inappropriate times but, at least I could fix it without having to reinstall everything which it seemed like I used to do on a bi-monthly basis before.

Hope this answers more of your questions.

– Owen.