LaTeX templates with Python and Jinja2 to generate PDFs

The Jinja templating engine works well to create LaTeX templates for generating PDF files. The only issue is the default Jinja block, variable, and comment identification strings can conflict with the LaTeX commands. A solution is to change the Jinja environment to mimic the LaTeX environment.

Golang: Passing a slice of variables to a function as multiple arguments

You need to pass some unknown number of values to a function ( which accepts unlimited arguments in golang? Put everything in a slice of interface{} and unpack that with "..."

id := 1
name := "test"

Waiting on a process/port/service with a custom Upstart service

Here are a couple Upstart configuration options for waiting on process dependency.
These files go in your Upstart /etc/init directory. Not the best way? Let me know!

Running ezstream as a startup service with Upstart

This is a method to run an ezstream icecast2 audio stream as a startup service within a Upstart init system. This method will also work for anything else which needs to run as a service.

I assume you have icecast2 installed and functioning:

Create a configuration file for ezstream in /etc/icecast2/ or in a project specific directory:

Arrow drawing tool for Adobe Flash CS2, CS3, CS4.

Some Adobe Flash projects require you to draw a lot of arrows. This can get tedious. So, many years ago, I wrote an Arrow drawing tool. It was written for CS2, but still works well enough in CS4.

You can:

  • Draw single sided arrrows
  • Draw double sided arrows
  • Draw curved line arrows
  • Adjust the width of the line
  • Adjust the ratio of the arrow head width to the line width

Python paths in subprocess.popen with Apache mod_wsgi and virtualenv

If you are using subprocess.Popen to run an external process while running Python/Django with a virtual environment in Apache via mod_wsgi you'll discover the new processes run outside of your virtual environment. In my case, I need to set the PYTHONPATH environment variable to get everything straight. Rather than hardcode it or the sys.path in the external script, I'd like to set it to the same value as the existing environment.

Installing multi-core Apache Solr 4.x on Debian, Ubuntu, Red Hat, CentOS, and more

I've installed Apache Solr on a range of servers over the years. The consistent problems are I don't do it enough to memorize it, but it's enough to be frustratingly repetitive. I end up researching the process every time. I've discovered this is a common problem for many people. There are numerous blog posts describing the process in detail. Download this, configure that, etc. This time I needed to install Solr on two local dev machines, the staging server, and the production server. I thought: "Four times? Nope, I'm scripting this!"

Disable/Prevent hotlinking of your Drupal images in Varnish or Apache

I'm going to assume you know what image hotlinking is and get to the details of prevention. The easiest to way to setup hotlinking prevention is to disable it in your Drupal site's .htaccess file. There are a few problems with this method:

The definitive Drupal "Field API Option List vs. Taxonomy" pro & con list

Here I am building out a content type for a new project again. I've got to decide whether to use a Option List field or a Taxonomy field. It's an easy choice right? Right? Once you think far enough down a site roadmap, you'll discover it rarely becomes a simple answer. I've read many articles on the subject and nothing I've found seems to cover all details. That being said, if you find any details or related links I've missed be sure to let me know in the comments.

Making a custom block with an admin settings form in a Drupal module

Often while building a Drupal website, you'll need to create a custom Block containing HTML and content. Completely standard right? It's a problem when your client or the site maintainer needs to change some of that content. They are forced to wade through significant amounts of HTML to find that little bit of content to update. Instead, why don't you build a custom settings page? Your site maintainer gets a simple form to update and you get variables to output.


Subscribe to Front page feed