Skip to content

Instantly share code, notes, and snippets.

@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
@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
tell application "Xcode"
set _workspace to active workspace document
set _workspaceFile to file of _workspace
end tell
tell application "Finder"
set _posixTargetPath to quoted form of POSIX path of _workspaceFile
end tell
tell application "Xcode"
set theProcessName to "iOS Simulator"
set theWindowNumber to 1
tell application "System Events"
tell process theProcessName
activate
tell window theWindowNumber
set thePosition to position
set theSize to size
end tell
@pwc3
pwc3 / simulator-floating-name.py
Last active October 24, 2019 21:41
Show/HIde the floating name at the bottom of the iOS Simulator
#!/usr/bin/env python
import argparse
import codecs
import subprocess
import sys
def parse_args(argv):
if argv is None:
argv = sys.argv[1:]
@pwc3
pwc3 / pdf2appicon.py
Created March 27, 2020 17:42
Converts a PDF to an iOS app icon
#!/usr/bin/env python
import argparse
import codecs
import json
import subprocess
import sys
def parse_args(argv):
if argv is None:
@pwc3
pwc3 / ValueTypeCapture.swift
Created April 29, 2020 14:48
Value Type Capture
import Foundation
class SimulatedOperation {
// Simulated function that collects data from multiple async calls.
// Build an array of [String] values, one element per async call. Hit the
// completion block once all of the elements are populated.
func collectData(completion: @escaping ([String]) -> Void) {
// Locally accumulate the results here. Why does this work?
@pwc3
pwc3 / git-rmtag
Last active May 7, 2020 14:54
Remove Git Tag
#!/usr/bin/env bash
set -euo pipefail
E_BADARGS=85
if [ $# -ne 1 ]; then
echo "Usage: $(basename $0) tag-name"
exit $E_BADARGS
fi
@pwc3
pwc3 / ppjson
Last active May 11, 2020 00:57
Pretty-Print JSON
#!/usr/bin/env python
from __future__ import print_function
import sys
import json
try:
json.dump(json.load(sys.stdin), sys.stdout, sort_keys=True, indent=4)
except ValueError as err:
print("Error:", err, file=sys.stderr)