Skip to content

Instantly share code, notes, and snippets.

View awaddell's full-sized avatar

Alastair Waddell awaddell

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
@marcellodesales
marcellodesales / ec2-host-from-tag-to-env-vars.sh
Last active November 8, 2022 11:49
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 3, 2024 18:53
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@amosshapira
amosshapira / gist:e043ef116bfdfe92e3cd
Created March 2, 2015 01:31
Reading AWS cli keys into vagrant-aws configuration
# NOTE: Uses ~/.aws/config to get the region and ~/.aws/credentials to get
# AWS credentials.
# TODO: When running on EC2, use the auto-IAM data
config.vm.provider :aws do |aws, override|
aws_credentials = IniFile.load(File.expand_path('~/.aws/credentials'))
aws.access_key_id = aws_credentials['default']['aws_access_key_id']
aws.secret_access_key = aws_credentials['default']['aws_secret_access_key']
aws_config = IniFile.load(File.expand_path('~/.aws/config'))
aws.region = aws_config['default']['region']
end
@ngpestelos
ngpestelos / remove-docker-containers.md
Last active March 5, 2024 20:45
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)
@P7h
P7h / jdk_download.sh
Last active February 20, 2024 11:29
Script to download JDK / JRE / Java binaries from Oracle website from terminal / shell / command line / command prompt
##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### ##### #####
### Shell script to download Oracle JDK / JRE / Java binaries from Oracle website using terminal / command / shell prompt using wget.
### You can download all the binaries one-shot by just giving the BASE_URL.
### Script might be useful if you need Oracle JDK on Amazon EC2 env.
### Script is updated for every JDK release.
### Features:-
# 1. Resumes a broken / interrupted [previous] download, if any.
# 2. Renames the file to a proper name with including platform info.
@kost
kost / cisco-4-sha256.pl
Last active December 15, 2015 01:09
Cisco Password Type 4 - SHA256 implementation in Perl
#!/usr/bin/perl
# Basic Cisco type 4 - password encoder by Kost
# Base64 custom encoder taken from VOMS::Lite::Base64
# Example: ./cisco-4-sha256.pl password
use strict;
use Digest::SHA qw(sha256);
my %Alphabets = (
CISCO => "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
@aliang
aliang / Mac SSH Autocomplete
Created June 14, 2011 07:14
Add auto complete to your ssh, put into your .bash_profile
_complete_ssh_hosts ()
{
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
comp_ssh_hosts=`cat ~/.ssh/known_hosts | \
cut -f 1 -d ' ' | \
sed -e s/,.*//g | \
grep -v ^# | \
uniq | \
grep -v "\[" ;
@jbhannah
jbhannah / he-ipv6.sh
Created May 23, 2011 17:51
Hurricane Electric IPv6 Tunnel Broker script for Ubuntu
#!/bin/sh
# Hurricane Electric IPv6 Tunnel Broker script for Ubuntu
# /etc/network/if-up.d/he-ipv6.sh
# Written by Jesse B. Hannah (http://jbhannah.net) <jesse@jbhannah.net>
# Based on instructions provided by Hurricane Electric (http://tunnelbroker.net)
###
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@pklaus
pklaus / tunnelbroker-net.sh
Last active January 14, 2024 12:10
tunnelbroker.net automatic tunnel IP update and tunnel setup (on Mac OS X)
#!/bin/bash
#### This script is published by Philipp Klaus <philipp.l.klaus@web.de>
#### on <http://blog.philippklaus.de/2011/05/ipv6-6in4-tunnel-via-hurricane-electric-tunnelbroker-net-automatic-ip-update-on-mac-os-x/>
#### It is originally by freese60 and modified by limemonkey.
#### Found on <http://www.tunnelbroker.net/forums/index.php?topic=287.0>
### Uncomment this line to debug the script:
#set -x