Skip to content

Instantly share code, notes, and snippets.

@gene1wood
gene1wood / 01_get_aws_account_id.py
Last active June 22, 2018 18:44
Method to determine the AWS account ID of your account using boto
#!/usr/bin/env python
import boto, boto.jsonresponse
conn = boto.connect_sts()
e = boto.jsonresponse.Element()
boto.jsonresponse.XmlHandler(e, conn).parse(conn.make_request('GetCallerIdentity',{},'/','POST').read())
e['GetCallerIdentityResponse']['GetCallerIdentityResult']['Account']
@tristanfisher
tristanfisher / Ansible-Vault how-to.md
Last active April 3, 2024 13:55
A short tutorial on how to use Vault in your Ansible workflow. Ansible-vault allows you to more safely store sensitive information in a source code repository or on disk.

Working with ansible-vault


I've been using a lot of Ansible lately and while almost everything has been great, finding a clean way to implement ansible-vault wasn't immediately apparent.

What I decided on was the following: put your secret information into a vars file, reference that vars file from your task, and encrypt the whole vars file using ansible-vault encrypt.

Let's use an example: You're writing an Ansible role and want to encrypt the spoiler for the movie Aliens.

@ghaering
ghaering / dbg-cloud-init
Created May 27, 2014 07:22
Re-run cloud init scripts on Ubuntu 12.04 (AWS)
#!/bin/sh
rm -rf /var/lib/cloud/sem/* /var/lib/cloud/instance /var/lib/cloud/instances/*
cloud-init start 2>&1 > /dev/null
cloud-init-cfg all final
@garnaat
garnaat / gist:10682964
Created April 14, 2014 21:11
Launch an AWS Web Console using credential from an IAM Role
#!/usr/bin/env python
"""
Launch an AWS Web Console.
Usage:
awsconsole launch --role=<role_arn> [--profile=<profile_name>]
Commands:
launch - Launch the AWS Console in your default web browser with
the specified credentials. The console will be authenticated
@ssmereka
ssmereka / plexDatabaseBackupScript.sh
Last active April 16, 2024 16:42
Plex Media Server database backup script.
#!/bin/bash
# Backup a Plex database.
# Author Scott Smereka
# Version 1.0
# Script Tested on:
# Ubuntu 12.04 on 2/2/2014 [ OK ]
# Plex Database Location. The trailing slash is
@kgaughan
kgaughan / nntp-pull.py
Last active May 3, 2016 22:00
Tool for pulling messages from a newsgroup and storing them in an mbox file for offline access.
#!/usr/bin/env python
"""
nntp-pull
Pulls all the messages from a newsgroup and puts them in a local mbox file.
Copyright (c) Keith Gaughan, 2013.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
#!/usr/bin/env python
# encoding: utf-8
"""
This script acquires statistics on usenet groups.
It first reads a list of groups from one or more usenet servers
and then gets monthly post statistics about these groups from
Google Groups.
"""