Skip to content

Instantly share code, notes, and snippets.

View richarvey's full-sized avatar
🤪
Building out a virtual AWS Community

Ric Harvey richarvey

🤪
Building out a virtual AWS Community
View GitHub Profile
@richarvey
richarvey / coreos()
Last active August 14, 2017 10:56
CoreOS_latest_AMI fuction
coreos() {
if [ "$1" == "" ]; then
echo "please specify a regions (eg: eu-west-1)"
else
aws ec2 describe-images --region=$1 --owner=595879546273 --filters "Name=virtualization-type,Values=hvm" "Name=name,Values=CoreOS-stable*" --query 'sort_by(Images,&CreationDate)[- 1].{id:ImageId}'
fi
}
@richarvey
richarvey / clean_up_docker.md
Last active August 18, 2017 10:25
clean_up_docker

Remove all stopped containers.

docker rm $(docker ps -a -q)

This will remove all stopped containers by getting a list of all containers with docker ps -a -q and passing their ids to docker rm. This should not remove any running containers, and it will tell you it can’t remove a running image.

Remove all untagged images

docker rmi $(docker images -q --filter "dangling=true")

@richarvey
richarvey / signed_url.py
Last active August 27, 2019 08:39
Generate signed URL's for S3 objects from the command line (requires .boto file for credentials)
#!/usr/bin/env python3
import boto3, argparse
parser = argparse.ArgumentParser()
parser.add_argument('-b','--bucket', help='Name of your S3 Bucket', required=True)
parser.add_argument('-o','--object', help='Name of the object + prefix in your bucket', required=True)
parser.add_argument('-t','--time', type=int, help='Expirery in seconds Default = 60', default=60)
args = vars(parser.parse_args())
@richarvey
richarvey / keybase.md
Last active August 29, 2015 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am richarvey on github.
  • I am ric_harvey (https://keybase.io/ric_harvey) on keybase.
  • I have a public key whose fingerprint is B9A6 97CD 5941 9EC2 45F4 BCF2 961E DD64 9D0F CA37

To claim this, I am signing this object:

@richarvey
richarvey / cache-tester.py
Created April 21, 2014 22:21
cache-tester
#!/usr/bin/python
import urllib2, httplib, sys
from BeautifulSoup import BeautifulSoup
site = "<YOUR URL>"
page = urllib2.urlopen('http://' + site)
soup = BeautifulSoup(page)
tags=soup.findAll('img')