Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am sdague on github.
  • I am sdague (https://keybase.io/sdague) on keybase.
  • I have a public key whose fingerprint is 4134 CF35 4470 6F86 DFB1 3746 1CAC 45A6 9FE5 AF45

To claim this, I am signing this object:

@sdague
sdague / imaway
Last active March 8, 2022 06:23
dbus xchat integration
#!/usr/bin/python
import dbus
import dbus.glib
import gobject
import subprocess
def lock():
print "Screen saver turned on"
#!/bin/sh
#
# usage: import-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t P,, -n "$REMHOST" -i $REMHOST
#!/usr/bin/python
import logging
import subprocess
import threading
import time
from contextlib import contextmanager
FORMAT = '%(asctime)-15s %(message)s'
@sdague
sdague / gist:4f22ae38b8a4048d8ceb
Created March 13, 2015 18:02
Fastmail sync script
#!/usr/bin/python
import difflib
import re
import bs4
import mechanize
import yaml
cfg = yaml.load(open("account.yaml", 'r'))
(defun insert-apl ()
"Insert standard Apache License header"
(interactive)
(let ((comment-style 'multi-line)
(comment-empty-lines t)
(apache
(concat "Copyright 2015 Hewlett-Packard Development Company, L.P.
Licensed under the Apache License, Version 2.0 (the \"License\"); you may
not use this file except in compliance with the License. You may obtain
#!/bin/bash
set -x
set -e
function install_in_venv {
local name=$1
local bins=$2
local venv=~/bin/.venv-$name
virtualenv $venv
arwn/wind {"bat": 9, "sig": 4, "timestamp": 1453139607.153499, "gust": 5.7, "speed": 4.8, "direction": 270, "id": "33:00"}
arwn/temperature/outdoors {"bat": 9, "humid": 33, "temp": -2.2, "timestamp": 1453139610.242939, "sig": 5, "id": "ec:01"}
arwn/temperature/office {"bat": 9, "humid": 33, "temp": 18.8, "timestamp": 1453139610.294258, "sig": 5, "id": "07:05"}
arwn/temperature/refrigerator {"bat": 9, "humid": 44, "temp": 5.2, "timestamp": 1453139611.633153, "sig": 6, "id": "8c:00"}
arwn/barometer {"pressure": 1004, "bat": 9, "sig": 6, "id": "8c:00", "timestamp": 1453139611.637239}
arwn/unknown/e9:04 TempHumid [subtype=THGR810, THGN800, seqnbr=47, id=e9:04, temp=8.9, humidity=19, humidity_status=2, battery=9, rssi=6]
arwn/wind {"bat": 9, "sig": 5, "timestamp": 1453139621.155715, "gust": 3.8, "speed": 4.8, "direction": 292, "id": "33:00"}
arwn/unknown/8b:06 TempHumid [subtype=THGR810, THGN800, seqnbr=49, id=8b:06, temp=-21.3, humidity=37, humidity_status=2, battery=9, rssi=5]
arwn/temperature/subaru {"bat": 9,
import json
import logging
from homeassistant.helpers.entity import Entity
import homeassistant.components.mqtt as mqtt
from homeassistant.const import (TEMP_FAHRENHEIT)
from homeassistant.util import slugify
DEPENDENCIES = ['mqtt']
import json
import logging
from homeassistant.helpers.entity import Entity
import homeassistant.components.mqtt as mqtt
from homeassistant.const import (TEMP_FAHRENHEIT)
from homeassistant.util import slugify
DEPENDENCIES = ['mqtt']