Skip to content

Instantly share code, notes, and snippets.

@strlng
strlng / dhcp_reservations.py
Last active October 29, 2015 18:27
Generate text necessary to create DHCP static reservations for OS X Server via command line
#!/usr/bin/python
import uuid
# Two dimensional array consisting of MAC Address, IP Address, Name
imacs=[["xx:xx:xx:xx:xx:xx","xxx.xxx.xxx.xxx","hostname"]]
for imac in imacs:
uniqueid = uuid.uuid4()
command = "dhcp:static_maps:_array_id:" + str(uniqueid) + " = create\n"
@strlng
strlng / OmniFocus Selected Mail Messages.applescript
Last active January 11, 2017 19:23 — forked from rentzsch/OmniFocus Selected Mail Messages.applescript
OmniFocus Selected Mail Messages.applescript
(*
OmniFocus Selected Mail Messages.applescript
Copyright (c) 2015 Jonathan 'Wolf' Rentzsch: http://rentzsch.com
Some rights reserved: http://opensource.org/licenses/mit
Pure AppleScript reimplementation of OmniGroup's Clip-o-Tron for OmniFocus.
Hopefully this implementation will be more resilient against OS X, Mail, and OmniFocus updates.
Successfully tested against OS X 10.10.1, OmniFocus 1.10.6, and OmniFocus 2.0.4.
### Keybase proof
I hereby claim:
* I am sterlinganderson on github.
* I am strlng (https://keybase.io/strlng) on keybase.
* I have a public key whose fingerprint is 01D9 D982 FF22 9EDF 1B59 B58A 4D9E 9AFC E59D 2D88
To claim this, I am signing this object:
#!/usr/bin/env ruby
require 'optparse'
require 'json'
require 'active_support/inflector'
options = {}
OptionParser.new do |opt|
opt.on('-u WWWUSER', '--wwwuser=WWWUSER', 'User web server runs as') { |o| options[:server_user] = o }
opt.on('-d DOCROOT', '--docroot=DOCROOT', 'Document root') { |o| options[:doc_root] = o }
@strlng
strlng / mailToOmniFocus
Created February 20, 2018 16:46
Can't remember where I got this updated script, but I didn't come up with it myself.
on alfred_script(q)
tell application "Mail"
set lst to (get selection)
set _msgRecent to my GetNewerMessage(lst)
repeat with _msg in _msgRecent
set _msgSubject to _msg's subject
set _msgBody to _msg's content
set _msgSender to _msg's sender
set _msgURL to "message://%3c" & _msg's message id & "%3e" -- Fixed: OmniFocus doesn't accept "<" and ">" as part of a URL
tell application "OmniFocus"
@strlng
strlng / VeryBasicBackup.command
Last active April 15, 2021 18:40
Just as the name implies, a very basic backup script. Uses Rsync to back up a Mac user's home directory to a folder named backup at the location of the script file. Depends on the $HOME environment variable being set.
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

Keybase proof

I hereby claim:

  • I am strlng on github.
  • I am strlng (https://keybase.io/strlng) on keybase.
  • I have a public key ASDeAWZZoIDQI6OTLPulU_rqoW5_D9_TVkATlLPyqyoZfQo

To claim this, I am signing this object: