start new:
tmux
start new with session name:
tmux new -s myname
#!/usr/bin/env python | |
""" | |
urlnorm.py - URL normalisation routines | |
urlnorm normalises a URL by; | |
* lowercasing the scheme and hostname | |
* taking out default port if present (e.g., http://www.foo.com:80/) | |
* collapsing the path (./, ../, etc) | |
* removing the last character in the hostname if it is '.' |
/* | |
This example uses Scala. Please see the MLlib documentation for a Java example. | |
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above. | |
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog | |
Spark: http://spark.apache.org/ | |
*/ | |
import scala.collection.mutable |
""" | |
Demo of json_required decorator for API input validation/error handling | |
""" | |
import inspect | |
import functools | |
import json | |
from traceback import format_exception | |
from flask import jsonify, request | |
import sys |
# -*- coding: utf-8 -*- | |
import unicodedata | |
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """ | |
data = u'naïve café' | |
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore') | |
print normal | |
Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications
like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.
open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl
You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html
#!/usr/bin/python2 | |
import serial | |
import re, sys, signal, os, time, datetime | |
import RPi.GPIO as GPIO | |
BITRATE = 9600 | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(7, GPIO.OUT) | |
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP) |
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source. | |
# Will include all hosts the playbook is run on. | |
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html | |
- name: "Build hosts file" | |
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present | |
when: hostvars[item].ansible_default_ipv4.address is defined | |
with_items: groups['all'] |
Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.
This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.
There is a companion feature matrix of various tools. Comments are welcome in the same manner.