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

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.

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

#!/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 / 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)
@dm
dm / config.py
Created January 7, 2018 15:11 — forked from bonzanini/config.py
Twitter Stream Downloader
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'
@dm
dm / reset.sh
Created January 22, 2018 12:17 — forked from reedobrien/reset.sh
fix "Waiting for other installations to complete." on OSX 10.6 10.7
## fix "Waiting for other installations to complete." on OSX 10.6 10.7
## sometimes a failed installation leaves us unable to
## perform an installation. The following fixes it for me
sudo rm /private/var/db/mds/system/mds.install.lock
sudo reboot
@dm
dm / fetch_and_combine.py
Created February 6, 2018 16:37 — forked from larsyencken/fetch_and_combine.py
Aggregating CloudFront logs
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# fetch_and_combine.py
#
"""
Scans CloudFront logs in an S3 bucket for any that are new. Combines log files
into a single local file per hour. If logs for multiple CloudFront
distributions are present, combines them all.
@dm
dm / .block
Created March 12, 2018 14:01 — forked from mbostock/.block
Box Plots
license: gpl-3.0