How to Use Git Rebase in a Practical Situation

Let’s say there are two pull requests open on a project repository.

Each change has its own branch like this:

  • master
  • feature/add-base64-endpoint
  • feature/add-user-agent-endpoint

The challenge is to use git rebase to add both changes to master. When you finished, your master branch should have three commits in the following order:

  • feat: add user-agent endpoint
  • feat: add base64 endpoint
  • init

Okay, let’s go!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
git clone repo_url
git status
git checkout feature/add-base64-endpoint
git rebase master
git status
git checkout master
git merge feature/add-base64-endpoint
git status
git checkout feature/add-user-agent-endpoint
git rebase master

Oops! You now see rebase conflict!

How to Enable Login with Password on Linux

Let’s update the Password Authentication parameter in the ssh service config file:

1
vim /etc/ssh/sshd_config

Wait, what? I can’t even find the sshd service?

Install it then:

1
2
sudo apt update
sudo apt install openssh-server

In the /etc/ssh/sshd_config file, uncomment this line:

1
#PasswordAuthentication yes

Done.

Oops! Don’t forget to reboot! 🙂

Or just run:

How to Update Apt Repository on Kali Linux

Back up the current sources.list first.

1
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

Well, run this command then.

1
sudo echo "deb http://http.kali.org/kali kali-rolling main non-free contrib" > /etc/apt/sources.list

Now you can run apt update command!

Happy networking! 😎

How to Dockerize a Full Stack MEVN Application

First things first. Let’s check the directory structure of the app.

A Full Stack MEVN Application

A Full Stack MEVN Application

Let’s take a look into the DB image first.

1
2
3
4
5
6
7
8
9
FROM mongo:latest

WORKDIR /app
COPY . /app

ENV MONGO_INITDB_ROOT_USERNAME=root
ENV MONGO_INITDB_ROOT_PASSWORD=password

EXPOSE 27017

I thought importing dump data should be working if I used CMD or ENTRYPOINT.

How to Setup a Reverse Proxy With Let's Encrypt SSL Certificates Using Docker

Let’s check our docker compose file first.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
version: '3'

services:
  nginx:
    image: nginx:1.15-alpine
    restart: unless-stopped
    volumes:
      - ./data/nginx:/etc/nginx/conf.d
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    ports:
      - "80:80"
      - "443:443"
    command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
  certbot:
    image: certbot/certbot
    restart: unless-stopped
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

In order to get Let’s Encrypt SSL certificates, create a shell script file (init_letsencrypt.sh) like so: