Skip to content

Instantly share code, notes, and snippets.

@amschaal
amschaal / lambdaAMICleanup.py
Created July 9, 2019 20:29 — forked from bkozora/lambdaAMICleanup.py
AWS Lambda Function to Delete AMIs and Snapshots
# Automated AMI and Snapshot Deletion
#
# @author Robert Kozora <[email protected]>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and reference the AMIs of that instance. We check that the latest daily backup
# succeeded then we store every image that's reached its DeleteOn tag's date for
# deletion. We then loop through the AMIs, deregister them and remove all the
# snapshots associated with that AMI.
@amschaal
amschaal / lambdaAMIBackups.py
Created July 9, 2019 20:29 — forked from bkozora/lambdaAMIBackups.py
AWS Lambda AMI Backups
# Automated AMI Backups
#
# @author Robert Kozora <[email protected]>
#
# This script will search for all instances having a tag with "Backup" or "backup"
# on it. As soon as we have the instances list, we loop through each instance
# and create an AMI of it. Also, it will look for a "Retention" tag key which
# will be used as a retention policy number in days. If there is no tag with
# that name, it will use a 7 days default value for each AMI.
#
@amschaal
amschaal / DRFNgTable.js
Created August 2, 2016 22:46
Make it easy to set up a server side NgTable with Django Rest Framework API backend
angular.module('DRFNgTable',['ngTable'])
//Usage: $scope.tableParams = DRFNgTableParams('/api/users/',{sorting: { last_name: "asc" }});
.factory('DRFNgTableParams', ['NgTableParams','$http', function(NgTableParams,$http) {
return function(url,ngparams,resource) {
var params = {
// page: 1, // show first page
// filter:{foo:'bar'}, //filter stuff
count: 10 // count per page
}
@amschaal
amschaal / ui-bootstrap-extras.js
Created July 7, 2016 21:41
Utility directives for making the use of Angular UI Bootstrap easier
angular.module('ui.bootstrap')
/*
Make use of $uibModal easier for common situations, such as assigning the result to a model in the controller scope.
IE: <button class="btn" modal-launcher modal-controller="GroupModalController" modal-template="template/group_modal.html" set-model="group">Select group</button>
*/
.directive('modalLauncher', function($compile,$uibModal) {
return {
restrict: 'A',
scope: {