Skip to content

Instantly share code, notes, and snippets.

Lee Packham leepa

Block or report user

Report or block leepa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:30697
#!/usr/bin/env ruby
=begin
INSTALL:
curl http://github.com/defunkt/gist/tree/master%2Fgist.rb?raw=true > gist &&
chmod 755 gist &&
sudo mv gist /usr/local/bin/gist
View gist:32293
def truncate_description(length, end_string = ' ...')
words = description.split()
words = words[0..(length-1)].join(' ') + (words.length > length ? end_string : '')
words
end
View gist:125807
[14:10:15] <Tikcus> Five surgeons from big cities are discussing who makes the best patients to operate on...
[14:10:17] <Tikcus> The first surgeon, from Bristol , says, "I like to see accountants on my operating table, because when you open them up, everything inside is numbered."
[14:10:19] <Tikcus> The second, from Manchester , responds, "Yeah, but you should try electricians! Everything inside them is colour coded."
[14:10:21] <Tikcus> The third surgeon, from Edinburgh , says, "No, I really think librarians are the best, everything inside them is in alphabetical order."
[14:10:23] <Tikcus> The fourth surgeon, from Birmingham chimes in: "You know, I like construction workers...those blokes always understand when you have a few parts left over."
[14:10:25] <Tikcus> But the fifth surgeon, from London shut them all up when he observed: "You're all wrong, Politicians are the easiest to operate on"...............................
[14:10:27] <Tikcus> .................................."There's no guts, no heart, n
View gist:137341
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(git::\1)/'
}
parse_svn_branch() {
parse_svn_url | sed -e 's#^'"$(parse_svn_repository_root)"'##g' | awk -F / '{print "(svn::"$1 "/" $2 ")"}'
}
parse_svn_url() {
svn info 2>/dev/null | grep -e '^URL*' | sed -e 's#^URL: *\(.*\)#\1#g '
}
parse_svn_repository_root() {
View gist:145257
import struct
from socket import socket
import ssl
import binascii
payload = '{"aps":{"alert":"Hello World","sound":"chime"}}'
fmt = "!cH32sH%ds" % len(payload)
command = '\x00'
token = '<<removed>>'
View gist:150195
#!/bin/sh -
"exec" "python" "-O" "$0" "$@"
__doc__ = """Tiny HTTP Proxy.
This module implements GET, HEAD, POST, PUT and DELETE methods
on BaseHTTPServer, and behaves as an HTTP proxy. The CONNECT
method is also implemented experimentally, but has not been
tested yet.
View gist:157010
#!/usr/local/bin/bash
INPUT="$1"
OUTPUT="$2"
VIDEO_CODEC="mpeg2video"
VIDEO_FPS=`mkvinfo $1 | grep -A 10 'Codec ID: V_MPEG4' | grep -w fps | awk '{print $6}' | cut -d'(' -f2`
mkvinfo $INPUT | grep -qE 'Codec ID.*DTS'
if [ $? -eq 0 ]; then
View gist:307740
class PkgCurlDownloadStrategy <CurlDownloadStrategy
def stage
safe_system '/usr/sbin/pkgutil', '--extract', @tarball_path, File.basename(@url)
chdir
end
end
View gist:307760
-(IBAction)genericPressed:(id)sender {
[theImage setImage:[UIImage imageNamed:[NSString stringWithFormat:@"bg1_%@.png", sender]]];
}
You can’t perform that action at this time.