Install GoAccess (Ubuntu 18.04)

$ sudo apt install goaccess

For the latest version:

$ echo "deb http://deb.goaccess.io/ $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/goaccess.list
$ wget -O - https://deb.goaccess.io/gnugpg.key | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install goaccess

Install the dependencies:

$ sudo apt-get install libgeoip-dev libncursesw5-dev

Download, configure and install goaccess:

$ wget https://tar.goaccess.io/goaccess-1.4.tar.gz
$ tar -xzvf goaccess-1.4.tar.gz
$ cd goaccess-1.4/
$ ./configure --enable-utf8 --enable-geoip=legacy
$ make
$ sudo make install

Determine Log Format

Once you have GoAccess installed, you should be ready to start using it. However, first you need to determine the log format of your access log…


Basic usage: simple GET method

This will make a GET request to the given URL and print response to stdout.

$ curl https://example.com

Ignore invalid and self-signed SSL connection errors with curl

Use -k or --insecure option

$ curl -k https://domain-with-insecure-ssl.com

Print response headers

Use -i option to print response headers and the response itself, -I option to omit the response and print response headers only.

$ curl -I https://example.com

Sample response:

HTTP/2 200
accept-ranges: bytes
age: 135602
cache-control: max-age=604800
content-type: text/html; charset=UTF-8
date: Wed, 06 Jan 2021 07:16:58 GMT
etag: "3147526947"
expires: Wed, 13 Jan 2021 07:16:58 GMT
last-modified: Thu, 17 Oct 2019 07:18:26 GMT
server: ECS (oxr/8310)
x-cache: HIT
content-length: 1256

Print payload size and response time

For this, we need…


There are many benefits you can get when using Nginx to proxy your S3 (and others) files, such as:

  • Proxy cache to leverage browser caching
  • URLs masking that helps a lot in case you change cloud provider later
  • Speed up transferring by offload SSL/TLS

This tutorial helps you through detailed steps you can follow to configure Nginx to proxy your files in S3, and leverage browser caching.

Inspect AWS S3 response headers

First, let inspect AWS S3 files’ response headers:

$ curl -I https://ucodevn.s3-ap-southeast-1.amazonaws.com/image_restored/1867/courses/42/17773/id365442.png

You will get a result similar to this:

HTTP/1.1 200 OK
x-amz-id-2: C8uQhUZqP8hZ3hACa3fFbG6l29kXYq/VS+i5otl9DNRHAHM4wnM+28Yk4LzDt9L/Q8OuMbLGeX4=
x-amz-request-id: 4A0191D9383DE48B
Date: Sun, 18 Oct 2020 01:47:31 GMT
Last-Modified: Mon…


Installing Docker

From official docs: https://docs.docker.com/engine/install/ubuntu/

Uninstalling old versions:

sudo apt-get remove docker docker-engine docker.io containerd runc

Set up the respository

sudo apt update

Install packages to allow apt to use a repository over HTTPS:

sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

Add Docker repository:

sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

Install Docker CE

$ sudo apt update
$ sudo apt-get install docker-ce docker-ce-cli containerd.io

Verify that Docker CE is installed correctly by running the hello-world image:

$…


Let’s Encrypt is a Certificate Authority (CA) that provides an easy way to obtain and install free TLS/SSL certificates for enabling encrypted HTTPS on web servers. It simplifies the process by providing a software client, Certbot, that attempts to automate most of the required steps for both Apache and Nginx.

Install certbot

sudo add-apt-repository ppa:certbot/certbot
sudo apt update
sudo apt-get install certbot
sudo apt-get install python-certbot-nginx
certbot --version

Obtain an SSL certificate

You should already a website configuration for your domain in nginx at /etc/nginx/sites-available/example.com:

server {
...
server_name example.com www.example.com;
...
}

Then obtain an SSL certificate and get certbort do all the configuration by…


NGINX provides a number of built‑in timing variables that you can include in log entries. All are measured in seconds with millisecond resolution.

  • $request_time – Full request time, starting when NGINX reads the first byte from the client and ending when NGINX sends the last byte of the response body
  • $upstream_connect_time – Time spent establishing a connection with an upstream server
  • $upstream_header_time – Time between establishing a connection to an upstream server and receiving the first byte of the response header
  • $upstream_response_time – Time between establishing a connection to an upstream server and receiving the last byte of the response…


Concepts

Messages are not published directly to a queue; instead, the producer sends messages to an exchange. An exchange is responsible for routing the messages to different queues with the help of bindings and routing keys.

A binding is a link between a queue and an exchange.

The routing key is a message attribute the exchange looks at when deciding how to route the message to queues (depending on exchange type).

Exchanges, connections, and queues can be configured with parameters such as durable, temporary, and auto delete upon creation. Durable exchanges survive server restarts and last until they are explicitly deleted…


Step 0: Install newest version of Erlang

$ wget -O- https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo apt-key add -
$ echo "deb https://packages.erlang-solutions.com/ubuntu bionic contrib" | sudo tee /etc/apt/sources.list.d/erlang.list

then:

sudo apt update
sudo apt install erlang

Check Erlang version:

$ erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().'  -noshell

Step 1: Add RabbitMQ Repository To Ubuntu 18.04

$ wget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc | sudo apt-key add -
$ wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -

then:

$ echo "deb https://dl.bintray.com/rabbitmq/debian $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/rabbitmq.list

Step 2: Install RabbitMQ Server Ubuntu 18.04 LTS

To install RabbitMQ Server Ubuntu 18.04, update apt list, then install rabbitmq-server package:

sudo apt update
sudo apt install rabbitmq-server

Check status:

sudo systemctl status  rabbitmq-server.service

or

sudo service rabbitmq-server status

Check RabbitMQ version:


Adding current git branch name in Bash prompt with highlighted color can help to avoid a lot of problems with working on wrong git branches, which is a quite popular scenario to most of the developers sometime. This guide show to do it and explain some underneath concept of the hack.

A quick hack

Adding this to ~/.bashrc:

parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
export PS1="\u@\h \[\e[32m\]\w \[\e[91m\]\$(parse_git_branch)\[\e[00m\]$ "

Restart the terminal, or source ~/.bashrc, and it works:


OCRmyPDF is a free utility that allows you to convert a scanned pdf to text (ocr — optical character recognition). In fact, OCRmyPDF adds an OCR text layer to scanned PDF files over the original one, allowing them to be searched or copy-pasted.

Main features

  • Generates a searchable PDF/A file from a regular PDF
  • Places OCR text accurately below the image to ease copy / paste
  • Keeps the exact resolution of the original embedded images
  • When possible, inserts OCR information as a “lossless” operation without disrupting any other content
  • Optimizes PDF images, often producing files smaller than the input file
  • If requested…

Chi Thuc Nguyen

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