Skip to content

Instantly share code, notes, and snippets.

View hoangddt's full-sized avatar

Hoang Truong hoangddt

View GitHub Profile
@hoangddt
hoangddt / ssh_root_user.md
Last active September 11, 2018 09:36
SSH root user

https://tecadmin.net/how-to-enable-ssh-as-root-on-aws-ubuntu-instance/

sudo service ssh reload

/etc/ssh/sshd_config

authorized_keys

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user "admin" rather than the user "root".';echo;sleep 10" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7cyhhhowluDtBnq3cw6opWeuD/AtwFWguGzwKwRZdlGjsNEv7hrsYeee6Cd82B8/pYdXX/e1Lg02hrmBnunvaB/BZD1Kb7IGvzplOjeJiaFqQvW6QMyWd1pt7ZiHmzyZ0uEBgBsgnblBink+25xqAb8gJD5fHVdzT8aEP8M3gs3dMScfhbxWIPC/a8cyzQ/8khNPdyQtaC0eEmXUHGhNsWnDmQv47lDaKjMi+AsoRxrtceGokWg6a9D/IGsxtKFMkMB/RM83UH/Yjcw9HxQPcKDUWEnnhMPGGGuPwQmikDdsipOT7RzFQZhF2MgNp7dwcnpxzp/sT1KW54L6ZjELP id_rsa

@hoangddt
hoangddt / table.md
Last active September 7, 2018 09:10
Writing table

Task: http://ielts-simon.com/ielts-help-and-english-pr/2011/01/ielts-writing-task-1-consumer-durables-table.html

The table give information about the consumer durables owned in Britain over the course of 11 years starting 1972.

Looking at the graph, it is immediately obvious that all the equipments in Britain exprienced an upward progression. The percentage of television registered the highest percentage throughout the period.

In 1972, television registered 93 percent, then increase steadily to 98 percent in 1983. A similar trend was seen in refrigerator and vacuum cleaner, they both slightly increase throughtout the period. To be specific, the figures for these start at 73 and 87 to 94 and 95 respectively. The percent of central heating in 1972 was 39, then increased exponentially to 64 in 1983. A sinilar trend was seen in telephone, which nearly doubled from 42 to 77 percent.

@hoangddt
hoangddt / link.md
Created August 22, 2018 09:57
fix helm issue
@hoangddt
hoangddt / ssh-agent
Created August 21, 2018 09:18
ssh-agent add default private key
ssh-add ~/.ssh/id_rsa
ssh-add -L
@hoangddt
hoangddt / x-docker-run
Created August 15, 2018 04:31
Override the entrypoint when using docker run
docker run --rm -ti --entrypoint='' <image> bash
@hoangddt
hoangddt / 1_kubernetes_on_macOS.md
Created August 2, 2018 09:34 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

@hoangddt
hoangddt / docker_phpmyadmin.sh
Last active August 6, 2018 02:31
Phpmyadmin docker quick run
$ docker run -d --link <container'sname>:db -p 8080:80 --net=<netname> phpmyadmin/phpmyadmin
adminer for almost all databases
$ docker run --rm --link database:db --net=docker-zulip_default -p 8888:8080 adminer
@hoangddt
hoangddt / tif_to_python.py
Last active July 20, 2018 04:54
Convert image in .tif to png
import sys
import os
from PIL import Image
def get_filename(filepath):
filename = os.path.basename(filepath)
filename, file_extension = os.path.splitext(filename)
return filename
def convert_to_png(filepath):
@hoangddt
hoangddt / sql-mongo_comparison.md
Created April 26, 2018 09:19 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@hoangddt
hoangddt / mysql-docker.sh
Created March 28, 2018 11:51 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE