Skip to content

Instantly share code, notes, and snippets.

View scheduled_thermostat.yaml
name: Set thermostat temperature at specific time
description: Sets a Thermostat to a specifc temperature at a certain time everyday
domain: automation
name: Time
View googledoorbellblueprint.yaml
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
domain: automation
name: Doorbell
description: This is the doorbell binary sensor
logikal /
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 / cent6.log
Created November 7, 2017 17:57
seccomp & bpf support between cent6 and cent7
View cent6.log
[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 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 /
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)
logikal / Dubai_HoE.txt
Created October 6, 2016 16:29
Head of Engineering - Devops (Dubai)
View Dubai_HoE.txt
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 / ttl_warn_to_crit.rb
Created July 25, 2016 23:02
A sensu mutator to turn warnings into criticals when the TTL has expired.
View ttl_warn_to_crit.rb
#!/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
# Cribbed from the example at
require 'json'
logikal / consul.json
Last active May 24, 2016 19:12
y u no statsd, consul?
View consul.json
"data_dir": "/var/lib/consul/",
"addresses": {
"rpc": ""
"ports": {
"dns": 8600,
"http": 8500,
"rpc": 8400,
"serf_lan": 8301,
View neighbor.c.diff
@@ -290,15 +290,7 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device
goto out_entries;
- if (tbl->entry_size)
- n = kzalloc(tbl->entry_size, GFP_ATOMIC);
- else {
- int sz = sizeof(*n) + tbl->key_len;