Skip to content

Instantly share code, notes, and snippets.

@caelor
caelor / satip-vtuner ubuntu
Last active July 11, 2023 18:18
Steps to get the satip/vtuner combination working on Ubuntu 14.10 - this makes a SatIP server appear as 4 local DVB-S2 tuners
Starting from Ubuntu 14.10 Server clean install
Set up:
> sudo mkdir /opt/satip
> sudo chown <user> /opt/satip
> sudo apt-get install git build-essential linux-source linux-headers-$(uname -r)
> cd /opt/satip
> git clone https://code.google.com/p/satip/
> tar xjvf /usr/src/linux-source-3.16.0/linux-source-3.16.0.tar.bz2
(extracts into /opt/satip/linux-source-3.16.0/)
@caelor
caelor / simple-timemachine.sh
Last active June 22, 2023 15:03
Simple, opinionated BTRFS snapshot "time machine".
#!/bin/bash
# Opinionated "timemachine" backups using btrfs snapshots
#
# Andy Boff, 2023-06-18. GPLv3
# No warranty - do your own testing to be confident it works for you
#
#
# Intended for use on a quiet home NAS where the drives are
# hopefully spun down most of the time. If the disks have not
set comment "Read source data. pi=power in, po=power out, pn=power net"
sensor pi_raw node1 @powerNetIn
sensor po_raw node1 @powerNetOut
op sub pn_raw pi_raw po_raw
set comment "Read min/max from memory cell. 0=pi_max, 1=po_max, 2=pn_max, 3=pn_min"
read pi_max cell1 1
read po_max cell1 2
read pn_max cell1 3
read pn_min cell1 4
set comment "update pi_max if needed"
@caelor
caelor / scene_controller.py
Last active November 15, 2018 12:04
Home Assistant Scene Controller Component
"""
Component to offer scene recording and tracking. Compatible with existing
services as much as possible (e.g. scene_controller.select_option works
the same as input_select.select_option). The scene controller will track
the current scene, and light values, and optionally update the scene
record to match the current values.
"""
import logging
import voluptuous as vol
#!/usr/bin/env python
# Script to read DOCSIS stats from a VM SuperHub 2ac in Modem mode,
# and insert them into an InfluxDB database (e.g. for graphing)
#
# Intended to be run every minute by cron job.
# Based on https://github.com/edent/SuperHub/blob/master/SuperHubStats.py
# Adapted for InfluxDB and Modem mode
from bs4 import BeautifulSoup

Keybase proof

I hereby claim:

  • I am caelor on github.
  • I am andy_boff (https://keybase.io/andy_boff) on keybase.
  • I have a public key whose fingerprint is 2569 B955 B44C C5DD 0F21 3119 7511 328A 7E48 0F9F

To claim this, I am signing this object:

@caelor
caelor / Install Notes
Created May 1, 2015 08:27
OpenWRT mr3020 Switchable configs on boot
1) Create the files /root/switchable_config.sh and /etc/init.d/modeswitch
2) /etc/init.d/modeswitch enable to enable the config
@caelor
caelor / ask.sh
Last active August 29, 2015 14:11
Bash "ask" function, modified to force reading from controlling terminal. This makes it suitable for using in "while read line; do ... done < $(file)" loops (that direct the file into stdin)
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"