Skip to content

Instantly share code, notes, and snippets.

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

Share Counts

I have always struggled with getting all the various share buttons from Facebook, Twitter, Google Plus, Pinterest, etc to align correctly and to not look like a tacky explosion of buttons. Seeing a number of sites rolling their own share buttons with counts, for example The Next Web I decided to look into the various APIs on how to simply return the share count.

If you want to roll up all of these into a single jQuery plugin check out Sharrre

Many of these API calls and methods are undocumented, so anticipate that they will change in the future. Also, if you are planning on rolling these out across a site I would recommend creating a simple endpoint that periodically caches results from all of the APIs so that you are not overloading the services will requests.

Twitter

@forficate
forficate / Play Framework Upstart script
Created December 9, 2013 23:23
Play framework upstart script
description "My Play App"
env USER=myappname
env GROUP=myappname
env HOME=/var/play/myappname
env PORT=9000
env ADDRESS=127.0.0.1
env EXTRA="-Xms128M -Xmx512m -server"
start on (filesystem and net-device-up IFACE=lo)
@forficate
forficate / Play framework init script
Created December 9, 2013 23:17
Play framework init script for CentOS 6
#!/bin/bash
# chkconfig: 345 20 80
# description: Play start/shutdown script
# processname: play
#
# Instalation:
# copy file to /etc/init.d
# chmod +x /etc/init.d/play
# chkconfig --add /etc/init.d/play
# chkconfig play on
@forficate
forficate / gist:5033866
Created February 25, 2013 22:19
Drupal input filters in scala for play framework
abstract trait InputFormat {
def format(source: String): String
}
object LineBreakFormatter extends InputFormat {
def format(source: String) = source.replaceAll("\n", "<br/>")
}
object HtmlEscapeFormatter extends InputFormat {
def format(source: String) = play.api.templates.HtmlFormat.escape(source).body
@forficate
forficate / gist:4179611
Created November 30, 2012 23:53
Show current working SVN branch at bash prompt
# Add the below to ~/.bash_profile
function parse_svn_branch {
# Note for mac users, use sed -nE 's/URL:.*\/(trunk|branches\/[^\/]*|tags\/[^\/]*).*/\1/p'
svn info 2> /dev/null | sed -rne 's/URL:.*\/(trunk|branches\/[^\/]*|tags\/[^\/]*).*/\1/p'
}
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"