All blog posts

Total posts: 32

NGINX conditional logging and responses

01 November, 2020 - 2 min read

Here are some examples on how to configure NGINX to conditionally log requests based on certain conditions like remote IP address, URI etc by using the map module and variables. Conditional logging Create a variable using ngx_http_map_module. This is placed in the HTTP block. Regexes can also be… Read more

LUKS Encryption Cheat Sheet

27 October, 2020 - 2 min read

Install and create partition Install on a Debian based system Install on a Red Hat based system Creating a new LUKS partition Key management Generate 4096-bit random key file Add a key file to next free key slot. This will prompt for a passphrase. You can have up to 8 slots. Add a key file to… Read more

Raspberry Pi Kiosk HOW-TO

13 September, 2020 - 5 min read

Tested with Raspberry Pi 3 and 4, but should work on some older models too. For Ethernet connected kiosk machines. Download and install Raspberry Pi OS Download img file and image to micro SD card. Raspberry Pi OS (32-bit) with desktop, Image with desktop based on Debian Buster. Warning: This is not… Read more

GPG Cheat Sheet

25 July, 2020 - 4 min read

For GPG versions 2.x only. List keys List public keys List all secret keys List public or secret keys, but show subkey fingerprints as well The key ring location is normally shown on the first line on stdout. Use different key ring List keys but use a different home directory for one command only… Read more

Using Let's Encrypt with internal web servers (without DNS challenge)

05 July, 2020 - 6 min read

TL;DR Use internet facing domain on an internal network, I normally use subdomains for this. Domain must have a DNS A record pointing to a public facing web server so Let's Encrypt can find it for the HTTP-01 challenge. This can be served as an empty site or just as a 404 response. Remote VPS uses… Read more

Protecting web sites with NGINX subrequest authentication

30 June, 2020 - 4 min read

TL;DR Protecting a web site with NGINX by using authentication server via a subrequest. Use in NGINX conf. When user requests protected area, NGINX make internal request to . If 201 is returned, protected contents are served. Anything else, NGINX responds with 401. is reverse proxied to Express… Read more

Netlify vs Vultr VPS hosting speed from Australia

28 April, 2020 - 2 min read

I've been comparing some load speeds from a variety of different web hosting companies. I started out by trying out the free tier of Netlify to compare how the performance is compared with my usual Vultr VPS service. After seeing that the Netlify load times was almost 10x longer than from the VPS… Read more

Convert multiple images to searchable PDF (OCR) with free command line tools

26 April, 2020 - 2 min read

In this example, we'll show how to convert multiple PNG images to a multi page searchable PDF file. We'll use the following command line tools: ImageMagick for converting PNGs into multi page TIFF and PDF files. Tesseract OCR, an open source OCR engine. PDFtk Free for overlay joining of PDF files… Read more

Start a simple React JS app with Parcel bundler

11 August, 2019 - 3 min read

Here's how to get started with a simple hello world React Javascript app using Parcel. We're going to be using a global install of Parcel here. Install Parcel Install parcel globally The advantage if you install it globally is that is only 4MB and 100 or so files. on the other hand will download… Read more

Loading icon fonts locally when using Ant Design React framework (instead of AliCDN)

05 August, 2018 - 1 min read

Don’t use Alibaba’s CDN! By default, when using the Ant Design ReactJS UI framework, icon fonts are loaded from China’s Alibaba Cloud CDN. This may be undesirable behaviour. You might prefer to have a web site that does not call home when you load a page, or leak IP addresses to a third party. You… Read more

Set up a signage or kiosk machine with Debian 9 Linux

26 June, 2018 - 2 min read

Installation Install Debian with . Use MBR and create a single root partition filling the entire disk. Choose minimal with no graphical desktop environment. Only choose standard system utilities. Create the default root user and a separate user with username . Install the following packages as root… Read more

Moving Virtual Box VDI files

16 April, 2017 - 2 min read

Note This works with encrypted VDI disks. The virtual machine must be shut down before proceeding. Backup first! Backup all the and files. Ths is very important! If you're using encryption, these keys are inside the vbox file so make sure you back this up somewhere safe. From now on we don't touch… Read more

Virtual Box Tips

16 April, 2017 - 2 min read

Backing up VirtualBox virtual machine Just make a copy of the and files. Reducing disk space of dynamic disks This doesn't work for encrypted disks. On client virtual machine: For Windows Defragment disk, e.g Zero free space, e.g (sdelete is part of SysInternals) For Linux (mounted) until there… Read more

Set up Let’s Encrypt with NGINX web server with webroot plugin

26 January, 2017 - 4 min read

Introduction This is one (of many) methods to speed up creating free SSL certificates with Let's Encrypt. It configures the NGINX web server to serve for each domain. This path is used by the webroot plugin. We’ll need to make a directory to servie the challenge files from, we’ll call this from… Read more

Generate some easy to remember passwords

17 March, 2016 - 2 min read

Do not use this for sending sensitive data! For that please use a public key encryption scheme like PGP or GnuPG. This below is suitable for things such as online logins etc. Obtain word list Prepare a text file with dictionary words. Here we download some word lists from Scowl. We grab the file… Read more

How to remove old Linux kernel images from /boot

17 March, 2016 - 1 min read

For RedHat based OS e.g RHEL or CentOS Install Check current running kernel version Remove old kernels, but leave the 2 latest ones. Edit and set: This will delete old kernels automatically but leave the latest two next time you perform a For Debian based OS e.g Ubuntu If that doesn’t work, you… Read more

How to open Gerber files in AutoCAD with free open source tools

02 April, 2015 - 2 min read

Here is a method for how you can import a Gerber RS-274X file into AutoCAD. There are many commercial software solutions to perform this, but this is how you can do it for free using open source tools! You’ll need to install and configure (if needed) the following software. gerbv – this is used to… Read more

GLCD Library Support for PIC24H with ST7565R / ST7565P / PCD8544 (Nokia 3310 5510) LCDs

31 December, 2013 - 3 min read

My graphic LCD library (glcd on GitHub) now supports PIC24H with the ST7565R, ST7565P and PCD8544 LCD controllers. The code has been tested with the Newhaven display NHD-C12864A1Z-FSW-FBW-HTT and NHD-C12832A1Z-FSW-FBW-3V3. I used a Microstick II development board to test these, with demo code… Read more

Find your camera shutter actuation count using gPhoto2

27 September, 2013 - 3 min read

This method can be used to obtain the shutter actuation count on the following cameras: Canon 1D Mark II Canon 50D Canon 5D Mark II Canon 5D Mark III Canon 7D Canon T2i There may be a few other compatible cameras too. Let me know if you have confirmed another model which works using this method. Mac… Read more

Moving a WordPress blog across domains using the shell

24 September, 2013 - 5 min read

Here’s a rundown, or more accurately a set of personal notes I made, for moving a WordPress blog from one domain name to another. This will also work when moving from one web host to another. First you’ll need to know some details of your old database: database host name, e.g or database name… Read more

USB datalogging on the Turnigy Accucel 6 Hobby Charger

16 August, 2013 - 6 min read

After owning this great little hobby charger for some time, I wanted to use the data logging capabilities of the Turnigy Accucel-6 unit. In particular, the aim is the plot  some discharge curves of some particular batteries. A quick search on Google found some articles, but a lot of conflicting… Read more

Arduino Library for DF Robot 16×2 LCD Keypad Shield

24 February, 2013 - 2 min read

A few years ago, I purchased one of these 16×2 LCD and Keypad Arduino shields. There are quite a few of them around (including some clones?), but they are similar to this one from DF Robot: I think I bought this one from eBay a few years ago, but nonetheless, the different ones around  are all… Read more

Custom avrdude with auto DTR reset and custom baud rate for Arduino boards

14 February, 2013 - 2 min read

I’ve been working on a project where I have been using a ATmega2560 with a custom bootloader (based on the Arduino Mega bootloader using the stk500v2 protocol). As I was using a 8MHz crystal, it was best that I used a baud rate of 38400 for programming. By default with avrdude, when using the… Read more

How to get ICC profiles working with TimThumb

13 January, 2013 - 2 min read

I was working on a web site that used TimThumb, and ran into an issue. TimThumb uses the PHP GD library, which does not support color profiles. It is a very common library used in WordPress themes. This can be an issue with web sites which are for photographers, as sometimes, it may be desired to… Read more

GLCD 0.4 Released – ST7565R and NT75451 support, Blueboard LPC11U37 demo

14 July, 2012 - 1 min read

August 2019 update: All demo code is available on Github project page Version 0.4 of GLCD Graphic LCD Library has been released. It includes added support for: ST7565R LCD controller with SPI serial interface with AVR8 implementation. This is used in Newhaven Display model NHD-C12864WC-FSW-FBW-3V3-M… Read more

Making custom fonts for GLCD library

08 July, 2012 - 3 min read

Update: I’ve been working on a little Qt based tool called glcd-utils which does makes creating fonts and bitmaps on GLCDs a lot easier than the process below. It is open source, but no binaries available or even much documentation. You can visit the Github page here. Otherwise, back to the tutorial… Read more

Measuring flash durations of speedlight and studio lighting and strobes

19 January, 2012 - 6 min read

It’s been a while since I’ve written a technical article. But today I’m going to talk about flash durations. After a bit of wild searching on the internet, I couldn’t really find any good resources showing actual real-world measurements of flash durations of speedlights, especially t.1 measurements… Read more

How To Calculate Exposures Quickly at Night Time

17 February, 2010 - 3 min read

Night photography generally requires very long exposures, often several minutes at a time. To get the best image quality, we need to keep the ISO as low as possible to keep our noise levels down to acceptable levels and also to minimize the occurrence of hot pixels and sometime banding artifacts… Read more

Photoshop Smart Objects for Photographers – Part 1, Soft Proofing and LAB Color Mode

07 August, 2009 - 5 min read

One of the great things that has happened since Photoshop CS2’s release, is the introduction of Smart Objects. Today we’ll talk about how photographers who shoot RAW can use smart objects in Photoshop to their advantage. One the features that we have been all waiting for is soft proofing in… Read more

Photoshop Smart Objects for Photographers – Part 2, Gradient and Selective White Balance

17 July, 2009 - 5 min read

Welcome to Part 2 of the Smart Objects for Photographers tutorial. This is a step-by-step tutorial on processing images using smart objects, in particular, selective white balancing. This straight out of camera image below is what we will be working with today. It is an image of Bronte Baths in… Read more

How to enhance colours in photographs with Photoshop

01 June, 2009 - 8 min read

Today we’ll talk about enhancing colours in a photograph. In particular, we’ll talk about increasing the saturation or vibrancy in an image. Not so much the changing of, or adding of color casts, but enhancing the look of the colours that are already in the photograph to begin with. This is one of… Read more

Multiple Exposure Blending for Landscapes

22 May, 2009 - 6 min read

Today we will be talking about multiple exposure blending. We will be blending multiple exposure to capture more dynamic range in a scene. This technique is more suited towards landscapes, such as those with sky and water/land structures in them where the scene is bright on one section (e.g up high… Read more

© Andy Gock 2009−2021