Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hoangddt's full-sized avatar

Hoang Truong hoangddt

View GitHub Profile
@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
@hoangddt
hoangddt / main.go
Created January 8, 2018 02:50 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@hoangddt
hoangddt / fibo.py
Created January 5, 2018 04:33
Fibonacci implementation in python as Genarator
def fib():
a = 0
b = 0
while True:
if b == 0:
yield 1
b = 1
continue
a, b = b, a + b
yield b
@hoangddt
hoangddt / ubuntu-installer-remote.ipxe
Created October 13, 2017 07:58 — forked from joelio/ubuntu-installer-remote.ipxe
Ubuntu 16.04 netboot installer via iPXE
#!ipxe
dhcp net0
# Figure out if client is 64-bit capable
cpuid --ext 29 && set arch x64 || set arch x86
echo Starting Ubuntu Xenial installer for ${mac}
set mirror http://archive.ubuntu.com
set release xenial
set base-url ${mirror}/ubuntu/dists/${release}/main/installer-${arch}/current/images/netboot/ubuntu-installer/${arch}
@hoangddt
hoangddt / install.sh
Last active November 18, 2017 15:30
Install HTS HTK
sudo apt-get install build-essential
sudo apt-get install libx11-dev:i386
sudo apt install g++-multilib
cd htk
cp ../HTS-2.3_for_HTK-3.4.1/HTS-2.3_for_HTK-3.4.1.patch .
sudo apt-get install libx11-dev
./configure CFLAGS="-DARCH=linux"
make all
sudo make install