Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View mndrix's full-sized avatar

Michael Hendricks mndrix

View GitHub Profile
@mndrix
mndrix / upc.hs
Created February 21, 2009 00:08
UPC validation in Haskell
module UPC (is_upc) where
import Data.Char (digitToInt)
-- Is this string a valid Universal Product Code?
is_upc :: String -> Bool
is_upc u = ( length u == 12 ) && ( upc_checksum u `mod` 10 == 0 )
-- Calculate the UPC checksum using the algorithm from http://xrl.us/omxh8
upc_checksum :: String -> Int
@mndrix
mndrix / event-notifications.txt
Created March 18, 2009 20:24
General event notification
In http://blog.ndrix.com/2009/02/generalizing-twitter.html I wrote
some thoughts about a generalized event notification system. This
gist is just some random notes about things I might want to be
notified about.
* a new bid is placed on an eBay item
* a UPS/FedEx/USPS package is delivered
* a UPS/FedEx/USPS package changes location
* someone commits to an open source project I care about
* a server I monitor goes down
Quality Matters:
"And whatsoever ye do, do it heartily, as to the Lord and not unto men" Colossians 3:23
Treo 680 (and Agendus) has some features the iPhone doesn't have, but I had to restart the Treo about once each week. My overall productivity feels higher on the iPhone and my satisfaction is higher even though some tasks require more effort
http://tech.lds.org/index.php?option=com_content&view=article&id=236:what-does-quality-feel-like-online&catid=1:miscellanous
Speed Matters:
Linus' talk on Git - http://www.youtube.com/watch?v=4XpnKHJAok8
Google Chrome is now faster - http://chrome.blogspot.com/2009/05/speedier-google-chrome-for-all-users.html
Guidelines for user interface response time - http://www.useit.com/papers/responsetime.html
Nearly any YouTube talk from Steve Souders
http://googleresearch.blogspot.com/2009/06/speed-matters.html
@mndrix
mndrix / git-commit-cycles.pl
Created June 23, 2009 18:22
Locating Git commit graph cycles
#!/usr/bin/perl
use strict;
use warnings;
use Graph;
use List::MoreUtils qw( any );
my $g = Graph->new;
open my $git, '-|', q{git log --all --format='%H;%P'} or die;
print "Building commit graph ...\n";
while ( my $line = <$git> ) {
testing
% Variable naming convention:
% T - town in which to snowbird
% Cs - choices made
% E - expense incurred
%
% t(T,Cs,E) represents a specific snowbirding trip. Standing at home
% and having decided to snowbird in Las Vegas is represented as
% t(vegas, Cs, 0). That is, I've decided on Vegas and incurred no cost yet,
% but haven't made any choices about how I'll get there.
diff --git a/src/jsprf.c b/src/jsprf.c
index 416c16c..6735520 100644
--- a/src/jsprf.c
+++ b/src/jsprf.c
@@ -58,6 +58,8 @@
*/
#ifdef HAVE_VA_COPY
#define VARARGS_ASSIGN(foo, bar) VA_COPY(foo,bar)
+#elif defined(va_copy)
+#define VARARGS_ASSIGN(foo, bar) va_copy(foo,bar)
@mndrix
mndrix / gist:865363
Created March 11, 2011 02:37
Support ;;gpg info --key CE52C98A48081991
diff --git a/GPG/plugin.py b/GPG/plugin.py
index 171d876..cfd4482 100644
--- a/GPG/plugin.py
+++ b/GPG/plugin.py
@@ -333,19 +333,27 @@ class GPG(callbacks.Plugin):
irc.reply(response + "not identified.")
ident = wrap(ident, [optional('something')])
- def info(self, irc, msg, args, nick):
- """<nick>
#!/usr/bin/perl
use strict;
use warnings;
use File::Temp qw( tempfile );
use autodie qw( system );
my ( undef, $filename ) = tempfile( 'otc-XXXX', TMPDIR => 1 );
system "pbpaste | gpg --clearsign > $filename";
system "scp $filename example.com:/var/www/otc-auth.asc";
system "echo -n ';;gpg verify http://www.example.com/otc-auth.asc' | pbcopy";