Archive for April, 2012

Defining the dom0 memory limit in GRUB2

Before I upgraded my dom0 to Fedora 16 (and by association Grub2), I had the dom0 memory limit fixed as an argument in grub.conf. When I upgraded to Grub2, I initially added it manually to the Xen boot command line, but eventually stopped doing that.

Today while looking through the xen-users list, I found an email that mentioned how to get grub2-mkconfig to automatically add it for you – add GRUB_CMDLINE_XEN=”dom0_mem=1024M” to /etc/default/grub. It seems to be the same on both Debian and Fedora, so I don’t see why it wouldn’t work on dom0s built with other distros.

,

No Comments

Fun with Python and image processing

Today I got to work with something I’ve been meaning to for a while – Image processing with Python, in particular the PIL/Pillow library. (Pillow’s a forked, more up to date version of PIL, and it’s in PyPi.)

So about 30 minutes after planning and googling and reading the docs, I have a first version that takes a bunch of images, all the same size (it doesn’t check though), and randomises the list, then cuts vertical stripes of equal sizes out of them, and assembles it into something like this:

This is made up of stripes of 120 photos

Then I moved into variations – swapping the red and blue channels with this code. (Result)

Or how about staggering the rgb channels so each stripe is built with the red channel from the first image, green from the second, and blue from the third? (Again, oddly funky result.)

And finally, just combining channels from three different images wholesale, without the vertical striping? (The result looks pretty interesting with the pink glow.)

What will I do next? Probably look at combining different sized images – have some way of calculating the height & width of images and cropping random portions out of them such that they can be pieced together. Not like the random shapes of a jigsaw puzzle (PIL only supports box shapes), but a collage almost.

I’m still getting over the ‘this is awesome’ and wondering how the random number generators will affect the outcome of the image though.

, ,

No Comments

One more time…

Went back to SAFTI today to see people. Can’t say I miss working there, but I do miss the people and the camaraderie. But it was nice to actually sit and talk to people after being in Canada for a month, and only talking to people over a fairly bad Skype connection.

Also started polishing my resume and linkedin profile, now that I’m back and looking for a job for the next 3 months. I’d be much more confident if I didn’t end up doing generic resumes that I’m having to friends who are willing to ask around – I much prefer to tailor resumes to jobs.

For example, got a hardware position? Excellent, I’ll feature my hardware side more prominently – I oversaw the maintenance and upkeep of more than 120 terminals while I was in NS, doing troubleshooting and component replacement, so that’s a nice bullet point. But it looks strange in a resume next to “Freelance Website Designer” and “Freelance Systems Administrator”.

But it’s probably a good thing I’m fixing up my LinkedIn profile and the various about pages… Nothing like looking at the About page on your site and seeing “Last edited on December 11, 2007 at 8:34 pm”. (There was a brief “Oh wow, I’ve had the site this long?!” moment, I’ll admit…)

, ,

No Comments

Updating phpBB

I’m one of two people who helps with sys admin tasks for the webcomic Twokinds – astute readers will recognise the comic name because I ended up doing the RSS and archive scripts for Tom too.

But recently I decided to update phpBB and the VPS. Get everything up to date wherever possible. The VPS was straightforward – it’s running CentOS, so yum update sorted everything out.

However, the forums were more trouble than I anticipated.

tl;dr – Don’t use the FTP upload function when updating phpBB, upload the zip file to the webserver, su to the webserver user and unzip and rsync the files over.

Read the rest of this entry »

,

No Comments

supybot plugin development

Problems I’ve faced & how I fixed them:

Read the rest of this entry »

, ,

No Comments

A collection of online font resources

www.fontsquirrel.com/ – dubs itself the “best collection of 100% free commercial use fonts”

www.fontspring.com/free – Free fonts from font spring (I am liking Museo Sans. A clean sans-serif font.)

www.google.com/webfonts – Makes using @font-face trivial, so I’ll probably end up using this. (Again, Glegoo and Open Sans look nice to me.)

, ,

No Comments

Dropbox API + Python to sync a folder

One of the more interesting Kickstarter projects that I saw recently is GameStow – software that would sync your saved game files to the cloud, an alternate to Steam Cloud Sync that’s not tied to Steam. I forget where I first saw it (most likely Slashdot or similar), but I fairly ignored it – I’ve been using Dropbox Folder Sync to sync my saved games, if Steam doesn’t natively support it.

I’m fairly sure I first saw on a site like Slashdot because I remember reading a comment later that went along the lines of “I don’t see anything special about this beyond the fact that it’ll automatically find your games. Sounds just like Dropbox – In fact, might even be Dropbox based, hooked into their API”.

