Skip to content

Instantly share code, notes, and snippets.

require 'mechanize'
require 'logger'
require_relative 'random_agent'
require_relative 'path'
# Mechanize::Page subclasses Mechanize::File, Mechanize::Download is its own thing
# module MimeInfo
# def size
# header["content-length"].to_i

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@jteneycke
jteneycke / deploy_prep.sh
Last active August 29, 2015 14:20
rails vps deployment without ripping your eyes out
# create a deploy user, and add them to sudoers
adduser deploy
gpasswd -a deploy sudo
# generate a key so you can just pop it on your github and pull your repo down from there
ssh-keygen -t rsa -C "your_email@example.com"
# test the connection so it adds the key to your authorized hosts list
ssh -T git@github.com
# add the phussion passenger package server key, and binaries source to to your apt packages list
@jteneycke
jteneycke / google_songza.js
Created July 24, 2015 03:15
google current playing songza track name
var link = document.createElement("a")
link.href = "https://www.google.ca/search?" + $.param({q: $(".miniplayer-info-track-title a").attr('title')})
link.target = "_blank"
link.click()
@jteneycke
jteneycke / seesaw-repl-tutorial.clj
Created November 1, 2015 06:36 — forked from daveray/seesaw-repl-tutorial.clj
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
# jEdit :folding=explicit:collapseFolds=1:indentSize=2:tabSize=2:
# add requires here #{{{
#}}}
# handle command line #{{{
def usage #{{{
puts <<-USAGE
import Html exposing (..)
import Html.App exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
import Http
import Task exposing (Task)
import Json.Decode as Json exposing ((:=))
type Msg
@jteneycke
jteneycke / Makefile
Created August 8, 2016 16:38 — forked from rtorr/Makefile
Watch elm files for changes and then recompile
js = $(shell echo $(elm) | tr A-Z a-z)
elm = Main
# Example: make elm=Main js=main watch
watch:
echo "watching *.elm files, outputing $(js).js" && fswatch -0 *.elm | xargs -0 -n 1 -I \{\} elm-make $(elm).elm --output $(js).js
# Example: make elm=Main js=main build
build:
elm-make $(elm).elm --output $(js).js