Skip to content

Instantly share code, notes, and snippets.

View johananl's full-sized avatar

Johanan Liebermann johananl

View GitHub Profile
@johananl
johananl / grafana.service
Created May 31, 2020 17:02
Monitoring a Flatcar node using Prometheus, Grafana and Node Exporter
[Unit]
Description=Grafana
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
Restart=always
ExecStartPre=-/usr/bin/docker stop %n
ExecStartPre=-/usr/bin/docker rm %n
@johananl
johananl / README.md
Created February 21, 2024 13:26
Linux CPU monitoring

Linux CPU monitoring

watch -n 0.5 "cat /proc/cpuinfo | grep MHz && echo && sensors"
watch cat /sys/devices/system/cpu/cpu{0..7}/cpufreq/cpuinfo_max_freq
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
watch -n 0.5 sudo tlp-stat -p
@johananl
johananl / script.sh
Created February 17, 2023 10:14
Build Flatcar CAPI images (OVA) for vSphere
# Generate a Packer var file
cat <<EOF > packer-ova.json
{
"vcenter_server":"vcenter.example.com",
"username":"me",
"password":"mypass",
"datacenter": "DC",
"datastore":"Datastore",
"folder": "foo",
"cluster": "10.1.2.3",
@johananl
johananl / README.md
Last active February 9, 2023 04:39
Debugging iPXE + HTTPS

Debugging iPXE image Download over HTTPS

Build iPXE

Get the source:

git clone git://git.ipxe.org/ipxe.git
@johananl
johananl / fix-dns.sh
Created June 27, 2022 07:43
Set WSL DNS to Windows host
#!/bin/bash
set -x
set -eou pipefail
gw=$(ip route | grep default | awk {'print $3'})
echo Fixing DNS
chattr -i /etc/resolv.conf
@johananl
johananl / alacritty.yml
Created May 4, 2022 15:37
Solarized Dark color scheme for Alacritty
# Colors (Solarized Dark)
colors:
# Default colors
primary:
background: '#002b36' # base03
foreground: '#839496' # base0
# Cursor colors
cursor:
text: '#002b36' # base03
@johananl
johananl / main.go
Created March 28, 2022 19:09
A good retry loop in Go
const maxAttempts = 10
const retryIntervalSeconds = 5
var sshConnected bool
log.Printf("Connecting to VM using SSH")
for i := 0; i < maxAttempts; i++ {
if i > 0 {
time.Sleep(time.Second * retryIntervalSeconds)
@johananl
johananl / README.md
Created October 30, 2018 20:14
KVM in runc

KVM in runc

Running a KVM virtual machine inside a runc contianer.

Requirements

  • A host which can run KVM virtual machines using Vagrant.

Setting up a test VM

@johananl
johananl / launch.json
Last active December 6, 2021 15:32
Debugging Go unit tests with Delve in VS Code
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/bootstrap/kubeadm/internal/controllers",
"args": [
@johananl
johananl / README.md
Last active November 17, 2021 12:03
Manipulating Google Calendar events using Python