Skip to content

Instantly share code, notes, and snippets.

View alecdoconnor's full-sized avatar

0xA1EC alecdoconnor

View GitHub Profile
from Crypto.PublicKey import RSA
# pem = open('private.pem','r').read()
# key = RSA.importKey(pem)
# cyphertext = open('message.bin','r').read()
# print key.decrypt(cyphertext)
def gcd(a,b):
@alecdoconnor
alecdoconnor / ExtensionAlertController.swift
Last active November 27, 2017 02:04
Extending UIAlertController for cleaner code
extension UIAlertController {
func addActions(_ actions: [UIAlertAction]) {
for action in actions {
self.addAction(action)
}
}
}
//
// ImageCache.swift
//
// Created by Alec O'Connor on 3/6/18.
// Copyright © 2018 Alec O'Connor. All rights reserved.
//
import UIKit
class ImageCache {
extension URL {
/// Initializes with a String and can provide automatic URL encoding
///
/// Returns nil if a URL cannot be formed with the string (for example, if the string contains characters that are illegal in a URL that could not be encoded, or is an empty string).
init?(_ string: String, provideURLEncoding: Bool) {
guard provideURLEncoding else {
guard let url = URL(string: string) else { return nil }
self = url
return