sontek ( John M. Anderson )

March 20, 2008

Upgrading wordpress

Filed under: Bash, Linux — Tags: , , — sontek @ 4:44 pm

I’m lazy, so I just have this basic script I run that upgrades my wordpress:

#!/bin/bash
blog_directory=
update_url=

wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
tar -zcvf blog-backup-$(date +’%F’).tar.gz $blog_directory
cp -rv wordpress/* $blog_directory
links $update_url
rm latest.tar.gz

How do you upgrade your wordpress?

March 12, 2008

Update Twitter from irssi

Filed under: Linux, Perl, Programming, Twitter, irssi — Tags: , , — sontek @ 11:10 pm

I wrote a quick little perl script/irssi plugin that allows you to update twitter from irssi. It also has autocompletion for names from your friends and follower list. You can get it here: http://devtoo.net/svn/twitter/twitter.pl

To use this script place it in ~/.irssi/scripts and then type /load twitter.pl in irssi

Usage:
/twitter u I’m updating twitter from irssi
/twitter d sontek I’m direct messasging sontek from irssi

DISCLAIMER: First perl script I’ve ever written, i’m sure I’ve done things wrong.

February 20, 2008

Whats in your PS1?

Filed under: Bash, Linux — Tags: , — sontek @ 1:01 am

Theres a discussion going on at reddit about PS1 ( here ).

Mine is:

PS1='\d \t\n\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \n\$\[\033[00m\] ‘

and it looks like:


Wed Feb 20 01:09:15
sontek@inspidell ~
$

Thanks to Chris Crummer for pointing out the reddit post.

January 25, 2008

Progress bar with cp

Filed under: Bash, Linux — Tags: , — sontek @ 9:42 am

Today I found a very informative post on how to get a progress bar with the cp command in Linux.

You can find that blog post here. But I’ll repost the information here in case his blog ever disappears.

With the following bash script:

#!/bin/sh
cp_p()
{
   set -e
   strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
      | awk '{
	    count += $NF
            if (count % 10 == 0) {
               percent = count / total_size * 100
               printf "%3d%% [", percent
               for (i=0;i<=percent;i++)
                  printf "="
               printf ">"
               for (i=percent;i<100;i++)
                  printf " "
               printf "]\r"
            }
         }
         END { print "" }' total_size=$(stat -c '%s' "${1}") count=0
}



You will get a progress bar like this:


% cp_p /mnt/raid/pub/iso/debian/debian-2.2r4potato-i386-netinst.iso /dev/null
76% [===========================================> ]

January 2, 2008

Pimp my irssi

Filed under: Linux — Tags: , — sontek @ 12:52 am

To start the new year, I was wondering what everyone’s favorite theme, scripts, and hacks for irssi are. I currently use the default irssi theme with the following scripts:

  • nicklist.pl - Allows me to see the user list in each channel, giving it the feel of the majority GUI IRC clients.
  • screen_away.pl - When I detach from my screen it will then set me to away and save any highlighted messages into the status window so I can easily respond to my people who were talking to me.
  • trackbar.pl - Sets a line at the last line that was viewable before I switched channels/windows, that way I can easily find the last place I read and continue from there.
  • splitlong.pl - Splits long messages

outside of the custom scripts I use, I also have:

scrollback_lines 100000
autolog = "yes"
autolog_path = "~/.irssi/irclogs/$tag/$0-%m%y.log"

December 18, 2007

Fedora 8 Review

Filed under: Fedora, Linux, SUSE, Uncategorized — Tags: , , — sontek @ 2:23 am

In response to Herlo’s reviews of openSUSE here and here , I thought I’d give Fedora 8 a shot and give an openSUSE user’s perspective.

Lets start with the bad:
First, during the installation it detected my video resolution wrong (nvidia 6800gt) so I had to do my installation without being able to read most of the screen (didn’t see any easy way to switch to text mode, I was using PXE). I did not have this issue with Ubuntu or openSUSE 10.3 on the same computer but I tried a different computer with an Intel video card and couldn’t reproduce the error.

Second, for some reason the nspluginwrapper was installed by default and caused Firefox to be extremely unstable and crash on any website that had embedded audio or video, once I removed the package Firefox became much more stable. Having it installed by default really made no sense because the computer I was running was a 32-bit system and the point of nspluginwrapper is to allow PPC and AMD64 users to run 32-bit plug-ins.

Third, codecs (mp3, video) were not easily installable. I understand that Fedora can’t include these in the distribution but I would’ve loved an easy way to retrieve them. I had to add extra repositories manually (after googling and finding which ones I needed) and then install them. In openSUSE the community repositories are readily available in yast and all I have to do is enable them, there is also the 1-Click install so you do not have to locate/add any repositories. Codecbuddy is a noble attempt but I would like more options than Fluendo.

Fourth, Flash was not readily available (it comes by default in openSUSE 10.3) and I had to search around the Internet (again) for a repository that included it. Luckily Adobe does provide a Fedora specific repository but I think this repository should be included by default in Fedora (or easily enabled).

Fifth, By default Fedora has chosen the iwlwifi drives for my Intel wireless which is great because its a completely open source driver that does not require a service running. But there are some known bugs in this driver and required me to modify my home network so I could connect to it and I can’t connect to my work network at all. This decision would not bother me except that they do not provide the closed ipw3945 drivers in the repositories as an alternative (openSUSE 10.3 provides iwl as an alternative in the repos).

Sixth, I’ve eluded to this a few times already but openSUSE 10.3 provides many community repositories in yast ready to be enabled but it’s also easy to add and find new ones through webpin and the openSUSE build service and add them quickly through yast/zypper. With Fedora it is a little more complicated to locate and add repositories.

Seventh, Most of the system-config-* applications required a running X server, so I was not able to manage my computer remotely with the provided tools. (boot, date, network, packages, printer, selinux, services, time, and users). Not only did they not have a cli/ncurses based interface, some of them even crashed with python errors instead of letting me know I needed X or they gave me a notice that they are deprecated. Why would you want to enforce configuration tools to require X? These tools also did not provide a central “Dashboard” to use them, so a user has to “Just know” what tool to use for the job, they can’t just browse around an easy to use control panel.

Eighth, By default NetworkManager was not on, I can’t think of any reason not to enable NetworkManager by default on a desktop distribution, especially when a wireless network card is available.

Most of the issues aren’t that big of a problem to solve for relatively experienced Linux users but I think they would be show stoppers and scare regular users away from Linux, there are also some issues with Fedora that are more personal preference than bugs:

First, I think clearlooks is a much better theme than the default Fedora one.
Second, I prefer the SLAB menu from openSUSE. Novell did a lot of usability research that I don’t think should be overlooked and even if Fedora doesn’t want to provide it by default, it should at least be in the repositories or an option in the installation. I found it very difficult to find the things I needed, one example was I wanted to modify SELinux to be permissive instead of enforcing, so I went to System->Administration and it wasn’t there, I had to go Applications->System Tools->SELinux Management. What is the difference between Applications->System Tools and System->Administration and why doesn’t SELinux fit in the latter?

Now that we’ve hit the bad and ugly, lets end on a good note?

First, I really love yum over yast’s package management module/zypper. The console output is a lot more detailed and the GTK interface isn’t as invasive as yast’s (yast’s GTK interface takes focus as it runs updates, so its nearly impossible to use the computer while using it). Also, zypper/yast is unbearably slow, I turn auto-refresh off and only update when I know I have time to wait. Yum on the other hand is lightning fast and I wasn’t afraid to use it.

Second, Bluetooth support was enabled by default, although the default configuration didn’t allow me to connect to my phone, its nice to actually have devices detected and ready to be configured out of the box.

So, overall my personal preference is for openSUSE, I think the advantages out weigh the downfalls but at the same time I believe both distros could learn from each other.

November 1, 2007

Matt Asay being facetious?

Filed under: .NET, C#, Linux, Mono, Programming — Tags: , , , — sontek @ 9:03 pm

Matt Asay has posted a blog here claiming that Miguel de Icaza is wasting away his talents by “cloning” C#/.NET with mono, rather than

“going back to the innovation in GNOME that originally made you one of the most interesting developers on the planet”

C# and CLI are open standards, so they are just implementing an open standard, not cloning it. This short sighted outlook on the future of Linux and GNOME shows the difference between Miguel and Matt. Miguel and his team at Ximian/Novell have been leading innovation in Linux for over 10 years with GNOME and Evolution and the reason they began

“Squandering one of the industry’s best open source talents”

by working on Mono was because they realized that Linux could not compete with Windows without a better development environment, so rather than always trying to play catch up to the proprietary world, Miguel and his team set out to even the playing field.

And Joe Shaw points out the most frivolous point in Matt’s post here.

Matt says:

“You [Miguel], personally, would convince more by going back to the innovation in GNOME that originally made you one of the most interesting developers on the planet. I want the old Miguel (and Nat - where has Nat Friedman been?) back, the one who demo’d Nat’s Dashboard with Nat at OSCON. The one who led and pushed GNOME forward for so many years.”

Dashboard is one of the very first C#/.NET/Mono desktop applications on Linux. It is still one of the most innovative applications on the Linux desktop, and Matt agrees with this, which shows just how great Mono is.

Miguel isn’t only allowing for innovation on the Linux desktop but he is also allowing corporations that were mainly a C#/.NET shop to be able to port their applications to the Mac and Linux platforms.

Matt, I respect your opinion and believe you did great things when pushing open source at Novell, but I think you need to look at the bigger picture and get past the fact that .NET was designed by Micrososft. C# is a great language and the .NET class library makes it easy to quickly develop desktop applications such as F-Spot, Beagle, Tomboy, and Banshee.

Jeffrey Steadfast also provides an interesting view on this here.

October 30, 2007

AutoFS - Automount network shares

Filed under: Linux, SUSE — Tags: , , , — sontek @ 12:32 am

Using AutoFS you can have all your network shares automatically mounted (CIFS, SMB, NFS, NIS) rather than defining every share in your /etc/fstab. To do this you just need to setup your /etc/auto.master (this is where it is on SUSE, it can be in a different file on other distros, check /etc/sysconfig/autofs for MASTER_MAP_NAME if its not there) with these lines:

 +auto.master
/net -hosts
/cifs /etc/auto.smb

the /net -hosts part says “mount all NFS shares on the network inside the /net folder”, -hosts is built into AutoFS and will scan your network for NFS shares.  The /cifs /etc/auto.smb says “mount all CIFS shares on the network in /cifs”, auto.smb is an external file AutoFS will read to figure out how to mount the CIFS shares.

So with this configuration you will now have the ability to just change into an nfs/cifs share as if it is already mount, like cd /net/fileserver/music or even list files in the share with ls /cifs/fileserver2/ebooks and it will auto mount the shares as you need them.  If you don’t use the shares for a certain amount of time (you can check /etc/sysconfig/autofs for DEFAULT_TIMEOUT to get the exact time), which allows you to roam network to network aimlessly always getting the shares on that network.

For more information check out the man pages for autofs, automount, and auto.master.

October 16, 2007

Who would you rather work for Novell or Sun

Filed under: Linux, SUSE — Tags: , , , — sontek @ 5:39 pm

Aaron Toponce has posted up a poll on his blog here and I wanted to cover some of the hypocrisies in the post and express my own feelings.

I think Novell has done nothing but good things for the open source community by employing some of the best and brightest developers around the world to help develop some of the most innovative applications on the Linux desktop (Tomboy, Banshee, F-Spot, Open Office, Evolution, Compiz, AppArmor, and GNOME) and have even more great products coming down the line like Giver and Banter. They also provide us with a great distribution in openSUSE with features that no other distribution has, such as the SLAB menu, openSUSE build service, 1-Click Install and the codecs installer.

They also employ the kernel hacker Greg Kroah-Hartman (the maintainer of PCI, USB, I²C, driver core and the sysfs kernel) and are allowing him to improve hardware compatibility in Linux by running the Linux Driver Project.

So, to cast my vote, It would be a dream come true to work for such a great company like Novell.

And in response to his poll:

  1. Novell has made a reputation for itself by laying off employees at a whim, with the AppArmor devs being the most recent example.
    1. Sun does the same thing, its part of owning a large corporation. And there are many reasons for layoffs, it doesn’t make anyone evil.
  2. Sun has opened up nearly all of it’s Solaris operating system. Coming from a Solaris background in the early days, this is cool.
    1. How is “nearly” open source better than being completely open source like Novell is with SUSE?
  3. Even though Novell apologized to the community for its agreement with Microsoft, knowing that they could be swallowed up any day now by the Redmond giant makes me nervous.
    1. Sun made a deal with Microsoft years ago:
      http://www.sun.com/aboutsun/media/features/sun_microsoft.html
      http://www.microsoft.com/presspass/press/2004/apr04/04-02SunAgreementPR.mspx
  4. Sun seems to have a promising future, where Novell seems to be riding the razors edge. I guess time will only tell there, however.
    1. This is just FUD/speculation, but I would have to disagree, openSUSE is looking better than ever and same goes with the rest of the products developed at Novell, I think nothing but great things are to come from them.
  5. Sun has said, that if Microsoft goes on a patent litigation rampage, Sun will pull out it’s portfolio protecting Linux users.
    1. Novell has a policy for this http://www.novell.com/company/policies/patent/ and since a majority of their business is invested in Linux and Open Source, why should we doubt them? Especially when they haven’t done anything to make us doubt them.

I would also recommend reading this article which describes the SuSE take over by Novell and how they have helped the open source community.

October 12, 2007

Setting up openWRT

Filed under: Linux, openWRT — Tags: , , — sontek @ 12:55 am

To setup OpenWRT on your router you’ll first want to check the hardware list to make sure this is even possible. After that you just need to download the latest firmware (which is kamikaze right now). Extract the code and run make menuconfig which will bring up an ncurses setup so that you can select your favorite packages and setup the kernel. When you are done just run make and it’ll generate a folder called bin with your image in it, mine is called openwrt-wrt54gs_v4-2.4-squashfs.bin.

Now that you have the firmware file you need to transfer it to your router, the best way to do this is with a tftp client, so grab tftp with your package manager (in suse: zypper in tftp) and run the following commands:

tftp 192.168.1.1
binary
rexmt 1
timeout 60
trace
Packet tracing on.
tftp> put openwrt-wrt54gs_v4-2.4-squashfs.bin

and then power cycle your router, this will copy the new firmware over and install it, it will reboot on its own so just wait until it comes back up and then you’ll need to telnet into the router to change the root password (by default, there is no password):

telnet 192.168.1.1
root@OpenWrt:~# passwd
Changing password for root
New password:

Now you will be able to use SSH to configure the rest of the settings. By default the wireless is turned off so that it isn’t open to the world, to re-enable it you just need to edit /etc/config/wireless and comment out the line option disabled 1 by placing a pound (#) in front of it. You will probably want to setup WPA/PSK/WEP while you are in there, here is my config:

config wifi-iface
option device wl0
option network lan
option mode ap
option ssid cortex
option encryption psk psk2
option key ******

Now all you have to do is restart networking /etc/init.d/network restart and you’ll have a fresh openWRT router. On the speakeasy.net speedtest I’m getting speeds like:

Download Speed: 9895 kbps (1236.9 KB/sec transfer rate)
Upload Speed: 1565 kbps (195.6 KB/sec transfer rate)

which is about double what I was getting with the default firmware on my router.

The biggest caveat, if you aren’t familiar with doing routing in Linux with iptables, is that there isn’t a easy to
use admin site to do the configuration for you anymore, everything has to be done through ssh.

For more information you can check out the following links:

http://wiki.openwrt.org/OpenWrtDocs/Installing/TFTP
http://downloads.openwrt.org/kamikaze/docs/openwrt.html#x1-50001.1.2

« Older PostsNewer Posts »

Powered by WordPress