Category Archives: IT & Tech

Interesting stuff from the world of bits, bytes and hardware.

Setting up & running letsencrypt a.k.a. certbot on CentOS / RHEL 5 systems

 

Getting letsencrypt to run on an ancient CentOS  or Red Hat Enterprise Linux 5 system (they still tend to appear in the wild from time to time) can be a major headache. I took some notes during the setup, I hope you find the useful (you'll need some basic Unix admin skills in order to follow this recipe, so caution is advised as you go through the procedure). 

Sources: 

http://stackoverflow.com/questions/23548188/how-do-i-compile-python-3-4-with-custom-openssl



Important: You'll need to use Python 2.7.8, anything beyond that version will
die with an invalid certificate error during the certbot setup phase. 



# compile openssl from source:

mkdir -p /server/src && cd /server/src

wget https://www.openssl.org/source/openssl-1.0.1t.tar.gz


tar xvzf openssl-1.0.1t.tar.gz && cd openssl-1.0.1t

./config --prefix=/server/openssl-1.0.1t shared --openssldir=/server/openssl-1.0.1t/openssl


make depend && make && make install

# create a softlink for convenience 

ln -s /server/openssl-1.0.1t /server/openssl

# Get Python 2.7.8

cd /server/src && wget https://www.python.org/ftp/python/2.7.11/Python-2.7.8.tgz


tar xvzf Python-2.7.8.tar.gz

cd python-2.7.8

# set up compile environment

export LDFLAGS=-"Wl,-rpath=/server/openssl/lib -L/server/openssl/lib -L/server/openssl/lib64/"

export LD_LIBRARY_PATH="/server/openssl/lib/:/server/openssl/lib64"

export CPPFLAGS="-I/server/openssl/include -I/server/openssl/include/openssl"

./configure --prefix=/server/python-2.7.8

make && make install

# create softlink, adjust PATH

ln -s /server/python-2.7.8 /server/python; export PATH=/server/python/bin:$PATH

# install pip in new python version

wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py

python2.7 get-pip.py

# install virtualenv, wheel

pip install virtualenv wheel

# git-clone certbot (latest version)

 cd /server/src/ ; git clone https://github.com/certbot/certbot

# Request a certificate manually (certonly)

cd certbot; ./letsencrypt-auto certonly --manual -d my.server.tld 

# configuring your webserver of choice is left as an exercise for the reader.

 

VBulletin keyboard navigation (a bit half-****, but works)

 

I really don’t like web forums all that much, I think they all suck in one way or another and I really yearn for the good old USENET days when everybody was free to use their reader of choice… well, those were the days.

 

With “vBulletin” being a vey prolific and widespread software for many forums / fora / forae I visit regularly, I wanted to bring some comfort back to browsing them by adding some simple keyboard navigation using some javascript I freely “borrowed” from the web sites out there.

 

Here’s the result:

 

“n” – Search for new posts

“g” – go to the first post in the list of new posts

“j/k” – navigate forward / backward in the pages of a thread and / or search results

Cut & Paste the script below and save it to a location of your choice, then you can use the  “tampermonkey” extension for Chrome and other browsers to enable these features (chrome stopped accepting non-store based extensions a year ago for whatever reasons they saw fit, tampermonkey helps to get chrome back under the user’s control)

Add the URLs of your favourite forums to the script and import it into tampermonkey (some niftier form of configuration may be on the cards, but I’m lazy so feel free to add it yourself if you want to).

I hope you find this script useful, enjoy keyboard navigation in vB! 😉

VBB “What’s new” user Script

// ==UserScript==
// @name VBB Show new posts
// @namespace http://www.schuerkamp.de/greasemonkeyhacks/
// @description Adds a "whats new" search link and some shortcuts to vbb forum pages
// @description Download URL: http://dl.dropbox.com/u/1983539/isi_whatsnew.user.js
// ##### ADD THE URL of your vB forums below ##################
// @include http*://*isiforums.net/*
// @include http*://*www.bmsforum.org/*
// 
// ==/UserScript==

var EuropeanDateFormat=1; 
var newlink = document.createElement('a');
var todays_posts = document.createElement('a');
newlink.href = 'search.php?do=getnew&contenttype=vBForum_Post';
todays_posts.href = 'search.php?do=getdaily&contenttype=vBForum_Post';
tn = document.createTextNode(' Show new posts ');
newlink.appendChild(tn);
tn2 = document.createTextNode(' Show todays posts');
todays_posts.appendChild(tn2);

var footer = document.getElementById('footer_links');

if (footer) {
 footer.appendChild(newlink);
 footer.appendChild(todays_posts); 
}

// quick hack to set a default email address
from = document.getElementById('it_from_3');
if (from) {
 from.value="beta-applications@imagespaceinc.com"; 
}

if (EuropeanDateFormat == 1) {
 var dates = document.getElementsByClassName('date');
 for (var i = 0 ; i < dates.length ; i++) {
 var post_date = dates[i].innerText;
 // check if there's a year string in the -2012 notation (will stop working in 2100 ;-) 
 if (post_date.indexOf("-20") != -1 ) {
 year = post_date.substring(6, 10);
 month = post_date.substring(0, 2);
 day = post_date.substring(3, 5);
 var new_date = ""; 
 dates[i].innerText = year + "/" + month + "/" + day; 
 }
 } 
}

// stolen shamelessly from userscript.org's facebook key navigation
// Thanks to Droll Troll

function OnKeyUp(e)
{
 var anchors = document.getElementsByTagName('a');
 for (var i = 0 ; i < anchors.length ; i++) {
 var href = anchors[i].getAttribute('href'); 
 if (href) {
 if(href.match(/goto=newpost/)) {
 break ; 
 }
 }
 } 

 // do a search if we cannot find the "next page" link
 next_page_or_new ="search.php?do=getnew&contenttype=vBForum_Post"
 for (var i = 0 ; i < anchors.length ; i++) {
 var next_page_href = anchors[i].getAttribute('href'); 
 var title01 = anchors[i].getAttribute('title'); 
 if (title01) {
 if(title01.match(/Next Page/)) {
 next_page_or_new = next_page_href
 break ; 
 }
 }
 } 

 prev_page_or_new ="search.php?do=getnew&contenttype=vBForum_Post"
 for (var i = 0 ; i < anchors.length ; i++) {
 var prev_page_href = anchors[i].getAttribute('href'); 
 var title01 = anchors[i].getAttribute('title'); 
 if (title01) {
 if(title01.match(/Prev Page/)) {
 prev_page_or_new = prev_page_href
 break ; 
 }
 }
 } 

 key_map = {
 "N" : "search.php?do=getnew&contenttype=vBForum_Post",
 "G" : href,
 "K" : next_page_or_new, 
 "J" : prev_page_or_new, 
 "T" : 'search.php?do=getdaily&contenttype=vBForum_Post'
 }

 if (String.fromCharCode(e.keyCode) in key_map && 
 (typeof e.target.type == "undefined" || (e.target.type != "text" && e.target.type != "textarea")) && 
 !e.altKey && !e.ctrlKey && e.keyCode <= 90)
 {
 window.location.replace(key_map[String.fromCharCode(e.keyCode)])
 }
}

window.addEventListener("keyup",function(event) { OnKeyUp(event); },false)



Nethack 3.6.0 for Debian / Ubuntu Systems

nh360

As you may have heard, the NetHack Devteam blessed us with an update to everyone’s favourite roguelike game “Nethack” a few months ago. As I was unable to track down a precompiled version, I compiled this version from source on my Ubuntu LTS machine.

The package isn’t signed and it might break on your system (hopefully not “your system”), but I’ve decided to put it out there anyway.

 

nethack360_3.6.0-1_amd64.deb for 64bit systems, Ubuntu LTS 12.04 (may also work on 14.04)

nethack360_3.6.0-1_i386.deb for 32bit systems Ubuntu LTS 12.04 (may also work on 14.04,)

UPDATE:

nethack360_3.6.0-1_amd64.deb for 64bit systems Ubuntu LTS 14.04

Use these debs at your own risk, if they break, you get to keep both parts 😉

Feel free to comment here if you come across any problems and I’ll do my best to fix them.

 

 

Fixing FaceTrackNoIR head tracking with 64bit game binaries

If you’re like me, you’re both a simracing and flightsimming buff. My sims of choice are rfactor2 for simracing and Falcon BMS (4.33 was released not too long ago) for flight sims.

While using a head tracking device feels very natural when it comes to flightsimming (I’m using the excellent DelanClip with FaceTrackNoIR), it always felt strange when simracing in rfactor2, I just couldn’t get used to it. The fact that the stock FTNoIR install didn’t work with the 64bit rfactor2 executable didn’t help, either.

Shtalik” on the BMS forum came up with a solution: Simply use the npclient64.dll from the OpenTrack zip archive and extract it to your FTNoIR directory. Following that, you should not have any problems enjoying head tracking in your favourite 64bit sim of choice.

 

 

Yet another Python-based vcalendar parser you can use with “Mutt”

The Mutt email client at work… thanks to symlink.dk

I’m still using “Mutt” as my main email client if you can believe it, and yes, I know it’s 2015. Still for me personally nothing allows me to work through my daily inbox at work (which can easily grow to 1,000 new messages a day) quicker than a keyboard-controlled, ASCII only email client like the venerable mutt (before that, I migrated from Unix’ old “mail” to “elm” in case you remember those).

No matter what tool I tried when attpempting to teach Mutt to show event invitations, parsing exchange-generated vcalendar events never worked properly for me, so I decided to come up with my own (much like every Python hacker worth his salt has to come up with an entire scratch built CMS framework at some point ;))

