Skip to content

Instantly share code, notes, and snippets.

View vladak's full-sized avatar

Vladimir Kotal vladak

  • Europe
View GitHub Profile
@vladak
vladak / safemode.py
Created April 16, 2024 19:44 — forked from anecdata/safemode.py
CircuitPython 8 safemode.py
# SPDX-FileCopyrightText: 2023 anecdata
#
# SPDX-License-Identifier: MIT
import json
import microcontroller
import supervisor
from ⚙️ import *
@vladak
vladak / opengrok-issue-4317.md
Last active February 9, 2024 12:58
opengrok issue 4317

more notes for oracle/opengrok#4317

Using the code fixed to perform correct Path comparisons in both places (on the set of files from FileCollector as well as in IndexDatabase#processFileIncremental(), the script number 3 (oracle/opengrok#4317 (comment)) this still leads to cases with duplicate documents. This does not happen every time, it might be timing related.

The script goes through solaris-userland Git repository using particular sequence of changesets that were previously known to reproduce the duplicate documents (before the Path comparator fixes): 3b039b16f 170ebb43b 80cc6ae18 52c217090 a609ca278 69a8daead 07e01a4e6 154009177 794af3182 c073248f7 823f2c28e 4a5e3cb85 341f9beb2 653378bce 4f8fe9ee8

Changes to the code:

diff --git a/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDatabase.java b/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDat
@vladak
vladak / apache-revproxy.conf
Last active May 26, 2023 12:26
Apache reverse proxy configuration for OpenGrok
LoadModule proxy_module libexec/mod_proxy.so
LoadModule proxy_http_module libexec/mod_proxy_http.so
# Assuming OpenGrok was deployed to /source and the application server listens for plain HTTP on port 8080.
<IfModule mod_proxy.c>
# The number of seconds Apache httpd waits for data sent by / to the backend.
# This should match the `interactiveCommandTimeout` setting in OpenGrok.
ProxyTimeout 600
ProxyPass /source/ http://localhost:8080/source/
@vladak
vladak / APC-NetBotz-Grafana.md
Last active May 16, 2023 09:28
APC NetBotz temperature/humidity monitoring with Grafana

The APC NetBotz computer lab monitoring units allow SNMP access. This gist summarizes how to collect and present the metrics from these units via Grafana.

The units look like this: APC Netbotz 200

APC Sensor Pod

The result looks like this: Grafana dashboard

This was tested for APC NetBotz Rack Monitor 200 with bunch of APC NetBotz Sensor Pod 150 attached.

@vladak
vladak / circuit_python_logging.md
Last active December 16, 2022 19:42
CircuitPython logging vs CPython logging

CircuitPython logging vs CPython logging

Note: this was written before support for multiple handlers per logger was added to CircuitPython logging.

Logger hierarchy

In CPython, there is a hierarchy of loggers. Each logger except the root logger has a parent. When a log record is handled for particular logger, the hierarchy is traversed until either the propagate flag of given logger is found to be False, or root logger is encountered.

@vladak
vladak / snmp_exporter-service.md
Created September 11, 2022 20:34
SNMP exporter service

SNMP exporter service

This is meant for Debian/Ubuntu.

wget -O /tmp/snmp_exporter.tgz \
    https://github.com/prometheus/snmp_exporter/releases/download/v0.20.0/snmp_exporter-0.20.0.linux-armv7.tar.gz
sudo mkdir -p /srv/snmp_exporter
sudo chown pi:pi /srv/snmp_exporter
@vladak
vladak / 1-grafana-truenas.md
Last active September 11, 2022 20:38
TrueNAS dashboard for Grafana

TrueNAS dashboard for Grafana

This setup is basically using the configuration from https://crashlaker.github.io/2021/10/09/truenas_snmp_exporter.html

It assumes Prometheus as data backend. Also, nas.local is the NAS machine hostname used throughout this Gist.

This note is a bit of a experiment with Gists.

The end result looks like this: grafana-NAS

@vladak
vladak / solokey-ssh.md
Last active June 24, 2022 07:23
Solokey setup for SSH

This is meant for Ubuntu 20.04.4 LTS and Solokey Somu

The purpose of the key is backup key (in case all my Yubikeys and smart phone get lost), hence the resident SSH key and 2FA setup for the Github account.

Initial setup

python3 -m venv env
. ./env/bin/activate
@vladak
vladak / sun-booklet.md
Last active April 27, 2022 07:05
Sun Microsystems - What we must do

Sun Microsystems - What we must do

A 2005 booklet with mission statement from Scott McNealy.


What we must do.

Participate or perish ?

@vladak
vladak / 1-pf-grafana.md
Last active May 12, 2023 09:37
setup for PF monitoring in Grafana

Presenting PF counters in Grafana

using https://yetiops.net/posts/openbsd-snmp-exporter/

The goal is to present basic metrics such as bytes passed through the external interface of the router. The main idea is to run SNMP on the OpenBSD router that can get the metrics from PF. Then SNMP exporter from Prometheus will convert the data to Prometheus format that can be scraped by Grafana.

The constraint is that this should be done in reasonably secure way: the IoT devices are in separate VLAN, however the router should have miminal exposure. Using snmpd with privilege separation and in flight data protection is sufficient. Further, the data collection and graphing will be done on single machine.

The result looks like this: Grafana PF dashboard