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
#!/bin/bash | |
S3BUCKET="backup.bucket.name" | |
FILENAME="sitename-wordpress" | |
BACKUP_DIR=${HOME}backup/$(date "+%Y%m%dT%H%M%S") | |
mkdir -p $BACKUP_DIR | |
wp --path=$DOCUMENT_ROOT export --dir=$BACKUP_DIR | |
wp --path=$DOCUMENT_ROOT db export ${BACKUP_DIR}/${FILENAME}-$(date "+%Y%m%dT%H%M%S").sql |
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
#!/usr/bin/env python | |
import sys | |
import ssl | |
import subprocess | |
from xmlrpclib import ServerProxy | |
from markdown import markdown | |
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 Darwin | |
var utsInfo = utsname() | |
uname(&utsInfo) | |
let machine = withUnsafeBytes(of: &utsInfo.machine) { (ptr) -> String? in | |
return Data(ptr).withUnsafeBytes({ (ptr: UnsafePointer<CChar>) -> String? in | |
return String(cString: ptr) | |
}) | |
} |
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
#!/usr/bin/env python | |
# This script is writted as a custom markdown processor with Marked 2 | |
# It takes markdown on standard input and writes rendered html5 to | |
# standard output. Unlike the built-in processors, this marks code | |
# blocks with CSS classes, which can be stylized with a stylesheet. | |
# This obviates the for javascript running on the client stylizing the | |
# code at page load. | |
import sys |
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
#!/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}" |
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
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 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 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 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 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(): |
NewerOlder