You can find the results below — as usual, the code is butt ugly (for some reason, my Python has started looking even worse than my Perl recently if such a thing is possible), but it does the job and works for me; YMMV.  You’ll certainly need to translate the field labels into your own language, but that shouldn’t be too difficult. You can then use mutt’s “auto_display” function to call the script automatically on text/calendar entries.

 

#!/usr/bin/env python
import sys

from datetime import *


def date_to_string(d):
 # 20151006T103000
 now=datetime.now()
 dt = datetime.strptime(d, "%Y%m%dT%H%M%S")
 return "%s (%d days)" % (dt.strftime("%A, %d. %B %Y, %H:%M Uhr"),
 abs (dt-now).days)

 

if __name__=="__main__":
 attendees=[]
 data=open(sys.argv[1]).readlines()
 for l in data:
 if l.find("ATTENDEE") > -1:
 attendees.append(l.strip().split(";")[4].replace('CN="', '').split(",")[0])
 if l.find('DTSTART;')==0:
 event_start=l.strip().split(":")[1]
 if l.find('DTEND;')==0:
 event_end=l.strip().split(":")[1]
 if l.find('SUMMARY;')==0:
 event_subject=l.strip().split(":")[1]
 if l.find('ORGANIZER;')==0:
 organizer = l.strip().split(";")[1].replace('"', '')
 orga_name, bla, orga_mail = organizer.split(":")
 orga_name=orga_name.replace('CN=', '')
 if l.find("LOCATION;")==0:
 location=l.strip().split(":")[1].replace('\\', '')

 if l.find("TZID:")==0:
 time_zone=l.strip().split(":")[1]
 
 
 print "===================================================================="
 print "Thema : ", event_subject
 print "Ersteller : ", orga_name
 print " ", orga_mail
 print "Start : ", date_to_string(event_start)
 print "Ende : ", date_to_string(event_end)
 print "Zeitzone : ", time_zone
 print "Ort : ", location
 print "Teilnehmer: ", ", ".join(attendees) 
 print "===================================================================="
 
 sys.exit(0)

