• Building a Raspberry Pi Zero temperature monitor with web interface

    I’ve recently purchased a few cheap DHT22 temperature sensors from Amazon. They work great and use Python to display the data from the sensors. I found I required a way to log the data, so I though why not make this a project!? I have created a simple Web Interface to view logged data: https://github.com/ryanfitton/rpi-temperature-monitor-logging-interface. ...
  • How to install Home Assistant within an LXC container

    I have published this blog post to help anyone having issues installing Home Assistant (and Docker) in an LXC container running on Ubuntu. When I was installing Home Assistant on my own hardware, I could not find any straight-forward guides detailing how to do this, and Home Assistant’s own documentation does not help with installing ...
  • How to LazyLoad images in WordPress without using a WP Plugin

    This post explains how to use the jQuery Lazy library in a WordPress template. By implementing this library into a template manually will give you greater flexibility in terms of which images can be ‘lazy loaded’. A couple of requirements are necessary before using the jQuery Lazy library: Requires at least jQuery 3.4.1 – This ...
  • Using loadCSS with WordPress

    I have been using loadCSS from the Filament Group recently, it’s a great tool to asynchronously load your CSS files in-order to increase your scores for Google’s PageSpeed tests. The main issue I faced is using loadCSS with WordPress. WordPress has many plugins to install and each of these plugins usually integrate with the hook...
  • Using Speedtest-CLI to record speed tests to CSV via CRON

    One of the most common speed testing services for Internet connections is Ookla’s Speedtest, and more often than not your ISP will either throttle your connection, or their network will slow down at peak times. Because of this, I wanted to make sure I am receiving the full connection speed which I am paying for. ...
  • Sass (SCSS) powered Linear and Radial CSS3 gradients with MS Filters

    I thought i’d share this code, it may be help anyone who wants to have some sort of backward compatibility when using CSS3 gradients with Internet Explorer 7+.   How does this work? Sass mixins and functions helps a lot with the ‘heavy-lifting’ and colour calculations. Let me explain the setup for Linear and Radial ...
  • Increasing the default ZFS Loop Device value in LXD on Ubuntu

    I’ve recently installed LXD 2.x on my Ubuntu server but forgot to set a custom value for the loop device. The default value was 20GB, but I wanted this to be 1.4TB. It took a while of searching accross the web to find an easy solution to increase this size, as I found it tricky ...
  • PHP contact form boilerplate

    Every now and again, there is a need for a simple HTML site which does not need the bloat of a CMS. However, these sites usually require a contact form, so to prevent the need of creating a new PHP form each time and re-downloading the PHPMailer library, etc. I have uploaded an PHP contact ...
  • LXD Container backup to FTP server script

    As mentioned in my previous post, I would post code for a script which will backup an LXD container as a snapshot, then transfer to an FTP server. The script to do this is below, it has been tested on Ubuntu 16.04 LTS. The steps listed below can be found in my LXC Container backup ...
  • Creating an LXD container on Ubuntu 16.04

    I have started getting-to-grips with LXD on Ubuntu – It’s pretty great! LXD makes it possible to separate your applications into containers, and the containers run close to bare metal. I’m running LXD on my webserver (the one hosting what you’re viewing this website on), with four containers: HAProxy: Used for sending port 80 and ...
  • Quick and easy FTP server install on a Raspberry Pi

    For this setup, i’m using Ubuntu 16.04 running on a Raspberry Pi 3. The instructions should work correctly in Debian and Raspbian too – in fact, you will probably have luck using these instructions on any Linux operating system, Raspberry Pi or not. Note: FTP is not a secure protocol, I would recommend using SFTP ...
  • VestaCP API firewall suspend and unsuspend bash script

    VestaCP offers an API which allows the firewall rules to be changed, but I could only find examples which use PHP and cURL and I required a script which would work as a Bash script. I’ve created a script below which you’re free to use. Ensure your host URL, admin username and password are correct ...
  • Steps to safely remove Linux kernels (Ubuntu)

    Note: Please understand, these instructions can make your system non-bootable. If you’re unsure, do not continue. If you’re trying to update the kernel and low/empty disk space errors are shown, it’s probably because the /boot/ directory is full. Use this command to see the available space of /boot/: sudo df -h Now check the kernel ...
  • Test your system for Spectre and Meltdown vulnerabilities

    Following the outbreak of three processor vulnerabilities, known as Spectre and Meltdown; I have already patched my systems and whilst doing so, came across this useful script written by Speed47. This script checks your system for the three vulnerabilities. I found it useful to check my systems were secure after applying kernel updates. To run ...
  • Version 2.0.0: Backup MySQL (Bash script)

    This is similar post to be read together with this. And a follow-up update to ‘Backup SQL files to FTP server‘ script. Some of my similar Backup scripts reside in a a GitHub here: https://github.com/ryanfitton/lxc-mysql-tar-backup-script-collection Version 2.0.0, now adds additional features and bug fixes: Now searches to ensure the required packages are installed. Uses ‘lftp‘ ...
  • Version 2.0.0: Backup server files as tar.gz (Bash script)

    This is a follow-up post with an update to the ‘Backup Files as Tar.GZ‘ script. Some of my similar Backup scripts reside in a a GitHub here: https://github.com/ryanfitton/lxc-mysql-tar-backup-script-collection Version 2.0.0, now adds additional features and bug fixes: Now searches to ensure the required packages are installed. Uses ‘lftp‘ to upload files via FTP. Lftp allows ...
  • Linux: Export computer specs as HTML

    This is a quick, but I thought it would be worth a post. Within Linux (I’m using Ubuntu 17.04) you can quickly export your computer specs as an HTML file, useful if you need some info on what particular hardware you’re running. Simply run this within your terminal at the location where you want the ...
  • Backup MySQL (Bash script)

    This is a follow-on from my previous post: ‘Backup server files as tar.gz‘. The script below works in a similar way as the previous, save as ‘backup_mysql2ftp.sh’ and fill out the ‘Backup options’, ‘MySQL Connection details’, and your email address. Run the script with sudo sh backup_mysql2ftp.sh (make sure the file is executable first). The ...
  • Backup server files as tar.gz (Bash script)

    This is a quick and simple backup script, specifically created for use with Online.net’s 100GB FTP Storage, which is given for free when buying one of their dedicated servers. The steps listed below can be found in my Backup script collection on GitHub here: https://github.com/ryanfitton/lxc-mysql-tar-backup-script-collection The script below is simple, saves as ‘sudo sh backup_files2ftp.sh’ ...
  • Disabling WordPress public REST API

    I've recently found that the public WP REST API endpoints within WordPress can provide information which can be used in 'hacking' attempts. One such endpoint is '/wp-json/wp/v2/users' (e.g. https://yourdomain.com/wp-json/wp/v2/users), this will display Admin usernames to any unauthenticated user. There are a couple of way to mitigate this risk, install the Disable REST API or add...
  • Notifying Google of an XML sitemap via a URL

    Today I found out you can easily notify Google of an XML sitemap by ‘pinging’ Google via a GET request: http://www.google.com/webmasters/sitemaps/ping?sitemap=URLOFSITEMAP.xml You can perform this via PHP, or if running on Linux; use wget.
  • Quick and Easy SSL chipers

    I’ve recently came across the https://cipherli.st/ site, from the cron.weekly email newsletter (I highly suggest you sign-up, some great posts and sites featured). Cipherli.st allows you to copy and paste SSL ciphers for a variety of web software (Apache, Nginx, etc.).
  • In-page embedded viewable PDF documents without a PDF reader

    Here is a neat trick which I’ve found: using a tool by Google named Docs Viewer you can embed PDF (Or office and Postscript) files into a webpage to be viewed on screen, even without a PDF reader plugin installed in the user’s browser. Simply use the snippet below and change where your_document_here is mentioned twice ...
  • Assigning fixed names for USB devices with udev on Linux

    Whilst you can use udev rules with any USB device, I am writing this post to help anyone else who is also having issues with their USB printer name. The main which I had was is the printer’s USB name changing when it is restarted, plugged into a different USB port or when another USB device is connected ...
  • Looping through a Data Map with Sass

    I’ve decided to share this code for anyone who requires a quick ‘copy and paste’ solution for using data maps (map-get) and loops within Sass. This example will allow you to set values within the data map, then loop through and output as CSS rules. Setup the variables within the data map and create the code ...
  • Using statuscake.com to monitor your website and database uptime

    Note: Updates have been added since this article was originally written. These updates are listed at the bottom of this page, click here to view them. This guide will show you how you can monitor your website and database uptime using a free service from Status Cake (https://www.statuscake.com). Once you have setup an account, you will ...
  • PHP Function: Get a file’s last modified timestamp

    I’ve recently found the need to show a file’s last modified timestamp. This function is useful when including CSS or JavaScript files. By including a query string will ensure web browsers re-download a fresh copy of the file rather than using a cached file. Simply run this function as you’re including a file, such as: ...
  • Custom WordPress login

    WordPress has a wide range of options to change the look and feel of your WordPress setup. One that most people overlook is the login box, accessible at http://yourdomain.com/wp-admin/. Using the code below, you will be able to apply a custom CSS stylesheet to the login page. Firstly create your stylesheet. You could name the file ...
  • Change Bootstrap 3 Navicon on toggle

    I’ve been looking at how to change the button icon which is shown across Bootstrap 3 navigation menus in a mobile viewport. For months I’ve come across a whole variety of clever Navicon icons which change when clicked upon. I wanted to implement this feature into a Bootstrap navigation menu. In the end, I used a ...
  • Using Font Icons with WordPress 3.8 Custom Post Types

    WordPress 3.8 introduced a new Admin design which now uses Font Icons instead of images. This method has many benefits such as great support for Retina devices and quicker load times. Before WordPress 3.8 you had to use images for your icons, now you can use Font Icons, specifically the icons designed for WordPress called ...
  • Making sure Outlook.com receives PHPcMail() emails

    During the recent development of bethanyjackson.co.uk I had found my current setup of Postfix which is used by PHP Mail() was not sending email correctly to Microsoft email services such as Outlook.com. Emails were being sent by my web server but never received by Outlook.com or placed in the Junk folder, even though emails were ...
  • WordPress 3.7 Auto Update

    The WordPress 3.7 (Basie) release went live on the 24 October 2013. It’s great release and includes a number of important features, one of which is Automatic Updates. By default automatic updates will only be applied to minor version upgrades and not major releases. For example; versions such as 3.7.1 to 3.7.2 will be applied ...
  • PHP cron job to download podcasts

    I have built this script a while ago to keep track of podcasts I wanted to watch. My ISP gives me free internet usage after 11pm which doesn’t contribute to my monthly download limit so I needed some way to automate the download of the podcast. I decided to build this script in PHP as ...
  • Updated: Animated CSS3 Android Bot

    Since my first post of creating a CSS3 Android bot (here) I have wanted to add animated functionality, and in under 15 minutes I did just that. I have animated the right arm of the Android bot so it simulates ‘waving’. I have added a CodePen and a Gist below. See the Pen Android Bot ...
  • Android Bot created in CSS3 code snippet

    Update: I have posted an updated version of this Android bot using CSS3 animations here. I have been playing around with CSS3 recently. As a small test to see if it is possible to design with CSS3 I had a goal to create the Android bot in HTML and CSS. The finished code appears to...
  • CSS3 Flat UI Scrollbars in Google Chrome

    I have recently been developing a piece of work which required the scroll-bars to look flat and clean. I had previously seen Google’s Gmail site using the same sort of scroll-bar design which would fit perfectly into the piece of work I creating. Having a look around the web didn’t show much code snippets or ...
  • Implementing an image picker for WordPress 3.5

    Since re-developing my portfolio for this website, I found that the media picker script which I was using to select portfolio images should be updated. Originally the first version of the script was using the old WordPress Thickbox modal. Since WordPress 3.5 it has been possible to use the new WordPress modal. Although I found ...