Skip to content

Instantly share code, notes, and snippets.

@Watson1978
Watson1978 / method.d
Created July 28, 2011 12:54
DTrace for MacRuby
% DYLD_LIBRARY_PATH=~/src/macruby-master sudo ./methods.d -c "/Users/watson/src/macruby-master/macruby /Users/watson/tmp/t.rb"
"a"
-> _GLOBAL__I__ZN12_GLOBAL__N_115ForceJITLinkingE
<- _GLOBAL__I__ZN12_GLOBAL__N_115ForceJITLinkingE = 0x1
-> __static_initialization_and_destruction_0(int, int)
<- __static_initialization_and_destruction_0(int, int) = 0x1
-> start
-> main
-> ruby_sysinit
<- ruby_sysinit = 0x3f
@karlwestin
karlwestin / .gitconfig
Created May 23, 2011 13:34
Make git diff ignore whitespace and don't try to open jpgs and shit
# this can be put in [repo]/.git/config for local settings
# or ~/.gitconfig for global settings
# create a difftool "nodiff" that just returns true
# this path is for Mac. On linux it's /bin/true i guess
[diff "nodiff"]
command = /usr/bin/true
# make git ignore white space differences, many different possibilites here
@msabramo
msabramo / load_optional_django_apps.py
Created April 27, 2011 22:48
How to load (optional) Django apps only if they're present (from http://blog.jupo.org/post/586256417/optional-django-apps)
LOAD_OPTIONAL_APPS = True
if LOAD_OPTIONAL_APPS:
# <copypaste from="http://blog.jupo.org/post/586256417/optional-django-apps">
# Define any settings specific to each of the optional apps.
#
import sys
USE_SOUTH = not (len(sys.argv) > 1 and sys.argv[1] == "test")
DEBUG_TOOLBAR_CONFIG = {"INTERCEPT_REDIRECTS": True}
@enaeseth
enaeseth / yaml_ordered_dict.py
Created February 25, 2011 19:54
Load YAML mappings as ordered dictionaries
import yaml
import yaml.constructor
try:
# included in standard lib from Python 2.7
from collections import OrderedDict
except ImportError:
# try importing the backported drop-in replacement
# it's available on PyPI
from ordereddict import OrderedDict
@msabramo
msabramo / lesspipe-1.71-bsd_ls.patch
Created January 27, 2011 07:20
This patch allows lesspipe.sh's color directory viewing to work with the ls in BSDs, including OS X
diff --git a/lesspipe.sh.in b/lesspipe.sh.in
index 00b40fc..2e620f4 100755
--- a/lesspipe.sh.in
+++ b/lesspipe.sh.in
@@ -506,13 +506,20 @@ isfinal() {
exit 1
elif [[ "$1" = *directory* ]]; then
echo "==> This is a directory, showing the output of"
- echo "ls -lA $2"
# color requires -r or -R when calling less, not recommended
@msabramo
msabramo / rebuild_services_menu.sh
Created January 4, 2011 02:06
How to force the OS X Services menu to rebuild itself; a good thing to try if your Services menu is stuck saying "Building..."
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# - or -
launchctl stop com.apple.pbs
@msabramo
msabramo / pastebin.workflow.applescript
Created January 1, 2011 01:33
Create a service workflow in Automator with a "Run AppleScript" action with this for an easy shortcut for posting to pastebin.com (See http://marc-abramowitz.com/archives/2011/01/02/os-x-service-for-posting-text-to-pastebin-com/)
-- pastebin.workflow.applescript
--
-- An automator workflow to copy selected text to pastebin.com
--
-- Created by Marc Abramowitz
-- December 5, 2010
-- version 1.0
on run {input}
@darthdeus
darthdeus / test-loop.rb
Created January 1, 2011 00:46
fixed syntax error with additional comma
#!/usr/bin/env ruby
# Continuous testing for Ruby with fork/eval
# https://github.com/sunaku/test-loop#readme
#-----------------------------------------------------------------------------
# (the ISC license)
#
# Copyright 2010 Suraj N. Kurapati <sunaku@gmail.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@jtrim
jtrim / git_latest.sh
Created December 21, 2010 17:22
Bash function to echo the latest git commit in oneline format and copy the SHA1 to your clipboard under OSX
function glast() {
LATEST=`git log --oneline -n 1`
echo -n $LATEST | ack '^([a-zA-Z0-9]*) {1}' --output='$1' | pbcopy
echo $LATEST
}