Skip to content

Instantly share code, notes, and snippets.

View bdpdx's full-sized avatar

Brian Doyle bdpdx

  • CodeSage, LLC
  • Lake Oswego, Oregon
View GitHub Profile
import boto3
import collections
import datetime
ec = boto3.client('ec2')
# inspired by https://serverlesscode.com/post/lambda-schedule-ebs-snapshot-backups/
#
# snapshot deletion lambda
# this function deletes snapshots backed up by the EBSSnapshotterCreator
@bdpdx
bdpdx / gist:b9adb10b00aeb464c61664f491fb95e3
Last active December 7, 2016 07:05
Amazon AWS EC2 Snapshot Creation Lambda
import boto3
import collections
import datetime
ec = boto3.client('ec2')
# inspired by https://serverlesscode.com/post/lambda-schedule-ebs-snapshot-backups/
#
# snapshot creation lambda
# this function creates snapshots
@bdpdx
bdpdx / offscreen.m
Last active April 18, 2019 07:13 — forked from chrisjdavis/offscreen.m
Creating windows offscreen for fun and profit.
- (IBAction)getImageFromWeb:(id)sender {
// grab the width and height of the document in our mobileView.
CGSize contentSize = CGSizeMake(
[[mobileView stringByEvaluatingJavaScriptFromString:@"document.body.scrollWidth;"] floatValue],
[[mobileView stringByEvaluatingJavaScriptFromString:@"document.body.scrollHeight;"] floatValue]
);
// create a new window, offscreen.
NSWindow *hiddenWindow = [[NSWindow alloc] initWithContentRect: NSMakeRect( -1000,-1000, contentSize.width, contentSize.height )
styleMask: NSTitledWindowMask | NSClosableWindowMask backing:NSBackingStoreNonretained defer:NO];