Having to mock global functions might be more common than you think, but thankfully, since PHP 5.3, we can do that simply with namespaces.

Image for post
Image for post
Photo by Steve Harvey on Unsplash

Quick Overview

If you were like me, unsure about when to use testing methods like these, I think it’s easier to paint you a picture of a recent use-case I had for a project that I was involved in recently.

The quick background of the project was, let’s imagine I have to make some changes to a wrapper class that was essentially wrapping the PDFLib class. For uniformity sake, let’s call this wrapper class . I’m using PhpUnit as my testing frameworks. And in case you’re wondering PDFLib is a paid PHP library. Once installed, the library adds many global functions. …


Image for post
Image for post
Photo by Scheier .hr on Unsplash

Setup your own free private streaming service with Plex and Raspberry Pi. Takes less than 15 minutes! Let’s go.

I’m using a raspberry pi 4, with built in wifi. Before this, I’ve set the raspberry pi up as a headless set up. If you’re interested installing raspberry the same way, check out my earlier article here.

Next, to get my video collection up onto raspberry pi, I also setup my raspberry pi to work as NAS. So if you’re interested, take a look at my earlier article on how I converted a 4TB external USB drive into a NAS.

Let’s Start!

First, update and and upgrade. We want to get the latest version of our repositories and make any package upgrade where necessary. …


I’ve been using Dropbox for a long time, but recently I’m really in love with Resilio Sync. Well if you have 30mins spare time and raspberry laying around, let’s go!

Image for post
Image for post

I was slightly annoyed at how dropbox isn’t working in countries like China and the fact that the free version now only works on a limited number of devices. Also, I’m not a huge fan of the subscription model — not in this use-case at least.

Recently, I revisited the idea of trying out BT Sync again. Apparently, the then BT Sync is now rebranded as Resilio Sync. I stop using it previously because it was slightly buggy previously, but this time round after trying it out of a month. …


With a built-in WIFI module, true Gigabit Ethernet ports and multiple USB3 ports, the raspberry was turning to be a real candidate.

Image for post
Image for post

Pre-requisites

I’m using a Raspberry 4 Model B for this project, but feel free to use older versions but your mileage might vary. I will be using the raspberry in headless mode, so checkout my previous articles on how to setup the raspberry pi incase you haven’t.

Also, if you want to know what other optimizations to work on after the installation, check out my article on 10 tweaks.

Hardware

  • Raspberry PI
  • Rasbian Buster
  • External USB HDD

Setup static IP

So, I actually was stuck here for quite a while. I wasn’t sure which approach to use, but I finally decided to use the approach. …


Image for post
Image for post
Different versions of Raspberry Pis

Here is a list of tweaks to make right after installing Rasbian on your Rasberry Pi.

Right. Before we start, some housekeeping out of the way; unless otherwise mentioned, the commands that we execute here will be ran on the Rasberry via ssh.

Incase you haven’t installed the latest Rasbian on your Raspberry pi, have a look here.

1. Create A ‘ChangeLog’

I think this is a good practice, it helps to keep things in place. Many times, we forget what we change and tinker along the way. Getting in the habit of writing down what we changed is a nice idea.

A ‘ChangeLog’ could look something the following. …


Image for post
Image for post

Setup your raspberry directly from your Windows, macOS or Linux machine without the need for any extra I/O devices.

Overview

So I wanted to set up the new raspberry pi 4 that I purchased recently, but I forgot to purchase the micro HDMI cable?! I really didn’t want to pay for this cable since my raspberry was never every really going to need a display other than for the initial installation. So this guide will show you how to quickly set this up so you can get on with your projects.

Pre-requisites

  1. Raspberry Pi (Any version)
  2. Computer (Windows, macOS or Linux)
  3. microSD…


Here is me documenting my journey as I set up a temporary FTP server for quick access before removing it at the end of the project.

Image for post
Image for post
Photo by Taylor Vick on Unsplash

The quick overview as to why I needed this article was to serve as a reminder for my future self on how to get this running quickly. So, recently I needed to run an FTP server quick and dirty because I needed to get a huge amount of files quickly to another party. Unfortunately, other storage solution wasn’t possible for this project, such as S3, so here we go…

Initially I thought it was an easy process, but there were some hiccups and I thought I document this down so future me would be able to access this information relatively quickly and set this up again in the blink of an eye. …


Using airconnect, we can instantly convert your Sonos Network into airplay supported network — oh did I mention also that it is entirely free?

Image for post
Image for post
Photo by Michał Borowczyk on Unsplash

Motivation

I own one Sonos Play:1 speaker. It sounds great and I loved that it is one of the cheaper Sonos speakers that still sounded really good. Recently, I was considering getting a second speaker and learnt that the Sonos One supported Airplay. Also, I found out I could potentially convert my Sonos Network by adding a Sonos One onto my network. …


My documented journey as I go through the entire process of setting up Stunnel + OpenVPN on Ubuntu 18.04.

Image for post
Image for post

Pre-requisites

The article assumes you already have a Ubuntu 18.04 machine setup somewhere, maybe with one of the cloud providers.

If you are looking to install this on Ubuntu 16.04, look at my previous article. There are quite a number of differences, so if you are looking to use this on 18.04, read on.

Installing OpenVPN and Stunnel

We will be installing these applications. OpenVPN and Stunnel from package repository. Also, we are going to update the latest version of OpenVPN

$ sudo -s$ apt-get install openvpn…


Here are my go-to steps to decide which python string formatting to use.

Image for post
Image for post
Photo by Sandrachile . on Unsplash

Overview

There are different ways to format strings in Python. I quickly summarize the different methods here. You should dig deeper to see how these techniques can be used in your respective scenarios.

  1. Formatting with the % operator
  2. Formatting with .format() method
  3. Using f-strings
  4. Using Template strings

Method 1: Formatting with % operator

Here’s one of the oldest method among the four techniques described above. Included here only so we know it exists and when we come across it in older legacy or Python 2.6 code, we understand it is doing string formatting. …

About

Jayden Chua

An avid web developer constantly looking for new web technologies to dabble in, more information can be found on bit.ly/jayden-chua

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store