Now, most recently I’ve been working with the dA Sta.sh API to do submissions direct from Lightroom, so when I saw that Dropbox had an API, I took a look at it. It looks interesting – I’d bet that their desktop plugin does proper deltas of files rather than uploading/downloading the entire file, and that what I was interested in, so I kinda forgot about it.

Then I found GameStow again while looking at fonts that were funded through Kickstarter. And at this time I remembered the Dropbox API, so I wondered if maybe the idea of GameStow could be built using the Dropbox API + Python.

So I thought about the structure of the program. Right now I’m using junction points to get the saved game folder into my Dropbox. So, I thought, does Python support making junction points? Answer: Seemingly, yep. Google-fu pulled up a relevant stackoverflow question, which pointed to a module that handled it, so I wouldn’t have to roll my own code.

However, I soon realised that I didn’t think things through. I don’t need to create junction points for every folder – I can specify folders in an app. Dropbox doesn’t care where the files are, just that I give it files to store, and download files from it. So, ok… no need to junction folders.

But! How do I detect changed files with Python? I’d have to monitor the folder anyway – I didn’t think about that initially, assuming that Dropbox would take care of that. But the Dropbox SDK says no, it doesn’t. Ok, back to Google. Another stackoverflow q-and-a later, and I’ve got a nice how to guide.

So, other than the GUI bits, in theory, we’ve got code that will monitor a folder and sync the contents of that folder to Dropbox. Just have to git it all together…

No Comments

Vote powered kickbanning – a supybot plugin

So… I’m an IRC operator on a fairly well traffic-ed channel (#twokinds on Nightstar, if you care – we’ve been averaging 55 people or so fairly consistently lately), and one of the things which I have to deal with is general malignants, which is generally done by kicking and banning them.

Now, I’m not the only op around, but there have been periods where all the ops disappear, and a few days ago there was an attack that happened to coincide with one of those periods.

I know this because a) people told me when I returned from being AFK, but also because b) I’ve got a supybot living in the channel providing a bunch of services to the channel. Now, because that bot is authenticated as me to NickServ, it also gets op privileges. So, it seemed time had come for me to implement one of the ideas which I’ve had – vote powered kickbanning, where trusted users can vote to kick and ban a miscreant.

So that covered steps 1-3 of my dev process. Next step was planning it out. And I really do use paper to plan:

Conceptualizing the flow of a plugin

Step 5 involved digging into the guts of existing supybot plugins – I’ll be pulling stuff from the Channel plugins to write it, so that was a starting point. The code is fairly convoluted, and I still don’t understand all of it, but I think I’ve got enough for the basics of the plugin to work.

Now it’s just to actually write the blasted thing, and get it working. 😛

, ,

No Comments

Developing software – my process.

I generally don’t have any plans for developing specific software. What I do create is more stuff I find or think would be useful. My Lightroom plugin started from there – I saw that dA published an API, and so I thought about working with said API in Lightroom. Sounded like something fun to do, and I had some free time at that point.

So, in general, my process goes like this:

  1. Come up with idea.
  2. Toss it around mentally, think if it’s possible
  3. Wonder if I even want to implement it – will I make use of it myself?
  4. Sketch out the general flow of the program on paper – at this point, think of input/output, edge cases and data structures.
  5. Look up language features/API functions that I’ll use, and put them into the paper design.
  6. Implement and test the barebones of the program – just the basic functionality at this point.
  7. Add new features/optimise the existing code as necessary.

Now, it’s not cut and dried – if the idea sounds sufficiently cool then I might jump straight to step 4. Of course, what generally ends up happening when I do that is me getting through designing the program, and then while researching how to write it, putting it on the backburner and forgetting about it.

So, the point of all this? I should probably start documenting my ideas, and I thought I should think about how I think about ideas first…

, ,

No Comments

Cloudflare/Dreamhost: Least surprise, maximum confusion indeed.

tl;dr – In summary

Dreamhost isn’t pointing domain nameservers at Cloudflare. They’re using an system of CNAMEs to redirect people to Cloudflare, hence the necessity of “Add WWW”. Dreamhost is still your nameserver. If you’re using Cloudflare and you’re moving back to Dreamhost, or were using Cloudflare, change your nameservers back to ns1.dreamhost.com and ns2.dreamhost.com to keep your sites working!

Also, if you’ve got subdomains, expect to have to edit each one and choose “Use Cloudflare”, if it works. (Subdomains currently aren’t showing as being delivered through Cloudflare as of 3am 8 April.)

Read the rest of this entry »

, , ,

No Comments