Skip to content

Instantly share code, notes, and snippets.


Kare Morstol kareman

View GitHub Profile
kareman / prepare-xcode-project.bash
Created Jan 18, 2015
Prepare an Xcode project for Git version control.
View prepare-xcode-project.bash
#!/bin/bash -x
# create the ignore file
cat > .gitignore <<_EOF_
# Xcode
View SwiftShell header.swift
import Foundation
class NSFileHandle {
struct String {
protocol Streamable {
kareman / listallexecutablesinpath.swift
Last active Aug 29, 2015
Lists all executables currently available in PATH, using the SwiftShell framework (
View listallexecutablesinpath.swift
#!/usr/bin/env swiftshell
import SwiftShell
let directories = environment["PATH"]!.split(":")
for directory in directories {
run("find \"\(directory)\" -type f -perm +ugo+x -print") |> writeTo(standardoutput)
kareman / trash.swift
Last active Apr 14, 2020 — forked from beccadax/trash.swift
Swift 3 script for sending files and folders to the trash, using the SwiftShell framework from .
View trash.swift
#!/usr/bin/env swiftshell
* Released under the MIT License (MIT),
import SwiftShell
import Dispatch
import Cocoa
kareman / Queue.swift
Last active Jul 31, 2020
A standard queue (FIFO - First In First Out) implemented in Swift. Supports simultaneous adding and removing, but only one item can be added at a time, and only one item can be removed at a time. Using the "Two-Lock Concurrent Queue Algorithm" from, without the locks.
View Queue.swift
// Queue.swift
// NTBSwift
// Created by Kåre Morstøl on 11/07/14.
// Using the "Two-Lock Concurrent Queue Algorithm" from, without the locks.
// should be an inner class of Queue, but inner classes and generics crash the compiler, SourceKit (repeatedly) and occasionally XCode.