Skip to content

Instantly share code, notes, and snippets.

View dungdt88's full-sized avatar

Richard Dam dungdt88

  • Ho Chi Minh City, Vietnam
View GitHub Profile
@dungdt88
dungdt88 / filter_know_hosts.sh
Created March 7, 2016 05:04
Filter saved know hosts
## For example: ssh-keygen -H -F google.com
ssh-keygen -H -F <hostname>
@dungdt88
dungdt88 / nginx.sh
Created March 10, 2016 03:41
Startup service for Nginx in Debian (/etc/init.d/nginx)
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@dungdt88
dungdt88 / install_docker.sh
Last active March 21, 2016 05:07
Install Docker Engine, Docker Compose and Docker Machine
## Install Docker Engine (need sudo)
wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker <username>
## Install Docker Compose
curl -L https://github.com/docker/compose/releases/download/1.6.2/docker-compose-`uname -s`-`uname -m` > docker-compose
sudo mv docker-compose /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
@dungdt88
dungdt88 / docker-machine-operations.md
Last active March 30, 2016 09:27
Manage docker on remote hosts with docker-machine

To set environment to manage a remote host

eval "$(docker-machine env dev)"

In which dev must be already registered in docker-machine. Says IP address of dev machine is 192.168.99.101, and API is exposed on port 2376, then the command above is equivalent to following commands:

## Create a new Bridge network
docker network create --driver=bridge --subnet=172.17.0.1/24 --gateway=172.17.0.1 --ip-range=172.17.0.0/24 network-name
@dungdt88
dungdt88 / Reset Archiva Admin Password.md
Last active September 25, 2020 08:56
How to reset archiva admin password

I don't know how to reset Archiva admin password -.- My work around is to create a new admin by deleting Archiva's user database.

Steps

  1. Delete Archiva user database. Don't forget to make a backup.
 mv /archiva-root/data/databases/users /archiva-root/data/databases/users_bak
@dungdt88
dungdt88 / firewall-cmd-rich-rule.md
Last active September 26, 2023 22:42
Allow docker to access all containers within host with firewall-cmd rich rule in Centos 7
@dungdt88
dungdt88 / fix_httpd_selinux_permission_denied.sh
Created December 30, 2016 07:44
Fix issue when apache user cannot write to some directory due to SELinux
chcon -R -t httpd_sys_content_t /path/to/directory
chcon -R -t httpd_sys_content_rw_t /path/to/directory

Create the CA Key and Certificate for signing Client Certs

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 1095 -key ca.key -out ca.crt

Create the Server Key, CSR, and Certificate

openssl genrsa -out server.key 4096
openssl req -new -key server.key -out server.csr
@dungdt88
dungdt88 / linux_date_time.md
Last active September 29, 2017 06:43
Set Date / Time on Linux

Update Time

date +%T -s "HH:mm:ss"

For example:

date +%T -s "15:28:00"