Skip to content

Instantly share code, notes, and snippets.

View mceachen's full-sized avatar

Matthew McEachen mceachen

View GitHub Profile
@mceachen
mceachen / thrift.rb
Created June 21, 2011 17:54
Thrift 0.5.0 homebrew
require 'formula'
class Thrift < Formula
homepage 'http://incubator.apache.org/thrift/'
head 'http://svn.apache.org/repos/asf/incubator/thrift/trunk'
url 'http://archive.apache.org/dist/incubator/thrift/0.5.0-incubating/thrift-0.5.0.tar.gz'
md5 '14c97adefb4efc209285f63b4c7f51f2'
depends_on 'boost'
@mceachen
mceachen / thrift.rb
Created January 31, 2012 23:12
Thrift 0.6.0 Homebrew formula
require 'formula'
class Thrift < Formula
homepage 'http://thrift.apache.org'
head 'http://svn.apache.org/repos/asf/thrift/trunk'
url 'http://archive.apache.org/dist/thrift/0.6.0/thrift-0.6.0.tar.gz'
md5 'c1a9c679bc75d038ce5ef447bf6e4c75'
depends_on 'boost'
@mceachen
mceachen / Growl.applescript
Created March 20, 2012 16:44
iChat and Messages applescript integration: place in ~/Library/Scripts/Messages
using terms from application "iChat"
on message received message from theBuddy for textChat
set whoDidIt to full name of theBuddy
set who to "iChat: " & whoDidIt
set buddyIcon to image of theBuddy
tell application "System Events"
set frontApp to name of first application process whose frontmost is true
end tell
tell application frontApp
set window_name to name of front window
@mceachen
mceachen / .travis.yml
Created April 9, 2012 01:28
Travis CI with multiple database engines
language: ruby
rvm:
- 1.9.3
env:
- DB=sqlite
- DB=mysql
- DB=postgresql

Install Styler for Chrome

Go to a review, click on the Styler "S" logo on the top right menu bar, and add the following CSS:

/* go/rb-css */
span.k { color: #b05179 }
span.nc { color: #41618d }
span.kt { color: #41618d }
span.kc { color: #806DA2 ; font-weight: normal }
// Type definitions for sharp v0.16.2
// Project: https://github.com/lovell/sharp
// Definitions by: Matthew McEachen <https://github.com/mceachen/>
/// <reference types="node" />
import * as stream from "stream"
import * as events from "events"
// See https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html

Last updated: 2017-03-18

Searching for Files

Find images in a directory that don't have a DateTimeOriginal

exiftool -filename -filemodifydate -createdate -r -if '(not $datetimeoriginal) and $filetype eq "JPEG"' .

Output photos that don't have datetimeoriginal to a CSV

Note this can take a long time if you have a lot of jpgs

@mceachen
mceachen / punch
Created August 28, 2017 15:15
`punch`: set zeroes in random locations to simulate file corruption
#!/usr/bin/env node
// Usage: punch <inputfile> [number of holes]
const fs = require("fs")
const process = require("process")
const file = process.argv[2]
const times = process.argv[3] || 1
const stat = fs.statSync(file)
@mceachen
mceachen / Option.ts
Last active October 9, 2017 16:56
Option support for TypeScript
/*!
Copyright (c) 2017 Matthew McEachen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@mceachen
mceachen / Opt.ts
Created December 20, 2018 22:59
Scala's Option, ported to TypeScript
/*!
Copyright (c) 2018 Matthew McEachen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.