Archlinux Pacman Update Fix

I’m writing this up as a quick solution to archlinux’s dreaded pacman update problem. If you have yaourt installed simply update package-query through it and update pacman normally. yaourt -S package-query pacman -Syu Make sure also to delete the SyncFirst option from /etc/pacman.conf

August 25, 2013 · Shane Dowling

Writing Django tests for PostGis

PostGis is awesome, I think I already established this in this post. However when you start writing django tests you might start getting errors complaining that certain postgres libs cannot be found. This is because you’ve failed to create a proper postgres_template database for your test database to work with. Run these commands in your postgres prompt to create the appropriate template. CREATE DATABASE template_postgis ENCODING='utf-8'; UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis'; sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis_comments.sql sudo -u postgres psql -d template_postgis -c 'GRANT ALL ON geometry_columns TO PUBLIC;' sudo -u postgres psql -d template_postgis -c 'GRANT ALL ON geography_columns TO PUBLIC;' sudo -u postgres psql -d template_postgis -c 'GRANT ALL ON spatial_ref_sys TO PUBLIC;' If you decide to name your postgis template something other than template_postgis, make sure you tell Django by putting the below into settings.py ...

August 24, 2013 · Shane Dowling

Install nzbget using salt

Recently I’ve been using vagrant to configure more and more of the local webapps I’m using day to day, simply as I find sticking all the apps I use on my host machine a little messy. I’ve also been picking up salt-stack with salt-states as the provisioner as I personally prefer it a lot more than puppet/chef. As a learning exercise I figured I’d setup nzbget using salt, it’s good because it requires a few config files and some compiling. You can find the repo here. Should be fairly self explanatory, but there’s more details in the README. If you’ve any questions just ask in the comments. ...

August 23, 2013 · Shane Dowling

Octopress back to Wordpress

I’ve been using Octopress for the last while and it felt good having a nice fast static blog as opposed to heavy-old Wordpress. After time passed however, I noticed I wrote less. Having to grab my laptop and pull up vim to write something, then play around with git or a sometimes having dodgy rsync problems it made the whole process less seamless. Jumping straight onto Wordpress anywhere I felt like(even my phone), has made the ability to write much more present during my day and naturally as a result I’m writing more. ...

August 22, 2013 · Shane Dowling

Postgis

from cities.models import City cape_town = City.objects.filter(country__name=‘South Africa’).get(name=‘Cape Town’) nearest = City.objects.distance(cape_town.location).exclude(id=cape_town.id).order_by(‘distance’)[:10000] I must be very damaged from location data being badly implemented in MySQL. I’m still amazed that this request could be under a second, let alone be pretty much instant. Postgis is basically the coolest thing ever. Oh and in case you were curious(which you weren’t), this place is in terms of distance the 10000th closest place to Cape Town. ...

August 19, 2013 · Shane Dowling

worksly.com — Find workspaces in the UK

It’s online here. Hopefully people find it useful, it’s got data from Foursquare, Yelp and a few other sources. The site itself is built in Python, Bottle, Bootstrap and MySQL, though I hope to upgrade to Postgres with PostGIS when I get the time. I also want to make it look a lot less bootstrappy. For scraping content, because Yelp renders it’s content in AJAX callbacks, it required Phantom JS and Python with it’s awesome beautifulsoup library. ...

May 22, 2013 · Shane Dowling

Circumventing The Pirate Bay Blockade

Fuck jou, Tim Kuik _Edit description_www.fucktimkuik.org will forward you to a number of viable options, but in case that goes down. Download music, movies, games, software! The Pirate Bay - The world’s most resilient BitTorrent… _Download music, movies, games, software and much more. The Pirate Bay is the world’s largest bittorrent tracker._thepiratebay.ee Loading… _Edit description_malaysiabay.org Loading… _Edit description_lanunbay.org And while you’re at it, could you be a doll and fill this in? ...

May 3, 2012 · Shane Dowling

Screwed Server Checklist

My servers started getting unusably slow at peak hours lately and I decided, midst panic to vaguely attempt to document the various things I had to go through to narrow down the problem, anyway I’m sticking them up here so a) I don’t lose the list and b) it might be of use to someone else. Some are obvious, some less so. I’ve already forgotten half of what I did to fix it, so here’s the other half before I forget anything else. ...

April 28, 2012 · Shane Dowling

Diary.py future proof memories.

I’ve created a little command line diary script for anyone whose interested. It stores your diaries in separate txt files so you know all of your memories will always be accessible to you in a format you’ll always be able to read. It’s super quick and easy to use. It’s based loosely on Gina Trapini’s todotxt. Documentation is here. Download is here. Works really well with Dropbox too!

March 8, 2012 · Shane Dowling

Quick vhost script

Quick script to setup a new virtualhost entry for apache. Works for me on archlinux. #!/usr/bin/python import sys, os, subprocess vhosts_file = "/etc/httpd/conf/extra/httpd-vhosts.conf" hosts_file = "/etc/hosts" domain_name=sys.argv[1] folder=sys.argv[2] def usage(): if (len(sys.argv) != 3): usage() sys.exit() currentUser = subprocess.getoutput("whoami") if currentUser != 'root': print("You need to be root!") sys.exit() if not os.path.exists(vhosts_file): print("Vhosts file doesn't exist, exiting") sys.exit() if not os.path.exists(hosts_file): print("Hosts file doesn't exist, exiting") sys.exit() if not os.path.exists(folder): print("Web folder doesn't exist, attempting to create") os.makedirs(folder) vhost_entry = "nnntServerAdmin your@%sntDocumentRoot "%s"ntServerName %sntServerAlias %s ntnttDirectoryIndex index.php index.htm index.htmlnttAddHandler cgi-script .cgi .plnttOptions ExecCGI Indexes FollowSymLinks MultiViews +IncludesnttAllowOverride NonenttOrder allow,denynttallow from allntn" % (domain_name, folder, domain_name, domain_name, folder) vhosts_file.write(vhost_entry) host_entry = "n127.0.0.1 %sn" % domain_name vhosts_file.write(host_entry) subprocess.call('/etc/rc.d/httpd restart', shell=True)

March 1, 2012 · Shane Dowling