Skip to content

Instantly share code, notes, and snippets.

mazz /
Created May 4, 2018 — forked from bastman/
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

mazz / rtlsdr-osx.txt
Created Mar 26, 2018 — forked from jheasly/rtlsdr-osx.txt
Build RTL-SDR on OSX with no tears using homebrew. Forked from, a macports solution.
View rtlsdr-osx.txt
rtl-sdr build notes for OSX
using macports
brew install cmake
brew install libusb
brew install pkgconfig
brew install sox # for easy audio
git clone git://
cd rtl-sdr/
mazz / ChatCollectionViewFlowLayout.swift
Created Feb 21, 2018 — forked from jochenschoellig/ChatCollectionViewFlowLayout.swift
A subclass of UICollectionViewFlowLayout to get chat behavior without turning collection view upside-down. This layout is written in Swift 3 and absolutely usable with RxSwift and RxDataSources because UI is completely separated from any logic or binding.
View ChatCollectionViewFlowLayout.swift
import UIKit
class ChatCollectionViewFlowLayout: UICollectionViewFlowLayout {
private var topMostVisibleItem = Int.max
private var bottomMostVisibleItem = -Int.max
private var offset: CGFloat = 0.0
private var visibleAttributes: [UICollectionViewLayoutAttributes]?
mazz / Flexible Dockerized Phoenix
Created Feb 16, 2018 — forked from jswny/Flexible Dockerized Phoenix
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.
View Flexible Dockerized Phoenix


I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

mazz / elixir_xml.exs
Created Jul 4, 2017 — forked from spint/elixir_xml.exs
Elixir XML processing (to JSON) with SweetXML
View elixir_xml.exs
# mix.exs file dependencies:
# defp deps do
# [
# {:sweet_xml, "~> 0.4.0"},
# {:json, "~> 0.3.0"}
# ]
# end
defmodule ElixirXml do
import SweetXml
View gist:353152b512c35f414622892471166073
allows users to sign up and login with their phone number, if that number is assoicated with an
existing customer record.
import logging
import colander
from cornice.service import Service
from pyramid.exceptions import HTTPBadRequest
from pyramid_sms.utils import normalize_us_phone_number
mazz / auto_dubstep.rb
Created Aug 22, 2016 — forked from xavriley/auto_dubstep.rb
Auto generating dubstep with Sonic Pi
View auto_dubstep.rb
# Combines ideas from my other gists
current_bpm = 140.0
use_bpm current_bpm
define :wob do
use_synth :dsaw
lowcut = note(:E1) # ~ 40Hz
highcut = note(:G8) # ~ 3000Hz
mazz /
Created Aug 22, 2016 — forked from jwinder/
Sonic Pi tutorials concatenated

1 Welcome to Sonic Pi

Welcome friend :-)

Welcome to Sonic Pi. Hopefully you're as excited to get started making crazy sounds as I am to show you. It's going to be a really fun ride where you'll learn all about music, synthesis, programming, composition, performance and more.

But wait, how rude of me! Let me introduce myself - I'm

mazz /
Created Aug 14, 2016 — forked from esperlu/
MySQL to Sqlite converter
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
mazz /
Created Aug 13, 2016 — forked from cecilemuller/
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two modes when you don't want Certbot to edit your configuration:

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80) to renew certificates.

In the following, we're setting up to be served from /var/www/mydomain, and challenges will be served from /var/www/letsencrypt.