Skip to content

Instantly share code, notes, and snippets.

View imbradbrown's full-sized avatar

Brad Brown imbradbrown

  • Madison, Tennessee
View GitHub Profile
@imbradbrown
imbradbrown / upload-ssec.sh
Last active November 30, 2022 06:20
Uploading to Amazon S3 from curl with Server Side Encrpytion - Customer Provided Key used. Note that this uses the Amazon Access Keys which should be used with care.
#!/bin/bash
## file to upload.
S3_UPLOAD_FILE=some/path/file.txt
## Specify the bucket name here. This can be found in the S3 console
S3_BUCKET=bucket name here
## The desired path relative to the root of the bucket. All folders must be forward slash '/' separated
S3_DESTINATION_FILE=folder/folder2/file.txt
@imbradbrown
imbradbrown / cygwin-copy-pasta.sh
Created June 2, 2016 14:40
Copy / Paste on Windows in Cygwin with Mac keyboard
#!/bin/bash
echo "stay next ^q stop undef start undef" >> ~/.bashrc
echo '"\C-v": paste-from-clipboard' >> ~/.inputrc
echo '"\C-z": copy-to-clipboard' >> ~/.inputrc
## Restart cygwin
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true)
var root = paths.first
if let path = root?.appending("/image.jpg") {
do {
let url = URL(fileURLWithPath: path)
try UIImagePNGRepresentation(image)?.write(to: url, options: Data.WritingOptions.atomicWrite)
} catch {
return
}
}
@imbradbrown
imbradbrown / WKWebView Anchors.swift
Created April 25, 2018 12:23
WKWebView scroll to anchor location useful if having to add header/footers that scroll with it
@IBOutlet var scrollView: UIScrollView!
var webView: WKWebView!
/// container for the webView in the storyboard
@IBOutlet var webViewContainer: UIView!
/// height of the container
@IBOutlet var webViewHeightConstraint: NSLayoutConstraint!
override func viewDidLoad() {
@imbradbrown
imbradbrown / keybase.md
Created November 5, 2019 18:15
keybase.md

Keybase proof

I hereby claim:

  • I am imbradbrown on github.
  • I am bradbrownrnp (https://keybase.io/bradbrownrnp) on keybase.
  • I have a public key ASBTAhPLs1MkCqxq77m5gCXOKUZsjvYy225Up6bjBwWlOAo

To claim this, I am signing this object: