Skip to content

Instantly share code, notes, and snippets.

View nmagee's full-sized avatar

Neal Magee nmagee

View GitHub Profile
#!/bin/bash
# Transfers a single file via script.
# Note the optional --encrypt flag.
set -e
globus=`which globus`
srce=c4d80096-7612-11e7-8b5e-22000b9923ef
dest=c4d80096-7612-11e7-8b5e-22000b9923ed
@nirbhabbarat
nirbhabbarat / cleanup_aws_volume_snapshot.py
Created February 18, 2018 06:48
Delete AWS volume snapshots older than 30 days via python boto3
#!/usr/bin/env python
##### USE ON YOUR OWN RISK - THIS IS GOING TO delete_snapshot OLDER THAN 30 DAYS
import datetime
import sys
import boto3
age = 30
aws_profile_name = 'prod'
def days_old(date):
date_obj = date.replace(tzinfo=None)
diff = datetime.datetime.now() - date_obj
@nirbhabbarat
nirbhabbarat / aws_delete_ami_boto3.py
Created February 9, 2018 06:56
Delete/Deregister 30 days old AMI in AWS using boto3 and python
#!/usr/bin/env python
##### USE ON YOUR OWN RISK - THIS IS GOING TO DEREGISTER AMI OLDER THAN 30 DAYS
import boto3
from dateutil.parser import parse
import datetime
age = 30
aws_profile_name = 'prod'
def days_old(date):
get_date_obj = parse(date)
@benjamincharity
benjamincharity / .travis.sync-s3.yml
Last active May 9, 2021 20:17
Set up TravisCI to sync an S3 bucket.
" Two env variables must be added to TravisCI settings:
" AWS_SECRET_ACCESS_KEY
" AWS_ACCESS_KEY_ID
before_deploy:
pip install --user awscli
deploy:
provider: script
script: ~/.local/bin/aws s3 sync dist s3://MY_BUCKET_NAME --region=us-west-2 --delete
skip_cleanup: true
@mmrko
mmrko / docker-prune.sh
Last active September 3, 2021 08:42
Prune stale Docker containers, images & volumes (Bash) (versions < 1.13.0)
#!/usr/bin/env bash
stale_images=`docker images --no-trunc --quiet --filter "dangling=true"`
stale_containers=`docker ps --no-trunc --quiet --filter "status=exited"`
stale_volumes=`docker volume ls --quiet --filter "dangling=true"`
stale_images_count=`echo "$stale_images" | sed '/^\s*$/d' | wc -l | xargs`
stale_containers_count=`echo "$stale_containers" | sed '/^\s*$/d' | wc -l | xargs`
stale_volumes_count=`echo "$stale_volumes" | sed '/^\s*$/d' | wc -l | xargs`
echo "Removing stale containers..."
@gene1wood
gene1wood / all_aws_lambda_modules_python.md
Last active April 25, 2024 03:06
AWS Lambda function to list all available Python modules for Python 2.7 3.6 and 3.7
@bonzanini
bonzanini / search_biopython.py
Last active February 9, 2024 21:44
Searching PubMed with Biopython
# This code uses Biopython to retrieve lists of articles from pubmed
# you need to install Biopython first.
# If you use Anaconda:
# conda install biopython
# If you use pip/venv:
# pip install biopython
# Full discussion:
@stojg
stojg / consul
Created December 1, 2014 04:51
consul service init script for debian
#!/bin/sh
### BEGIN INIT INFO
# Provides: consul
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Consul service discovery framework
# Description: Healthchecks local services and registers
# them in a central consul database.
# Varnish 4.0 file for our Craft CMS projects
# Based on https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
#
# This is still work in progress, comments appreciated.
vcl 4.0;
import std;
import directors;
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 19, 2024 11:00
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: