Skip to content

Instantly share code, notes, and snippets.

diff --git a/homeassistant/components/homekit_controller/config_flow.py b/homeassistant/components/homekit_controller/config_flow.py
index ac840eb068..21631b9ec5 100644
--- a/homeassistant/components/homekit_controller/config_flow.py
+++ b/homeassistant/components/homekit_controller/config_flow.py
@@ -3,16 +3,18 @@ from __future__ import annotations
import logging
import re
+import struct
from typing import Any
@Jc2k
Jc2k / geoip.rb
Created March 3, 2021 12:55
Version of logstash-filter-geoip that reloads automatically
# In your Dockerfile:
# COPY geoip.rb /usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-filter-geoip-6.0.3-java/lib/logstash/filters/geoip.rb
# encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"
require "logstash-filter-geoip_jars"
# The GeoIP filter adds information about the geographical location of IP addresses,
@Jc2k
Jc2k / connection.py
Last active March 24, 2020 17:12
Extra instrumentation
#
# Copyright 2019 aiohomekit team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@Jc2k
Jc2k / connection.py
Last active March 19, 2020 17:27
homekit_controller fixes
#
# Copyright 2019 aiohomekit team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@Jc2k
Jc2k / walkthrough.md
Last active November 20, 2017 05:51
Installing cowrie with systemd on Ubuntu 16.04

This is a quick demo of using twisted enpoints with cowrie to be able to use systemd socket activation. This has been tested on a fresh install of Ubuntu 16.04.2:

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-62-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

Last login: Tue May 2 23:47:09 2017
@Jc2k
Jc2k / post.md
Last active June 27, 2018 07:02
My first alexa skill

Backend

I used the alexandra python package. See https://pypi.python.org/pypi/alexandra. It abstracts away dealing with HTTP or Lambda and you just use decorators to map Alexa intents to python functions. Here is my test.py:

import alexandra

app = alexandra.Application()
name_map = {}

@app.launch

@Jc2k
Jc2k / find_tags.py
Created March 21, 2016 14:05
Find the first tag a file was in and the last tag it was changed in
import subprocess
tags = [
subprocess.check_output(["git", "rev-list", "--max-parents=0", "HEAD"]).strip()
]
tags.extend(
subprocess.check_output(["git", "tag", "-l"]).split(),
)
added = {}
@Jc2k
Jc2k / newrelic_to_git.py
Created March 21, 2016 11:31
Generate a git repo out of a python packages releases
import os
import subprocess
import sys
import requests
from pip.index import PackageFinder
p = PackageFinder([], ["https://pypi.python.org/simple"], session=requests.Session())
versions = p._find_all_versions("newrelic")
versions = sorted(
versions,
@Jc2k
Jc2k / schedule.py
Last active April 1, 2016 13:06
Get totals for how many hours an engineer spends on call for a given PagerDuty schedule
from __future__ import print_function, division
from decimal import Decimal
import argparse
import datetime
import getpass
import sys
from dateutil.parser import parse
from dateutil.relativedelta import relativedelta
@Jc2k
Jc2k / .bash_profile
Last active March 24, 2024 14:42
GPG Cheat Sheet
if [ -f "${HOME}/.gpg-agent-info" ]; then
. "${HOME}/.gpg-agent-info"
export GPG_AGENT_INFO
export SSH_AUTH_SOCK
export SSH_AGENT_PID
fi