Skip to content

Instantly share code, notes, and snippets.

@jlyonsmith
jlyonsmith / IRequiresRequestStream_Service.cs
Last active February 13, 2019 17:05
Using IRequiresRequestStream with ServiceStack
using System;
using Mono.Unix;
using Mono.Unix.Native;
using System.Configuration;
using ServiceStack;
using ServiceStack.Web;
using System.IO;
using ServiceStack.Host.HttpListener;
using System.Net;
require 'formula'
class Vacuum < Formula
homepage "http://github.com/jlyonsmith/Vacuum"
url "https://s3-us-west-2.amazonaws.com/jlyonsmith/Vacuum-3.0.20307.tar.gz"
sha1 "e24bc5621753fbee9166e4dc2bf5dcc9ee426016"
def install
mono_path = `/usr/bin/which mono`.strip
if mono_path.size == 0 || `#{mono_path} --version`.index(/3\./) == nil
require 'formula'
class Soapbox < Formula
homepage "http://github.com/jlyonsmith/Soapbox"
url "https://s3-us-west-2.amazonaws.com/jlyonsmith/Soapbox-1.0.20302.tar.gz"
sha1 "b146ce78122a19ec104e9bf6be73fd0c1ef9acd4"
def install
mono_path = `/usr/bin/which mono`.strip
if mono_path.size == 0 || `#{mono_path} --version`.index(/3\./) == nil
require 'formula'
class Codetools < Formula
homepage "http://jlyonsmith.github.io/CodeTools/"
url "https://s3-us-west-2.amazonaws.com/jlyonsmith/CodeTools-3.0.10708.tar.gz"
sha1 "32e70ffdd931fa6b3928d50b04d3e567ec37f471"
def install
mono_path = `/usr/bin/which mono`.strip
if mono_path.size == 0 || `#{mono_path} --version`.index(/3\./) == nil
public func Log<T>(item: T, fileName: String = __FILE__, line: Int = __LINE__, funcName:String = __FUNCTION__) {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "MM/dd/yyyy HH:mm:ss:SSS"
let process = NSProcessInfo.processInfo()
let threadId = "?"
var shortFileName = (NSURL(string: fileName)?.lastPathComponent?.componentsSeparatedByString(".").first)
if shortFileName == nil {
shortFileName = "unknown"
}
@jlyonsmith
jlyonsmith / delete-github-merged.sh
Last active April 21, 2016 22:24 — forked from schacon/gist:942899
delete all remote branches that have already been merged into master
git branch -r --merged | grep origin | grep -v '>' | grep -v master | xargs -L1 | ruby -e 'ARGF.each { |line| a = line.match(/(?:[^\/]*)\/(.*)/).captures; puts a }' | xargs git push origin --delete
#!/bin/bash
# Print the SSH MD5 fingerprint (works on OSX El Capitan which defaults to a SHA256 fingerprint)
ssh-keygen -E md5 -lf ~/.ssh/id_rsa
#!/bin/bash
# Convert a .p12 format file to a .pem format
openssl pkcs12 -in $1 -out $2 -nodes
@jlyonsmith
jlyonsmith / add-user.sh
Last active September 21, 2016 21:34
OpenSSL Client Side Certificate Scripts
#!/bin/bash
USERNAME=$1
EMAIL=$2
if [[ "$USERNAME" == "" || "$EMAIL" == "" ]]; then
echo 'Usage: create-user USERNAME EMAIL'
exit 1
fi
@jlyonsmith
jlyonsmith / UIAlertController.swift
Last active November 27, 2016 19:09 — forked from pietrorea/UIAlertController.swift
UIAlertController example
let alert = UIAlertController(title: "Title", message: "Message", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Save", style: .default, handler: { (action: UIAlertAction!) in
debugPrint("Saved")
}))
alert.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (action: UIAlertAction!) in
debugPrint("Cancel")
}))
present(alert, animated: true, completion: nil)