Skip to content

Instantly share code, notes, and snippets.

Avatar
🧱
If you want to truly understand something, try to change it.

Hoang Trinh piavgh

🧱
If you want to truly understand something, try to change it.
View GitHub Profile
@piavgh
piavgh / animal.go
Last active Feb 12, 2022
Golang duck typing
View animal.go
package animal
import "fmt"
type Action interface {
Run()
}
type animal struct {
name string
View checkport
alias checkport="sudo lsof -i -P -n | grep LISTEN"
View docker-clear-log.sh
#!/bin/bash -e
if [[ -z $1 ]]; then
echo "No container specified"
exit 1
fi
if [[ "$(docker ps -aq -f name=^/${1}$ 2> /dev/null)" == "" ]]; then
echo "Container \"$1\" does not exist, exiting."
exit 1
@piavgh
piavgh / add-docker-user.sh
Created Aug 17, 2020
Add a Docker user with the name from command line
View add-docker-user.sh
#!/usr/bin/env bash
help() {
cat <<EOF
Arguments:
+\$1 given username
Usage example:
$ ./add-docker-user.sh jenkins
EOF
}
@piavgh
piavgh / docker-compose.yml
Last active Aug 13, 2020
Traefik docker-compose.yml for OpenPaaS SPAs
View docker-compose.yml
version: '3'
services:
reverse-proxy:
# The official v2 Traefik docker image
image: traefik:v2.2
# Enables the web UI and tells Traefik to listen to docker
command:
- "--log.level=INFO"
- "--accesslog=true"