Using Vue without a build step

Background I would like to share my experience using Vue 2 without a build step in my project and factors using this approach. I started experimenting with Vue.js (Vue 2) back in 2020. One of the nice feature of Vue is the ability to use the framework directly into HTML page without a build tool (compilation). This particular feature is the deciding factor why I selected this framework in migrating a jQuery based web application....

October 25, 2023 · John Pili

Set HTTP Request Body Size in Go

Use http.MaxBytesReader to limit and control the size HTTP request body. This is a good practice to prevent abuse and save bandwidth. In the example below, I set a 20 bytes HTTP request body size limit. package main import ( "" "io" "log" "net/http" "time" ) func main() { router := httprouter.New() router.HandlerFunc(http.MethodPost, "/", func(w http.ResponseWriter, r *http.Request) { buffer, err := io.ReadAll(http.MaxBytesReader(w, r.Body, 20)) defer r.Body.Close() if err != nil { w....

October 23, 2023 · John Pili

Boot Linux without a splash screen

If you prefer to boot up your Linux machine with the boot messages rather than the distro splash screen. You can enable that by editing the file /etc/default/grub and set the value of GRUB_CMDLINE_LINUX_DEFAULT to an empty string. Example: GRUB_DEFAULT=0 GRUB_TIMEOUT=5 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" After editing the file, execute update-grub to load your configuration into the bootloader. sudo /usr/sbin/update-grub Output of update-grub Generating grub configuration file ....

August 5, 2023 · John Pili

Start a React project without using CRA

Let’s start a React project without using create-react-app (CRA). CRA is a good project starter but for those who wants a complete control over the building process, we will have to use bundler tools like webpack or yarn. Prerequisites React.js knowledge Installed and configures NodeJS Installed node package manager (npm) Steps Using the command-line, let us follow the following steps: Create directories and files mkdir webapp cd webapp Let us continue with our src folder and placeholder files...

May 30, 2023 · John Pili

The Pragmatic Programmer - It's your life

A sound bite from The Pragmatic Programmer: Your Journey To Mastery, 20th Anniversary Edition (2nd Edition) Interested? You can grab a copy of this book from Amazon.

January 17, 2023 · John Pili

Change your SSH server port to reduce brute force attacks

Reduce SSH brute force attacks by changing your default SSH server (sshd) port from port 22 to a different one. Below is a sshd log example of a brute force attacks. Changing the port You can change the default port by editing the sshd configuration file. sudo nano /etc/ssh/sshd_config Find the line that say #Port. Remove the # symbol and set the port number you prefer. Refer to the image below as reference....

December 27, 2022 · John Pili

Rsync with different SSH port

Some Linux servers were security hardened by changing the default SSH port from port 22 to a different port number. To use rsync with a different SSH port, add ‘ssh -p 12345’ in the rsync parameters. Push rsync -azvP -e 'ssh -p 12345' SOURCE USER@HOST:DEST Pull rsync -azvP -e 'ssh -p 12345' USER@HOST:SOURCE DEST

December 26, 2022 · John Pili

Golang with reCAPTCHA

Google’s reCAPTCHA is one of the tool we can use to stop malicious internet bots from abusing our web applications. It comes in two versions, reCAPTCHA v2 and v3. Version 3 uses a score-based method with no user interaction. Version 2 uses a checkbox that will require users to answer a question. In this tutorial we will focus on reCAPTCHA v2. Prerequisite This tutorial requires the following: Registered Google webmaster account Domain registered property in Google webmaster Created Google reCAPTCHA account – https://www....

December 18, 2022 · John Pili

Embed Resources in Go

The go:embed feature was introduce in Go 1.16. It lets you embed resources into the compiled application. Prior to version 1.16, developers uses external tooling to do this. With go:embed you can embed images, webpages, email templates, predefined SQL statements or an entire directory. That’s neat! Usage Examples Embedding a text file in a string //go:embed version.txt var version string Embedding a binary file //go:embed product-catalog.pdf var catalog []byte Embedding a directory filesystem //go:embed template/* var templateFS fs....

December 18, 2022

Active Directory userAccountControl flags

I was creating an Active Directory (AD) security auditing tool in Go and Python when I stumbled upon the UserAccountControl flags. This attribute can hold multiple statuses like ACCOUNTDISABLE, NORMAL_ACCOUNT, or DONT_EXPIRE_PASSWORD. It uses a bit-field; a bit-field is a group of bits with each bit representing a value. It is an efficient way of handling multiple statues of a record. A tool that helps identify the property flags. Since a bit-field can hold a range of values, I need a tool that can help me look up the value it represents....

December 2, 2022 · John Pili