Skip to content

Instantly share code, notes, and snippets.

View shamil614's full-sized avatar

scott hamilton shamil614

View GitHub Profile
@jamtur01
jamtur01 / pre-commit
Created October 18, 2016 21:54
A Terraform validation and formatting pre-commit hook
#!/usr/bin/env bash
set -e
# Formats any *.tf files according to the hashicorp convention
files=$(git diff --cached --name-only)
for f in $files
do
if [ -e "$f" ] && [[ $f == *.tf ]]; then
#terraform validate `dirname $f`
terraform fmt $f
@mmartinson
mmartinson / gist:79ac288f4233202f2e7c12d9a4a7a397
Created December 27, 2016 22:33
Elixir Task async/await example
t = [1,1,2,2,3]
f = fn(n) ->
IO.puts("starting #{n}")
:timer.sleep(n * 1000)
IO.puts("finishing #{n}")
n
end
tasks = Enum.map(t, fn(n) ->
@brianshumate
brianshumate / docker-macos-terraform.md
Last active May 30, 2025 12:21
The Simplest Terraform with Docker on macOS

If you'd like to experiment with Terraform on macOS locally, a great provider for doing so is the Docker provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@tsertkov
tsertkov / cloud-config.awslogs-auth.yaml
Last active November 19, 2024 15:55
Cloud-config for amzn2-ami provisioning docker env
#cloud-config
package_upgrade: true
packages:
- docker
- python2-pip
write_files:
- path: /etc/systemd/system/docker.service.d/aws-credentials.conf
content: |
[Service]
Environment="AWS_ACCESS_KEY_ID=<key>"
@sukima
sukima / Makefile
Last active October 2, 2024 13:23
Makefile for compiling PlantUML diagrams
# Makefile for PlantUML
# Author: Devin Weaver (@sukima) <[email protected]>
# GistID: 52eacde54bf7861b19ee66a07b864583
#
# This handles SVGs PNGs and ASCII outputs.
# It handles included files with the .iuml extension: !include foo.iuml
# All diagrams have the .uml extension and reside in the diagrams directory
# All output is saved to the output directory
#
# make svg - (default) build all diagrams as SVGs
@ProGM
ProGM / arel_cheatsheet_on_steroids.md
Last active October 16, 2025 04:30
Arel cheatsheet on Steroids

Arel Cheatsheet on Steroids

A (more) complete cheatsheet for Arel, including NamedFunction functions, raw SQL and window functions.

Tables

posts = Arel::Table.new(:posts)
posts = Post.arel_table # ActiveRecord

Table alias

@aanari
aanari / install_pg11_al2.sh
Last active May 9, 2023 14:00
Install Postgres 11 on Amazon Linux 2
sudo yum update
sudo amazon-linux-extras enable postgresql11
sudo yum install postgresql postgresql-devel
@jweyrich
jweyrich / pgsql_performance.sql
Created July 8, 2020 14:04
PostgreSQL performance troubleshooting
psql -h <host> -U <user> -W -d postgres
SELECT * from pg_stat_activity;
SELECT * from pg_stat_database;
# Queries running during >5 minutes
SELECT
pid,
datname,
query,