Brandon's Notepad

June 5, 2015

m4 Macro Processor

Filed under: Computer Software,Linux — Brandon @ 3:54 am
Tags: , , , , , ,

Home > My Lists > Technical Notes > Linux > m4 Macro Processor

m4 is a macro processor that replaces tokens in a file. It was once used as a FORTRAN preprocessor and is now used by various systems to manage configuration files. I started using it years ago in conjunction with make to automatically generate web pages, but that practice ended when I decided to move this site to a ‘blog platform. Since then, I’ve continued to look for additional ways to leverage it.

Presently, I’m collecting links about m4 and will write more if needed:

GNU m4 Manual
m4 Manpage (
Using m4 Macros in Your Programs
Building text files with m4 macros
Michael Breen’s Notes on the M4 Macro Language
Fractals with SVG and m4
m4 Macros and CSS
Using the m4 macro processor for fun and profit

Here’s a random snippet of a makefile using m4:

.SUFFIXES: .m4 .html
.m4.html: $(Common)
m4 -D_LOCATION=coding -P $*.html

March 8, 2010

Back Up WordPress ‘Blog With Wget

Filed under: How-To — Brandon @ 1:22 am
Tags: , , , , , ,

One risk of keeping my notepad online is the eventual disappearance of Backing up my ‘blog is of utmost importance. WordPress has a built-in export function, which I do use, but it is most useful for reloading the ‘blog into a WordPress-driven site. I also wanted a way to create a local copy of my notepad for local browsing and for quick upload to a non-Wordpress site if the need arose. Enter, wget.

Wget is one very useful tool. In a nutshell, it gets files, even entire sites, from the Web. I did a quick search and found this posting that provides a recommended set of command line options. I removed the -w and -H parameters and limited the -D parameter to my ‘blog only. Also, I used the shorter flags for brevity (e.g. -m for –mirror, -k for –convert-links, etc.).

wget -m -p –E -k -P ~/var/tmp/Notepad

Now I can keep a local copy or even burn it to for use on other machines.

February 27, 2008

Graphics Automation

Filed under: Computer Software,Linux — Brandon @ 9:07 pm
Tags: , , , , , , ,

Home > My Lists > Technical Notes > Graphics Automation

I read an interesting article on running OpenOffice as a headless service. (Look here for more info on actually making it work.) It focuses on using OO as an online document converter, but I’m sure there are other uses.

Reading that made me think of other useful things that could be done from the command line, such as editing & converting photos. I know that the Gimp (i.e. OpenSource equivalent to Photoshop) includes a scripting language and a Perl interface exists if you want to use its capabilities in a script; however, I don’t think it can run headless out of the box. Instead, I use ImageMagick for such tasks. Here’s an article explaining how to do some simple things in that tool. It’s really useful if you manage a lot of graphics files, be it your personal photo album or the graphics for the websites you author.

Finally, Inkscape is a vector graphics program similar to Adobe Illustrator and Macromedia Freehand. It will allow you to save vector-based drawings (i.e. lines & shapes) as XML files that can be directly manipulated with a text editor (or a script, if you want to automate the creation of forms or whatever). It also has a command-line interface that could allow you to export your drawings as PDF files!

For Non-Linux Users: All three of these applications are available for Windows (i.e. you need not install Linux to use them)! OO and Inkscape are available for Mac OS X, but it appears that ImageMagick must be compiled from source. Since Windows has a command prompt (even Vista) and BSD-based OS X has a command-line shell as well, these tricks should work on any of these platforms.

Blog at