A fresh Look at Linux Mint 17.2

Linux Mint “Rafaela” 17.2

Back in the day, I used to be a Linux Mint user and advocate, going back to Mint 7 and Mint 8. I just loved the fresh, modern and mostly mint-green looks of the interface, the painless installation and its ease of use even for folks that were new to Linux, so I guess you could call it my “mom and dad” distro of choice (in fact, my Mom used Linux mint ever since she started dabbling with computers and the internet until she passed away in 2010).

I got fed up with Mint because of the seemingly stubborn refusal by the Mint team to support non-destructive upgrades between releases; if you wanted the newest, freshest Mint, a complete re-install would be on the cards.  I eventually ended up being an Ubuntu user (again), mostly in the form of the XFCE-based xubuntu or Lubuntu which uses the LXDE desktop by default.

When my brother in law Keith asked for my help in breathing new life into his malware ridden win7 “home premium” Fujitsu notebook a few weeks ago, I naturally tended towards xfce because of its rather modest hardware requirements, but while preparing a bunch of USB media to boot and install from I thought “What the heck” and downloaded Linux Mint Cinnamon edition (64bit, version 17.2).

A quick check showed the usb stick to boot fine and boy, was it quick! I hadn’t looked at cinnamon in a while either, and I really liked what I saw, with the numerous codecs and add-on software that comes with Mint (1,6GB iso compared to a meagre 800MB or so for xfce) it was an easy choice with Mint to get my in-law up running in the shortest amount of time.

With Keith being a scout leader, I realized that windows office compatibility and good hardware support (skype, printing, scanning what have you) would be a great bonus.

Installation

The first major disappointment was on the cards for us when we found no way of reducing the NTFS partition on the notebook. I seem to recall this being possible in earlier Ubuntu (which mint is still based on) and Mint releases, but this feature seems to have been removed. Just to make sure I checked xubuntu 14.04 and 15.04 which I’d also available on USB sticks, but sure enough those distros didn’t support shrinking the windows partition, either.

As we had a backup of most of the important stuff on an external drive this was no major obstacle though, so we decided to wipe the entire disk and configure it for Mint’s exclusive use.

The rest of the installation was easy and went quickly as expected.

Network

Network config was painless and worked out of the box, both for the ethernet port and the wireless chip, but that’s to be expected these days. During the installation Mint downloaded updates and extra language packs which is a nice bonus.

Hardware support

Installing the Brother printer drivers wasn’t quite as easy, and I guess a Linux newbie would have given up here, but as I’ve been a Unix user since 1990 or so I wasn’t fazed by the text-based shell script installer wrapper that’s provided by Brother (yes, they do list Linux as a supported OS on their homepage, nice!), so the only problem we had was to find out the printer’s IP address on the LAN (I have no idea why the printer part of the installer was able to determine it automatically, but the scanner software installer asking for the IP address specifically).

Sure enough, printing worked and even scanning was supported using the “simple scan” tool, and, to be honest, non-SCSI scanners (remember those?) have been notoriously difficult on Linux in the past  (especially those all-in-one printer / scanner / copier crap garbage printers by HP and the like), so I was very pleasantly surprised when everything worked just great.

Multimedia & Networking: Skype

Next on the list was “Skype” which Keith uses to stay in touch with his Scout leader mates and his family back in England. Installation was a breeze using apt with Skype readily available via the stock Mint repo), and in short order we were able to place a test call with a friend. However the internal speakers being broken in the notebook, Keith got a headset to check the audio output, and my heart skipped a beat when he (rather mindlessly) plugged in a USB headset, simply expecting it to work, I knew we were in trouble from here.

To my amazement, as soon as he’d plugged in the headset, it started working in Skype as if by magic, no reboot / pulseaudio stuff or even a Skye restart required. Amazing how far Linux has come in terms of hardware support!

Multimedia pt. II: Banshee

As we had to kill Keith’s MP3 collection when formatting the hard disk (there simply wasn’t time to copy it all over to the usb drive), we were naturally interested in how to rip his CD collection in Mint. Being  the “bearded type” Unix user, I told him I’d use ripperX for that purpose, an ancient perl wrapper around several multimedia tools. Before I’d finished the sentence, he’d jammed an Audio C/D in the notebook’s cdrom drive and was ripping it to  his “Musci” folder using Banshee’s “Import Media” function.

“Aha”, I went, “hang on, this is surely going to be OGG Vorbis which will get you in trouble if you try playing it on your car’s stereo”, so I checked the Music folder expecting a bunch of (technically superior, but not yet as widely supported) OGG Vorbis files.

No, another surprise: Familiar “.mp3” tags all over the place, fantastic. We tried a more esoteric piece of his collection which I was sure would not be recognized as a known album online, but sure enough Banshee was able to download track / title / album info from the depths of the net just like it was nothing. Wow! Just wow. This was getting very interesting.

Multimedia pt. III: Playing DVDs

VLC by VideoLAN

I was quickly running out of things that usually break on a fresh Linux install, so trying encrypted DVD playback was on the cards next.

“True Grit” went into the notebook’s drive, VLC came up, the menu played, one more click and were happily watching the movie in VLC, effortlessly switching between scenes, audio tracks and whatnot. Another wow from your “Unix bearded” type, for Keith it was the expected behaviour I guess 😉

 

Multimedia pt iV: YT & Friends

4k video downloader in action

Ok, you know the feeling: You watch a nice music vid on Youtube and would like to keep  / download for offline use.  I had heard of 4k video downloader, but had never tried it personally, so we were able to download it from the website, right click on the package and select “Install using GDebi” and we were downloading stuff from YT about two minutes later, even being able to extract the audio part only and integrate it into the music collection automatically. Nice!

 

