Tmux Cheatsheet

I use linux terminal all day, and if you are like me, you should use tmux, which enables a number of terminals to be created, accessed, and controlled from a single screen, just to be more productive! So, there’re some essential commands for tmux down below. start a new session tmux # session name will be 0,1,2, ... by default tmux new -s <session name> # you can set a custom session name rename an existing session tmux rename-session -t <old name> <new name> detach current session C-b d

Automatic Https With Caddy - Extremely Easy

Today I had a chance to try Caddy for dev purpose, and you guess what, it was extremely easy and funny. Only two steps and boom, you got a secured website almost instantly. Here are the steps I followed: Install Caddy on Ubuntu/Debian Check their documentation for another OS/installation method. 1 2 3 4 5 sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.

How to Deploy Next.js App to AWS EC2 in Production and Set up CI/CD with Github Actions

Yo! In this article, we’ll be discussing how to deploy a Next.js app to AWS EC2 and set up continuous integration and deployment using Github Actions. Before proceeding, you will need to have the infrastructure ready on AWS, which can be deployed manually or by using Terraform code. I’ll be skipping the infrastructure setup part for the purpose of this article. First things first, we need to SSH into the EC2 instance.

How to Configure Vim as Your Go IDE

Vim/Neovim is my IDE for day-to-day work. My vimrc file can be found here. This article is all about Vim(not Neovim), and I assume that you have already configured Vim as your code editor. Okay, let’s get started by installing fatih/vim-go plugin with your favorite vim plugin manager. After that, if you have Go installed correctly on your machine already, you will be able to run :GoInstallBinaries. Next, install coc.nvim plugin, which is a great language server host for Vim.

How to Setup Eslint and Prettier With Git Precommit Hooks in React Typescript Project

You may create a new react app with typescript like so: 1 npx create-react-app my-app --template typescript Now let’s setup eslint and prettier. Remove eslintConfig from package.json. Install prettier using these commands: 1 2 3 yarn add --dev --exact prettier # these are for making eslint and prettier to play well together yarn add --dev eslint-config-prettier eslint-plugin-prettier Create config files like this: 1 touch .eslintrc.js .eslintignore .prettierrc.js .prettierignore Use same contents for both ignore files:

Improve Your Wireguard Server's Performance

The default MTU(Maximum Transmission Unit) is 1420 in wireguard, while the most other devices use 1496 or 1500. Read here for more info. TL;DR Stop the wireguard interface in use: sudo systemctl stop wg-quick@wg0 # or sudo wg-quick down wg0 Edit the wireguard config file: sudo vim /etc/wireguard/wg0.conf Add MTU=1400 to the Interface section like this: 1 2 3 4 5 6 [Interface] Address = 10.10.10.1/24 SaveConfig = true ListenPort = 51820 MTU = 1400 PrivateKey = xxxxxx And start the stopped service:

Redux Setup in Your React Project - Personal Preference

The first thing is to install libraries for redux, as you may guess: 1 npm install -S redux react-redux redux-logger reselect redux-persist redux-logger is a redux middleware which is really really helpful in development, but it’s up to you whether to use it or not. reselect is a memoization implementation for redux. redux-persist is for leveraging localStorage/sessionStorage browser APIs in redux. Assuming that you have the react project structured in your own way, I’d create a new folder named redux inside the src/app folder:

Setup a Wireguard VPN Server on Ubuntu

This tutorial is going to show you how to set up your own WireGuard VPN server on Ubuntu. WireGuard is made specifically for the Linux kernel. It runs inside the Linux kernel and allows you to create fast, modern, and secure VPN tunnel. TL;DR Prerequisites This tutorial assumes that the VPN server and VPN client are both going to be running on Ubuntu 20.04 operating system. Setting Up the WireGuard Server Install Wireguard from the default Ubuntu repository:

Setup Wireguard VPN Server on CentOS

This tutorial is going to show you how to set up your own WireGuard VPN server on CentOS. WireGuard is made specifically for the Linux kernel. It runs inside the Linux kernel and allows you to create fast, modern, and secure VPN tunnel. TL;DR Prerequisites This tutorial assumes that the VPN server and VPN client are both going to be running on CentOS 7/8 operating system. Step 1: Install WireGuard on CentOS Server and Desktop Log into your CentOS server, then run the following commands to install WireGuard.

Git Cheatsheet for Minimalists

Basic Git Concepts Working copy (working tree file): It refers to the file in the repository that appears on the hard disk. Index (staging area or cache): it refers to you have git add-ed, or, what would be committed if you were to run git commit. HEAD: It refers to the “current” or “active” branch, when we need to check out a branch (referring to your attempt to match the branch with what is in the working copy), only one can be checked out at a time.