A long time ago I created my own website and created each page by hand in Windows notepad. I probably even used some server side includes and I certainly used Apache as the web server. I don’t have copies of that site. In 2004 I moved to a blogging system called MovableType
In 2012 I migrated from Movabletype to WordPress and today in 2020 I’ve migrated my blog to static files, much like the very first pages I created. I’m not writing every page by hand, but using a static site generator that takes simple content files and combines them with templates to make the site as you see it. The generator manages turning formatted text into links, for example
[blogging system called MovableType]({filename}/about-this-site.md)
generates the link that you see in the paragraph above to my first ever blog post, or at least, the current generated version of the original blog post.
The biggest motivation for me to switch was the hassle of keeping PHP, WordPress and all the WordPress plugins and templates up to date to limit the chance of my server being compromised by bad-people(tm). I don’t post here as often as I used to and having a nice web interface to write in really isn’t important to me. I’m comfortable writing in a terminal then running a command or two to generate new pages. This means I don’t need PHP, or a database. It also means I can no longer host comments (although that is possible through third party systems, so perhaps I’ll add them back)
Of course, there’s a time and effort cost to setting up and learning new software but so far most of it has been intuitive or very similar to things I’ve used before. I chose to use Pelican which is written in Python. Although I’m more comfortably in Ruby, I’m currently working on my Python skills. Actually I haven’t needed to look at any of the Python code! Pelican had clear an easy to follow instructions, I found a template I liked called Flex which I haven’t had to touch at all (although eventually I’ll turn the default red links into my preferred default of blue). There was a plugin that took my WordPress XML backup and extracted all the old blog posts and generated the static files. I’ve also had to use a WordPress plugin to get a list of WordPress URLS to create Nginx rewrites so that people coming from search engines to old pages land on the new pages.
All in all, this has been a pretty straight forward migration. There are a few issues to resolve. Several of the images have broken links and I know that some pages have artefacts to fix (and some of those related to the 2012 migration and I never got around to fixing them).
Speaking of images, here’s my first image embeded into a page, a screenshot of the old WordPress site
and for good measure the same page on the new SITEURL
A couple of years ago I stopped buying letterheads for my business and instead created a special print queue that merged any document sent to print with a PDF letterhead template.
Last month, it stopped working on just my PC. I’m not quite sure if it broke from a Windows update or something else had changed but the result was I needed to start from scratch and make it all again. My original notes weren’t very good and in 3 years time I’ll look back on these notes and think much the same. If you’re looking to print letterheads on demand too, these notes may help you achieve it.
Getting here took me far to long (days!) but the end result is not having to buy preprinted stationary or an extra tray for our printer.
Summary of what I’m about to do:
# We need to resize the logical volume to use all the existing and free space of the volume group
$ lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
lvm> exit
# And then, we need to resize the file system to use the new available space in the logical volume
$ resize2fs /dev/ubuntu-vg/ubuntu-lv
resize2fs 1.44.1 (24-Mar-2018)
Filesystem at /dev/ubuntu-vg/ubuntu-lv is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 58
The filesystem on /dev/ubuntu-vg/ubuntu-lv is now 120784896 (4k) blocks long.
# Finally, you can check that you now have available space:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 786M 1.2M 785M 1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv 454G 3.8G 432G 1% /
>ip addr show
#sudo apt install cups
usermod -aG lpadmin <myusername>
systemctl stop cups.service
Listen *:631
<Location />
Order allow,deny
Allow all
</Location><Location /admin>
Order allow,deny
Allow all
</Location>
systemctl start cups.service
systemctl stop cups-browsed.service
/etc/cups/cups-browsed.conf
BrowseRemoteProtocols none
# was BrowseRemoteProtocols dnssd cups
systemctl start cups-browsed.service
Check box “share printers connected to this system”
+ check allow printing from the internet
Nb: it will redirect you to https pages then ask for your username/password as per the account you added to the lpadmin group.
I decided to call my print server “Mars” and setup up print queues using the format ‘server’+’printer model name’+’optional descriptive label’
Footnote: Adding printers for the magic letterhead has been problematic. The last printer I set up needed to be set up as described here https://www.steveroot.co.uk/2022/11/03/automatic-letterheads-from-a-printer/ using generic CUPS driverless drivers rather than the manufacturer provided PPD.
Apt install pdftk
AppArmor can be disabled, and the kernel module unloaded by entering the following:
sudo systemctl stop apparmor.service
sudo update-rc.d -f apparmor removeTo re-enable AppArmor in the future enter:
sudo systemctl start apparmor.service
sudo update-rc.d apparmor
Chmod 755
#!/bin/bash
logfile=/tmp/watermarkpdf.log
watermark=/etc/cups/Letterhead.pdftempdir=$(mktemp -d)
echo $(date) “$0 $* (tempdir: $tempdir)” >> $logfile
# Command line arguments
job=”$1″
user=”$2″
title=”$3″
numcopies=”$4″
options=”$5″
filename=”$6″if [ -z “$filename” ] ; then
filename=”-”
fi
if [ $# -ge 7 ]; then
cat $6 > $tempdir/ps.in
else
cat > $tempdir/ps.in
fi# convert Postscript to PDF
/usr/bin/ps2pdf $tempdir/ps.in $tempdir/pdf.in 2>>$tempdir/err# watermarking. ‘stamp’ puts letterhead over document, ‘background’ puts it under. Some documents send all white background so letterhead will not show through white areas.
/usr/bin/pdftk $tempdir/pdf.in stamp “$watermark” output $tempdir/pdf.out 2>>$tempdir/err# convert PDF to Postscript
/usr/bin/pdftops $tempdir/pdf.out – 2>>$tempdir/err# clean-up. I don’t remove the tmp files as they are very useful to find out what stage of this script is failing
# rm -rf $tempdir
From <http://technik.blogs.nde.ag/files/2012/10/watermark.sh>
Ln -s /usr/lib/cups/filter/ cups_filter_directory
systemctl restart cups.service
systemctl stop cups.service
*cupsFilter: "application/vnd.cups-postscript 100 letterheadwatermarkpdf"
systemctl start cups.service