logo

ShrimpWorks

// why am I so n00b?

After the release of the “Dumb Image Browser”, (which worked/works very well for what it’s supposed to do), I thought of prettying it up a bit, and adding some extra features.

The result is the Nice Image Browser. It’s vastly improved in terms of visuals, as well as offering features like easier browsing around the galleries, easy creation of new galleries, and uploading files directly from the browser.

It maintains the same PHP5-powered, database-less, cache-less, auto-thumbnail generating system of the Dumb Image Browser, meaning it’s just as easy to get set up (copy the files to a directory you want to become your gallery).

Thanks to Korpse/k4y/K` for the new stylesheet used for displaying the thumbnails.

The ReadMe includes usage and setup instructions. Happy image browsing! :)

Alright, so I’ve been getting more and more spam in recent weeks, and they’ve been getting harder and harder to build basic filter rules for.

My mail works in a pretty round-about way:
I have multiple POP accounts all over the place, which have sort of accumulated over the years. It becomes a bit of a mission to always set up and check all these accounts, so what I have now is a small Python script that connects to each of the servers, grabs the mail, sorts them based on some simple filters (like, containing a [mailinglist] type subject), and places them within a Maildir structure based on that sorting. In addition, it does the same thing for deciding if it should delete a message - extremely basic spam filtering rules can be set up to check out certain headers for possible spam flags, etc.

The downloaded mail is then served via IMAP, using the Dovecot mail server. The great thing about that, is then every time I re-install any of the machines I use for mail access, or install a new one, I instantly have all my neatly sorted folders, all my mail from all my accounts, and only one IMAP account I need to set up.

Anyway, basically, the spam filtering of the above system was rather lame, so I went on the hunt for something a little more useful. Enter SpamBayes - a mail proxy application written in Python.

It’s already “in Debian”, so installing was as fun as always (aptitude install spambayes), after which I only needed to start the service, and then it’s off to a browser to configure it. Actually there wasone step before that - since I’m running this on my server, and SpamBayes is meant for use by a single user on their own PC, it doesn’t allow connections do it’s browser-based configuration from other hosts. Which is a bit of a problem when running a server which I have no interaction with beyond a command shell. Thanks to Lynx I was able to configure it to allow connections from my local network.

For starters, you need to tell it which POP3 servers you want to connect to, and assign local ports to each one, which will be stand-ins for port 110 when connecting to servers. The interface for this is a bit troublesome however, requiring you to enter each server into a single input field, separated by commas. The associated ports for each server are then entered into another input field in the same manner. It took me a while to get both the fields synced due tot he number of servers I intended using.

Next up, I fed it a few emails for training (saved emails out of Thunderbird as EML files, and these can be uploaded to the server for training via the browser interface) both ‘ham’ and spam.

Once it knew the basics, I simply updated the list of servers in my Python script to “localhost”, and whichever port each one was set to. Shortly thereafter, mail started passing through the system. Most of it was identified as “unsure”, as it hadn’t seen enough examples of ham or spam yet. Quite smartly, it keeps a record of each message that’s passed through, and you can easily train ham or spam from these.

Around 50 mails later, it was identifying almost every message perfectly. I’m going to leave it running for a day or two more, training everything that arrives, then I’ll just add a single filter to my mail fetching script, looking at the “X-Spambayes-Classification” header for “spam” (delete), or “ham” take no action.

I’m quite happy with this setup, looks like it’ll work quite well :D.

Created two very basic scripts this past week:

The first, a basic Image Browser:

Basically, I really hate trying to set up and use normal image publishing/gallery software. Something like Gallery is pretty nice and feature packed, but for putting a photo of your cat online, it’s pretty much a mission, with users, permissions, logins, galleries, categories, grouping, keywords, thumbnail options, etc, etc. I just want to upload a JPEG and say that’s the end of it, but still have ti browsable with some thumbnails that didn’t take me 10 minutes to create in Photoshop.

Anyway, yar. So I made this script. It’s actually a pair of scripts. A basic browser interface that simply goes through a directory, finds all images, links to them, and shows thumbnails of them via the second script - a basic thumbnail generator.

So ‘installation’ is simply dropping this pair of scripts into the directory you want to publish your images from, and it’s done. Any sub-directories will be navigable, so you can use them as ‘categories’ if you’d like. Since the thumbnails are generated on the fly as needed, there’s no database or anything, and adding a new image is as simple as dropping the file into your image directory.

The second script, is a Download Tracker:

Extremely simple again, simply does a count of hits on any file passed to the file.php script. The files can be located anywhere on the system (so if you really don’t want people getting at your files without going through the counter, they can be outside of your www published path).

Again, I was going for simplicity here, so there’s no massive upload manager UI, or snazzy hit monitoring UI, or a 5000 table MySQL database. It keeps track of the hits by simply storing them in a regular PHP array, and then serializing this array to a file. Next time the file it requested, the hit log file is loaded, then unserialized into the array, the array is updated and serialized again. :). So you’ll need to make sure the files.log file is writable by the web server (or the whole directory the tracker files are in). It also requires PHP5, unless you write replacement functions for file_get_contents() and file_put_contents() on earlier PHP versions.

Link to a file as follows: http://my-site.za.net/file.php?installer.exe, or even http://my-site.za.net/file.php?path/to/document.pdf

You can then view the hits and things via the file_stats.php which outputs a very basic tabular representation of the stats the hit log tracks.

Both of these packages’ code is pretty well documented, so if anything, they may be educational so you can build more exciting versions of these. However, as they are, they serve my needs, but just thought I’d share anyway ;).

Usage instructions are also within the code.

Yay, on Friday, I decided to take the plunge, and install Debian on my laptop. I’ve always wanted to try working in a Linux desktop environment, considering I do practically no Delphi development any more, everything’s either PHP or Python. Since Debian has plenty of support for both of these, it seemed quite ideal.

I’m not dumping the existing Windows install though, so I had to partition my drive. Now, partitioning drives is about the most nerve-racking thing I’ve ever done, no matter what software I’m using, no matter how little data I stand to lose, I’m always scared as hell something will go wrong. Doubly so on this laptop since I use it constantly for work, and it’s the default installation HP put on, which I’m not really eager to bugger up. Luckily, that all went smoothly though :D.

When it came to installing Debian though, I had a problem with the netinst installer I was using, in that a package or two would not install due to missing some authentication files or something. So, since that installer didn’t work, it was suggested that I try an older Sarge installer and upgrade to the Unstable branch from there.

As expected, that installation went without issue. Unfortunately I just had to try my best to keep the machine cool while waiting for the installation to complete and the ACPI applications to kick in so the fans would do their thing. Thanks Korpse for warning me about that in advance ;).

So anyway, after the base installation was done, it was trivial (as I have come to expect from Debian,) to get Gnome, X.org and GDM installed and running. Apache, PHP and the rest were even easier. I was very pleased to see that the Firebird SQL server (open source’d Interbase fork thingey) was available in Debian right away, so I plonked that in as well. All that was left was to install Subversion, and check out my work stuff. Once done, I was 100% ready for work :D.

There are a few things not working yet - I haven’t had much luck with the wireless LAN. Gnome’s wireless LAN configuration applet thing is missing WPA-PSK authentication options (which I’ve configured my wireless AP to use), it only supports WEP. I also can’t seem to get the WPA tools (wap_supplicant) to work correctly. Based on the output I’m getting though, it *looks* like it’s connecting to the access point - it manages to find the AP’s MAC address and everything just fine, and it reports the authentication was successful, but beyond that, I can’t actually ping anything, and all traffic still seems to be trying to go through eth0 (wired LAN) rather than eth1 (wireless). Guess I need to learn a bit more about Linux networking… heh.

Another thing that’s not quite working is Bluetooth. Again, it *seems* to be working, the hardware is detected, and is working fine. My phone can pair with the laptop fine, using the PIN I’ve defined, but I can’t seem to transfer files or anything in either direction. I’ll admit that I haven’t played with this much yet, but I’m not really sure where to go next. I haven’t even tried looking into infra-red yet :).

And yes, I do use all these things, that’s why I spent so much on this laptop :P.

I also haven’t installed the ATI drivers yet, it looks like it’s going to be a bit of a mission on it’s own though.

Along the way I’ve also discovered some interesting new applications I haven’t seen or heard of before. gDesklets seem like a nice way to waste some CPU time and memory if you like to keep your desktop busy. Beep Media Player seems like a very nice alternative to XMMS, seems a lot more stable, and the general feel integrates better with Gnome. RapidSVN looks like it’s trying to be a nice enough SVN front-end, however I find the good old command-line a lot more friendly and efficient (and it crashes less). Sylpheed is a rather nice little mail client, and works well as an alternative to Thunderbird - assuming you’re unhappy with Thunderbird though. ibWebAdmin is a neat web-based tool for managing your Interbase databases, not as feature-packed or good looking as phpMyAdmin, but it does what it needs to do pretty well.

All that’s left now is to give it a shot at work tomorrow, and see how it all goes :).

A few weeks ago, the Serious Sam 2 demo was release, and my clan, the Avatars, and I were dying to try out the co-op, since we had played the previous game though together (although some shocking networking code made it near impossible), and were rather looking forward to SS2.

Unfortunately however, the demo’s internet play functionality was rather broken. After some digging on various forums looking for a solution, someone found a rather useful little utility - Hamachi.

Hamachi is basically a very simple VPN system, which behaves pretty much like an instant messaging client. When you install it, you’re run through a very informative little tutorial to get you started. During the process, you’re assigned an IP in the 5.5.x.x range - though I’m not entirely sure where the range starts or ends, we all got IPs like that - and a new Hamachi network connection is created under Windows. You may then join or create as many private or public networks as you like.

Members on the network can ping each other on their “Hamachi IPs”, they can browse shares, and copy files backwards and forwards (shares even end up showing up in your “My Network Places” eventually), send messages back and forth, etc. And of course in our case, it registers in games as a LAN connection, so you can easily play any multiplayer game with LAN support, without the need for the person hosting the game to mess with their firewalls, routers, port forwarding, etc.

There is a Linux binary available, however I couldn’t get this to work on my Debian Sid server, there were various tunneling problems, which are a bit beyond my networking skills to resolve.

In general though, the possibilities are pretty endless. Anything you can do an a LAN, you can securely and easily do with Hamachi, on a network spanning the world if you really wanted.

“Oops, I just printed my bank statement to Joe in Australia’s printer!”

Ever since installing BattleField 2, I’ve had a problem with taking screenshots. Basically, the game completely freezes up when I press whatever key is assigned to screen captures, and I need to reset my computer completely. Also, I seemed unable to use Fraps to make screen captures since the game seemed to be blocking all requests to whichever keys I assigned to Fraps’ capturing options.

I decided to rather just create my own utility. A simple application that hooks into the “Print Screen” key’s press, so when you press Print Screen, this app takes the image out of the clipboard, and will write it to a folder as a JPEG image. You can customise both the output location and the JPEG compression quality. The images are named after the current date and time.

It doesn’t work only for games, ANY time you press Print Screen, a screenshot will be saved. I think that could actually be pretty useful.

Yes, there are a million screen grabbers for Windows out there, but writing something yourself is both educational, and you know exactly what it’s doing. Also, I now have a single screenshot button for games, and everything else as well :D.

Note this may not work for all games, as some games tend to dump quite a mess to the clipboard when attempting a Print Screen.

This post also serves as a test for the attachment plugin for WordPress I recently installed ;).

I only noticed this rather recently.. But you can set up Firefox’s ‘Homepage’ option to open multiple tabs when you open the browser.

Just enter the URLs you want to open by default, separated by the pipe (’|’) character. The same effect can be achieved by opening all the tabs you want, then use the ‘Use Current Page(s)’ button.

So you can now open Google and 200 random websites you probably won’t even look at anyway! Personally, it irritated the hell out of me, but maybe someone would find it useful…

Thanks to a link mithrandi posted in IRC, I’ve discovered this rather useful tool.

Gregarius is a web-based RSS/RDF/ATOM feed aggregator (oops, I didn’t copy/paste that from their homepage :P) which you can install on your own server, and manage as you like.

Setup was a breeze, I just checked out the latest version from their Subversion repo, copied the files over to /var/www, and created a MySQL database. First visit to your Gregarius URL prompts for database access settings, and creates the tables and everything for you.

It has an extremely clean interface, I suspect in fact that it’s highly influenced by WordPress (their “devlog” using WordPress further convinces me), but that’s beside the point. It’s extremely easy to manage categories, add feeds (it automatically fetches a “favicon.ico” file if one’s available as well), etc. I got my whole installation and 10 feeds all setup within around 10 minutes.

It presents the feed items nicely enough, sorted by date, with links to the full versions, as well as descriptions/summaries. It also keeps track of items you’ve left unread, making it easy to come back to them later. Another helpful feature is the ability to search within the feeds it’s downloaded and stored, allowing you to pull up any item at any time, I’ve already found this quite useful.

All-in-all, a pretty great little package. It sure beats Thunderbird’s RSS reader hands down. If you subscribe to any feeds, have the ability to host it (just PHP and MySQL required), and 10 minutes to set it up, throw away your existing RSS readers and get your own Gregarius aggregator up and running :).

I must say, I’m rather disappointed with my “SmoothWall experience” so far. I’ve been tasked with setting up a SmoothWall firewall/proxy machine at work, and from what I’ve read, it’s like the best thing since sliced bread.

Unfortunately I cannot agree.

The installation tends to go fine, it partitions the hard disk by itself, installs fairly fast, then steps through a simple setup ‘wizard’. Here we are prompted if we want to enable or disable ADSL. Now, I want SmoothWall to connect via our ADSL line. BUT, it seems the developer’s idea of “ADSL” is in fact “USB ADSL Modem”.

Anyway, after figuring that one out, and after much shuffling of subnets and IPs between the router, SmoothWall, and my PC, I finally get it to use the router as a gateway. I try visiting some sites - DNS lookups fail. I take a look in all the log options on SmoothWall, and find the firewall is blocking DNS traffic, and is trying to route everything through the same (“Green”) NIC, rather than the second (“Red”) one.

Sooo, turns out I can fix this by running the “setup” tool again, and ‘pretending’ to change the IPs, so it resets everything (re-writes the firewall rules maybe?). Cool, everything’s working again. Not quite.

Seems after that, the proxy magically stops working altogether, so from the web interface, I just disable it, and re-enable it. Cool, everything’s working now. Riiiiight.

A few hours later, suddenly the internet is dead. Hmm, seems the firewall is blocking all traffic again and routing though the same NIC. Sooo, I repeat the whole IP change/reset, proxy reset, etc, and everything’s cool.

A few hours later I find myself repeating the whole procedure again.

This is seriously lame, having to practically reboot the entire machine every few hours. So I think maybe I’ll try to set up a PPPoE connection. So I go and configure the router correctly, test ‘dialing up’ with my machine in XP, all’s cool. Now to set up SmoothWall. Running the setup tool again lets me set the “Red” interface to “PPPoE”, and that seems done. Now where do I put my username and password to dial up?

Apparently the “ppp settings” page of the web GUI is where it’s done. Now excuse my ignorance, but this looks like a modem dial-up page, asking for phone numbers, which COM port my modem is on, etc, etc. A bit of searching around the rather un-helpful support forums, reveals that this is indeed where you need to configure PPPoE usernames and passwords. Just leave all settings alone except for login details.

I give it a shot, tell it to connect, nothing happens. Check the logs, and not surprisingly, it’s trying to connect via ttyS0 (COM1).

Now, apparently there’s supposed to be an option to select the correct interface in the drop-list where you select which port your modem is on, on the “PPP Settings” page, but for some magical reason this does not exist for me.

Unfortunately their forums are also not very helpful it seems, and even after composing a very descriptive help request, I get a rather sarcastic “RTFM” response for a subject not covered in the manual.

Basically the manuals are not up to scratch, the support forums are full of leetbois, the options in both the setup tool and web UI are obscure, and the whole thing is bloody useless, needing a darn reboot every few hours. WTF.

I’d love to send the whole thing to hell, but unfortunately I have to get it to work. *sigh*