I hereby claim:
- I am Grayson on github.
- I am Grayson (https://keybase.io/Grayson) on keybase.
- I have a public key whose fingerprint is C240 DA4B 8327 D87F F17C D56D 40C3 43A9 4889 DCCF
To claim this, I am signing this object:
#!/usr/bin/env python | |
# usage: python getDefaultAppForURL.py 'http://' 'ftp://' 'afp://'... | |
from LaunchServices import LSGetApplicationForURL, kLSRolesViewer | |
from Foundation import NSURL | |
from sys import argv | |
for arg in argv[1:]: | |
url = NSURL.URLWithString_(arg) | |
if url == None: continue |
#!/usr/bin/env bash | |
# Echo some information to STDOUT as well as show a growl notification if available | |
function notify { | |
if [[ -f /usr/local/bin/growlnotify ]]; then | |
echo $1 | /usr/local/bin/growlnotify "Updating WebKit" | |
fi | |
echo $1 | |
} | |
#!/usr/bin/env python | |
# Grayson Hansard, 2008 | |
# This is a simple python script that I wrote as part of a system to | |
# use the number of git commits on a project as an incremental build number system. | |
import os, sys | |
if len(sys.argv) < 2: | |
print "Usage git hash-from-commit-number <commit-number>" |
// Simple way of getting a list of ivar names for an Objective-C class. | |
#import <objc/runtime.h> | |
@interface NSObject (ivars) | |
-(NSArray *)ivars { | |
unsigned int ivarCount = 0; | |
Ivar *ivars = class_copyIvarList([self class], &ivarCount); | |
if (ivars && ivarCount) { | |
NSMutableArray *array = [NSMutableArray array]; |
on isOptionKeyPressed() | |
return (do shell script "/usr/bin/python -c 'import Cocoa; print Cocoa.NSEvent.modifierFlags() & Cocoa.NSAlternateKeyMask > 1'") is "True" | |
end isOptionKeyPressed |
# Just copy and paste the following into your shell prompt. | |
echo "scale=4;" `cat ~/.bash_history | grep -e "^ *git" | wc -l` "/" `cat ~/.bash_history | wc -l` " * 100" | bc |
#!/usr/bin/env bash | |
total=`cat ~/.bash_history | grep -e "^ *git" | awk '{print $1}' | sort | uniq -c | awk '{print $1}'` | |
oldifs=$IFS | |
IFS=$'\n' | |
for l in `cat ~/.bash_history | grep -e "^ *git" | awk '{print $2}' | sort | uniq -c`; do | |
count=`echo $l | awk '{print $1}'` | |
gitcmd=`echo $l | awk '{print $2}'` | |
percentage=`echo "scale=4; $count / $total * 100" | bc` | |
I hereby claim:
To claim this, I am signing this object:
import os | |
import shutil | |
import sqlite3 | |
from sys import argv | |
from xml.dom.minidom import parse | |
def dom_element_to_insert(elem): | |
return (elem.getAttribute('xmlUrl'),elem.getAttribute('text'), elem.getAttribute('title'), elem.getAttribute('htmlUrl')) | |
def main(path_to_opml): |
Name | CSS | Hex | R | G | B | |
---|---|---|---|---|---|---|
Licorice | #000000 | 0x000000 | 0 | 0 | 0 | |
Lead | #191919 | 0x191919 | 25 | 25 | 25 | |
Tungsten | #333333 | 0x333333 | 51 | 51 | 51 | |
Iron | #4C4C4C | 0x4C4C4C | 76 | 76 | 76 | |
Steel | #666666 | 0x666666 | 102 | 102 | 102 | |
Tin | #7F7F7F | 0x7F7F7F | 127 | 127 | 127 | |
Nickel | #808080 | 0x808080 | 128 | 128 | 128 | |
Aluminum | #999999 | 0x999999 | 153 | 153 | 153 | |
Magnesium | #B3B3B3 | 0xB3B3B3 | 179 | 179 | 179 |