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 / S3-Static-Sites.md
Created October 2, 2018 11:29 — forked from bradwestfall/S3-Static-Sites.md
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation

Resources

@dm
dm / facebook-contact-info-summary.rb
Created March 23, 2018 22:54 — forked from dylanmckay/facebook-contact-info-summary.rb
A Ruby script for collecting phone record statistics from a Facebook user data dump
#! /usr/bin/env ruby
# This script can be used to parse and dump the information from
# the 'html/contact_info.htm' file in a Facebook user data ZIP download.
#
# It prints all cell phone call + SMS message + MMS records, plus a summary of each.
#
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created
# in whatever the working directory of the program is when executed.
#
@dm
dm / .block
Created March 12, 2018 14:01 — forked from mbostock/.block
Box Plots
license: gpl-3.0
@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 / 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 / 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 / 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'\
)

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