Tagged: one pic a day

Comments (0)

Tagged: one pic a day

Comments (0)

Photo

Comments (0)

MySQL 5.5 on Mac OS X Snow Leopard

Just had a whale of a time getting this installed, thought I'd share the solution.

I was getting errors like:

 /usr/local/mysql/support-files/mysql.server: line 256: my_print_defaults: command not found 

All you need to do is run this commands:

 echo "/usr/local/mysql/bin" > /etc/paths.d/mysql && echo "[mysqld]\nbasedir=/usr/local/mysql" >> /etc/my.cnf 

Hope that helps!

Comments (0)

LaTeX Dissertation Template

I've decided to turn my dissertation into a freely available template. I know of at least 4 other people who've used this template in one version or another to produce their dissertations, so thought I'd publish it online for all to use. Those doing computer science dissertations (especially those at Sussex Uni!) will find this most useful, though it should be relatively easy to adapt for others.

 
The directory structure should say it all. The build script simply cats everything together in the right order and runs pdflatex bibtex pdflatex pdflatex on it. Again, this should be very easy to adapt for other TeXs, such as the awesome XeTeX. I've deliberately tried to keep it very simple and clean, such that it doesn't restrict you too much in your choice of software, packages, OS or file structure, and most importantly stays out of the way when you're trying to get your dissertation written!
 
Please drop me a note if you use this, I'd love to see what people create with it!
 
Code hosted online at github as LaTeX-Dissertation-Template, sample PDF below.

Click here to download:
report.pdf (155 KB)
(download)

Comments (0)

Comments (0)

Comments (0)

Managing server configs the easy way with Git

I've got quite a cute way of managing my config files on my VPS that I thought I'd share. As I spend a lot of time fiddling and tweaking, getting the process as streamlined as possible and being able to recover from a bad setting were the primary goals in setting this up.

The inspiration for how this works came from Gitosis. I highly recommend Garry Dolley's tutorial on how to set it up and for general info. In this short tutorial I assume you're running Gitosis on the same machine you're managing configs for, though it wouldn't be hard at all to change things for other Git repos or remote hosts. I also assume you've got Monit installed and running, though if you don't, just ignore that part of the tutorial and you'll just have to restart the service yourself to pick up new config changes.

I've recently installed nginx on rly.gd, so I'll be taking this as an example. I begin by creating a new repository with Gitosis called nginx-conf (again, see Garry Dolley's tutorial for info). Then, I create a git repo in nginx's config dir (/opt/nginx/conf for me, probably /etc/nginx for you), add all the files, and commit.

Referring again to the same tutorial, I add the Gitosis repo as the remote origin and push the initial commit.

Then, on my local machine, I clone the repo from Gitosis:

Back on the server, I create a file named post-update in /home/git/repositories/nginx-conf.git/hooks, and chmod it +x. The following script first deletes the old files (don't worry, you've still got a copy in Gitosis!) then clones the latest version:

This script means that now when you push to the Gitosis repo, it'll update nginx's config to match the latest revision. So now, when you're making edits to your server config, you just need to commit, push, then restart the service. Taking it one step further, we can automate the last step out of the process too, so the service will restart itself. Depending on how your server is set up, you may just be able to add /etc/init.d/nginx restart to the bottom of your post-update hook, though it's not a very clean or secure solution. Better is to make Monit watch the config for changes, and restart the service if necessary. Here's a monitrc entry for nginx:

The bit you're interested in specifically is lines 13–17, where we make Monit watch for changes on nginx.conf, and make the nginx service depend on its config.

So that's it, a simple but useful little trick to ease configuration changes. I've used this to automate changes to all my important services on all my servers, and it definitely makes life a lot easier!

Tagged: ubuntu server

Comments (0)

Monit is awesome.

Media_httpmmonitcommo_fuofq

They really aren't kidding, it takes about 5 mins to install and 10 mins to write service definitions - and now I can sleep easy knowing my server will fix *itself*!

Comments (0)

Tagged: ubuntu

Comments (0)