Skip to content

Instantly share code, notes, and snippets.

View guilhermehn's full-sized avatar

Guilherme Nagatomo guilhermehn

  • PagSeguro
  • Brasil, São Paulo
View GitHub Profile

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

{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot more} useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch} your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any? {Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe. Thanks.|
{It is|It's} {appropriate|perfect|the best} time to make some plans for the future and {it is|i
@guilhermehn
guilhermehn / Preferences.sublime-settings
Last active December 21, 2015 21:59
My Sublime Text 3 settings
{
"always_show_minimap_viewport": true,
"bold_folder_labels": true,
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Material Theme/schemes/Material-Theme.tmTheme",
"drag_text": false,
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"font_size": 10,
@guilhermehn
guilhermehn / polyfill.isArray.js
Created August 6, 2013 18:21
Array.isArray polyfill
(function(){ "use strict";
if( !Array.protoype.isArray) ){
Array.prototype.isArray = function( obj ){
return Object.prototype.toString.call( obj || this ) === "[object Array]";
};
}
})();
@guilhermehn
guilhermehn / gist:5978751
Created July 11, 2013 20:06
Regex to remove console.* lines Example: http://regexr.com?35i19
(\s|\t)+?console\.[^;]+;
@guilhermehn
guilhermehn / gist:5833114
Created June 21, 2013 18:07
tuenti_secure JSON parser
function tuenti_secure(string) {
var regexp1 = /^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/,
regexp2 = /\\./g,
regexp3 = /"[^"\\\n\r]*"/g;
if (!string || typeof string !== "string") {
return null;
}
if (regexp1.test(string.replace(regexp2, "@").replace(regexp3, ""))) {
return null;
}
@guilhermehn
guilhermehn / gist:5731713
Last active December 18, 2015 05:19
AngularJS ngDisabled directive
angular.module('app', [])
.directive('ngDisabled', [function(){
return {
restrict: 'A',
link: function(scope, element, attrs){
if(scope.$eval(attrs.ngDisabled)){
element.attr('disabled', 'disabled');
}
}
};
@guilhermehn
guilhermehn / gist:5538436
Created May 8, 2013 05:30
Download e conversao de video do youtube para mp3
youtube-dl --max-quality mp4 {{link}}
ffmpeg -i {{arquivo baixado}} -ab 256000 -ar 44100 {{nome do arquivo de audio}}.mp3
@guilhermehn
guilhermehn / gist:5506328
Created May 2, 2013 23:48
AngularJS directive - strip special characters
angular.module('ng', []).directive('removeSpecials', function(){
return {
require: 'ngModel',
link: function(scope, element, attrs, modelCtrl){
var clearString = function(inputValue){
if(inputValue && inputValue.length){
var cleanString = inputValue
.replace(/(^\s+)|(\s+$)/g, '')
.replace(/[\d\-\.\/\\\[\]\,\_\*\|\;\:\'\~\^\´\`\¨\%$$\@\!\(\)\=\+\#\¹\²\³\£\¢\¬\&<\>\°\º\ª\?]/g, '')
.replace(/\s+/g, ' ')
@guilhermehn
guilhermehn / gist:5506304
Last active December 16, 2015 22:20
AngularJS directive - Uppercas
angular.module('ng', []).directive('uppercase', function(){
return {
require: 'ngModel',
link: function(scope, element, attrs, modelCtrl){
// Cria o parsers
var _uppercase = function(inputValue){
var uppercased = angular.uppercase(inputValue);
if(uppercased !== inputValue){
modelCtrl.$setViewValue(uppercased);
modelCtrl.$render();