Demonastery Blog http://demonastery.org Demonastery.org, Blog of Zane.A Hackfest Weekend http://demonastery.org/42/ Back from a really fun hacking weekend in Wellington, where I met some new people (and fellow hackers) and got to work on a project integrating <a href="http://threadingbuildingblocks.org" target="_blank">TBB</a> further into the <a href="http://github.com/facebook/hiphop-php" target="_blank">HipHop-PHP</a> compiler (and exposing it to PHP), which can be found at <a href="http://github.com/OpenParallel" target="_blank">Github</a>. We made some pretty good progress and came up with a few pretty graphs.<br /> <br /> As mentioned in the last post, I have decided to purchase a <a href="http://linode.com" target="_blank">Linode VPS</a> for a couple of months to try it out, and so far I am super impressed with the overall service. I will be using it mainly as a LNMP (Linux, Nginx, MySQL, PHP) host and so far it is doing the job well. I will also be spending the coming months looking further into <a href="http://rubyonrails.org" target="_blank">RoR</a>, Perl, a couple of NoSQL servers (<a href="http://couchdb.apache.org" target="_blank">CouchDB</a>, <a href="http://code.google.com/p/redis/" target="_blank">Redis</a>), and maybe a message passing framework or two. This will also give me a chance to play around with some monitoring systems, and some deployment systems, such as <a href="http://capify.org" target="_blank">Capistrano</a>.<br /> <br /> As a side-note, anyone have any ideas of what to do with a bunch of Clickatell SMS credits? I have an account with plenty of credits but it's sitting pretty stagnant at the moment.<br /> <br /> Also really looking forward to visiting Christchurch in the coming weeks. Haven't been there in forever. Wednesday, 1 September 2010 An Update http://demonastery.org/41/ Still alive! Posting since I just updated the look of my blog (yet again). I have updated the syntax highlighting colors as you can see below (just scroll down a bit). They should now more or less match my Emacs color theme, and code blocks should also be a fair bit more readable now.<br /> <br /> So what have I been up to lately? Well for a change I've actually been rather busy.. I've had a few jobs to work on which has kept me occupied, and I've been travelling around a bit (and hopefully will be more in the future). I've also decided to check out <a href="http://linode.com" target="_blank">Linode</a>, and I'm looking at getting, or at least sharing a VPS with some friends (for evaluation purposes). Linode just may some day end up hosting this web site :)<br /> <br /> Also cleaned up the comment area a bit, feel free to try it out ;)<br /> Thursday, 19 August 2010 Emacs Again http://demonastery.org/40/ Back to Emacs again! Think I might stick with it this time, got a custom colortheme and everything else is pretty much exactly as it was in Gvim :D<br /> Using viper-mode and vimpulse.el of course! Saturday, 17 July 2010 ProtoIRC http://demonastery.org/39/ So I made a tiny and very hackable IRC bot/client base in PHP for rapid prototyping. Of course I threw it on <a href="http://github.com/ZaneA/ProtoIRC" target="_blank">GitHub</a>. It makes heavy use of PHP >= 5.3 closure support as well as regular expressions for defining just about everything. Basic knowledge of the IRC protocol is recommended. You can find more information in the README file in the previous link.<br /> <br /> Here is an example of what a minimal bot looks like:<br /> <div><?php<br /> require('protoirc.php');<br /> <br /> $irc = new ProtoIRC('hostname', 6667, 'NickName', function ($irc) {<br /> // This code will run on connect<br /> $irc->send('JOIN #channel');<br /> });<br /> <br /> $irc->in('/^:(.*)!~.* PRIVMSG (.*) :!echo (.*)/', function ($irc, $nick, $channel, $args) {<br /> // Arguments are self documenting<br /> $irc->send($channel, "Echoing '{$args}' for you {$nick}", 'green');<br /> });<br /> <br /> // Also available is the ability to catch stdin, irc in, and irc out. Set up timers, and call functions asynchronously.<br /> <br /> // This will run once, until disconnected<br /> $irc->go();</div><br /> Friday, 9 July 2010 HashTWM Patch http://demonastery.org/38/ This morning I woke up to find a patch waiting for me on GitHub that extends <a href="http://github.com/ZaneA/HashTWM" target="_blank">HashTWM</a>'s primitive tag support with what appears to be a more full featured, dwm-like tag support. Thanks to <a href="http://github.com/gtellalov" target="_blank">http://github.com/gtellalov</a> for this patch :)<br /> <br /> This is the beauty of open source :D Wednesday, 23 June 2010 Todo.txt-Utilities http://demonastery.org/37/ Just created another git repository for my <a href="http://github.com/ZaneA/Todo.txt-Utilities" target="_blank">miscellaneous todo.txt utilities</a>. For now there are only two scripts, and both are written in [wiki]PHP[/wiki]. Each is explained briefly in the <a href="http://github.com/ZaneA/Todo.txt-Utilities/blob/master/README" target="_blank">README</a> file.<br /> One of the utilities I wrote yesterday while learning how to use [wiki]GraphViz[/wiki] takes a todo.txt file and spits out a DOT one which can be piped into one of the GraphViz renderers.<br /> <br /> It generates output that looks like this:<br /> <br /> <center><img src="/images/screenshot-todot.png" alt="/images/screenshot-todot.png" /></center><br /> <br /> As you can see it takes the item with the highest priority, and steps through to the lowest priority, before splitting off to the remaining items.<br /> You can also find this script in the <a href="http://github.com/ZaneA/Todo.txt-Utilities/blob/master/todot" target="_blank">git repository</a>. Wednesday, 9 June 2010 LibOrgParser Update http://demonastery.org/36/ Today I brought my <a href="http://github.com/ZaneA/LibOrgParser" target="_blank">LibOrgParser</a> repository up to date with my local copy, for the first time in a while since I've been rather slack with my local repository.. but hopefully I got everything. The new version brings reading and writing functionality, as well as a new API, and the OrgQL utility, which lets you run simple SQL like queries on an org-mode file, thanks to the [wiki]SQLite[/wiki] library. Queries that look like this,<br /> <br /> <div>*" $@ | while read; do xdg-open "$REPLY"; done; }<br /> <br /> # use like this<br /> nav todo.org someotherfile.txt<br /> </div> Thursday, 3 June 2010 A Couple of Handy Utilities http://demonastery.org/35/ If you do a lot of work with remote files, which is common in web development, there are a few handy tools that are available for both Linux and Windows that can help you out considerably.<br /> In daily development I would guess that the most commonly used protocols are [wiki]FTP[/wiki] and [wiki]SSH[/wiki]. Rather than using an FTP/SFTP client to download files, edit them, and then upload them back, you can make use of the wonderful [wiki=Filesystem_in_Userspace]FUSE[/wiki] in Linux, or the Windows equivalent, [wiki]Dokan[/wiki]. FUSE and Dokan both have implementations of filesystems over SSH and FTP, meaning that you can mount your remote box as though it were local, and your applications need not know the difference.<br /> <br /> Anyway, to the point, under Linux (well, Ubuntu/Debian), we can download and use SSHFS like so:<br /> <div><br /> sudo apt-get install curlftpfs<br /> <br /> mkdir Remote-Server<br /> <br /> curlftpfs ftp://user:yourpass@host Remote-Server<br /> <br /> # If the previous line didn't work, try this<br /> # sudo curlftpfs -o allow_other ftp://user:yourpass@host Remote-Server<br /> </div><br /> <br /> For Windows systems you need to download and install the <a href="http://dokan-dev.net/en/download/" target="_blank">Dokan</a> driver, you can also get Dokan SSHFS from the same place. You can get an FTP filesystem from here <a href="http://www.ferrobackup.com/ftpuse/" target="_blank">http://www.ferrobackup.com/ftpuse/</a>. I haven't used the FTP one personally, but it should work if you follow the instructions.<br /> <br /> That's all there is to it, I hope this helps you to be more productive in your daily tasks!<br /> <br /> <b>Edit:</b> And now half a day later I realise that Nautilus has these features built in to it anyway.. courtesy of gvfs.. to use select File -> Connect to Server Wednesday, 2 June 2010 New GitHub Repository http://demonastery.org/34/ Just created a new git repository on GitHub for my <a href="http://github.com/ZaneA/Win32-Hacks" target="_blank">Miscellaneous Win32 utilities</a>. Right now it just has my ExplorerGestures code, but I will be adding some more utilities as I find them on my hard drive.<br /> <br /> Btw I hope everyone likes the new design :) this is much more focused on content as opposed to looks.<br /> <br /> <b>Edit:</b> Added some more utilities. Probably still more to come..<br /> Tuesday, 1 June 2010 MPD Class for PHP http://demonastery.org/33/ I've just been going through a couple of folders and I found a very basic PHP class I wrote to control the <a href="http://mpd.wikia.com/wiki/Music_Player_Daemon_Wiki" target="_blank">Music Player Daemon</a>. Assuming the text protocol hasn't changed much it should still work fine :)<br /> <br /> <div>);<br /> $artist = $album = $title = '';<br /> break;<br /> }<br /> }<br /> return $playlist;<br /> }<br /> }<br /> ?><br /> </div><br /> <br /> Consider this code to be in the public domain, so have fun with it! Monday, 31 May 2010 Start Page http://demonastery.org/32/ As always, long time no post, hi! It is exciting times in the land of HashBox, and I've been super busy so haven't had much chance to even think of my blog, but hey, maybe that will change one day :)<br /> <br /> Anyway, recently I decided to put together my own "start page". This post is to show you all a screenshot along with the relevant code to help you to roll your own!<br /> <br /> First up, here's what it looks like :D<br /> <a href="http://demonastery.org/data/gallery/images/HashBox/startpage.png" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/startpage.png" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/startpage.png" /></a><br /> Yes, it turned out a bit girly, but I found the design to be quite refreshing. As you can see it makes use of many newer web technologies, including some great web fonts from the <a href="http://code.google.com/webfonts" target="_blank">Google Font Directory</a>, and also some WebKit exclusive gradient rendering, among other CSS3 goodness.<br /> <br /> I decided to use PHP to do all the processing for the page, here are some examples.<br /> <br /> Here is how I've defined my newsfeeds:<br /> <div><br /> foreach ($newsfeeds as $url => $desc) {<br /> // Fetch and display<br /> }<br /> </div><br /> <br /> The email stuff is unfortunately not coded in PHP as my version of PHP was missing the IMAP library! So I resorted to calling some external Python, which feels admittedly a little hacky, but it works. I may post that in the future too.<br /> <br /> That's all for now, hope you enjoyed my relatively long post 8) Monday, 31 May 2010 A smallish update? http://demonastery.org/8/ Been a while since I posted anything here, and it's always good to have some fresh content, so I thought I'd post my latest creation PrepFS (Pre-process FS), a small utility FUSE filesystem, that enables preprocessing of files.<br /> <br /> My main motivation behind creating this, is enabling modified .Xdefaults dependent on running window manager, or machine it is being viewed from. An Example of usage would be something like this:<br /> <br /> ~/.xinitrc<br /> <div><br /> #ifdef openbox<br /> blah*blah: blah<br /> #else<br /> this*stuff: here<br /> #endif<br /> </div><br /> <br /> Then make sure ~/.Xdefaults is symlinked to ~/.dotfiles/prepfs/.Xdefaults<br /> <br /> More information (including source) can be found here <a href="http://bbs.archlinux.org/viewtopic.php?pid=576680" target="_blank">http://bbs.archlinux.org/viewtopic.php?pid=576680</a> Monday, 31 May 2010 Another Quake III Map http://demonastery.org/30/ Made another map today as practice using NetRadiant :)<br /> <br /> Might make an alright 1v1 map with CPM physics.<br /> <br /> <a href="http://demonastery.org/data/gallery/images/HashBox/shot0013.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0013.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0013.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0014.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0014.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0014.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0015.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0015.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0015.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0016.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0016.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0016.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0017.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0017.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0017.jpg" /></a> Monday, 8 February 2010 New Quake III map.. http://demonastery.org/29/ Spent the last few days working on a Quake 3 map. I'm not much when it comes to designing but I'm pretty happy with how it turned out.<br /> <br /> Pretty much has a blue and red base, some fancy overused mirrors, and some working lifts designed to <b>KILL</b>. The lighting also needs work obviously, to be a tad more subtle.<br /> <br /> <a href="http://demonastery.org/data/gallery/images/HashBox/shot0008.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0008.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0008.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0009.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0009.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0009.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0010.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0010.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0010.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0011.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0011.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0011.jpg" /></a><a href="http://demonastery.org/data/gallery/images/HashBox/shot0012.jpg" target="_blank"><img src="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0012.jpg" alt="http://demonastery.org/data/gallery/thumb.php?img=images/HashBox/shot0012.jpg" /></a> Friday, 29 January 2010 ExplorerGestures http://demonastery.org/5/ So it's <b>2:56</b> in the AM and I've just hacked up a little app to enable moving up a directory in Windows Explorer by using the Thunar/Nautilus <b>middle click + drag up</b> gesture. You can find it on my <a href="http://oss.demonastery.org" target="_blank">OSS page</a>.<br /> <br /> Enjoy.<br /> <br /> <b>Edit:</b> This morning I've extended it to have left and right gestures to go backward and forward respectively just like Thunar and Nautilus. Down is used for exit rather than refresh as Windows seems to take care of this. Saturday, 3 October 2009