sudo apt-get install \
cmake cmake-data libcairo2-dev libxcb1-dev libxcb-ewmh-dev \
libxcb-icccm4-dev libxcb-image0-dev libxcb-randr0-dev \
libxcb-util0-dev libxcb-xkb-dev pkg-config python-xcbgen \
xcb-proto libxcb-xrm-dev i3-wm libasound2-dev libmpdclient-dev \
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
SVC=<service-name> | |
S_PORT=8000 | |
D_PORT=8000 | |
kubectl port-forward deployment/${SVC} $S_PORT:$D_PORT & | |
PID_PORTF=$! | |
# Wait for $S_PORT to become available | |
# This is required as port-forwarding is not instant | |
while ! nc -vz localhost "$S_PORT" > /dev/null 2>&1 ; do |
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
locals { | |
required_value = { | |
RequiredValue = "${var.required}" | |
} | |
optional_value = { | |
exists = { | |
OptionalValue = "${var.optional}" | |
} | |
not_exists = {} |
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
# Put this file in /etc/nginx/conf.d/ directory | |
# This will listen for media.<domain>.<tld> | |
# as it listens on 443 HTTPS Port so you'll also need SSL certificate for your domain. | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name media.<domain>.<tld>; | |
return 301 https://$host$request_uri; | |
} |
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/bash | |
# A bash script to update a Cloudflare DNS A record with the external IP of the source machine | |
# Used to provide DDNS service for my home | |
# Needs the DNS record pre-creating on Cloudflare | |
# Proxy - uncomment and provide details if using a proxy | |
#export https_proxy=http://<proxyuser>:<proxypassword>@<proxyip>:<proxyport> | |
# Cloudflare zone is the zone which holds the record |
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
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: nginx-conf | |
data: | |
nginx.conf: | | |
user nginx; | |
worker_processes 3; | |
error_log /var/log/nginx/error.log; | |
events { |
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
" Vim syntax file | |
" Language: Todo | |
" Maintainer: Huy Tran | |
" Latest Revision: 14 June 2020 | |
if exists("b:current_syntax") | |
finish | |
endif | |
" Custom conceal |
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
# Rounded Corners - Python's pillow v7.1.1 | |
# Ref: https://stackoverflow.com/a/11291419/7416198 | |
from PIL import Image, ImageDraw | |
# im Image() Image object | |
# rad int radius of curve | |
def add_corners(im, rad): | |
circle = Image.new('L', (rad * 2, rad * 2), 0) |
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 | |
# Go project bootstrap file | |
# It creates required directory structure and files | |
# | |
# Author: Shubham Oli <[email protected]> | |
# Date: 09-03-2020 | |
# Inspired by: https://github.com/golang-standards/project-layout |
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 | |
// cut -d '/' -f 2- : this will remove "origin/" from output of first command | |
// | |
// I've excluded master, staging and development branches for safety | |
// But You can change this to suit your use-case | |
git branch -r --merged | cut -d ‘/’ -f 2- | grep -v ’master\|staging\|development’ | xargs git push --delete origin |