Skip to content

Instantly share code, notes, and snippets.

View dleonard00's full-sized avatar

Doug Leonard dleonard00

View GitHub Profile
@dleonard00
dleonard00 / keybase.md
Created May 30, 2014 21:55
keybase verification

Keybase proof

I hereby claim:

  • I am dleonard00 on github.
  • I am dug (https://keybase.io/dug) on keybase.
  • I have a public key whose fingerprint is 16AD 7AC8 C7C6 20A1 C2F6 D343 3A04 FAAF A2FB E919

To claim this, I am signing this object:

@dleonard00
dleonard00 / gist:d92661a17cf26c31c978
Created May 15, 2015 16:16
RFC 3339 date string in Swift
var now = NSDate()
var localTimeZone = NSTimeZone.systemTimeZone()
var rfc3339DateFormatter = NSDateFormatter(format: "yyyy'-'MM'-'dd'T'HH':'mm':'ssZ")
rfc3339DateFormatter.locale = NSLocale( localeIdentifier: "en_US_POSIX")
rfc3339DateFormatter.timeZone = localTimeZone
var dateString = rfc3339DateFormatter.stringFromDate(now)
NSLog("RFC 3339 datetime: \(dateString)")
@dleonard00
dleonard00 / dockerClean.sh
Last active April 27, 2017 21:01
Clean up docker
#!/bin/bash
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q) && echo "-------- ALL DONE ---------" && docker ps && docker ps -a && docker images
@dleonard00
dleonard00 / explode-opvn.sh
Created January 15, 2017 07:31
extract the certificate and key from an .ovpn file
#!/bin/bash
# This script will extract the certificate and key from an .ovpn file
# into their own files, which makes it possible to use them to configure
# the VPN using Ubuntu's network manager
# Usage example:
# >> ovpnconvert username.dev.ovpn
# You can keep following these instructions here:
@dleonard00
dleonard00 / password_protect.sh
Created January 15, 2017 07:57
add password to pkcs12
openssl pkcs12 -in Certificates.p12 -out temp.pem -passin pass: -passout pass:temppassword
openssl pkcs12 -export -in temp.pem -out Certificates-final.p12 -passin pass:temppassword -passout pass:newpassword
rm -rf temp.pem
#! /bin/bash
#generate private ca key
openssl genrsa -aes128 -out ca.key 2048
#remove password form ca.key
openssl rsa -in ca.key -out ca_decrypted.key
#generage self signed ca cert
openssl req -new -x509 -days 365 -key ca_decrypted.key -out ca.crt
// implementation detail relevant whenever code is edited.
'use strict';

// cloud-provider / trigger specifc dependancy relevant only to a single cloud provider.
const functions = require('firebase-functions');

// business logic dependancies relevant when understanding solution details, and when making changes.
const moment = require('moment'); // Moments library to format dates.
// implementation detail relevant whenever code is edited.
'use strict';

// cloud-provider / trigger specifc dependancy relevant only to a single cloud provider.
const functions = require('firebase-functions');

// business logic dependancies relevant when understanding solution details, and when making changes.
const moment = require('moment'); // Moments library to format dates.
lazy var contacts: [CNContact] = {
let contactStore = CNContactStore()
contactStore.requestAccess(for: .contacts, completionHandler: { (granted, error) in
guard granted else {
let alert = UIAlertController(title: "Can't access contact", message: "Please go to Settings to enable contact permissions.", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
//TODO: link directly to settings app here.
self.present(alert, animated: true, completion: nil)
return
@dleonard00
dleonard00 / Bull.swift
Created June 7, 2017 18:54
Fat finger bool literal aliases
//
// Bull.swift
//
// Created by doug on 6/7/17.
//
import Foundation
let ture: BooleanLiteralType = true
let rtue: BooleanLiteralType = true