Content from 2014

By devin, 18 November, 2014

I just made two cool bash functions for use at work. One checks if a Debian/Ubuntu package is present and installs it if it isn't. The second takes a string bash command and echos it before running it, exiting the script if there's an error.

By devin, 24 October, 2014

I maintain a Drupal website with several hundred files in the /sites/default/files folder. It's a big mess - they're unsorted, many are no longer referred to, and so on. That's another topic.

I was wondering if there was a way to make future links nicer. People accessing the website or sharing links to files on our website don't want to type "sites/default" - that's stupid!

By devin, 23 September, 2014

I've been trying to access the Canada Post Sell Online API (if it's even still called that, in 2014) and I'm having lots of trouble. I'm using an Ubercart module (uc_canadapost) and it doesn't seem to work or something. It looks like you used to get a Merchant ID when you used Sell Online, and with Canada Post's new APIs you get a username and password as your API key.

It took me a good 2 hours to figure out how to successfully use curl to access the REST API. I'm now going to document the examples of successful curl commands that have actually worked.

By devin, 18 March, 2014

In the same vein as my Drupal permissions setup script, here's a script that should set up a Wordpress install with file permissions that are secure, except Wordpress will allow editing of the files through the admin backend. Permissions are locked down in the same way as with Drupal, except wp-content is set up like Drupal's files directory with write permissions for the webserver.

By devin, 6 March, 2014

My two favourite CMSes and my two favourite web servers. Here are four config files for the same website. Let's assume we have a user devin with two directories in his public_html folder:

/home/devin/public_html/drupal
/home/devin/public_html/wordpress

And then has already created the following logs folders (nginx and Apache have a habit of crashing when you try to specify a non-existent logging directory):

By devin, 6 March, 2014

vsftpd is a simple and secure FTP server, I hear. I've used it to set up an FTP server quickly. Rather than fighting with TLS and FTP, I just use SFTP now - it's much simpler.

You'll need to download and install vsftpd and openssh-server at least. Also, I usually use AllowUsers in my /etc/ssh/sshd_config to whitelist  which users are allowed to ssh in like so:

By devin, 12 February, 2014

Here are some useful Drupal scripts! The first is a script that will put your Drupal directory's UNIX file permissions back to a secure and useful state. The second is great if you have a production and a staging website. You often need to clone your production website back to production then change some configuration to make the staging website "development". This is pretty basic; for instance, I sometimes need to disable google analytics as well in this script. The third is basically a listing of the crucial Drupal 7 modules I install in every site I have.