Skip to content

Instantly share code, notes, and snippets.

@weavenet
weavenet / delete_all_object_versions.sh
Created May 4, 2015 05:21
Delete all versions of all files in s3 versioned bucket using AWS CLI and jq.
#!/bin/bash
bucket=$1
set -e
echo "Removing all versions from $bucket"
versions=`aws s3api list-object-versions --bucket $bucket |jq '.Versions'`
markers=`aws s3api list-object-versions --bucket $bucket |jq '.DeleteMarkers'`
@weavenet
weavenet / console.py
Last active August 5, 2023 17:57
Python script to assume STS role and generate AWS console URL.
#!/usr/bin/env python
import getpass
import json
import requests
import sys
import urllib
import boto3
@weavenet
weavenet / cfn-signal.sh
Last active March 10, 2023 14:49
Bash script to send Cloud Formation signals via curl.
#!/bin/bash
#
# This script will signal the provided Cloud Formation URL with success or failue.
# Result is expected to be the return code of a configuration management script.
# Success will only be signaled if the script returns 0
export result=$1
export url=$2
function help {
@weavenet
weavenet / gist:6171363
Created August 7, 2013 05:07
Ruby method to stub out ENV variables in Rspec.
module EnvVar
def set_env_var(name, value)
ENV.stub(:[])
ENV.stub(:[]).with(name).and_return(value)
end
end
@weavenet
weavenet / gist:1524092
Created December 27, 2011 15:50
Quick github repo backup script
#!/bin/bash
# Script to backup git repo to S3
# Set bucket, dir, password and account to use for the backup. I keep mine in local env vars
# These are set by localrc which lives on an encrypted home directory and is executed by my bashrc
bucket=$GITHUB_BACKUP_BUCKET
dir=$GITHUB_BACKUP_DIR
password=$GITHUB_BACKUP_PASSWORD
account=$GITHUB_ACCOUNT
@weavenet
weavenet / install.sh
Last active October 20, 2022 18:23
Weavnet Dotfiles Auto Install Cpio
#!/bin/bash
set -e
VERSION=0.0.2
#
# Create CPIO Archive, derivitive of tar script for containers that don't have tar https://gist.github.com/weavenet/32b0938e5aea6f3dd18fb98e2bfbdd42
# extract the lastest tar archive
#
@weavenet
weavenet / install.sh
Last active October 20, 2022 17:30
Weavnet Dotfiles Auto Install Tar
#!/bin/bash
set -e
VERSION=0.0.2
DIRECTORY=$HOME/dotfiles_weavenet
echo "Making dotfile directory to '$DIRECTORY'"
mkdir -p $DIRECTORY
# Examples on how to store secret data outside of dotfiles
#
# Encyrpted cipher text created via:
#
# echo SECRET_VALUE | openssl enc -e -aes-256-cbc -a -salt -pass pass:`cat ~/.password`
#
password=`cat ~/.password`
cipher_text=U2FsdGVkX1/OGxV6uRFeFfihJXZ/DU8rOibHL3uKxcY=
export SECRET1=`echo $cipher_text | openssl enc -d -aes-256-cbc -a -salt -pass pass:$password`
@weavenet
weavenet / gist:1621166
Created January 16, 2012 14:41
Install AWS Cloud Init On RHEL 6u2
#!/bin/bash
# For latest cloud init source see
# http://aws.amazon.com/developertools/4026240853893296
# Download archive
wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-1.0-6.zip
# Unzip archive
unzip aws-cfn-*.zip

Keybase proof

I hereby claim:

  • I am weavenet on github.
  • I am weavenet (https://keybase.io/weavenet) on keybase.
  • I have a public key whose fingerprint is F6C4 D180 15CA F8B5 9C60 403F F83F 43F6 6744 510A

To claim this, I am signing this object: