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
@leepa
leepa / jessie.rb
Created Apr 30, 2015
Jessie 'Service' Provider for Puppet - it will work around https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705254 to ensure services don't keep getting enabled.
View jessie.rb
Puppet::Type.type(:service).provide :jessie, :parent => :systemd do
desc "Manages `systemd` services using `systemctl` on jessie."
defaultfor :osfamily => :debian, :operatingsystem => :debian, :operatingsystemmajrelease => "8"
def get_start_link_count
Dir.glob("/etc/rc*.d/S??#{@resource[:name]}").length
end
def enabled?
View gist:69ff1b6371d2f0ee51ab
#!/bin/sh
#
# This shell script passes all its arguments to the binary inside the
# MacVim.app application bundle. If you make links to this script as view,
# gvim, etc., then it will peek at the name used to call it and set options
# appropriately.
#
# Based on a script by Wout Mertens and suggestions from Laurent Bihanic. This
# version is the fault of Benji Fisher, 16 May 2005 (with modifications by Nico
# Weber and Bjorn Winckler, Aug 13 2007).
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
You can’t perform that action at this time.