Skip to content

Instantly share code, notes, and snippets.

Brian Doyle bdpdx

View GitHub Profile
@bdpdx
bdpdx / AppleUSBFTDILoader.swift
Last active Apr 18, 2019
Script to prevent loading of the Apple USB FTDI interface 0 driver on Mac OS X
View AppleUSBFTDILoader.swift
#!/usr/bin/swift
/*
AppleUSBFTDILoader.swift
Brian Doyle
April 17, 2019
The purpose of this script is to aid debugging of an Espressif ESP32-WROVER-KIT on Mac OS X.
View gist:f15c65923386aff092f11647f6c31511

Preparing the Build Environment

cd ~/Desktop
mkdir wget-build
cd wget-build

Building & Installing GMP 5.0.2

View README
# Softether VPN client setup for SSTP on Mac OS X Sierra
# install tuntap from the binaries at http://tuntaposx.sourceforge.net (can't build from source w/o kext-enabled cert from apple)
# download and build softether mac os x client, then:
sudo mv vpnclient /usr/local
sudo chown -R 0:0 /usr/local/vpnclient
sudo find /usr/local/vpnclient -type f -exec chmod 600 {} \; -type d -exec chmod 700 {} \;
sudo chmod 700 /usr/local/vpnclient/{vpnclient,vpncmd}
@bdpdx
bdpdx / NSLocking+Synchronize.swift
Created Jan 4, 2017
NSLocking synchronize() method that returns a value, Swift 3
View NSLocking+Synchronize.swift
extension NSLocking {
@discardableResult
func synchronize<T>(_ closure: (Void) -> T) -> T {
lock() ; defer { unlock() }
return closure()
}
}
View Amazon AWS EC2 Snapshot Deletion Lambda
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 Dec 7, 2016
Amazon AWS EC2 Snapshot Creation Lambda
View gist:b9adb10b00aeb464c61664f491fb95e3
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 Apr 18, 2019 — forked from chrisjdavis/offscreen.m
Creating windows offscreen for fun and profit.
View offscreen.m
- (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];
You can’t perform that action at this time.