This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
history > history.txt | |
awk '{print $1}' ../history.txt > commands.txt | |
cat commands.txt | sort | uniq -c | sort -r > sorted_commands.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Preferences" | |
set current pane to pane id "com.apple.preference.universalaccess" | |
delay 1 | |
tell application "System Events" to tell process "System Preferences" to tell window "Accessibility" | |
select row 5 of table 1 of scroll area 1 | |
tell tab group 1 of group 1 | |
click radio button "Colour Filters" | |
click pop up button 1 | |
click menu item "Greyscale" of menu 1 of pop up button 1 | |
click checkbox "Enable Colour Filters" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import PlaygroundSupport | |
struct Contact: Identifiable { | |
// important for each to be unique | |
var id = UUID() | |
var name: String | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am matthewspear on github. | |
* I am matthewspear (https://keybase.io/matthewspear) on keybase. | |
* I have a public key whose fingerprint is 7430 C437 5A47 3405 AB10 D169 F8D6 8498 7F65 3D4E | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class Person | |
{ | |
let name: String | |
let birthday: NSDate | |
lazy var age: Double = self.calculateAge() | |
init(name: String, birthday: NSDate) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
// Setup Standard Output, Error | |
let stderr = NSFileHandle.fileHandleWithStandardError() | |
let stdout = NSFileHandle.fileHandleWithStandardOutput() | |
func writeToStd(handle: NSFileHandle, _ str: String) | |
{ | |
if let data = str.dataUsingEncoding(NSUTF8StringEncoding) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add these lines to ~/.bash_profile or ~/.zshrc: | |
# SelfControl | |
alias sc-read="defaults read org.eyebeam.SelfControl" | |
alias sc-run="sudo /Applications/SelfControl.app/Contents/MacOS/org.eyebeam.SelfControl $(id -u $(whoami)) --install" | |
alias sc-check="sudo /Library/PrivilegedHelperTools/org.eyebeam.SelfControl $(id -u $(whoami)) --checkup" | |
sc-set() | |
{ | |
if [ "$1" = "" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Functional FizzBuzz Generator in Python | |
def fizz_buzz(num): | |
if num % 3 == 0 and num % 5 == 0: | |
return 'FizzBuzz' | |
elif num % 3 == 0: | |
return 'Fizz' | |
elif num % 5 == 0: | |
return 'Buzz' | |
else: | |
return str(num) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "Calendar" | |
tell calendar "Timetable" | |
--reload calendars | |
set theEvents to {} | |
set AllEvents to events | |
repeat with anEvent in AllEvents | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: Playground - noun: a place where people can play | |
func fizzBuzz(n: Int) -> String | |
{ | |
let divThree = (n % 3 == 0) | |
let divFive = (n % 5 == 0) | |
var numberName = "" | |
if (divThree && divFive) | |
{ |
NewerOlder