Skip to content

Instantly share code, notes, and snippets.

@johngidt
johngidt / git-commit-template.md
Created February 17, 2023 19:02 — forked from lisawolderiksen/git-commit-template.md
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
chef-server-ctl stop
chef-server-ctl kill
chef-server-ctl cleanse
chef-server-ctl uninstall
pkill -9 -u opscode
pkill -9 -f postgres
pkill -9 -f beam
pkill -9 -f /opt/chef
rm -rf /etc/opscode /etc/chef /opt/opscode /opt/chef /var/chef
rm -rf /etc/chef-server /etc/chef /opt/chef-server /opt/chef /root/.chef /var/opt/chef-server
@johngidt
johngidt / cloudformation-yaml-to-json.py
Created April 9, 2018 18:17 — forked from kesor/cloudformation-yaml-to-json.py
Convert CloudFormation YAML format to JSON format
#!/usr/bin/env python
import sys, yaml, json
def funcparse(loader, node):
node.value = {
yaml.constructor.ScalarNode: loader.construct_scalar,
yaml.constructor.SequenceNode: loader.construct_sequence,
yaml.constructor.MappingNode: loader.construct_mapping,
}[type(node)](node)
node.tag = node.tag.replace(u'!Ref', 'Ref').replace(u'!', u'Fn::')
@johngidt
johngidt / gist:17a81e5b6247bcbdf799a50f0a2085ef
Created February 19, 2018 19:03 — forked from LarsFronius/gist:e579051d7f140fd803b0
If you ever want to debug a kinesis stream, copy this bash one liner.
On a mac, `brew install awscli gnu-sed` before.
streamname=staging;aws kinesis describe-stream --stream-name $streamname --output text | grep SHARDS | awk '{print $2}' | while read shard; do aws kinesis get-shard-iterator --stream-name $streamname --shard-id $shard --shard-iterator-type LATEST --output text | while read iterator; do while output=`aws kinesis get-records --shard-iterator $iterator --output text`; do iterator=`echo "$output" | head -n1`; echo "$output" | gsed 1d | grep RECORDS | while read record; do echo $record | awk '{print $2}' | base64 -D; done; done; done; done
@johngidt
johngidt / lambda-website-checker.js
Created February 8, 2018 17:11 — forked from marcelog/lambda-website-checker.js
This AWS Lambda can be used to check your website for availability
'use strict';
var url = require('url');
var target = 'http://www.yourwebsite.com'; // Change this one
exports.handler = function(event, context, callback) {
var urlObject = url.parse(target);
var mod = require(
urlObject.protocol.substring(0, urlObject.protocol.length - 1)
);
@johngidt
johngidt / desc.md
Created June 16, 2016 21:43
boto3 Lacks EC2 Instance Identity Metadata Parsing

Given that boto/boto3#313 is not resolved, I hacked together something else in Python that I'm using.

@johngidt
johngidt / proxy.js
Created June 16, 2016 15:53 — forked from nakedible-p/proxy.js
AWS ES proxy
var AWS = require('aws-sdk');
var http = require('http');
var httpProxy = require('http-proxy');
var express = require('express');
var bodyParser = require('body-parser');
var stream = require('stream');
if (process.argv.length != 3) {
console.error('usage: aws-es-proxy <my-cluster-endpoint>');
process.exit(1);
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
@johngidt
johngidt / ansible_logging.py
Created June 15, 2016 20:30 — forked from pragdave/ansible_logging.py
Logging plugin for Ansible
# Interpret the Ansible log for humans. In particular, we
# look for command executions and format their content
#
# - name: list files
# shell: "ls -lrt *e*"
#
# Might produce
#
# TASK: [1] ***********************************************************
# changed: [localhost]