Skip to content

Instantly share code, notes, and snippets.

View vladak's full-sized avatar

Vladimir Kotal vladak

  • Europe
View GitHub Profile
@vladak
vladak / guide.md
Created September 12, 2024 05:45 — forked from Kranzes/guide.md
SSH Resident Key Guide

Initial checks

Start by checking that there aren't any previous ssh keys inside the FIDO2 authenticator of your YubiKey. You can check if they exist by running the command below:

nix shell nixpkgs#yubikey-manager -c ykman fido credentials list

If the command above outputs a string mentioning "ssh" or "openssh", then you have already got a key generated and store on your YubiKey.

Evaluating additional authentication factors

Before generating a new ssh key to store on your YubiKey you must consider which additional required authentication factors you want to use. Below you can see a table with the available factors and their corresponding command:

@vladak
vladak / tar-trivial.md
Last active May 24, 2024 13:11
trivial example of how tar creates uncompressed archive

Firstly, let's create a file of 512 bytes, i.e. matching the tar block size exactly, full of 'A' characters:

$ python3 -c 'print("A" * 512, end="")' > 512A.out

We can see that the length of the file is indeed 512 bytes and that the contents match our expectations:

$ ls -ld 512A.out 
@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 October 2, 2024 19:33
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