Skip to content

Instantly share code, notes, and snippets.

View webmat's full-sized avatar

Mathieu Martin webmat

View GitHub Profile
import argparse
import json
import yaml
import os
import sys
parser = argparse.ArgumentParser()
#es details
parser.add_argument('--ecs_migration_file', dest='ecs_migration_file', required=False, default='./ecs-migration.yml')
@pmbauer
pmbauer / screen-time.sh
Last active November 5, 2020 12:14
create a datadog time board from a screen board
#!/usr/bin/env bash
#params
# dd_api_key=
# dd_app_key=
# screen_id=
curl -sX GET "https://app.datadoghq.com/api/v1/screen/${screen_id}?api_key=${dd_api_key}&application_key=${dd_app_key}" \
| jq '{
title: .board_title,
description: .board_title,
template_variables: .template_variables,
@hartfordfive
hartfordfive / pre-commit
Created March 4, 2015 16:13
Git pre-commit hook to validate Chef JSON environment files
#!/bin/bash
# Comments:
# 1. You must add execution rights to this file (chmod u+x pre-commit)
# 2. You need to have the 'jq' package installed to parse the json
echo -e "\n#### Validating chef environment files ####"
if git-rev-parse --verify HEAD >/dev/null 2>&1; then
@hartfordfive
hartfordfive / create_cert_databag.sh
Last active August 29, 2015 14:13
Create un-encrypted data bag file to be used with chef certificate_manage cookbook
if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then
echo ""
echo "Usage: ./create_cert_databag.sh [DATABAG_NAME] [SSL_CERT] [SSL_KEY [SSL_CA_CHAIN]]"
echo ""
exit 1
fi
DATABAG_NAME=$1
SSL_CERT=$2
@hartfordfive
hartfordfive / aws-ssh.py
Last active December 21, 2018 12:48
Sample python script to SSH into EC2 instances by hostname tag
#!/usr/bin/env python
import sys, subprocess, json, os
from pprint import pprint
if __name__ == "__main__":
if 'AWS_SSH_KEY_FILE' in os.environ:
key_path = os.environ['AWS_SSH_KEY_FILE']
else:
@davidgiesberg
davidgiesberg / README.md
Created September 30, 2014 02:30
Shellshock Chef Updates for Ubuntu

We added these bits to one of our base cookbooks that gets applied to every node.

Because apt doesn't allow you to specify a minimum version for a package to be installed, I had to build an approximation of that logic in this recipe. Basically, what we do is check for a bash package version that is less than what is specified in the node attributes for that platform. If and only if the installed version is less than the min_pkg_ver attribute, we notify apt_package[bash] to run the :upgrade action. That ought to prevent us from updating bash unnecessarily, but also ensuring that we are never running an unpatched bash.

(Also, handy thing to note is the execute[apt-get update] - that's using the apt cookbook to force an apt-get update to run immediately. If you don't do that, bash won't update until apt has updated AND this chef recipe runs again.

@rgbkrk
rgbkrk / hubdecrypt.sh
Last active April 6, 2022 02:55
Encrypt a (short) file using someone's public key from github
#!/usr/bin/env bash
# HubCrypt
# ========
#
# Decrypt a file encrypted using hubencrypt (ok, it's just openssl + rsautl +
# your SSH keys). It needs the private key that matches your last public key
# listed at github.com/<user>.keys
#
#!/usr/bin/env ruby
def foo_proc
puts 'proc 1'
proc { return }.call
puts 'proc 2'
end
def foo_block
puts 'block 1'
@wrightling
wrightling / design_for_devs.md
Last active December 14, 2015 15:59
CSS, HTML, and Design for a back-end developer. Suggestions from the Ruby Rogues' Parlay list.

Development box installation guide

This guide will show how to setup a VirtualBox similiar to an Ubuntu 12.04.1 server for use with Amazon EC2.

Covered in this guide:

  • VeeWee: Tool for building base boxes which will be used by vagrant
  • Vagrant: Tool for managing virtual machines with an easy to use CLI
  • Librarian: Bundler for chef cookbooks
  • Chef-solo & Knife solo: Tool for automating installing and management of servers