Skip to content

Instantly share code, notes, and snippets.

View danielperna84's full-sized avatar

Daniel Perna danielperna84

  • QGroup GmbH
  • Frankfurt am Main, Germany
View GitHub Profile
@danielperna84
danielperna84 / README.md
Created December 21, 2020 16:58
Unseal HashiCorp Vault using systemd

Automatically unseal HashiCorp Vault via systemd

WARNING!

Automatically unsealing Vault drastically reduces the security of the stored secrets. That being said, there might be scenarios, in which this simple approach could be useful / sufficient.

How it works / installation

This requires Vault to be started by a systemd-unit named vault.service, which typically is the case when installing from a distribution package. The script vault-unseal.sh should be placed in /root and secured with 700 permissions.

import time
import logging
import threading
from xmlrpc.server import SimpleXMLRPCServer
from xmlrpc.server import SimpleXMLRPCRequestHandler
import xmlrpc.client
LOG = logging.getLogger(__name__)
#### Configuration for CCU ####
@danielperna84
danielperna84 / uds_socketserver.py
Created April 3, 2019 16:10
Python Unix Domain Socket SocketServer with ThreadingMixin and Multiprocessing
#!/usr/bin/python
import os
import sys
import time
import signal
import logging
import multiprocessing
from multiprocessing import Process
import SocketServer
@danielperna84
danielperna84 / pyhomematic_ccu3.py
Last active November 26, 2018 21:59
Tests for CCU3 + pyhomematic (authentication + SSL)
#!/usr/bin/python3
import logging
from pyhomematic import HMConnection
logging.basicConfig(level=logging.WARNING)
DEVICE = "KEQ1234567:1"
PARAMETER = "STATE"
CONNECTIONDATA = {
"ccu3test": {
"ip": "192.168.1.23",
@danielperna84
danielperna84 / haws.html
Last active April 10, 2018 17:59
Home Assistant HTML WebSocket API client with authentication
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="A web interface for Home Assistant with WebSocket">
<title>Home Assistant with WebSocket</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<script src='http://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script>
<script type="text/javascript">
@danielperna84
danielperna84 / getfit.py
Last active December 29, 2021 13:35 — forked from cedricbonhomme/getfit.py
Get total step count from Google Fit API for current day
#! /usr/bin/env python
#-*- coding: utf-8 -*-
import json
import httplib2
import time
from datetime import datetime
from datetime import timedelta
from apiclient.discovery import build