Skip to content

Instantly share code, notes, and snippets.

@jterrace
jterrace / git-annex-gcs.sh
Last active September 8, 2021 22:09
An example of how to use Google Cloud Storage with git-annex
# Initialize git and git-annex
$ mkdir annex-gcs-test
$ cd annex-gcs-test/
$ git init
Initialized empty Git repository in /Users/jterrace/annex-gcs-test/.git/
$ git annex init "my machine"
init my machine ok
(Recording state in git...)
# Set up AWS credentials
@jterrace
jterrace / distribute_chips.py
Created September 20, 2018 04:10
Programmatically determine how to distribute your chips for Take Your Chances game
import sys
DICE_SIDES = 6
distribution = [0] * DICE_SIDES
for d1 in range(1, DICE_SIDES + 1):
for d2 in range(1, DICE_SIDES + 1):
delta = abs(d1 - d2)
distribution[delta] += 1
distribution = [
@jterrace
jterrace / calendar2eink.js
Last active January 22, 2025 08:01
node-red code to pull calendar and push to eink
// Formats the given Date and returns map with format string parts.
const makeTimeFormatMap = function(date) {
const tz = Intl.DateTimeFormat().resolvedOptions().locale;
const dateTimeFormat = new Intl.DateTimeFormat(tz, {
month: 'short',
day: 'numeric',
weekday: 'short',
hour: 'numeric',
minute: 'numeric',
hour12: true,
blueprint:
name: Send actionable notifications for Android with Camera Snapshot
description: >
Send actionable notifications to an Android device. Customized from vorion's blueprint.
Changes
- Remove notify_device integration requirement to allow notify groups to be used.
- Removed trigger_entity domain input_boolean requirement. Removed reset of input_boolean from actions. (For use in detecting doorbell rings from sensor)
- Added camera snapshot for doorbell capture (required).
For each action, you can open an URL, an application on the device or load a lovelace view/dashboard.