Skip to content

Instantly share code, notes, and snippets.

switches.yaml:
- platform: mqtt
name: "Doorbell Chime"
state_topic: "doorbell/chime/state"
command_topic: "doorbell/chime/cmnd"
retain: true
qos: 1
# vim:ft=ansible:
- name: Rotate TLS tickets
hosts: yourhostlist
become: True
vars:
key_count: some number...
ticket_path: /etc/nginx/ssl # Ideally this should not be on persistent storage
tasks:

Keybase proof

I hereby claim:

  • I am jshwright on github.
  • I am jshwright (https://keybase.io/jshwright) on keybase.
  • I have a public key whose fingerprint is 5D10 5704 48A1 165B D2C0 E9D5 0C83 7DE5 71FC 0467

To claim this, I am signing this object:

#!/usr/bin/env python
from collections import namedtuple
log_file = '/var/log/apt-cacher-ng/apt-cacher.log'
def humanize_bytes(bytes, precision=1):
'''
Borrowed from:
http://code.activestate.com/recipes/577081-humanized-representation-of-a-number-of-bytes/
'''
def ajaxsubmit(request):
new_msg = Message(msg = request.POST['msg'],
posted_by = request.POST['posted_by'])
new_msg.save()
# Updating the message is handled by a post_save signal,
# so just return an empty 200.
return HttpResponse()
def send_message(sender, instance, **kwargs):
cmd = [{'cmd': 'inlinepush',
'params': {
'password': settings.APE_PASSWORD,
'raw': 'postmsg',
'channel': 'messages',
'data': {
'msg': instance.msg,
'posted_by': instance.posted_by,
'timestamp': str(instance.timestamp)
def ajaxsubmit(request):
new_msg = Message(msg = request.POST['msg'],
posted_by = request.POST['posted_by'])
new_msg.save()
# Again, we're just going to assume this always works
cmd = [{'cmd': 'inlinepush',
'params': {
'password': settings.APE_PASSWORD,
'raw': 'postmsg',
'channel': 'messages',
var client = new APE.Client();
client.load();
client.addEvent('load', function() {
posted_by = prompt('Your name?');
client.core.start({"name": posted_by});
$("input[name='posted_by']").val(posted_by);
});
client.addEvent('ready', function() {
def show_messages(request):
messages = Message.objects.all()
return render_to_response('messages.html', {'messages': messages})
def ajaxsubmit(request):
new_msg = Message(msg = request.POST['msg'],
posted_by = request.POST['posted_by'])
new_msg.save()
jsonified_msg = serializers.serialize("json", [new_msg])
# Again, we're just going to assume this always works
function append_message(data) {
fields = data[0].fields;
message_str = fields.msg + '\nPosted by: <strong>'
+ fields.posted_by + '</strong> on: '
+ fields.timestamp;
new_div = $('<div />').addClass('message').html(message_str);
$('div#current_messages').append(new_div);
}
$('#msgform').submit(function() {