Categories
Linux rant

Useful scripting from a non-expert

I’m not a programmer. It’s almost embarrassing how long it takes me to write a short script, but I am learning as I find new tasks that are scriptable. Finding scriptable tasks was my problem during my first attempts at learning Python while I was still on Windows. I remember learning Python and experimenting with it but having no idea what I could do with it. Now that I run on Gentoo Linux exclusively I see many oportunities for scripting. Of course, the internals of Windows are not exposed unless you pay money to get the necessary tools and insider access via MSDN, etc. On Linux, all of the MSDN equivalents and more are freely available. For new potential programmers, what is more likely to be your first learning language? Python or Visual Basic?

My most recent piece of scripting grew from work I was doing to rip my music to FLAC then transcode the FLAC files into mp3. Given that FLAC audio is lossless it is an excellent archival format I wanted to guarantee that the FLAC files I create today would be the same pristine files a year from now. The obvious answer was to checksum everything with sha1sum and burn it to DVD. Yeah, what now? I have a directory structure of several hundred files and more than a dozen checksum files. The manual process of checking this structure can be automated very effectively with a shell script.

First of all, tools like sha1sum or even md5sum aren’t available on a Windows system. In order to do the same thing I’d have to search for a Windows implementation. On Linux, this is one of many tools that is expected to be there already. Waiting for some idiot like me to glue the components together and create something useful. Linux started in an academic environment and to this day Linux has the components to bootstrap your own education.

Download sha1sum_chk

Categories
everything else

Just passing through…

From Trail of Tears Motorcycle Trip

I’m writing this from my hotel room in Hopkinsville, Kentucky. The locals call this place Hop Town. As far as I can tell, there’s not a lot of hopping going on around here. It’s a nice enough town. It has the usual collection of WalMarts, Starbucks, and other chain names. It’s kind’a spooky how similar all American towns are beginning to look. I used to think that was comforting. Now, I’m not too sure I like it. I think the mom and pop stores of the past seemed more authentic. The chains are all copies of someone’s idea of what a good restaurant or store should be, but they all feel a little fake.

I have a Google Alert setup that watches for references to “hopkinsville kentucky”.

Worse than the chain store sameness is the proliferation of pawn shops, title loan brokers, and pay day loan offices I saw. I could not keep count of the number of these establishments I encountered in every town I rode through from Canton Georgia to Hopkinsville Kentucky. That there is such a large market for these places speaks volumes about the real state of our economy and how close we may very well be to the economic abyss.

*sigh* Very sad but true, Hopkinsville already has too many of these loan sharks.

Categories
everything else

CFS change causes CPU insomnia

Continuing on from previous thoughts about why Linux 2.6.23 sleeps in shallow cpu idle states with Wifi active. I finally have it narrowed down to a scheduler change after v2.6.23-rc3. On an idle system with no Xorg started but Wifi active the CPU remains in the C2 state unneccessarily.

PowerTOP 1.8 (C) 2007 Intel Corporation
Collecting data for 60 seconds
Cn Avg residency
C0 (cpu running) ( 0.2%)
C1 0.0ms ( 0.0%)
C2 82.0ms (85.9%)
C3 0.0ms ( 0.0%)
C4 37.9ms (13.9%)
P-states (frequencies)
1.87 Ghz 0.0%
1.60 Ghz 0.0%
1333 Mhz 0.0%
800 Mhz 100.0%
Wakeups-from-idle per second : 14.2 interval: 60.0s
no ACPI power usage estimate available
Top causes for wakeups:
71.8% ( 10.1) <interrupt> : ipw2200, lan0

In -rc3 and earlier the CPU would fall into C4 99% of the time even with ipw2200 active. In -rc4 and later there’s a 70/30 or greater split between C2/C4 under the same conditions. If I start tapping the keyboard to create wakeups then it actually spends greater amounts of time in C4.

PowerTOP 1.8 (C) 2007 Intel Corporation
Collecting data for 60 seconds
Cn Avg residency
C0 (cpu running) ( 0.2%)
C1 0.0ms ( 0.0%)
C2 56.1ms (61.4%)
C3 0.5ms ( 0.0%)
C4 38.0ms (38.4%)
P-states (frequencies)
1.87 Ghz 0.0%
1.60 Ghz 0.0%
1333 Mhz 0.0%
800 Mhz 100.0%
Wakeups-from-idle per second : 21.1 interval: 60.0s
no ACPI power usage estimate available
Top causes for wakeups:
48.5% ( 10.1) <interrupt> : ipw2200, lan0
30.4% ( 6.3) <interrupt> : PS/2 keyboard/mouse/touchpad