Skip to content

Instantly share code, notes, and snippets.

View dm's full-sized avatar
🐍

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

🐍
  • Marks and Spencers
View GitHub Profile
@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
@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

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 / 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.
@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 / 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

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

# GeoNames.org Country Information
# ================================
#
#
# CountryCodes:
# ============
#
# The official ISO country code for the United Kingdom is 'GB'. The code 'UK' is reserved.
#
# A list of dependent countries is available here:
@dm
dm / alias.zsh
Last active August 29, 2015 14:14
AWS CLI for multiple clients
# in ~/.dotfiles/zsh/alias.zsh
alias aws='client=$1 source ~/.dotfiles/bin/aws.zsh $client'
@dm
dm / ThirdPartyNotices.txt
Created April 30, 2015 14:24
Visual Studio Code ThirdPartyNotices.txt
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
Do Not Translate or Localize
This file provides information regarding components that are being relicensed to you by Microsoft under Microsoft?s Visual Studio Code ?Preview? software licensing terms. Microsoft reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.
Microsoft is offering you a license to use the following components subject to the Microsoft Visual Studio Code ?Preview? software license terms, except that components licensed under open source licenses requiring that such component remain under the original license are being made available to you by Microsoft under the original licensing terms. Please refer to the accompanying Credits_41.0.2272.76.html file for additional notices regarding the Chromium open source project.
1. Async-each version 0.1.6 (https://github.com/paulmillr/async-each)
2. atom-electron version 0.22.3 (https://github.com/atom/electron)