Skip to content

Instantly share code, notes, and snippets.

View philfreo's full-sized avatar

Phil Freo philfreo

View GitHub Profile
#!/bin/bash
set -e
CONTENTS=$(tesseract -c language_model_penalty_non_dict_word=0.8 --tessdata-dir /usr/local/share/ "$1" stdout -l eng | xml esc)
hex=$((cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
@philfreo
philfreo / swap.pp
Last active December 23, 2015 03:49 — forked from Yggdrasil/swap.pp
# Manages swapspace on a node.
#
# Based on https://gist.github.com/Yggdrasil/3918632
#
# Parameters:
# - $ensure Allows creation or removal of swapspace and the corresponding file.
# - $swapfile Defaults to /mnt which is a fast ephemeral filesystem on EC2 instances.
# This keeps performance reasonable while avoiding I/O charges on EBS.
# - $swapsize Size of the swapfile in MB. Defaults to memory size.
#
<?php
/**
* Custom configuration bootsrtap file for ExpressionEngine
*
* Place config.php in your site root
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/config.php
* Add require(realpath(dirname(__FILE__) . '/../../config_bootstrap.php')); to the bottom of system/expressionengine/config/database.php
* If you have moved your site root you'll need to update the require_once path
*
sqlite3 ~Library/Messages/chat.db "DELETE FROM message WHERE text LIKE '%File:///%';"
@philfreo
philfreo / gist:3148065
Created July 20, 2012 01:21 — forked from mattheworiordan/gist:1037984
Backbone patch to defer update method requests when new create requests are not complete on a model
(function() {
function proxyAjaxEvent(event, options, dit) {
var eventCallback = options[event];
options[event] = function() {
// check if callback for event exists and if so pass on request
if (eventCallback) { eventCallback(arguments) }
if (eventCallback) { eventCallback.apply(dit, arguments); }
dit.proxyProcessQueue(); // move onto next save request in the queue
}
}
@philfreo
philfreo / gist:3148064
Created July 20, 2012 01:21 — forked from mattheworiordan/gist:1037984
Backbone patch to defer update method requests when new create requests are not complete on a model
// Queue of Backbone.Model save()s so that we don't issue multiple POSTs while waiting for
// the first one to come back. The first save() will always POST and the second will always PUT now.
// https://github.com/documentcloud/backbone/issues/345
// https://gist.github.com/1037984 and https://gist.github.com/gists/3148064
(function() {
function proxyAjaxEvent(event, options, dit) {
var eventCallback = options[event];
options[event] = function() {
// check if callback for event exists and if so pass on request
if (eventCallback) { eventCallback(arguments) }
// ==UserScript==
// @name Gmail "From" Address auto-selector
// @version 0.18
// @description Looks in your "To" field and sees if you have an email address in your "From" addresses with the same domain. Changes <select> onblur
// @author Andrew Sutherland, https://github.com/asuth
// @include http://mail.google.com/*
// @include https://mail.google.com/*
// @include http://*.mail.google.com/*
// @include https://*.mail.google.com/*
// ==/UserScript==