Skip to content

Instantly share code, notes, and snippets.

View xanderificnl's full-sized avatar
💭
Rest In Piece Xander 13-09-2023

Xander xanderificnl

💭
Rest In Piece Xander 13-09-2023
View GitHub Profile
@xanderificnl
xanderificnl / usage.md
Created September 5, 2023 18:28
Keychron VIA configuration (linux | fedora)

In short:

You'll need to give write acess to the correct /dev/hidrawN device and possibly turn off SELinux enforcing while you're running the VIA app, be sure to turn it back on afterwards.

Steps

  • You need a chromium-based browser
  • Go to usevia.app and load the device, if all is well: great.

When it fails:

@xanderificnl
xanderificnl / quickstart.md
Created August 12, 2023 07:05
asdf + java + jruby + openhab automations

Java

asdf plugin add java
asdf install java adoptopenjdk-jre-17.0.7+7 
echo '. "$HOME/.asdf/plugins/java/set-java-home.bash"' | tee -a ~/.bashrc
source ~/.bashrc

Ruby

@xanderificnl
xanderificnl / butane-segment.yaml
Created August 7, 2023 11:52
Fedora CoreOS mDNS resolving via systemd-resolved
- path: /etc/systemd/resolved.conf
overwrite: true
contents:
inline: |
# enables mDNS resolving...
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it under the
# terms of the GNU Lesser General Public License as published by the Free
{
"network": {
"wifi": {
"ssid": "XiFi",
"password": ""
}
},
"mqtt": {
"server": {
"host": "192.168.88.253",
@xanderificnl
xanderificnl / easyenergy.rb
Created July 20, 2023 01:05
Fetch EasyEnergy prices (for openhab-jruby)
# Group EnergyMarkets "Energy Markets"
# Group NaturalGasMarketPrices "Natural Gas" (EnergyMarkets)
# Group EnergyMarketPrices "Energy" (EnergyMarkets)
# Number EnergyPrice "Energy Price [%.3f €/kWh]" (EnergyMarketPrices)
# Number EnergyBasePrice "Energy Base Price [%.3f €/kWh]" (EnergyMarketPrices)
# Number EnergyProcurementSurcharge "Energy Procurement Price [%.3f €/kWh]" (EnergyMarketPrices)
# Number EnergyTaxSurcharge "Energy Tax Surcharge [%.3f €/kWh]" (EnergyMarketPrices)
# Number EnergyGreenSurcharge "Energy Green Surcharge [%.3f €/kWh]" (EnergyMarketPrices)
@xanderificnl
xanderificnl / install.sh
Last active May 7, 2023 00:33
Install homeassistant OS from a livecd
wget "https://github.com/home-assistant/operating-system/releases/download/10.1/haos_generic-x86-64-10.1.img.xz" -O- | \
xzcat > /dev/sda && \
sync && \
reboot
@xanderificnl
xanderificnl / httpgit
Created April 22, 2023 00:35
expose a git directory via HTTP
#!/usr/bin/env bash
#= Exposes the git repository under the current working directory over HTTP.
#= ​
#= Usage: $name [OPTION]... [PORT=3456]
#= ​
#= --help displays this text
#= ​
# Change this value if `git-http-backend` exists elsewhere.
HTTP_BACKEND="/usr/libexec/git/git-http-backend"
local wezterm = require 'wezterm'
local keymap = {}
-- Rebind tab switching
for i = 1, 8 do
table.insert(keymap, {key = tostring(i), mods = 'ALT', action = wezterm.action.ActivateTab(i - 1)})
end
-- Rebind horizontal and vertical splits
table.insert(keymap, {key = 'h', mods = 'ALT', action = wezterm.action.SplitHorizontal { domain = "CurrentPaneDomain" }})
@xanderificnl
xanderificnl / cpu-vulns.md
Created April 1, 2023 14:50
Check for CPU vulnerabilities
$ grep -ri mitigation /sys/devices/system/cpu/vulnerabilities/* | cut -d/ -f7- | column -t -s: -l3 -H2
itlb_multihit       Mitigation: VMX disabled
l1tf                PTE Inversion; VMX: conditional cache flushes, SMT disabled
mds                 Clear CPU buffers; SMT disabled
meltdown            PTI
mmio_stale_data     No mitigations
spec_store_bypass   Speculative Store Bypass disabled via prctl
spectre_v1          usercopy/swapgs barriers and __user pointer sanitization
spectre_v2 Retpolines, IBPB: conditional, IBRS_FW, STIBP: disabled, RSB filling, PBRSB-eIBRS: Not affected
@xanderificnl
xanderificnl / Flashing ESP* via WSL2.md
Last active March 29, 2023 23:05
Flashing ESP* via WSL2

Getting "Access Denied" when trying to flash from Windows? Same here, no application was communicating with the device and my prompt was elevated.

I ended up installing https://github.com/dorssel/usbipd-win and flashing from WSL, i.e.:

$ esptool --before default_reset --after hard_reset --baud 115200 --chip esp8266 --port /dev/ttyUSB0 write_fl
ash 0x0 ./tasmota.bin
esptool.py v2.8
Serial port /dev/ttyUSB0
Connecting....