Skip to content

Instantly share code, notes, and snippets.

View dm's full-sized avatar
🐍

ÐΛИIΞL MΔCΞDѲ dm

🐍
  • UK
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

@dm
dm / ico.sh
Created March 17, 2014 17:57
i++ i--
#!/bin/bash
convert -size 760x760 xc: +noise Random noise1.jpg
convert noise1.jpg -bordercolor none -mattecolor "rgba(83, 83, 83, 0.5)" -frame 20x20 noise2.jpg
convert noise2.jpg -gravity center -strokewidth 3 -fill "rgba(50, 50, 50, 0.5)" -pointsize 300 -font '/usr/share/fonts/truetype/freefont/FreeMonoBold.ttf' -annotate 0 "i++\ni--" noise3.jpg
convert noise3.jpg -scale 10% -scale 1000% noise4.jpg
@dm
dm / roman.php
Created February 19, 2013 13:21
Roman numerals
<?php
// Originally found this gem on the PHP docs
// http://php.net/manual/en/function.base-convert.php#105414
function roman($N)
{
$c = 'IVXLCDM';
for ($a = 5, $b = $s = ''; $N; $b++, $a ^= 7)
{
@dm
dm / Bcrypt.php
Created June 15, 2012 07:13 — forked from krypton/Bcrypt.php
Simple PHP 5.3+ Bcrypt class adapted from phpass
<?php
/*
Adaptation by Marco Arment <me@marco.org>.
Adapted from Portable PHP Password Hashing Framework (phpass) version 0.3:
http://www.openwall.com/phpass/
phpass was by Solar Designer <solar at openwall.com> in 2004-2006 and is in
the public domain. This adaptation is also in the public domain.

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@dm
dm / php5
Created April 25, 2012 20:35
PHP fcgid wrapper
#!/bin/sh
PHP_FGCI_MAX_REQUESTS=500
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php
@dm
dm / git-prune-tags.rb
Created March 29, 2012 07:02 — forked from rlivsey/git-prune-tags.rb
Script to prune any tags which exist locally but not on the remote
#!/usr/bin/env ruby
require 'readline'
def prompt(prompt="> ")
input = nil
prompt += " " unless prompt =~ /\s$/
loop do
input = Readline.readline(prompt)
break if input.length > 0
end