Skip to content

Instantly share code, notes, and snippets.

View mlbright's full-sized avatar

Martin-Louis Bright mlbright

  • Toronto
  • 20:05 (UTC -04:00)
View GitHub Profile
@seanh
seanh / detect-broken-symlinks.py
Created November 8, 2009 19:48
A Python script to check for broken symlinks in the current working directory. I use this as part of a pre-commit hook with git.
# Depends on the OS X "say" command
import time, datetime, subprocess, math, sys
def say(s):
subprocess.call(['say', str(s)])
def seconds_until(dt):
return time.mktime(dt.timetuple()) - time.time()
@sugmak
sugmak / chrome_bookmarks_to_html.pl
Created March 21, 2010 14:25
A Perl script to export Google Chrome's bookmark to HTML in order to use from LaunchBar
#!/usr/bin/env perl
use strict;
use warnings;
use JSON;
use utf8;
use Encode;
# use Data::Dumper;
my $chrome_bookmark_file = $ENV{'HOME'}.'/Library/Application Support/Google/Chrome/Default/Bookmarks';
@tdd
tdd / gitconfig.ini
Last active April 17, 2024 10:04
Nice, useful global Git configuration
# Put this in your ~/.gitconfig or ~/.config/git/config
# Windows users: "~" is your profile's home directory, e.g. C:\Users\<YourName>
[user]
name = Your Full Name
email = your@email.tld
[color]
# Enable colors in color-supporting terminals
ui = auto
[alias]
# List available aliases
import bisect
class NFA(object):
EPSILON = object()
ANY = object()
def __init__(self, start_state):
self.transitions = {}
self.final_states = set()
self._start_state = start_state
#!/usr/bin/env ruby
require 'ftools'
require 'fileutils'
require 'rubygems'
require 'RMagick'
include Magick
require 'open3'
def merge( files = [] )
import json
import logging
import zmq
class QueueHandler(logging.Handler):
"""
This handler sends events to a queue. Typically, it would be used together
with a multiprocessing Queue to centralise logging to file in one process
(in a multi-process application), so as to avoid file write contention
between processes.
import logging
try:
import Queue as queue
except ImportError:
import queue
import threading
class QueueHandler(logging.Handler):
"""
This handler sends events to a queue. Typically, it would be used together
@schacon
schacon / ruby_c_ext.txt
Created December 19, 2010 06:46
Ruby C Extension Articles
README.ext
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/tags/v1_8_6/README.EXT?revision=12055
Extending Ruby - Pickaxe
http://ruby-doc.org/docs/ProgrammingRuby/html/ext_ruby.html
Extending Ruby on O'Reilly
http://onlamp.com/pub/a/onlamp/2004/11/18/extending_ruby.html
Ruby C Extensions - Mark Volkman
@dmn001
dmn001 / Dropbox-Diet Solution
Created February 1, 2011 14:03
My solution for the Dropbox Diet Challenge
#!/usr/bin/perl
use strict;
# dmn001 <at> gmail
# 31/01/2011
my %pos;
my %neg;
my $num_lines = <STDIN>;
while (<STDIN>){