Skip to content

Instantly share code, notes, and snippets.

@asciipip
asciipip / tirex-queue
Last active December 19, 2015 20:09
Script for rerendering all of my tirex tiles.
#!/bin/sh
# Extent of the rendering database; tiles outside this are pointless.
latlon="lon=-125.0841,-66.9251 lat=24.2520,49.3845"
for map in cutouts; do
# rerender everything that's expired.
for z in `seq 2 16`; do
prio=$(calc 70 - $z)
tirex-batch -f 'exists;older(/var/lib/tirex/tiles/planet-import-complete)' -p $prio $latlon map=$map z=$z
@asciipip
asciipip / MPL115A2.py
Last active April 10, 2021 06:25
Python class for communicating with a MPL115A2 I2C digital barometer/temperature sensor. Uses the Adafruit_I2C class from the Adafruit Raspberry Pi Python Code: https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code .
#!/usr/bin/python
# Author: Phil! Gold <[email protected]>
# License: CC0 Waiver http://creativecommons.org/publicdomain/zero/1.0/
import time
from Adafruit_I2C import Adafruit_I2C
class _MPL115A2_Register:
#!/usr/bin/python
import random
import string
UNAMBIGUOUS_LETTERS = list(set(string.ascii_lowercase) - set('ilou'))
def randid():
"""Creates a random ID space with three modified
base32 characters and one number in random order for
#!/usr/bin/python
import random
import string
UNAMBIGUOUS_LETTERS = list(set(string.ascii_lowercase) - set('ilou'))
def randid_worker(params):
"""PARAMS is a collection of (SET, COUNT) pairs. The function returns
a collection of COUNT_0 + COUNT_1 + ... COUNT_n items, drawn from the
@asciipip
asciipip / README.md
Created December 14, 2015 02:25
OpenHAB Alarm Definition

This defines a rule that allows for a "sunrise" style alarm. Basically, you trigger it by setting the Alarm_Trigger item to a value that defines parameters for the alarm:

  • duration gives the length of the alarm in minutes
  • light gives the minimum and maximum brightness values over the course of the alarm, e.g. light=0,75.
  • temp gives the range of color temperatures over the course of the alarm, e.g. temp=2700,5000

Add dimmers to the Alarm_Dimmers group. Add Number items for color temperature to the Alarm_Temps group. Any switches in the Alarm_Switches group will be turned on at the end of the alarm.

The Alarm_Running item serves as a UI element to halt a running alarm. Just turn it OFF while the alarm is running,

@asciipip
asciipip / primes.lisp
Last active December 5, 2016 01:16
Common Lisp prime testing
;;;; Needs the iterate package.
(defmacro maybep (&body body)
"Give this a series of forms. It will return the result of the first one that
yields T or NIL. Any other result will cause the next form to be evaluated.
Short-circuits like IF or COND."
(labels ((maybep-expand (forms)
(if (endp forms)
`(error "All evaluated forms yielded MAYBE.")
`(let ((result ,(car forms)))
@asciipip
asciipip / well-heads.geojson
Last active May 22, 2017 18:27 — forked from anonymous/overpass.geojson
Well Heads for the Accident Natural Gas Storage Facility
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asciipip
asciipip / tiber_river.geojson
Last active May 29, 2018 14:28
Watershed of the Tiber River
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asciipip
asciipip / weekday_alarm.toml
Created April 11, 2019 18:47
The morning alarm script I use with `oh-set-gradually`.
#### Normal use: start at 6:00 am
[rest]
host = "openhab.example.com"
port = 8080
[monitor]
item = "morning_alarm_running"
initialize = "ON"
stop_on = "OFF"

Keybase proof

I hereby claim:

  • I am asciipip on github.
  • I am asciiphil (https://keybase.io/asciiphil) on keybase.
  • I have a public key whose fingerprint is D200 5BDB FC4B B24A 9248 9F7A 4322 2D22 026A 27F2

To claim this, I am signing this object: