flac to mp3 1
I love flac files, and I always rip my CDs in EAC - straight to FLAC. The problem is that a couple months ago I was transfering some of my older music to my MacBook and I discovered something awful. The horror known as iTunes doesn’t grok Flac. I failed to find a single plugin.
First, I sought to convert my FLACs to ALEs - because it’s rad. But I gave up. I finally discovered someone already having written what I wanted - in python - w00t.
flac2mp is an awesome little script. He got it from “ogg 2mp3”, and I like it.
inotify
We were messing w/ Postfix and Cyrus IMAPD today. Our prime goal was making a sensical approach to authenticating against a PostgreSQL-based directory. LDAP (OpenLDAP and FDS) based tools sucks for most people. Using native-box-auth is actually quite messy. The mail data cannot be easily associated with the users. You end up with data spread everywhere.
Our basic tenants are:
- Simple Database Schema - there is no need for a highly relational approach for something so simple.
- Embedded procedures where possible.
- Simple front-end.
My esteemed colleague John implemented our thoughts. He ended up with a few PGSQL functions, a couple views and a very straight-forward process.
The actual setup for IMAPD and Postfix is nearly as simple. He will be documenting it at his site later. For now, we wanted to verify the actual behaviour of postfix and imapd during SASL auth in realtime. We turned to inotify. I install pyinotify, and used thier Quick Start script. This ended up leaving me a simple script which monitored the directories which I wanted.
This will not show you files which failed to open. But it does good enough.
import os
from pyinotify import WatchManager, Notifier, ThreadedNotifier, EventsCodes, ProcessEvent
wm = WatchManager()
mask = EventsCodes.IN_DELETE | EventsCodes.IN_ACCESS | EventsCodes.IN_OPEN | EventsCodes.IN_CREATE # watched events
class PTmp(ProcessEvent):
def process_IN_CREATE(self, event):
print "Create: %s" % os.path.join(event.path, event.name)
def process_IN_DELETE(self, event):
print "Remove: %s" % os.path.join(event.path, event.name)
def process_IN_ACCESS(self, event):
print "Access: %s" % os.path.join(event.path, event.name)
def process_IN_OPEN(self,event):
print "Open: %s" % os.path.join(event.path, event.name)
notifier = Notifier(wm, PTmp())
wdd = wm.add_watch('/etc', mask, rec=True)
wdd = wm.add_watch('/usr/lib/sasl2', mask, rec=True)
while True: # loop forever
try:
# process the queue of events as explained above
notifier.process_events()
if notifier.check_events():
# read notified events and enqeue them
notifier.read_events()
# you can do some tasks here...
except KeyboardInterrupt:
# destroy the inotify's instance on this interrupt (stop monitoring)
notifier.stop()
break
Turbogears Init Scripts
Turbogears lacks init scripts, and if you use it long enough you will long for them. The Ashbyte crew hacked up something quick and dirty. They aren’t much, but they’ll save time for Gentoo users.
The main difficulty is the child processes that TG spawns when running with dev configs. Finally, I settled on an awk script which I picked up from Dave Taylor
Port Forwarders
Everyone needs a decent IP port forwarder, once in a while. Here are three great ones:
- Thread-based, this is my most frequently used.
- Async-Core - recently used when the threaded model wouldn’t forward an ssh session (???)
- Pinhole - another threaded implementation.
The Async-core version is clearly the hottest. It runs as slick as can be, and (at least for low-b/w) it was staggeringly quick.
Trac: MassConfig Changes
Pacopablo posted a quick example of doing mass-environment changes to Trac sites on Asylumware. Today I used it, and I updated it.
NGinx + Tracd 2
I hate Apache. I really do. I refuse to vindicate that hatred. There are great aspects about it, but the things I want to do are hampered by things like the sewer-refuse-styled configuration syntax.
I like Nginx. It is fast, simple, and is amazing. It does proxy, reverse proxy, rewrite, ssl, and everything else. Cliff Wells cooked up a wiki. As linked before, it cleans up when facing off with Apache, Pound, Lighttpd, etc. It has all the core features that sane people need.
I just wrote a recipie for Trac + Nginx over at Edgewall. Trac + Nginx + PostgreSQL Kicks ass.
Note: I still use Apache for moddavsvn, and a mod_python only application. (But that will be fixed soon enough). SVN is another question entirely.
Evo2Sieve - Converting Filters
My lovely wife has been using Evolution for some time now. We use Gmail lots anymore, but she still has lists and other traffic bound for Evolution on our Cyrus IMAP server. One continuous problem is the crappy filter problems with Evolution.
Cyrus provides a usable solution for this, Sieve. It is a complete and usable script tool. Here was the problem: IT’S OBSCURE. Sieve has no really nice utilities or specific integrations that are very nice.
I can write a sufficient scriptl, but I cannot teach Colette to do so, so I have been left with her running Evolution and depending on the flaky filter behaviour.
No more, I wrote the initial, very RAW version of evo2sieve.py. It depends on Gnosis XML Utilites and is actually a decent start at solving the problem.
Needs:
- Managesieve integration, which sucks because it doesn’t work out of the box, and the Cheeseshop install is broken.
- Optparse support to allow actual command line options.
- Minor GUI support to monitor and allow change management
Exchange Sucks Today
Microsoft Exchange, the pithy "message server of the masses". Running atop the 'venerable' Windows 2003 Small Business Server. It calmly neglects everything except it's beloved Outlook. Which in turn neglects everything except it's cancerous host: Windows.
Microsoft Assist (paid) phone support, separated by distance, culture, and of course, source code, fails to be able to address most Exchange issues which don't already have a fix in the Microsoft Support site.
When you call support, it's reasonable to expect that if an existing TID could fix it, you would have found it rather than piss away two bucks and change ($250 - $500) on a support ticket. Despite that, every IT man worth his salt would never contest the right and desire of support to see to the basics before proceeding to the difficult.
Today's incident began in June of '05, and continues today. Microsoft Exchange 2003, running on Small Business Server 2003. Service Pack 0, Service Pack 1 and now, improved with Service Pack 2. We have a lingering Information Store crash. Now we need evidence that Exchange Sucks. (Or, is my issue with Microsoft, Support, Closed Source software.....)
Read the Article
Stupid Cooking Tricks on Windows.
Cliff tried a number of things, but he has had occasional issues w/ file writes under VMware (Which is where he runs Windows). He suspected he was hitting a write issue due to VMware, and had hit a dead end solving the problem.
I finally had an opportunity to review the problem, and I stumbled across the solution while reading the pycurl multi-file retriever. It turns out that on sane platforms (e.g. Linux) the python file object defaults to binary files. Under uber-magical windows, the file object defaults to ASCII. What a suprise. The entire problem of cooked zip files was solved by:
file('foo.zip','wb').write(data.getvalue())
Woo-hoo.
Tech Notes:
- 'data' is a StringIO object.
- We are using standard crap w/ pycurl.