Skip to content

Instantly share code, notes, and snippets.

View chmurph2's full-sized avatar

Christopher R. Murphy chmurph2

View GitHub Profile
@chmurph2
chmurph2 / gist:1f606f1bafff9b729bf6ce77a9a20421
Created September 17, 2017 13:12
AppleScript Audio: Go to Current Playing Track
# Goes to iTunes or Spotify (in that order of priority), shows the currently playing track.
if appIsRunning("iTunes") then
tell application "iTunes" to activate
try
tell application "System Events"
tell process "iTunes"
tell menu bar 1 to pick menu item "Go to Current Song" of menu "Controls"
end tell
end tell
end try
@chmurph2
chmurph2 / sodastream_diy.soulver
Created September 6, 2017 19:01
SodaStream DIY Recoup and Calculations
@tl;dr
5.3 months // how often 3 sparkling water drinkers will go through a 20 lbs CO2 tank
$90 // SodaStream
$29 // 20 lbs tank refill every 6 months, at Robert's Oxygen in Dulles, VA
$201 // initial investment in tank, refill attachments/adapter, first CO2 fill
5.4 months // time to recoup initial equipment investment (sans SodaStream)
@initial equipment costs (excluding SodaStream, which we got as a gift)
diy_tank_20lbs = $115 + $21.34 shipping // 20 lb CO2 tank
adapter_kit = $30 // kit to attach tank to sodastream bottle to refill (tubes, connectors, valves)
@chmurph2
chmurph2 / rt
Created July 31, 2014 17:15
Bash function to run targeted Rails tests.
# Use: rt test_file
# Use: rt test_file:test_name_regex
# Finds a file under test/* and runs it with -n /test_name_regex/
function rt {
FILE_HINT=`echo $1 | cut -f1 -d:`
TEST_REGEX=`echo $1 | cut -f2 -d:`
FILE_PATH=`find test/* -maxdepth 3 -name ${FILE_HINT}_test.rb`
if [ -z $FILE_PATH ];
then
echo Couldn\'t find file for $FILE_HINT
Picture menu
Picture mode: Custom
Contrast: +90
Brightness: +50
Color: +44
Tint: 0
Sharpness: 0
Color temp: Warm 1
Color mgmt: Off [grayed out]
C.A.T.S.: Off
require 'niftp'
class SomeObject
include NiFTP
def ftp_stuff
# get a file from an FTP Secure (FTPS) server
ftp("ftp.appareldownload.com", { username: "changeme", password: "changeme", ftps: true }) do |client|
p "Connected to Alpha! Buyakasha!"
files = client.list('s*')
@chmurph2
chmurph2 / com.rabbitmq.plist
Created December 9, 2010 19:01
I created this plist in ~/Library/LaunchAgents after install RabbitMQ via Homebrew.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.rabbitmq</string>
<key>Program</key>
<string>/usr/local/sbin/rabbitmq-server</string>
<key>RunAtLoad</key>
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Displays" of menu "View" of menu bar 1
tell button "Detect Displays" of window 1 to click
end tell
end tell
delay 1
tell application "System Preferences" to quit
# See http://github.com/mynyml/watchr/
# This script was modified from http://gist.github.com/raw/189052/1fd4faf0e9edab9d8e941fd21a1a9e7f70cf5aad/specs.watchr.rb
#
# Run me with:
#
# $ watchr ~/.rails.watchr.rb
#
# or alias me with:
#
# alias rw='watchr ~/.rails.watchr.rb'
@chmurph2
chmurph2 / copyURLPlusSafari.scpt
Created February 26, 2009 01:12
In Safari, this applescript copies the title and URL of the current tab to the clipboard.
-- In Safari, this copies the Title and URL of the current tab to the clipboard.
-- Save the script in ~/Library/Scripts/Applications/Safari
-- Using QuickSilver, I assign a trigger to this script using the hotkey ⌥-C (option c), with the scope of the trigger limited to Safari.
-- Inspired by CopyURL + (http://copyurlplus.mozdev.org/)
-- Christopher R. Murphy
tell application "Safari"
set theURL to URL of front document
set theTitle to name of front document
set the clipboard to theTitle & return & theURL as string