Skip to content

Instantly share code, notes, and snippets.

Terraform

Bash prompt display workspace

terraform-workspace-prompt

Create Terraform template files

sh -c "$(curl -fsSL https://raw.githubusercontent.com/dyordsabuzo/miscellany/main/tools/terraform-create-template-files.sh)"

Windows 10

Setup

Chocolatey

Package management

  • choco install <PACKAGE_NAME>
  • choco list --local-only
  • choco outdated
@ngstigator
ngstigator / git.md
Last active November 1, 2023 18:13

Git

Commands

Trigger without needing empty commits

git add . && git commit --amend --no-edit

Delete latest commit from remote

@ngstigator
ngstigator / docker.md
Last active June 3, 2022 22:49
Docker things

Docker

Housekeeping

List images grep filter

Example: list image name and ID

docker images |grep 224466 |awk '{ print ($1,$3) }'
@ngstigator
ngstigator / nginx_try_files_proxy_pass.txt
Created February 2, 2020 18:12
Nginx try_files with proxy_pass
# https://gist.github.com/mattd/1006398/598df8f218a18bc1b0f3415550b4a369f37afb7c
server {
root /var/www/example.com/static;
server_name example.com;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;
try_files /maintenance.html @proxy;
location @proxy {
@ngstigator
ngstigator / gist:ddb6d65a7d3b501b81182a15e2431abd
Created June 27, 2019 21:12
AWS S3 backup cron-able script
#!/bin/bash
export HOME="/home/web"
export AWS_CONFIG_FILE="/home/web/.aws/config"
export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BACKUP_DIR=/home/web/db/$(date +%Y)
DB_FILE=$(ls $BACKUP_DIR -tp |grep -v /$ | head -1)
@ngstigator
ngstigator / sticky_dir_perms.txt
Last active December 5, 2018 00:59
set default sticky directory permissions
# grant directory rwx to group
`setfacl -R -m d:g:{group_name}:rwx {folder_name}/`
@ngstigator
ngstigator / bundle2chained_cert.txt
Created October 22, 2018 21:26
Convert bundled SSL certificates to chained certificate
bundle usually consists of:
- example_com.ca-bundle
- example_com.crt
append bundle contents to crt will yield a chained certificate.
@ngstigator
ngstigator / sticky_dir_perms.txt
Created October 10, 2018 17:12
Set default sticky directory permissions
`setfacl -R -m d:g:www-data:rwx {directory_target}/`
@ngstigator
ngstigator / .htaccess
Created June 4, 2018 21:40
Drupal 7 .htaccess password protect custom directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
# CUSTOM - make node export download directory password protectable
RewriteCond %{THE_REQUEST} !/sites/default/files/CUSTOM/.*
RewriteRule ^ index.php [L]