0%

This is a simple post and a quick read but I've found the following 5 books essential to my programming career at different points.

If you're a developer of any kind these will come in handy.

# 1. Test Driven Development by Example - Kent Beck

One of the most cruicial books I've got at the moment since starting at a PCI-DSS Level 1 company where security is paramount. In the past I've been able to get away without using TDD all the time and often been discouraged from using it even at some major companies because of time constraints.

So this book is coming in very handy for my PHP development. Although the examples are in Java it's now possible to write PHP like Java with all the associated object orientation and type hinting so this is very useful from the first chapter to the last.

# 2. Extreme Programming - Kent Beck

This book is an expansion of the main core of TDD above with extra ideas covering code reviews, pair programming and other techniques to ensure programming is done at the most efficient, robust and secure way possible. The pair programming while not ideal for all companies can be good for on-boarding new devs if there's a lot of new domain knowledge required in the system.

# 3. Clean Code - Robert C Martin

This book covers practically everything from TDD to naming conventions and paths of execution in your code. Its a thicker book than the previous 2 but every once of it is well worth a read.

# 4. Pragmatic Programmer

This book is famous as being voted the number programming book in more lists than any other. Its has general advice for coders including picking a text editor, learning your tools, learning your language and being an overall better developer. No matter the tool or language used. Its a manual for becoming a better programmer overall.

# 5. Refactoring - Martin Fowler

If you've ever wondered how you can make your code better built, when best to use a specific design pattern or when to optimise and when to leave well alone. Then this book is for you. It also has the great added side-effect of making you better at code reviewing which is why its my bed time and spare-5-minute-read book. I always open up a random page, find out a nugget of gold information and learn to use it in my future projects.

# Bonus: Design Patterns - GoF

I know I should have changed the title but I have a thing for the number 5 and 3 so I needed to make it five and you get a bonus at the end: This is the original and best book when it comes to design patterns. Now you can develop PHP 7+ as if it were Java and the syntax is so similar with its culry braces and C heritage the Java examples in here can often be used with few changes to your code.

These are the book sand recommendations. Done & dusted. I needed to blog something. I'm tired of the previous ancient post.

DevOps Logo

DevOps was invented sometime around 2008 and became hugely successful as a complement to the growing popularity of Agile. GitLab began to provide DevOps tools as part of it's free plan enabling people to access a huge multitude of free devops templates and processes to get started without the need to install specialised Jenkins installs or Kubernetes clusters.

Since 2008 the job title of devops is now no. 10 on ITJobsWatch UK.

Below is a list of some of the best free YouTube courses I've come across while brushing up on my previously limited DevOps knowledge.

# 1. DevOps BootCamp in 14mins

TechWorld with Nana has a great reputation for providing great training materials on YouTube and although this bootcamp is just 14mins long she has plenty more in depth tutorials and information on her channel covering the subject. Well worth delving deeper after watching this quick bootcamp.

TechWorld With Nana DevOps Bootcamp

# 2. DevOps Master Class by John Savill

This is a great full-blown course playlist on YouTube covering everything devops from beginning to end. Each lecture is from 1-1.5hrs long and there's 10 in total so this course covers a great range of areas within devops including IaaC, Containers, Monitoring and much more.

DevOps Master Class by John Savill

# 3. IBM DevOps Explained

You know anything created by IBM must of a high calibre. If you're more interested in shorter (10-15min) videos over the longer lectures provided by John Savill, above, then check out the video tutorials provided by IBM. They cover other areas within devops including subjects like DevSecOps, various tools and their pros & cons.

DevOps Explained by IBM

# 4. GitLab Specific DevOps by LevelUpTuts

If you didn't do what I did and start your foray into devops with GitLab then you may find this interesting as it's a full course dedicated to the tools and capabilities inherent in the GitLab CI/CD devops system they have available to everyone for free (some services are paid for). The free version of GitLab comes with runners for managing and deploying pipelines of various types ase don commit tags and other triggers. You're also treated to a comparison between GitLab and GitHub's version of devops in this playlist.

DevOps GitLab by LevelUpTuts

# 5. Cloud Specific Training

This 'link' is a bit of a cheat. I was originally going to link to the free courses available for each specific cloud providers devops as there's plenty of jobs out there for people familiar with devops on a particular cloud platform. However, none of them host their free courses on YouTube so I thought I'd clump all their resources under no.5. Here they are in alphabetical order:

  1. AWS Dev Ops Course
  2. Azure DevOps Course
  3. Google DevOps Course

The blog for this plan was one I had well into the Xmas Annual Leave but thankfully I already had a pretty good idea of my plans already before the Leave started.

It helped that I had my probation period meeting (which I passed btw) with some recommendations shortly before the beginning of my Annual Leave.

In the criticisms of my initial 3 months it was made clear I could have been faster to learn legacy code but that my code quality was good and various other aspects. I want to focus on what could be improved here as it basically decided what I would be doing with my holidah and continue to do as the holiday progresses.

I'm Buddhist and have never been very fond of Christmas anyway. I also live alone so see no special reason or have any special desire to treat the day or holidays any differently than I do others. I do and always have seen Annual Leave when not abroad as an opportunity to work on my own projects. Whether they be my home network of Raspberry Pis and their clones or Home Assistant and its modules. However this year I decided after being told I need to 'improve my legacy code pick up' that this holiday's plan is:

# The Plan

  1. Identify all open source packages I offer via Composer, NPM or PyPi - my 3 main languages. I've already started EU Tyre Label, Clickatell Yii Plugin (likely to be converted into a standard composer package), AWIN Feeder for Wordpress, Hexo Tag Deezer, etc.
  2. See how far behind they are and if they are legacy code I'd create a new repo or branch to bring the old code up to speed (practice makes perfect).
  3. Find dead projects others have abandoned on Github or one of the package indexes above to resurrect and polish them off to support the version I use at work. E.g. PHP5.4 library upgrade to PHP7.3+ library (maybe create a PHP8 lib while I'm at it). If it uses a technology from work I don't know (Redis, SNS, Queues) then all the better - two birds one stone.
  4. Update Github badges (Appveyor, CircleCI, TravisCI) with the latest build actions and paths so they have more accurate and up-to-date CI/CD pipelines.
  5. Update my LinkedIn profile as I no longer have to be defined by my horrible time at XBite Chesterfield, which really knocked my confidence.
  6. Use PHPStorm instead of my usual VSCode. I can use the 30 day evaluation which is more than enough time to make use of it during the holiday period. I've been wrestling between which program to use since I started at this job but I think either way I never properly got to know PHPStorm and all its shortcuts and power user features.
  7. Use my Big List of Ideas I keep in Todoist to create new projects or find old, existing projects that are similar but need some work to get some regular coding practice.

The above activities should make me better at picking up old code and bringing it up to speed with the latest version - exactly what I didn't do well at probation. Thereby making this a holiday that benefits me because I get a break (coding is a hobby as well as work) and work gets a better coder.

Everybody wins.

Gitlab's CI/CD features are second-to-none. Its one of the main reasons I switched from Github to Gitlab along with the free private repos back in the day. GitHub's Actions and plugins have closed the gap in features a little but Gitlab still has the greatest level of customisability. Though its user friendliness could be tweaked a bit. In this post I'm going to detail how you can setup Sitespeed.io's checking of a site in your Gitlab CI/CD pipeline.

# Requirements

To pull this off you need to have a few prequesites:

I'm not 100% sure you need the above but thats what this tutorial assumes you have. You may be able to get this working with Netlify deployment but I'm not sure. That'd be an exercise for yu to figure out.

# What is SiteSpeed.io

It's a fully open source docker image and website that provides docker images with various differwnt browsers that are used to process performance reports of websites. There's a high level of customisability with a list of the arguments available in their documentation. Many of these arguments can be used as part of your Gitlab CI setup file.

Here's just a few simple screenshots of the report that gets generated.

Sitespeed Dashboard

Sitespeed Screenshot

Sitespeed Screenshot

Sitespeed Screenshot

You can get the report by visiting CI/CD > Pipelines > Click the icon at the far right of the pipeline with a download icon that will give you the options to download multiple artifacts. The one you want is likely lablelbed something like performance (shown below). After downloading you'll need to unzip it and visit the index.html file of the report to begin looking through all the generated metrics.

You can get a full report of my the last performance report of this site at this link.

# How to Make Use of SiteSpeed on Gitlab

There is official documentation showing its use but its not the most comprehensive. I hope to post a few examples here that you can use in your own projects.

# Examples

# HexoJS Site Performance Test

This blog is hosted using Gitlab Pages generated by HexoJS (a static site generator that uses Markfdown files for posts and pages). Hexo have a basic Gitlab Pages devops config on their site but we're going to take that and convert it into something that includes the Sitespeed checks we're discussing here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
stages:
- deploy
- performance

include:
template: Verify/Browser-Performance.gitlab-ci.yml

cache:
paths:
- node_modules/

deploy:
stage: deploy
image: node:14.15.0-alpine3.12

before_script:
- npm install hexo-cli -g
- npm install

script:
- hexo clean --debug
- hexo generate --debug
artifacts:
paths:
- public
only:
- master

performance:
stage: performance
variables:
URL: https://www.yopurbuiltsiteurl.com
SITESPEED_OPTIONS: -n 5

# Hugo Site Performance Test

Hugo is a popular Go-based static site generator and it provides a skeleton Gitlab CI yaml file just like Hexo does but converting the original to use the performance testing from sitespeed.io gives us this.

Note the use of different arguments in this case to SITESPEED_OPTIONS . I this case it will follow links to a depth of one meaning it will follow just links from the homepage when presenting its performance report. However, the -m option ensures it tests a maximum of 30 pages.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
stages:
- deploy
- performance

include:
template: Verify/Browser-Performance.gitlab-ci.yml

variables:
GIT_SUBMODULE_STRATEGY: recursive

deploy:
image: monachus/hugo
script:
- hugo
artifacts:
paths:
- public
only:
- master

performance:
stage: performance
variables:
URL: https://www.yopurbuiltsiteurl.com
SITESPEED_OPTIONS: -d 2 -m 30

# Python Site Performance Test

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
stages:
- test
- deploy

test:
stage: test
script:
# this configures Django application to use attached postgres database that is run on `postgres` host
- export DATABASE_URL=postgres://postgres:@postgres:5432/python-test-app
- apt-get update -qy
- apt-get install -y python-dev python-pip
- pip install -r requirements.txt
- python manage.py test

production:
stage: deploy
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=gitlab-ci-python-test-prod --api-key=$HEROKU_PRODUCTION_API_KEY
only:
- tags

performance:
stage: performance
variables:
URL: https://www.yopurbuiltsiteurl.com
SITESPEED_OPTIONS: -d 2 -m 30

# Summary How-To

Some people work better with examples like the above. Others with a simple how-to. So here's that how-to.

# 1. Include the template file

Incoude the template file near the top of the file but after the stages:

1
2
include:
template: Verify/Browser-Performance.gitlab-ci.yml

# 2. Create stages

To structure your yaml file the best you can make sure its got stages like this and you'll be able to download the files for each stage seperately from the pipelines section of the site:

1
2
3
stages:
- test
- deploy

# 3. Make sure performance has everything it needs

The performance section is pretty easy to setup as you can see from the examples. The only part you need to consider is the SITESPEED_OPTIONS section which I've already linked to the documentation of but something like thsi would work fine:

1
2
3
4
5
performance:
stage: performance
variables:
URL: https://www.yopurbuiltsiteurl.com
SITESPEED_OPTIONS: -d 2 -m 30

# Conclusion

This is just the beginning. Gitlab also offer an accessibility checker template for your pipeline so you can assess the accessibility of your site after every build as well as the performance. So thereby having 2 great reports to consider and help you improve your site for your visitors. I may cover the accessibility testing in a future post. I hope this has been useful to some.

# FAQs

# Do you need a static site generator?

It makes clear in the documentation that you can use a dynamically generated site which I assume means a site built using something other than a static site gen but you have to be sure to make the performance stage only run once the deployment stage has run and it could then be used to output several URL's for testing instead of just one.

# What static site generators does this work for?

Pretty much any of them. This will work with any site where the source is hosted on Gitlab and its entirely free. So whether you're using Hugo Jekyll, Hexo or something else then you should be able to use it in a similar fashion to the above. Be sure to check out your static site generators documentation for a basic .gitlab-ci.yml file that can be altered for your use.

# Can I alter the behaviour of the speed test?

Yes absolutely. In the example I've given I've shown only 1 of the options which is -n 5 which makes sitespeed.io run the test 5 times to get averages. But if you check their documentation you can pass hundreds of arguments to the SITESPEED_OPTIONS variable.

MySQL Logo

Anyone who’s spent more than 5 minutes on the MySQL documentation will realise it leaves a lot to be desired. The same goes for many of the 3rd party apps latched onto this platform which offer mediocre functionality and anything beyind the basic comes at a huge premium.

Well here’s a set of 20 resources, tools, articles that hope to break that and bring it all under one roof. Enjoy.

# Design & Administration Tools

  • Adminier - A really simple PHPMyAdmin alternative. I find it useful as a basic database administration panel during development of new web-based projects.
  • MyDB Studio - Makes a useful administration app for MySQL and also has some design capabilities such as the SELECT wizard to help with overly complicated queries.
  • HeidiSql - Provides an excellent GUI for administrating you MySQL database and can be used in Linux via WINE.
  • AutoMySQLBackup - Why go to the special effort of producing scripts to backup when you can use this.
  • PHPMyAdmin - Been around for years and still going strong. Its not the most speedy when handling large sets of data (try offline apps such as SQLYog or MyDB) but its got every functionality you can shake a stick at.
  • DBeaver - Similar to HeidiSQL but with better features and works on multiple platforms including Linux.

# Security Tools

SQLIer - A SQL injection tool which you provide a URL to and it does all it can to perform SQL injection. You'll often find this installed by default on security distros like Kali or ParrotOS Security.
SQLMap - A blind SQL injection tool thats a veteran with a plethora of features that makes SQLIer look like a Hello World app in comparison. It provides support for PostgreSQL, MSSQL as well as MySQL. Absolutely essential for people performing pen testing against a server. Will often be installed by default on Kali Linux, Black Arch, ParrotOD, etc.
Absinthe - An application which is available on Linux and Windows. It provides blind MySQL injection brute forcing but with more features than SQLIer.
SQID - SQL Injection Digger was created in Ruby as a command-line tool for brute force SQL injection testing. Can scrape Googl for potential targets as well as using Tor as a means to hide the identity of the attacker. More of a black hat tool than some of the others here.

# Optimising MySQL

MySQL Performace Blog - By the masters of high performance MySQL at Percona.
MySQL Percona Toolkit - a ton of tools to help with tweaking your MySQL database for the best performance.
101 Tips on MySQL Perormance - a 2019 blog post with a lot packed into a small space.
Exclusive MySQL Performance Tuning Tips - They just keep on trucking with those optimisation tips.

# Knowledge

SQLZoo - The basics of SQL.
10 Essential MySQL Performance Tips - some basic tips on keeping your MySQL database performing at max.
MySQL Cheat Sheet - Provided by devhints.io.
10 Common Mistakes of MySQL Design - Learn what not to do!
MySQL Clustering How-To - Digital Ocean is a great resource for documentation and tutorials. They've also startedd making some pretty good in-roads into providing simple cloud hosting.
MySQL Master-to-Master Replication - Another great Digital Ocean tutorial but this time covering master-master replication.
MySQL vs. PostgreSQL - One of many comparisons of the 2 major RDBMS databases.

# Books

I guess these could go under knowledge but these you have to buy so they get their own section.

If you think I’ve missed anything off then leave a note in the comments and I’ll make the list grow.