Skip to content

Instantly share code, notes, and snippets.

@ericdke
ericdke / gist:859d4a8b1d749948f6dd
Created August 1, 2015 15:29 — forked from erica/gist:7c298164409795bbf92f
Swift: Launch at Login Helper
//
// LaunchAtLoginHelper.swift
//
// Created by Erica Sadun on 4/1/15.
// Copyright (c) 2015 Erica Sadun. All rights reserved.
//
import Foundation
public func getLoginItems() -> LSSharedFileList? {
let task = NSTask()
task.launchPath = "/bin/sh"
task.arguments = ["-c", "sleep 0.2; open \"\(NSBundle.mainBundle().bundlePath)\""]
task.launch()
NSApplication.sharedApplication().terminate(nil)
@ericdke
ericdke / blowfish.rb
Last active November 18, 2015 17:43 — forked from nono/blowfish.rb
Blowfish in Ruby
#!/usr/bin/env ruby
require "openssl"
class BF < Struct.new(:key, :pad_with_spaces)
def encrypt(str)
cipher = OpenSSL::Cipher.new('bf-ecb').encrypt
if pad_with_spaces
str += " " until str.bytesize % 8 == 0
cipher.padding = 0