Skip to content

Instantly share code, notes, and snippets.

View daubac402's full-sized avatar
πŸ‡»πŸ‡³
πŸŽ„

NguyenTheAnh daubac402

πŸ‡»πŸ‡³
πŸŽ„
View GitHub Profile
@daubac402
daubac402 / install-docker.md
Created May 23, 2022 02:42 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@daubac402
daubac402 / git.migrate
Created January 28, 2022 04:57 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@daubac402
daubac402 / CentOS-Base.repo for CentOS 6, using vault.centos.org instead of mirror.centos.org.repo
Last active June 18, 2025 11:31
CentOS-Base.repo for CentOS 6, using vault.centos.org instead of mirror.centos.org
# vim /etc/yum.repos.d/CentOS-Base.repo
# Because mirror.centos.org now doesn't support CentOS, we use vault.centos.org instead
# Change version "6.4" with your CentOS 6.x version: rpm -q centos-release
# Some old CentOS 6 server has old SSL so that it can't connect to https site, so need to add: "sslverify=0"
[base]
name=CentOS-$releasever - Base
baseurl=https://vault.centos.org/6.4/os/$basearch/
gpgcheck=1
@daubac402
daubac402 / Setup DKIM on Postfix Mail server.txt
Last active February 24, 2022 01:59
Setup DKIM on Postfix Mail server.txt
$ MYDOMAIN=yourdomain.com
$ mkdir -p /etc/mail/dkim-keys/$MYDOMAIN
$ cd /etc/mail/dkim-keys/$MYDOMAIN
$ opendkim-genkey -t -s mail -d $MYDOMAIN
# if opendkim-genkey command is not found, install it#
# Eg: With Centos 7:
$ rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ sudo yum install -y opendkim
@daubac402
daubac402 / AWS - EC - EBS - Expand xvda + Mount xvdb to CentOS
Last active May 27, 2022 09:51
AWS - EC - EBS - Expand /dev/xvda + Make an Amazon EBS volume (/dev/xvdb) available for use to CentOS
# Check current partitions status
lsblk
# Expand /dev/xvda from 8GB (default) to your current EBS size (please increase your EBS volume in AWS Console then run these below commands)
sudo yum install -y epel-release
sudo yum install -y cloud-utils-growpart
growpart /dev/xvda 1
reboot
# Make an Amazon EBS volume available for use on Linux (for eg: /dev/xvdb)
@daubac402
daubac402 / minification.md
Created April 9, 2021 08:42 — forked from gaearon/minification.md
How to Set Up Minification

In production, it is recommended to minify any JavaScript code that is included with your application. Minification can help your website load several times faster, especially as the size of your JavaScript source code grows.

Here's one way to set it up:

  1. Install Node.js
  2. Run npm init -y in your project folder (don't skip this step!)
  3. Run npm install terser

Now, to minify a file called like_button.js, run in the terminal:

@daubac402
daubac402 / self-signed-certificate-with-custom-ca.md
Last active April 7, 2021 05:45 — forked from fntlnz/self-signed-certificate-with-custom-ca.md
Self Signed Certificate with Custom Root CA

1. Create Root CA (Done once)

1.1. Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
@daubac402
daubac402 / Add and new user for SSH
Created March 25, 2021 05:37
Add and new user for SSH
$ sudo useradd new_user
$ sudo passwd new_user
# Create new_user key pair, then add public key into that user's authorized_keys
$ sudo mkdir /home/new_user/.ssh/
$ sudo vim /home/new_user/.ssh/authorized_keys
# And permission
$ sudo chown new_user:new_user -R /home/new_user/
$ sudo chmod 700 /home/new_user/.ssh/
@daubac402
daubac402 / Add an user to sudoers list (no password required)
Created January 19, 2021 01:37
Add an user to sudoers list (no password required)
# Let’s say you want to allow the user to run sudo commands without being asked for a password
# Login as root
$ su
# Edit /etc/sudoers
$ visudo
# Add this line to the last, with username is the username that you want to add to sudoers, then save (:wq)
username ALL=(ALL) NOPASSWD:ALL
@daubac402
daubac402 / Bypass outbound port firewall USING SSH Tunneling + tsocks
Last active March 11, 2022 06:15
Bypass outbound port firewall USING SSH Tunneling + tsocks (Tested on Windows 10 + WSL)
# You will connect to the internet through a 3rd server (using SSH Tunneling)
# And of course, this 3rd server needs to connect to the Internet freedomly!
sudo apt-get install tsocks
sudo vim /etc/tsocks.conf
Change near the end of file to:
server = 127.0.0.1
server_port = 1080