Skip to content

Instantly share code, notes, and snippets.

@pwc3
pwc3 / SkypeMenuUpdater.rb
Created May 18, 2012 23:42
Shows the number of unread Skype conversations in the menu bar
#!/usr/bin/env ruby
FSCRIPT_PATH = "/Library/Frameworks/FScript.framework"
GDB = IO.popen("gdb", "w")
def gdb(cmd)
GDB.puts cmd
GDB.flush
end
@pwc3
pwc3 / gist:5078925
Created March 3, 2013 23:44
Type checking assignments.
NSDictionary *aDictionary = nil;
NSArray *anArray = nil;
void (^aBlock)() = ^{ };
// no warning
aDictionary = aBlock;
// no warning
anArray = aBlock;
// warning assigning NSArray to NSDictionary, but not for block assignment
aDictionary = anArray = aBlock;
@pwc3
pwc3 / Exchange Sync.applescript
Last active February 1, 2024 12:34
AppleScript to copy all of the events from an Exchange calendar to an iCloud calendar.
tell application "Calendar"
-- delete everything from the destination calendar
-- TODO: Change "Destination Calendar" to be the name of your destination calendar
repeat with anEvent in (get events of calendar "Destination Calendar")
delete anEvent
end repeat
-- copy all events from the source calendar to the destination
-- TODO: Change "Source Calendar" to be the name of your source calendar
-- TODO: Change "Destination Calendar" to be the name of your destination calendar
@pwc3
pwc3 / edit-plist.py
Created August 6, 2013 01:17
Opens a property list file in a text editor, converting from binary if necessary.
#!/usr/bin/env python
import argparse
import subprocess
import sys
EDITOR = 'vim'
BINARY = 'Apple binary property list'
XML = 'XML document text'
@pwc3
pwc3 / skypecall.py
Created August 16, 2013 02:46
Python script for Mac OS X to call a number in Skype then send an arbitrary DTMF string.
#!/usr/bin/env python
# Idea taken from:
# http://community.skype.com/t5/Mac/Re-Pause-option-when-dialing/td-p/731820
import argparse
import codecs
import re
import subprocess
import sys
@pwc3
pwc3 / alfred-shell-script.sh
Created August 16, 2013 03:13
Alfred workflow shell script
# set interpreter to /bin/bash
case "{query}" in
"monday") code="12345#,,#" ;;
"wednesday") code="23456#,,#" ;;
"friday") code="34567#,,#" ;;
*) code="{query}#,,#" ;;
esac
$HOME/bin/skypecall "800-555-1212" "$code"
@pwc3
pwc3 / ExtractMarkdownFromVoodoopad.py
Created August 29, 2013 01:07
Python script to extract Markdown from a VoodooPad file used for static blog generation.
#!/usr/bin/env python
import argparse
import codecs
import glob
import os
import plistlib
import re
import sys
@pwc3
pwc3 / com.paulcalnan.pbcopy.plist
Created September 30, 2013 05:31
LaunchDaemon enabling copying to the pasteboard from a remote host.
<?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.paulcalnan.pbcopy</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/pbcopy</string>
</array>
@pwc3
pwc3 / SkypeMenuUpdater_Output.txt
Created October 8, 2013 05:32
This is the output I'm getting from my SkypeMenuUpdater.rb script. This is on a computer running Mac OS X 10.8.5 with FScript 2.1 and Skype 6.7.60.373. I was able to run a script (https://gist.github.com/1170175) to successfully inject F-Script into Safari. This leads me to think that there is an issue with Skype.
$ SkypeMenuUpdater.rb
GNU gdb 6.3.50-20050815 (Apple version gdb-1824) (Wed Feb 6 22:51:23 UTC 2013)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin".
(gdb) Attaching to process 5393.
Reading symbols for shared libraries . done
set appleID to "ENTER YOUR APPLE ID HERE"
activate application "Xcode"
tell application "System Events"
tell process "Xcode"
-- open the preferences dialog
click menu item "Preferences…" of menu "Xcode" of menu bar 1
-- find and select the Accounts tab