Skip to content

Instantly share code, notes, and snippets.

-- I use this snippet with Octopress to make new linklog posts.
-- I've tweaked the new_post rake task to allow me to fill in
-- the external-url: property by taking in a second argument:
-- rake new_post["Blog Title","http://some.url.com/"]
-- If the 2nd argument is the empty string, then I omit
-- that property in the yaml front matter.
-- I should note that I haven't updated my Octopress engine in a long time,
-- and when I set up the blog, link posts weren't built in. So
-- there may be a proper rake task for this now, since I think
--Originally posted at http://n8henrie.com/2013/02/how-to-test-hazel-applescripts-in-applescript-editor
-- uncomment below for testing Noodlesoft Hazel script in Applescript Editor
(*
property theFile : alias "Path:To:Your File.extension"
hazelProcessFile(theFile)
*)
on hazelProcessFile(theFile)
--Your external Hazel script goes here.
--Alternatively, just use the "property theFile :" line at the top for testing scripts to be embedded.

These are some notes I put together prior to and during setting up my new Retina MacBook Pro. If anyone else is setting up a new machine, it may help you with the process.

Prepare Old Machine

  • Verify Disk with Disk Utility—see here
  • Generate a final TimeMachine backup
  • Verify Crashplan backup is complete
  • Create a final SuperDuper! bootable backup
  • Push changes to remote git repos
tell application "Safari"
set vURL to URL of current tab of window 1
end tell
tell application "Google Chrome"
if windows ≠ {} then
make new tab at the end of window 1 with properties {URL:vURL}
else
make new window
set URL of (active tab of window 1) to vURL
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
#!/usr/bin/env ruby -wKU
# Adapted from Brett Terpstra’s original “Markdown to Evernote” service (http://brettterpstra.com/a-better-os-x-system-service-for-evernote-notes-with-multimarkdown/)
# Martin Kopischke 2011 – License: Creative Commons Attribution Share-Alike (CC BY-SA) 3.0 Unported (http://creativecommons.org/licenses/by-sa/3.0/)
# Changes: – create only one Evernote note per (Multi)Markdown input passed (instead of one per line)
# – do not choke on shell escape characters (use Tempfile instead of shell pipe for osascript)
# – default to MultiMarkdown 3 executable (instead of MMD 2 Perl script)
# – make smart typography processing optional (set SMARTY to 'false' to bypass processing;
# note smart typography cannot be disabled in MMD 3.0 and 3.0.1
# – handle both smart typography processing scripts (ie. SmartyPants.pl)
-- Get the text from Safari
tell application "Safari"
set thePageText to text of document 1
end tell
-- Split the text into paragraphs
set thePars to paragraphs of thePageText
-- Find all paragraphs matching the desired criteria
set theText to ""
#!/bin/bash
find_project_or_workspace() {
MASK=$1
ALL_PROJECTS_OR_WORKSPACES=`/bin/ls -1 -d $MASK 2>/dev/null`
FILE_TO_OPEN=''
if [ z"${ALL_PROJECTS_OR_WORKSPACES}" != z ] ; then
for i in ${ALL_PROJECTS_OR_WORKSPACES} ; do
if [ z"${PROJECT}" == z ] ; then
# Dependencies:
sudo yum install autoconf automake gcc git make openssl-devel pkgconfig
# Libevent2:
wget https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz
tar xf libevent-2.0.16-stable.tar.gz
cd libevent-2.0.16-stable
./configure
make
sudo make install
#! /bin/sh
# /etc/init.d/iptables: load and save the iptables
IPTABLES_CONF=/etc/default/iptables.conf
IPTABLES_BAK=/etc/default/iptables.bak
SAVE_CMD=/sbin/iptables-save
LOAD_CMD=/sbin/iptables-restore
check_config() {
if [ ! -r $IPTABLES_CONF ]; then
echo "Cannot find saved iptable!"
exit 1