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 / ansible-role-test.sh
Created October 5, 2017 13:07 — forked from geerlingguy/ansible-role-test.sh
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
# - test_idempotence: whether to test playbook's idempotence (default = true)
#!/bin/bash
files=(\
'https://adaway.org/hosts.txt'\
'http://winhelp2002.mvps.org/hosts.txt'\
'http://hosts-file.net/.\ad_servers.txt'\
'http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext'\
'http://someonewhocares.org/hosts/hosts'\
)
@dm
dm / functions.git.zsh
Created August 9, 2017 12:17
Partial functions.git.zsh
# <snip>
# Destructive! Resets all rebased commit dates to COMMITER_DATE
git-reset-dates() {
echo "Usage: git-reset-dates [ SHA1..HEAD ]"
echo "Are you sure you wish to reset git commit dates to COMMITER_DATE? (y/N)"
read REPLY
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
@dm
dm / Tree.MD
Created December 23, 2016 11:53
Xmas Tree 1997

Happy Xmas and a Merry New Year :D

           *             ,
                       _/^\_
                      <     >
     *                 /.-.\         *
              *        `/&\`                   *
                      ,@.*;@,
 /_o.I %_\ *
@dm
dm / github.sh
Created November 11, 2016 15:45
Clone all organisation repos into current directory
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# Create a Personal Access Token and add it here (replace my username with yours)
# https://github.com/settings/tokens
CREDS=dm:TOKEN
ORG=${ORG:=sansible}
PAGES=${PAGES:=60}
@dm
dm / git.sh
Created June 28, 2016 12:47
Github expected Squash+Merge behaviour
git checkout PR-Branch
git reset --soft HEAD~10 # i.e. PR with 10 commits
git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})"
git checkout master
git merge --no-ff PR-Branch
@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)
@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'
# 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:

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