Skip to content

Instantly share code, notes, and snippets.

@mdg
mdg / toggler.py
Created August 12, 2010 17:18
Return a function that will return alternating items
# Return a function that will return alternate items and a new function
def make_toggler(a,b):
return lambda: (a, make_toggler(b,a))
@mdg
mdg / gist:916667
Created April 12, 2011 23:22
gm identify -verbose problem.jpg
Image: problem.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Geometry: 698x1080
Class: DirectClass
Type: true color
Depth: 8 bits-per-pixel component
Channel Depths:
Red: 8 bits
Green: 8 bits
@mdg
mdg / gist:916670
Created April 12, 2011 23:25
exiftool problem.jpg
ExifTool Version Number : 8.40
File Name : problem.jpg
Directory : .
File Size : 637 kB
File Modification Date/Time : 2011:04:12 23:24:00+00:00
File Permissions : rw-r--r--
File Type : JPEG
MIME Type : image/jpeg
JFIF Version : 1.01
Exif Byte Order : Big-endian (Motorola, MM)
@mdg
mdg / gist:916683
Created April 12, 2011 23:35
gm -version
GraphicsMagick 1.3.7 2009-09-17 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2009 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP yes
@mdg
mdg / gist:916685
Created April 12, 2011 23:37
rpm -qa |grep -E "(jpeg|tiff|ghost|png|lcms|wmf)" | sort
$ rpm -qa |grep -E "(jpeg|tiff|ghost|png|lcms|wmf)" | sort
lcms-1.18-0.1.beta1.el5_3.2
lcms-1.18-0.1.beta1.el5_3.2
libjpeg-6b-37
libjpeg-6b-37
libjpeg-devel-6b-37
libjpeg-devel-6b-37
libpng-1.2.10-7.1.el5_5.3
libpng-1.2.10-7.1.el5_5.3
libtiff-3.8.2-7.el5_5.5
@mdg
mdg / factorial.code
Last active December 14, 2015 13:48
Pattern matching factorial function written in my very own programming language.
factorial :=
?(1) => 1
?(0) => 0
?(n) => n * factorial(n-1)
main() => write(@stdout, msg) where
result <- factorial(5)
msg <- "factorial(5) is $result\n"
@mdg
mdg / animals.cpp
Last active December 20, 2015 15:09
OO Type Hierarchy
class Animal
{
public:
std::string name;
virtual ~Animal() {}
};
class Dog : public Animal
{
public:
@mdg
mdg / README
Last active August 29, 2015 14:01
Keyur's patches for Etsy API Concurrency
Here's the source RPM we built on:
http://vault.centos.org/6.5/os/Source/SPackages/curl-7.19.7-37.el6_4.src.rpm
The PHP release we applied the patch on is 5.4.26:
http://us1.php.net/get/php-5.4.26.tar.gz/from/a/mirror
@mdg
mdg / README.md
Last active August 29, 2015 14:10
Penn State Technical Conference

Penn State Technical Conference

A technical conference by and for Penn State Alumni.

Lanyrd Page

When/Where

April 17, 2015 - Friday before the [Blue-White Game]

@mdg
mdg / token-ids.diff
Last active December 22, 2015 06:11
The different of the output for the example parser in lemon-diff given the changes in pull request #3
diff --git a/origin.rs b/token-ids.rs
index 736580d..b849a41 100644
--- a/origin.rs
+++ b/token-ids.rs
@@ -48,23 +48,40 @@ const YYERRORSYMBOL: i32 = 0;
pub enum Token {
EOI, //0
VALUE( i32 ), //1
PLUS, //2
MINUS, //3