Alternative Browsers

Being a Firefox user on Windows, Keith was rather happy to find Firefox available on Mint as the default browser, but he’d heard of google Chrome but wasn’t too pleased about the company’s policies. So in order for him to be able to try an alternative browser, I installed Chromium (again from the repos so it was just an apt-get away) so he could take a look at a different and leaner browser (some might argue this point, but I’ve found Chromium to be quite a bit faster than Firefox on similar hardware).

Suspend / Resume

Another thing that has been quite finicky in the past on Linux based Notebooks is the power management, especially suspending and resuming the OS from hibernation. Everything appeared to work flawlessly on Linux Mint here: The system went to sleep properly using the swap partition (?) for the memory image and resuming when opening the lid again.

Conclusion

Linux Mint has come a long, long looong way since I last gave it a good, hard look in the form of the first “Linux Mint Debian Edition” a few years back (then hoping to avoid the “reinstall” issue in order to upgrade to the latest release). While I have no idea how long 17.2 is going to be supported, I feel we’ve found the optimal “Newbie” distro again for a casual computer user where all he / she needs to do is to browse the web, do some word processing / spreadsheet stuff, check their emails and do some multimedia stuff every once in a while.

Linux Mint 17.2 looks great, has a comprehensive feel to it that comes across as very integrated and apparently the designers have given some serious thought to choosing the best applications for the job. There’s always more from the plethora of apt repos if you need it, but the default choices made seem to be very good.

I’d recommend Linux Mint to anyone wanting to take a quick, fresh look at a modern Linux desktop distro, and I’m quite sure it’s going to make its way onto my next notebook.

Note

All media content has been imported / linked to from the original (c) holder’s web sites. Please let me know if there is a problem with that. Thanks!

IBus / openbox eats Ctrl-Space… how do I set the mark in GNU Emacs?

GNU Emacs: The Editor to Rule Them All

This problem has been bugging me for a while now until finally today I sat down trying to fix it.

This post

http://lists.gnu.org/archive/html/help-gnu-emacs/2014-05/msg00282.html

on the GNU mailing list had the working and simple solution: ibus maps Ctrl-Spase to “next input method”, so all one needs to do is to run “ibus-setup” from a terminal and map this function to some other keyboard combination that’s not frequently used, and hey presto!, setting the mark in GNU emacs works again as expected.

Happy holidays!

 

OpenStack “icehouse”: We’re online

After two lazy Fridays hacking around on OpenStack “IceHouse”, I’ve now got the first instance up on an old HP DL380G5 style server with 64GB or RAM, 8 vCores and a total of 2,4TB disk space.

Setting it all up was surprisingly easy and much less of a headache than I thought, in many ways thanks to the fantastic OpenStack Ubuntu manual (the hardware currently runs 12.04 LTS).

This is the first virtual server that’s actually doing something a “medium” instance, running a wordpress site powered by a MariaDB backend. The performance isn’t great, but then again it’s old hardware and there are probably some knobs waiting to be twisted and turned in their appropriate directions.

I had previously played around with “devstack.sh” which is basically one huge bash script that pulls the latest and greatest from git and works all kinds of magic, but there are two major downsides to this approach:

  • not really intended for production sites
  • It’s basically a black box that mostly works but leaves you baffled as to what it actually did to your system.

So after a couple of vain attempts I decided to take the no-shortcut route and install everything manually, hopefully leaving me with a stable system that can be updated as new releases openstack releases appear.

 

Next on the list: Cinder for block storage fun, then maybe giving glusterfs on some hapless CentOS VMs a try  😉

Repopulating a bogofilter wordlist.db after corruption

So it had to happen eventually: My 660MB wordlist.db file got corrupted without any chance of recovering or repairing it. Having amassed a large amount of spam messages in an mbox file called “spam” during bogofilter’s operation, it’s quite easy to repopulate the wordlist using the “formail” command:

$ formail -ds sh -c 'cat  | bogofilter -s ' < spam

This operation may take a while depending on your spam mailbox size and your disk speed, but it should set you up quickly with bogofilter in a working state.

It’s also advisable to check the spam mailbox for false positives *before* feeding it to formail to reduce the chance or legit mails ending up in your spambox due to false flagging by bogofilter.

 

Aldi Medion Grafik-Tablett unter Ubuntu

Feine Sache, das 40€-Tablett aus dem heutigen Aldi-Angebot läuft auch unter Linux…

