This file contains hidden or 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
-- See article here: http://daringfireball.net/2007/07/simple_inbox_sweeper | |
-- The following should be one long line: | |
set _description to "All unflagged, read messages in each IMAP account | |
inbox will be moved to the “Archive” mailbox corresponding to that | |
account. This action is not undoable." | |
tell application "Mail" | |
display alert "Archive read messages from IMAP inboxes?" buttons ¬ | |
{"Cancel", "Archive"} cancel button 1 message _description |
This file contains hidden or 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
TMP_CLONE_DIR=$(mktemp -d -t sitename) | |
git clone ${HOME}/site.git ${TMP_CLONE_DIR} | |
jekyll ${TMP_CLONE_DIR} ${DOCUMENT_ROOT} | |
rm -rf ${TMP_CLONE_DIR} |
This file contains hidden or 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
(define (count-change amount) | |
(cc amount 5)) | |
(define (cc amount kinds-of-coins) | |
(cond ((= amount 0) 1) | |
((or (< amount 0) (= kinds-of-coins 0)) 0) | |
(else (+ (cc amount | |
(- kinds-of-coins 1)) | |
(cc (- amount | |
(first-denomination kinds-of-coins)) |
This file contains hidden or 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
#!/bin/bash | |
# $1 = recipient | |
# $2 = The Subject | |
# $3 = The message content | |
sendapplemail() { | |
/usr/bin/osascript >/dev/null 2>&1 <<EOF | |
tell application "Mail" | |
set myContent to quoted form of "$3" | |
set theMessage to make new outgoing message with properties {subject:"$2", content:myContent, sender:"Steve Brokaw <[email protected]>"} |
This file contains hidden or 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
#!/usr/bin/env python3 | |
# A text filter for BBEdit. If it encounters a JSON error, it writes an error message | |
# to stderr (appears in a new BBEdit window) and leaves the original text unaltered. | |
# c.f. http://crisp.tumblr.com/post/2574967567/json-pretty-print-formatting-in-bbedit | |
# c.f. http://blog.scottlowe.org/2013/11/11/making-json-output-more-readable-with-bbedit/ | |
import json | |
import sys | |
def main(): |
This file contains hidden or 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
#!/usr/bin/env python | |
# Requires third-party markdown library. pip install --user Markdown | |
import sys | |
import markdown | |
def main(): | |
input = sys.stdin.read() | |
extensions = ['markdown.extensions.extra', |
This file contains hidden or 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
extension CBUUID { | |
var UUIDValue: UUID? { | |
get { | |
return self.data.withUnsafeBytes { buffer in | |
guard buffer.count == MemoryLayout<uuid_t>.size else { return nil } | |
let uuid = buffer.bindMemory(to: uuid_t.self) | |
return UUID(uuid: uuid.baseAddress!.pointee) | |
} | |
} | |
} |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at |
This file contains hidden or 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
struct FibIterator: IteratorProtocol { | |
var currentCount = 0 | |
var maxCount: Int? | |
var maxValue: Int? | |
var currentFib: Int | |
var previousFib: Int | |
mutating func next() -> Int? { | |
if let maxCount = maxCount, currentCount >= maxCount { | |
return nil | |
} |
This file contains hidden or 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
#!/bin/sh | |
# vex: Virutalenv EXecute | |
# Inspired by https://gist.github.com/datagrok/2199506 | |
VEXPATH="$(dirname $0)" | |
export PS1='\[\e[1;31m\](python3)\[\e[0m\] \h:\W \u\$ ' | |
export VIRTUAL_ENV="$HOME/Library/Python/virtualenvs/py3" | |
export PATH="$VEXPATH:$VIRTUAL_ENV/bin:$PATH" | |
unset PYTHON_HOME | |
exec "${@:-$SHELL}" |
OlderNewer