Skip to content

Instantly share code, notes, and snippets.

@krisek
krisek / README.md
Last active January 2, 2025 23:47
Home Assistant on 32bit raspbian on RPi 3 with a smaller SD card

The problem...

Home Assistant cannot really build anymore on a raspbian Raspberry Pi 3: you need to install pyenv to get Python 3.13 and all build dependencies, it takes easilly 1-2 GB and even, the build process requires so much RAM that it simply fails.

An alternative would be to use podman/docker to run Home Assistant, but these containerization solutions do use so much disk, there is no way to start a Home Assistant container on a 8GB SD-card.

Hence I came up with some hacking to overcome this problem, fasten your seat belts, it will be a few steps.

@krisek
krisek / proxy-config.yaml
Created October 25, 2023 14:28
Simpistic Squid forward proxy replacement with Envoy
admin:
access_log_path: /dev/stdout
address:
socket_address:
address: 127.0.0.1
protocol: TCP
port_value: 9901
static_resources:
listeners:
- name: listener_0
@krisek
krisek / gist:447efef5baa3fe3d993504de0548b561
Created December 20, 2022 07:13
ZeroTier basic Hub and Spoke
# Create a tag for which department someone is in
tag department
id 1000 # arbitrary, but must be unique
enum 100 spoke # has no meaning to filter, but used in UI to offer a selection
enum 200 hub
;
# Whitelist only IPv4 (/ARP) and IPv6 traffic and allow only ZeroTier-assigned IP addresses
drop # drop cannot be overridden by capabilities
not ethertype ipv4 # frame is not ipv4
@krisek
krisek / matrix-webhook.py
Last active January 2, 2022 11:34
Matrix webhook
#!/usr/bin/env python3
"""
Matrix Webhook.
Post a message to a matrix room with a simple HTTP POST
"""
import asyncio
import json
import os
@krisek
krisek / kyverno_vpa.yaml
Last active September 6, 2021 06:19
kyverno_vpa.yaml
apiVersion: autoscaling.k8s.io/v1
kind: VerticalPodAutoscaler
metadata:
name: kyverno
spec:
targetRef:
apiVersion: "apps/v1"
kind: Deployment
name: kyverno
updatePolicy:
@krisek
krisek / nettols.md
Last active May 12, 2023 13:21
Most important connectivity test and network discovery tools

Most important connectivity test and network discovery tools

Netcat

Package: netcat-openbsd

Connect to a server on a given IP and port (telnet on steroids)

nc 10.10.2.1 80
import json
import requests
import os
import re
import hashlib
templates = {
'slack': {},
'teams': {
@krisek
krisek / route_tables.py
Created March 21, 2021 21:49
Cartography EC2 route_tables ingest draft
import logging
from typing import Dict
from typing import List
import boto3
import neo4j
from .util import get_botocore_config
from cartography.util import aws_handle_regions
from cartography.util import run_cleanup_job
@krisek
krisek / default
Created March 21, 2021 13:35
default nginx config to reverse proxy prometheus and grafana
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# https://www.nginx.com/resources/wiki/start/
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
# https://wiki.debian.org/Nginx/DirectoryStructure
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
@krisek
krisek / alert.rules.yml
Last active December 30, 2024 10:10
Prometheus alert rules for node exporter
groups:
- name: node_exporter_alerts
rules:
- alert: Node down
expr: up{job="monitoring-pi"} == 0
for: 2m
labels:
severity: warning
annotations:
title: Node {{ $labels.instance }} is down