Skip to content

Instantly share code, notes, and snippets.

View kevinkirkup's full-sized avatar

Kevin S Kirkup kevinkirkup

  • Digital Realty Trust
  • Raleigh, NC
View GitHub Profile
@kevinkirkup
kevinkirkup / gist:3674147
Created September 8, 2012 11:53
FFMPEGx - Dump MpegTS file timestamp information to the console
ffmpeg -debug_ts -re -copyts -i <intput_ts> -f null out.null
@kevinkirkup
kevinkirkup / gist:3674134
Created September 8, 2012 11:51
Rubyx - Array natural number sorting
##################################################
# Add natural number sorting to arrays
##################################################
class Array
# Method which sort an array composed of strings with embedded numbers by
# the 'natural' representation of numbers inside a string.
def natcmp
reg_number = /\d+/
@kevinkirkup
kevinkirkup / gist:3674112
Created September 8, 2012 11:46
Pythonx - argparse example
import argparse
##################################################
# Create the argument parser
# http://docs.python.org/dev/library/argparse.html
##################################################
parser = argparse.ArgumentParser(description="Parse arguments")
parser.add_argument("input_file", action="store", help="File to read", metavar="INFILE")
parser.add_argument("output_file", action="store", default="output.txt", help="File to write", metavar="OUTFILE")
@kevinkirkup
kevinkirkup / gist:3673925
Created September 8, 2012 11:32
Rubyx Choice parameter block
require 'choice'
# Choice Block for argument definition
Choice.options do
header 'Application options:'
option :template, :required => true do
short '-t'
long '--template=TEMPLATE'
desc 'The path to the preset settings template'
@kevinkirkup
kevinkirkup / gist:2029043
Created March 13, 2012 14:16
jQuery Async Script loading
//
// Dynamically generate the html script tag to prevent
// blocking the parser.
// http://css-tricks.com/thinking-async/
//
jQuery.ajax({
url: '//third-party.com/resource.js',
dataType: 'script',
success: function() {
// script loaded, do stuff!
@kevinkirkup
kevinkirkup / gist:1266475
Created October 6, 2011 03:59
Applescript Trim Subroutine
(*
A sub-routine for trimming unwanted characters from strings.
Taken from http://www.macosxautomation.com
*)
on trim_line(this_text, trim_chars, trim_indicator)
-- 0 = beginning, 1 = end, 2 = both
set x to the length of the trim_chars
-- TRIM BEGINNING
if the trim_indicator is in {0, 2} then
repeat while this_text begins with the trim_chars
@kevinkirkup
kevinkirkup / COM Return Array of Strings
Created April 1, 2011 16:18
COM Method implementation to return an array of strings
STDMETHODIMP CMyClass::GetThings(VARIANT* returnThings)
{
HRESULT hr = S_OK;
SAFEARRAY FAR* safeArray;
SAFEARRAYBOUND safeArrayBound;
if (m_thing != NULL)
{
std::set<const char *>::iterator it;
std::set<const char *> things = m_thing->GetThings();
@kevinkirkup
kevinkirkup / COM String Utilities
Created April 1, 2011 16:15
Utilities to convert from C++ basic types to COM String Types
#include <comutil.h>
_com_util::ConvertBSTRToString("")
_com_util::ConvertStringToBSTR("");
@kevinkirkup
kevinkirkup / bblean.vim
Created November 30, 2009 01:37
bblean vim syntax highlighter
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Filename: bblean.vim
" Purpose: Vim syntax file for bblen resource files
" Language: bblean *.rc files
" Maintainer; Kevin S Kirkup [email protected]
" URL:
" Last Update: Sat 11/19/2005
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"-----------------------------------------------------------
@kevinkirkup
kevinkirkup / kevin2.vim
Created November 30, 2009 01:35
Kevin2 VIM syntax color file
" Vim color file
" Maintainer: Kevin S Kirkup <[email protected]>
" Last Change: 2005 Feb 27
" This color scheme uses a black background.
" First remove all existing highlighting.
set background=dark
highlight clear