Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am anderscarling on github.
  • I am lowe (https://keybase.io/lowe) on keybase.
  • I have a public key whose fingerprint is D814 3C99 6D75 4946 C58B 5AFF B4DC 2C2B B226 EB49

To claim this, I am signing this object:

@anderscarling
anderscarling / add_country_code_to_phone_numbers_in_contacts.scpt
Created Apr 23, 2016
Apple Script for adding country code prefix to numbers in address book that doesn't currently have one
View add_country_code_to_phone_numbers_in_contacts.scpt
#! /usr/bin/env osascript
on run argv
set is_real to (count of argv > 0 and item 1 of argv equals "--real")
if is_real then
log "Running real run, changes will be saved!"
log ""
else
log "Running test run, add --real to save changes.."
View install-graphite-ubuntu-10.04.sh
####################################
# BASIC REQUIREMENTS
# http://graphite.wikidot.com/installation
# http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
# Last tested & updated 10/13/2011
####################################
sudo apt-get update
sudo apt-get upgrade
@anderscarling
anderscarling / RemoteSwitch.rb
Created Aug 23, 2011
Remote Switch for ohlzon
View RemoteSwitch.rb
# Usage
# # Turn on
# RemoteSwitch.new(params[:id]).on!
#
# # Turn off
# RemoteSwitch.new(params[:id]).off!
#
# Raises exception
# RemoteSwitch.new("not an id")
#
@anderscarling
anderscarling / gist:112155
Created May 15, 2009
This is how you use ruby as your vim pasteboard buffer. For fun, and profit
View gist:112155
" Because we can use ruby as our pasteboard buffer (w/o support for newlines), damnit!
" Copy all lines
:1rubydo $x=""
:rubydo $x << $_;
" Will paste on line 6, the line needs to exist
:6rubydo $_=$x
" Copy from line 1 to line 6. Please note that you can even use instance variables.
:1rubydo temp=$_
@anderscarling
anderscarling / Tabs to Clippings.scpt
Created Apr 26, 2009
Turn's tabs open in NewsNetWire into Clippings. Relies on UI Scripting access and default keyboard shortcut.
View Tabs to Clippings.scpt
-- Note, this has proven to be quite unreliable if the tabs are not preloaded and your not quite lucky (which I was my first run, i guess).
tell application "NetNewsWire"
activate
tell application "System Events" to tell process "NetNewsWire" to keystroke "\\" using command down
set repeatTimes to number of tabs - 1
repeat repeatTimes times
tell application "System Events" to tell process "NetNewsWire" to keystroke "}" using command down
tell application "System Events" to tell process "NetNewsWire" to keystroke "s" using {command down, option down}
tell application "System Events" to tell process "NetNewsWire" to keystroke "w" using command down
end repeat
@anderscarling
anderscarling / disk_free_check.rb
Created Apr 26, 2009
Will send mail to root@localhost if disk usage on one or more file systems is above 80 percent
View disk_free_check.rb
#! /usr/bin/ruby -w
require 'net/smtp'
# Configuration
SMTP_SERVER = "localhost"
FROM_ADDRESS = "root@localhost"
TO_ADDRESS = "root@localhost"
DEFAULT_LIMIT = 80