This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# Credit: https://gist.github.com/coderua/5592d95970038944d099, https://gist.github.com/Mins/4602864 | |
# Usages: | |
# wget -O - https://gist.githubusercontent.com/piihuynh/xxx/raw/xxx/install-mariadb-10.6.sh | bash -s newpassword | |
# bash -c "$(wget -qO - 'https://gist.githubusercontent.com/piihuynh/xxx/raw/xxx/install-mariadb-10.6.sh')" '' newpassword | |
# Check the bash shell script is being run by root | |
if [[ $EUID -ne 0 ]]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -e | |
# Usages: | |
# wget -O - https://gist.githubusercontent.com/piihuynh/xxx/raw/yyy/add-user-on-ubuntu.sh | bash -s username | |
# bash -c "$(wget -qO - 'https://gist.githubusercontent.com/piihuynh/xxx/raw/587yyy/add-user-on-ubuntu.sh')" '' username | |
[ $EUID -ne 0 ] && echo "This script must be run as root" 1>&2 && exit 1 | |
[ -z "$1" ] && echo "Please provide a username in 1st param" && exit 1 | |
# Define username from param |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sample Nginx config with sane caching settings for modern web development | |
# | |
# Motivation: | |
# Modern web development often happens with developer tools open, e. g. the Chrome Dev Tools. | |
# These tools automatically deactivate all sorts of caching for you, so you always have a fresh | |
# and juicy version of your assets available. | |
# At some point, however, you want to show your work to testers, your boss or your client. | |
# After you implemented and deployed their feedback, they reload the testing page – and report | |
# the exact same issues as before! What happened? Of course, they did not have developer tools | |
# open, and of course, they did not empty their caches before navigating to your site. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.2' | |
services: | |
agent: | |
image: portainer/agent:2.9.2 | |
volumes: | |
- /var/run/docker.sock:/var/run/docker.sock | |
- /var/lib/docker/volumes:/var/lib/docker/volumes | |
environment: | |
AGENT_CLUSTER_ADDR: tasks.agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
services: | |
traefik: | |
# Use the latest Traefik image | |
image: traefik:v2.5 | |
ports: | |
# Listen on port 80, default for HTTP, necessary to redirect to HTTPS | |
- target: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function importFontNotoSansCJKjpRegular(jsPdfDoc) { | |
if (!jsPdfDoc) return; | |
jsPdfDoc.addFileToVFS('NotoSansCJKjp-Regular.ttf','AAEAAAANAIAAAwBQRkZUTXas8jIADxLYAAAAHEdERUYAKRA8AA8SuAAAAB5PUy8ywjboQwAAAVgAAABWY21hcM+tTs8AACQgAABX2mdhc3D//wADAA8SsAAAAAhnbHlmHuJx0gAAvNgADVUsaGVhZAe8do4AAADcAAAANmhoZWEH2APCAAABFAAAACRobXR4AmrW+gAAAbAAACJubG9jYV+I4xgAAHv8AABA3G1heHAQjADLAAABOAAAACBuYW1li6KVSAAOEgQAAAGhcG9zdBcZx50ADhOoAAD/BQABAAAAAQAAF3dSEl8PPPUACwPoAAAAANJwmYAAAAAA0nCZgP/U/ukD6AO/AAAACAACAAEAAAAAAAEAAAO//ukAWgP2/9T/4QPoAAEAAAAAAAAAAAAAAAAAAAEBAAEAABA2AMgAFAAAAAAAAgAAAAEAAQAAAEAAAAAAAAAAAQHSAZAABQAAAooCvAAAAIwCigK8AAAB4AAxAQIAAAIABQMAAAAAAACAAAKDCAdo6AAAABAAAAAAUGZFZAAAACD/5QMg/zgAWgSIAUAAEgAEAAAAAAAAA+gAAAAAAAABTQAAAOAAAAFDAF8CKwAoAisAOgOZACcCqAAkARYAWgFSAFwBUgArAdMAQAIrACYBFgA1AVsALgEWAEkBiAALAisAMQIrAFgCKwAoAisAHQIrABQCKwAcAisAOAIrADECKwAtAisALAEWAEkBFgA1AisAJgIrACYCKwAmAdoAKwOyADgCXwADApEAZAJ+ADoCrwBkAkwAZAIoAGQCsQA6AtgAZAElAGQCGAAjAoYAZAIeAGQDLABkAtIAZALmADoCeABkAuYAOgJ7AGQCVQAvAlcAHwLRAGECPwABA24AGQI9ABECE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: https://www.exclamationlabs.com/blog/continuous-deployment-to-npm-using-gitlab-ci/ | |
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# 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: https://github.com/blueyed/dotfiles/commit/a14f0b4b#commitcomment-6736470 | |
docker ps -a | tail -n +2 | awk '$2 ~ "^[0-9a-f]+$" {print $'$1'}' |
NewerOlder