An Autonomous Agent

exploring the noosphere

Category: code

WordPress Application as Static Site Generator

While there are currently nice tools which exist to generate static websites, such as Hugo or Jekyll, there is also WordPress combined with a static site generating plug-in. Thus, WordPress can be used just like Hugo and Jekyll to create a set of static files to be hosted on the web via a service like IPFS or Github pages.

I was forced to investigate this topic thanks to Openshift 3, Redhat’s new upgrade for their web application hosting platform. For the past three years this site and two others have been running on Openshift’s version 2 for basically free (around $2.00 per month for total).

But Redhat decided to discontinue Openshift 2 and in the process switch their target customers away from the little guys. Normal people just wanting to blog cannot afford the $50 per month they want for their paid platform hosting account. And just to download their development kit requires filling out private information like phone number, address, and clicking a promise check-box that you agree you are using their CDK for development only. They are now as frustrating as Oracle, where you can’t download an old Java version without filling out the same identifying information.

Well, I then started to look around for WordPress hosting, expecting that I could get-by paying a small fee each month – around $5 for all sites. Nope — nothing, everywhere that I looked they wanted an exorbitant amount just to host a WordPress application. Namecheap was the best I found, 10 for the first year for three sites and then 50 per year after that. So it then seemed like a no-brainer to create a static site and put it on either IPFS or Github, which would be free. Github does have some restrictions like 1GB storage and I think they even have a monthly bandwidth limit. Since Github is free and since this site is not that popular, it was perfect. IPFS would also be nice, but I have a slow Internet connection and I already host one IPFS site and an Openbazaar storefront. And in any-case, with a static site it is rather simple to transfer or simultaneously host on other services.

I had been thinking for some time about switching to static websites, and now I was being forced to actually make the switch. Sacrificing the comment and search functionality in WordPress for a static site was something I didn’t mind, but for some people this might not be an option. I then spent about a day installing WordPress on my local desktop and transferring all data from my existing sites to the local install. This was near pain-free, although it may be headache for some who are unfamiliar with the internal structure of WordPress or terminal commands. You just have to follow the instructions listed below with the knowledge that online instructions are not always 100% correct due to differences in operating system versions, previously installed programs, etc…

And if you are copying existing WordPress data, be sure to export only the necessary tables correctly and remember to transfer all your previous uploads. Once you have the code on your Github repository, you just need to set the CNAME properties on Github and your domain name provider correctly and you are up and running.

Directions:

How to install WordPress on Ubuntu 14.04

How to install WordPress 4.7 on Ubuntu 16.10/16.04 Using LAMP Stack

Set Up SSL on Github Pages With Custom Domains for Free

Github repositories:

An Autonomous Agent

Solar Anamnesis

Removing Bad, Hot, Dead Pixels – GIMP

My 5MP A3550UPA Omax CCD has about 20 bad (hot or dead) pixel groups in every image. They seem to be identical through time and are noticeable on my raw images. Typically, the panoramas I create are composed of between 80 and 200 individual images that I stitch together manually. Before stitching I go through the images with the GIMP blur tool in order to remove these bad CCD pixels. Thus, I have to blur between 1,600 and 4,000 pixel groups. A tedious task! This takes between one and two weeks to complete, depending on my free time.

Bad CCD Example

Bad CCD Example – Blue

My patience for this corrective task has run dry. Since I knew that GIMP was theoretically capable of performing such a repetitive task via a custom script, I decided to develop such a script. The final result is a tiny piece of code. Its brevity masks the hours of frustration and hopeless despair I encountered while learning Scheme and integrating the commands into GIMP as a valid working procedure. My work has paid off. I now have a script which corrects all my bad pixels.

Github – Bad CCD Fix Script

At first I tried to develop a script based on layer masks and Gaussian blurring. The results were never what I wanted. For instance a Gaussian blur mask on only the bad pixels still contained some of the original RGB color information from the bad pixels. I then tried doing the Gaussian blur preceded by a selection remove of the bad pixels. However, this had a problem – the Gaussian blur is not fully colored in the removed bad pixel areas, i.e. transparency issues remain in the removed pixel holes. The final result had colors were not quite correct.

Gaussian Blur Without Bad Pixel

Gaussian Blur Without Bad Pixel

Isolate the Pixel

Isolate the Pixel

I thought I had reached a brick wall and that I may have to do the pixel correction manually as before.

After a little research I found the work of Dr. Paul Harrison, who has created an amazing GIMP Python plugin designed for complex pixel correction. You can read about this plugin and all its cool features at Pat David’s blog.

The final code flows from this discovery and the entire script is centered around the Heal Selection plugin. The script loops through a set of images and prepares them for the Heal Selection function.

The selection is based off a static file containing the black points in the precise locations of the bad CCD pixels. The script takes this reference file and using the GIMP “Alpha to Selection” creates a selection based on the black points.

Black Point Example

Black Point Example

The manual GIMP steps for the script are:

  1. Open the image
  2. Add the “black points” PNG image as a layer
  3. Right click on the “black points” layer and click “Alpha to Selection”
  4. Merge layers, aka flatten
  5. Click Heal Selection plugin and enter desired parameters
  6. Clear selection
  7. Save

Thanks to this script I can turn a week or two of work into an hour or less. NOTE: I was only able to successfully run the script via the GIMP internal console.

I have included test images and example commands in the Github folder.

A Few Interesting Projects

This post is aimed at people who are perhaps unaware of some new technologies and platforms. I have listed the ones I think have great potential to benefit an open society.
If you have any others which are of similar scope, please let me know. Will add to these links as I continue to research.

Update (06-12-2016):

Sia – Will someone develop a MySQL version to run a database that exists on Sia? I imagine hosting a WordPress site on IPFS, and the database for the site will be on Sia, I think that is a correct way to view the future of WordPress…?

Steem

IPFSDroid – IPFS for Android, eventually I imagine it will support a full node on a cell phone!

Update (05-11-2016):

AKASHA PROJECT

IPFS:

InterPlanetary File System and IPFS Blog

Juan Batiz-Benet slide deck

Ethereum:

Ethereum and Ethereum Blog

Developing Dapps

Synereo:

Synereo and Synereo Blog

Others:

Follow My Vote

Kim Dotcom’s MegaNet (link and status pending…)

Videos:

Juan Batiz-Benet at DEVCON1:

Ethereum for Dummies – Dr. Gavin Wood at DEVCON1:

MegaNet Kim Dotcom on RT:

Nerdy Method to Encode Email Address to Avoid Spam

Contact Email (spam robots… try to solve this!):

Supply modulus N: 13503701

Decryption Key d: 2273

Ciphertext Message in numeric form:

8207129 334600 4505190 12801374 7109281 11118282 2016909 11164527 5778177 7691883 10206105 12801374 10206105 2976139 7669811

Decrypt Email Here

NOTE: To encode your own email you must first find two prime numbers and then follow the steps listed in this RSA Worksheet.

Code: The Hidden Language of Computer Hardware and Software – Charles Petzold

I recently entered a computer science reading frenzy and have a few books in this category which I wish to read. Code, by Charles Petzold provides a readable, accessible, and concise account of the fundamental concepts supporting the hardware and software enabling you to read this post. So important are these concepts to our daily lives, I think that this book should be required reading in all high schools.

Become a Friend of GNOME [ GNU Link] kde-user

Powered by WordPress & Theme by Anders Norén