Skip to content

Instantly share code, notes, and snippets.

@labkey-stuartm
labkey-stuartm / extract.sh
Last active May 15, 2020 18:11 — forked from brittbinler/extract.sh
Extract Bash Function
#!/bin/bash
# function Extract for tar or zip file formats
# Inspired by this Source: https://github.com/xvoland/Extract/blob/master/extract.sh
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|gz|tar|tbz2|tgz|tar.bz2|tar.gz|tar.xz>"
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
return 1
@labkey-stuartm
labkey-stuartm / tag-vols-snaps.py
Created March 18, 2019 16:52 — forked from sansane123/tag-vols-snaps.py
Automatically tag EC2 snapshots and volumes based on their attached AMIs/instances
# Tag snapshots based on their associated AMI and volumes based on attached instance.
# format:
# (AMI:db5|db5) /dev/sda1 (1/4)
# (AMI:db5|db5) /dev/sdb (2/4)
# Best practice: create IAM user
# Simplest privilege to get it to work with reasonable security: use predefined policy "ReadOnlyAccess"
# and add your own custom policy that grants "ec2:CreateTags"