Skip to content

Instantly share code, notes, and snippets.

View mkhl's full-sized avatar
🖤
…at any cost

Martin Kühl mkhl

🖤
…at any cost
View GitHub Profile
@mkhl
mkhl / bypass.rb
Created November 23, 2008 14:43 — forked from mojombo/Glavni program
Bypass encapsulation to test private methods (Ruby)
# This allows you to be a good OOP citizen and honor encapsulation, but
# still make calls to private methods (for testing) by doing
#
# obj.bypass.private_thingie(arg1, arg2)
#
# Which is easier on the eye than
#
# obj.send(:private_thingie, arg1, arg2)
#
class Object
@mkhl
mkhl / id_rsa.pub
Created November 23, 2008 16:15
My SSH public key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA8iMjLZGkoBG5VHHJG1jzA2vdh1QnPSr8aYIw6fsgdDsS4iYNq++iDg5nEsIwdjAfnyY3lGUWafpn3nDyn+bnDp+SZwSIAfZuqpnM06Lk37283GayW/98nLahIxnnm7P30rlqNmhxgwPygawA0Ayl5s2/Pi+fkFrkn52CS/MsZZsRVks6+MBL4Ssmvs0GBEQBGILu1rp8CCIfh5Dk6690wp8s4vq07oS0xg3vFwbgzcwuyMVEnz/BYG5oFKMDzdQTB30jrd39kGs2xyWz9hlfpXW4NFbfMMlIzLsgWgJePzcNElUF6ZVmGy/+wqC/Znj/bYh1FUralW6h9jpA7SMwAw== [email protected]
@mkhl
mkhl / a2x-osx-compat.patch
Created November 23, 2008 23:04
Patches to let a few programs work on OS X.
Patch to make vanilla a2x run on OS X
--- /usr/local/bin/a2x 2008-02-11 00:49:23.000000000 +0100
+++ a2x 2007-10-29 04:50:53.000000000 +0100
@@ -7,24 +7,13 @@
# under the terms of the GNU General Public License (GPL).
#
-# MK: `readlink -f' isn't available on OS X.
-function realpath()
-{
@mkhl
mkhl / py-appscript.py
Created November 24, 2008 08:34
Appscript ⁄ ScriptingBridge
#!/usr/bin/env python
# A tiny appscript example in Python.
import appscript
appscript.app("iTunes").current_track.artist.get()
@mkhl
mkhl / dump-completions.lisp
Created November 25, 2008 09:34
Dump symbols to a file to support tab-completion in sn SBCL REPL.
(with-open-file (!!!-stream (merge-pathnames ".sbcl_completions" (user-homedir-pathname))
:direction :output
:if-exists :supersede)
(let ((!!!-seen (make-hash-table :size 6000 :test #'equal))
(!!!-cl-package (find-package "CL"))
(!!!-cl-user-package (find-package "CL-USER")))
(loop for !!!-package in (list-all-packages)
do (let ((!!!-prefixes
(if (or (eq !!!-package !!!-cl-package)
(eq !!!-package !!!-cl-user-package))
@mkhl
mkhl / gx.rb
Created November 25, 2008 09:38
An old version of gx, plus a few macros I used to use.
#!/usr/bin/env ruby
# evanphx's old version of the gx git macro facility, slightly modified.
# I guess this is completely superseded by git aliases by now, but I like
# having it around somewhere...
class GitProxy
def initialize(prog="git")
@prog = prog
@record = false
@recording = []
@mkhl
mkhl / zlogout.zsh
Created November 25, 2008 19:02
Based on the zsh config I'm migrating away from. Will probably be revisited...
#!/bin/zsh
#
# zlogout
# zsh-specific logout script
# Clear tty
if whence tty >/dev/null; then
case "$(tty)" in
/dev/tty[0-9]*) clear ;;
esac
@mkhl
mkhl / Clean Apps.applescript
Created November 28, 2008 20:40
Set sensible defaults for owner, permissions and quarantine flags for the dropped app bundles
on open (theItems)
set theCleanedItems to {}
repeat with theApp in theItems
set thePath to the POSIX path of theApp
fixOwner(thePath)
fixPermissions(thePath)
unquarantine(thePath)
set theCleanedItems to theCleanedItems & ("- " & the displayed name of item (theApp as string) of application "Finder")
end repeat
set theText to "Successfully cleaned:
@mkhl
mkhl / ToggleTerm.applescript
Created November 28, 2008 20:44
When using Terminal.app, hide it, otherwise switch to it
tell application "System Events"
if exists application process "Terminal" then
set terminalProcess to application process "Terminal"
if frontmost of terminalProcess then
tell terminalProcess to set visible to false
else
tell terminalProcess to set frontmost to true
end if
else
tell application "Terminal"
@mkhl
mkhl / Yojimbo Helper.applescript
Created November 28, 2008 21:37
Helper script for Yojimbo; can archive and bookmark items, and adds Growl support
on archive(theURL, theTitle)
tell application "Yojimbo"
set theItem to make new web archive item¬
with contents theURL
end tell
end archive
on bookmark(theURL, theTitle)
tell application "Yojimbo"
set theItem to make new bookmark item¬