usb 1-1.2: Product: Graphics Tablet
[25185.390571] usb 1-1.2: Manufacturer: WALTOP International Corp.
[25185.401639] input: WALTOP International Corp. Graphics Tablet as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.2/1-1.2:1.0/input/input18
[25185.401888] hid-generic 0003:172F:0047.0003: input,hidraw2: USB HID v1.10 Mouse [WALTOP International Corp. Graphics Tablet] on usb-0000:00:1a.0-1.2/input0
[25917.665185] usb 1-1.2: USB disconnect, device number 5

 

Funktionstasten habe ich noch nicht alle ausprobiert, aber wenn es derart erkannt wird, ist das ja schon die halbe Miete!

Da das Haus hier voller Linkshänder ist, war die Drehbarkeit per Software wichtig, und die scheint ebenfalls zu funktionieren.

 

 

Growing a RAID1 mirror (destructively) on an HP Proliant Server using hpacucli

(c) hp.com

Recently, we’ve had to replace a RAID1 mirror consisting of 2 146GB drives with 2 300GB ones. As we were able to move the data elsewhere on the server during the process, this was possible online without rebooting the server and causing unnecessary downtimes. Here’s what we did:

– unmount the device if necessary (we were using it for Oracle raw devices so we had to move stuff within Oracle in order to be able to remove it)

– Identify the logical device (usually /dev/cciss/c0d0 or similar). For this example, we’ll be using /dev/cciss/c0d0 (the first logical drive on the first controller #0) .

– Find the logical drive for the mount point by using hpacucli:

show ctrl=0 ld all

then, for each logical drive <n>, do

show ctrl=0 ld <n> show

Eventually, you’ll find the Linux device in this line:

Disk Name: /dev/cciss/c0d0

– Find out which physical drives make up the logical drive by turning on their leds:

ctrl slot=0 ld 0 modify led=on

Now the blue leds on the drives should be lit. Pull the drives from the storage / box server and wait a minute or two.

hpacucli now should have marked the logical drive as failed:

ctrl slot=0 ld 0 show status
Status: Failed

Now install the new (hopefully larger ;-)) drives and use hpacucli again to verify it’s now seeing the larger drives:

ctrl slot=0 ld 0 show

 

You should now see the larger drives in these lines:

 

Mirror Group 0:
 physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 300 GB, OK)
 Mirror Group 1:
 physicaldrive 2I:1:7 (port 2I:box 1:bay 7, SAS, 300 GB, OK)

Now you can re-enable the mirror, using those larger devices:

ctrl slot=0 ld 0 modify reenable

You’ll have to confirm that data on the LD will be lost, but it’s no biggie as you copied the stuff elsewhere, right? 😉

Finally, grow the logical drive to its new capacity:

ctrl slot=0 ld 5 modify size=286070

(this is for a 300GB SAS drive).

Instruct the Linux kernel to partprobe the new disks (they should come up empty with no partitions on them):

# partprobe

That’s it, you should now be able to access the new, larger logical drive using the old Linux device name at /dev/cciss/c0d0. Create partitions as needed and copy back your data to the new device.

 

 

Snipping and adding fade in / out effects using ffmpeg

While you might think ffmpeg is well documented on Linux given its relative maturity, I found the docs provided very confusing and even misleading as some filters (like “afade”) referenced in many examples weren’t even availble on Ubuntu 12.04 LTS. (check your own version using the “-filters” ffmpeg argument: After much searching and googling, I arrived at the solution below and I’m documenting it here for my own use and posterity 😉

Get the latest static ffmpeg build to make sure you have the “afade” filter available for Linux:

http://ffmpeg.gusari.org/static/

Extract ffmpeg to somewhere in your path (I use $HOME/bin). 

Extract 70 seconds of audio, starting at 60 seconds into the file:

ffmpeg -i test.mp3  -ss 60 -t 70 test01.mp3

Add the fade-in effect (4 seconds):

ffmpeg -i test01.mp3 -af "afade=t=in:ss=0:d=4" test02.mp3

Add the fade-out effect (5 seconds, starting at 65 seconds) to the new file:

ffmpeg -i test02.mp3 -af "afade=t=out:st=65:d=5" test03.mp3

I guess this could be done in a better way, combining the snipping and the filtering in one go, but I couldn’t figure out the correct filter / snipping syntax. If you do, please comment.