Skip to content

Instantly share code, notes, and snippets.

View SamRothCA's full-sized avatar

Sam Rothenberg SamRothCA

  • San Francisco, CA
View GitHub Profile
@SamRothCA
SamRothCA / -
Created January 31, 2016 22:24
U _CC_SHA1
U _CFAllocatorAllocate
U _CFAllocatorDeallocate
U _CFDataGetBytePtr
U _CFDataGetLength
U _CFDictionaryGetValue
U _CFPreferencesCopyKeyList
U _CFPreferencesCopyMultiple
U _CFRelease
U _CFRetain
#!/bin/bash
echo $'infix operator .. {}\n'
declare min=2; max=4
for count in `eval echo {$min..$max}`;
do
declare -a originalArgSets=() providedArgSets=() remainingArgSets=() closureArgSets=() invocationArgSets=() parenthesesSets=()
infix operator .. {}
public func .. <A0, A1, A2, R> (f: (A0)->(A1)->(A2 ) -> R, p: ((), (), () )) -> (A0, A1, A2 ) -> R { return { a0, a1, a2 in f( a0)( a1)( a2 ) } }
public func .. <A0, A1, A2, R> (f: (A0)->(A1)->(A2 ) -> R, p: (A0, (), () )) -> ( A1, A2 ) -> R { return { a1, a2 in f(p.0)( a1)( a2 ) } }
public func .. <A0, A1, A2, R> (f: (A0)->(A1)->(A2 ) -> R, p: ((), A1, () )) -> (A0, A2 ) -> R { return { a0, a2 in f( a0)(p.1)( a2 ) } }
public func .. <A0, A1, A2, R> (f: (A0)->(A1)->(A2 ) -> R, p: (A0, A1, () )) -> ( A2 ) -> R { return { a2 in f(p.0)(p.1)( a2 ) } }
public func .. <A0, A1, A2, R> (f: (A0)->(A1)->(A2 ) -> R, p: ((), (), A2 )) -> (A0, A1 ) -> R { return { a0, a1 in f( a0)( a1)(p.2 ) } }
public func .. <A0, A1
<?xml version="1.0"?>
<root>
<item>
<name>Unmodified F19 to Control+Shift+Command</name>
<identifier>f19_to_ctrl_cmnd_shft</identifier>
<autogen>
__KeyToKey__
KeyCode::F19, ModifierFlag::NONE,
KeyCode::COMMAND_L, ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
</autogen>
@SamRothCA
SamRothCA / Regex.swift
Created December 27, 2015 17:04 — forked from ningsuhen/Regex.swift
Swift extension for Native String class to support Regex match and Regex replace. Credit - http://www.swift-studies.com/blog/2014/6/12/regex-matching-and-template-replacement-operators-in-swift
import Foundation
struct Regex: StringLiteralConvertible {
var pattern: String {
didSet {
updateRegex()
}
}
var expressionOptions: NSRegularExpressionOptions {
didSet {
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key> <string>local.DragThing</string>
<key>ProgramArguments</key> <array>
<string>/usr/bin/open</string>
<string>-W</string>
<string>/Applications/DragThing.app</string>
</array>
<?xml version="1.0"?>
<root>
<item>
<name>Unmodified F19 to Control+Shift+Command</name>
<identifier>f19_to_ctrl_cmnd_shft</identifier>
<autogen>
__KeyToKey__
KeyCode::F19, ModifierFlag::NONE,
KeyCode::COMMAND_L, ModifierFlag::SHIFT_L | ModifierFlag::CONTROL_L
</autogen>
uname -v; diskutil list; diskutil cs list;Last login: Wed Jul 22 11:58:08 on console
Andrews-iMac-2:~ Astreet$ uname -v; diskutil list; diskutil cs list;
Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_HFS Untitled 121.0 GB disk0s2
/dev/disk1
NSString * passwordString = @"b";
NSString * mountPoint = @"/a";
NSTask * veraCrypt = [[NSTask alloc] init];
[veraCrypt setLaunchPath:@"/Applications/VeraCrypt.app/Contents/MacOS/VeraCrypt"];
[veraCrypt setArguments:@[@"-t", @"--mount", mountPoint]];
NSPipe * inputPipe = [NSPipe pipe];
[veraCrypt setStandardInput:inputPipe];
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key><string>local.myjob</string>
<key>ProgramArguments</key><array>
<string>/usr/bin/open</string>
<string>-a</string>
<string>My App Name</string>
</array>