Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
echo '[default]' > .s3cfg
if [ -n "$ACCESS_KEY" ] && [ -n "$SECRET_KEY" ] ; then
echo access_key=$ACCESS_KEY >> .s3cfg
echo secret_key=$SECRET_KEY >> .s3cfg
else
echo access_key=$AWS_ACCESS_KEY_ID >> .s3cfg
echo secret_key=$AWS_SECRET_ACCESS_KEY >> .s3cfg
#!/bin/bash -x
S3DIR=s3://fgassert.com/old/
FILENAME=old
PUTDIR=s3://fgassert.com/
sudo apt-get install git -y
git clone https://github.com/s3tools/s3cmd.git
cd s3cmd
@fgassert
fgassert / ec2-get-security-credentials
Last active March 18, 2020 01:27
gets iam security credentials from instance metadata and writes them to awscli environment variables and .s3cfg (for s3cmd)
#!/bin/bash
# gets iam security credentials from instance metadata and writes them to
# awscli environment variables and .s3cfg (for s3cmd)
# Usage: ec2-get-security-credentials ROLENAME DEFAULT_REGION
# ROLE=$1
# DEFAULT_REGION=$2
@fgassert
fgassert / python_tutorial1.py
Created January 3, 2014 20:09
Intro to Python for GIS tutorial 1: Python basics
'''
Created on Jan 26, 2012
@author: Francis.Gassert
'''
'''
Welcome to Python!
Python is a simple scripting language that allows you to harness the power of your computer.
@fgassert
fgassert / descend.py
Last active December 24, 2015 08:09
Descends a directory and executes a command on all files in the directory. Will duplicate directory structure and file names into optional output directory
#!/usr/bin/python
import os
import sys
import subprocess
import string
import fnmatch
def tree(indir, func, pattern, max_level, l=0):
if l>max_level: