Skip to content

Instantly share code, notes, and snippets.

@logikal
logikal / mqttknob.yaml
Last active December 18, 2024 23:42
a HomeAssistant automation for using an MQTT smart knob for controlling the volume of a media_player
alias: "Knob: Volume Up/Down"
description: "Knob: Volume Up/Down"
triggers:
- domain: mqtt
device_id: 96d04892651a90bd5c81cd7211453052
type: action
subtype: brightness_step_up
trigger: device
- domain: mqtt
device_id: 96d04892651a90bd5c81cd7211453052
@logikal
logikal / docker-compose.llms.yaml
Last active June 27, 2024 15:53
docker compose for locally hosted llms with tailscale
services:
# More info on using tailscale like this can be found in the
# tailscale blog entry about it: https://tailscale.com/blog/docker-tailscale-guide
ts-aichat-server:
image: tailscale/tailscale:latest
container_name: ts-aichat-server
hostname: aichat
environment:
- TS_AUTH_KEY=tskey-auth-REPLACEME
- TS_EXTRA_ARGS=--advertise-tags=tag:container --reset
blueprint:
name: Set thermostat temperature at specific time
description: Sets a Thermostat to a specifc temperature at a certain time everyday
domain: automation
input:
time_to_set:
name: Time
selector:
time:
climate_entity:
blueprint:
name: Doorbell - Notify Google and send camera snapshot to app
description: 'Make an announcement over Google devices when the doorbell is pushed and send a camera snapshot to your app.'
# from https://community.home-assistant.io/t/doorbell-notify-google-and-send-camera-snapshot-to-app/257953
domain: automation
input:
doorbell:
name: Doorbell
description: This is the doorbell binary sensor
@logikal
logikal / ntp_drift_reporter.sh
Created November 21, 2018 03:24
Ever wondered how far off your clock was? now you can know.
#!/usr/bin/env bash
# finds the maximum clock drift in the last 30 days
# using the stats files kept in /var/log/ntpstats
# We need somewhere temporary to keep our concatenated results
TMPFILE=$(mktemp) || exit 1
FILELIST=$(find /var/log/ntpstats/ -mtime -31 -type f)
cut -d' ' -f 5 $FILELIST| sort -g > $TMPFILE
@logikal
logikal / cent6.log
Created November 7, 2017 17:57
seccomp & bpf support between cent6 and cent7
[vagrant@seccomp-centos-6-chef-12-kitchen ~]$ cat /etc/redhat-release
CentOS release 6.8 (Final)
[vagrant@seccomp-centos-6-chef-12-kitchen ~]$ uname -a
Linux seccomp-centos-6-chef-12-kitchen.vagrantup.com 2.6.32-642.4.2.el6.x86_64 #1 SMP Tue Aug 23 19:58:13 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
[vagrant@seccomp-centos-6-chef-12-kitchen ~]$ gcc -H -fsyntax-only test.c
. /usr/lib/gcc/x86_64-redhat-linux/4.4.7/include/stdbool.h
. /usr/include/stdio.h
.. /usr/include/features.h
... /usr/include/sys/cdefs.h
@logikal
logikal / graphite_traps.sh
Last active August 2, 2017 23:15
using traps to send graphite metrics in bash scripts
#!/usr/bin/env bash
starttime=$(date +%s)
########
# Set up a set of functions and traps that will emit duration and error counts for this script on exit.
# expects that $GRAPHITE_HOST is set in the environment.
function emit_duration {
endtime=$(date +%s)
duration=$(($endtime-$starttime))
@logikal
logikal / Dubai_HoE.txt
Created October 6, 2016 16:29
Head of Engineering - Devops (Dubai)
Dear $PERSON,
I hope you're well and don't mind me contacting you directly like this. How are things going at $JOB? I see you've been there a while, so was keen to reach out about an opportunity based here in Dubai that you look great for, for a Head of Engineering - DevOps project!
Our client is backed by the people that built the worlds tallest building, the Burj Khalifa and their about to have a similar impact on the Digital space, by building a world class E-Commerce Platform. They have the biggest Polymer/Scala project taking off Globally at the moment.
They have already attracted top talent from some of the biggest Digital organisations in the world, and now they are building an elite Development Team. I wanted to speak to you about a Head of Engineering role I have here that I thought you would be a good fit for?
Based in Dubai, a stunning package is on offer that includes –
Very competitive tax-free salary
@logikal
logikal / ttl_warn_to_crit.rb
Created July 25, 2016 23:02
A sensu mutator to turn warnings into criticals when the TTL has expired.
#!/usr/bin/env ruby
#
# Mutate TTL results with warnings to critical status
# Because Sensu hardcodes a stale TTL check to status=1
# we'll never get paged for TTL failures.
# Refer to https://github.com/sensu/sensu/issues/1166
#
# Cribbed from the example at https://sensuapp.org/docs/0.25/reference/plugins.html#example-plugins
require 'json'