Skip to content

Instantly share code, notes, and snippets.

piihuynh / portainer.yml
Last active Nov 25, 2021
Portainer-CE swarm mode with Traefik
View portainer.yml
version: '3.2'
image: portainer/agent:2.9.2
- /var/run/docker.sock:/var/run/docker.sock
- /var/lib/docker/volumes:/var/lib/docker/volumes
piihuynh / traefik-host.yml
Created Nov 25, 2021
Traefik v2.5 Swarm mode with "host" mode
View traefik-host.yml
version: '3.3'
# Use the latest Traefik image
image: traefik:v2.5
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS
- target: 80
piihuynh / parse_dotenv.bash
Created Aug 26, 2021 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
View parse_dotenv.bash
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
piihuynh / jspdf-import-fonts.js
Last active Feb 23, 2021
Import Japanese fonts functions for jsPDF
View jspdf-import-fonts.js
This file has been truncated, but you can view the full file.
function importFontNotoSansCJKjpRegular(jsPdfDoc) {
if (!jsPdfDoc) return;
piihuynh / .gitlab-ci.yml
Created Feb 22, 2021 — forked from superjose/.gitlab-ci.yml
This is an example of a .gitlab-ci.yml that is required for Continuous Integration on GitLab projects.
View .gitlab-ci.yml
# Reference:
# GitLab uses docker in the background, so we need to specify the
# image versions. This is useful because we're freely to use
# multiple node versions to work with it. They come from the docker
# repo.
# Uses NodeJS V 9.4.0
image: node:9.4.0
# And to cache them as well.
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# =============================
# Install docker
# -----------------------------
# Option 1
# -----------------------------
# Install kernel extra's to enable docker aufs support
piihuynh / docker-cleanup
Created Aug 8, 2020 — forked from wdullaer/docker-cleanup
Cleanup unused Docker images and containers
View docker-cleanup
# Cleanup docker files: untagged containers and images.
# Use `docker-cleanup -n` for a dry run to see what would be deleted.
untagged_containers() {
# Print containers using untagged images: $1 is used with awk's print: 0=line, 1=column 1.
# NOTE: "[0-9a-f]{12}" does not work with GNU Awk 3.1.7 (RHEL6).
# Ref:
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}'
piihuynh /
Created Jul 27, 2020 — forked from tombigel/
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in's Wayback Machine

Mac OS X

To check the current limits on your Mac OS X system, run:


Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
View Backup, restore postgres in docker container
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres