Skip to content

Instantly share code, notes, and snippets.

@defanator
defanator / zigbee2mqtt.log
Created March 8, 2025 05:23
IKEA Rodret E2201 OTA update log
This file has been truncated, but you can view the full file.
[2025-03-07 15:14:47] info: z2m: Updating 'controls/rodret1' to latest firmware
[2025-03-07 15:14:53] info: z2m:mqtt: MQTT publish: topic 'z2m/controls/rodret1', payload '{"battery":100,"identify":null,"last_seen":"2025-03-07T15:14:53+00:00","linkquality":232,"update":{"installed_version":16777287,"latest_version":16777303,"state":"available"}}'
@defanator
defanator / Vagrantfile
Created February 21, 2025 13:13
Vagrantfile for ARM macOS and VMWare Desktop/Fusion
Vagrant.configure("2") do |config|
config.vm.define "ubuntu2404_gyptazy", autostart: false do |cfg|
cfg.vm.box = "gyptazy/ubuntu24.04-server-arm64"
cfg.vm.box_version = "1.0.0"
cfg.vm.network "private_network", type: "dhcp"
#cfg.vm.synced_folder ".", "/vagrant"
cfg.vm.provision "shell",
inline: "printf \"%s\" \"vagrant ALL=(ALL:ALL) ALL\" >/etc/sudoers.d/vagrant-nopassw"
@defanator
defanator / output.txt
Created February 10, 2025 17:57
vagrant 2.4.3 issue with virtualbox 7.1.6
% vagrant
<internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require': ffi_prep_cif failed. status=0x2 (fatal)
from <internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
from /opt/vagrant/embedded/gems/gems/ffi-1.17.0/lib/ffi.rb:5:in `rescue in <top (required)>'
from /opt/vagrant/embedded/gems/gems/ffi-1.17.0/lib/ffi.rb:2:in `<top (required)>'
from <internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
from <internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
from /Users/defan/.vagrant.d/gems/3.3.6/gems/virtualbox-0.8.6/lib/virtualbox/com/ffi/interface.rb:1:in `<top (required)>'
from <internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
from <internal:/opt/vagrant/embedded/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
@defanator
defanator / nokia-router-cfg-tool.py
Created September 9, 2023 16:16 — forked from thedroidgeek/nokia-router-cfg-tool.py
Nokia/Alcatel-Lucent router backup configuration tool
#!/usr/bin/env python3
#
# Nokia/Alcatel-Lucent router backup configuration tool
#
# Features:
# - Unpack/repack .cfg files generated from the backup and restore functionnality
# in order to modify the full router configuration
# - Decrypt/encrypt the passwords/secret values present in the configuration
@defanator
defanator / vagrant-version.txt
Created June 19, 2023 04:29
vagrant version output from vagrant/2.3.7 with virtualbox plugin 0.8.6 on macOS 13.4
INFO global: Vagrant version: 2.3.7
INFO global: Ruby version: 3.1.4
INFO global: RubyGems version: 3.3.26
INFO global: VAGRANT_INSTALLER_ENV="1"
INFO global: VAGRANT_INSTALLER_VERSION="2"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/gems/vagrant-2.3.7/bin/vagrant"
INFO global: VAGRANT_INSTALLER_EMBEDDED_DIR="/opt/vagrant/embedded"
INFO global: VAGRANT_LOG="debug"
WARN global: resolv replacement has not been enabled!
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-2.3.7/plugins/synced_folders/nfs/plugin.rb
@defanator
defanator / wordsearch.py
Last active June 4, 2023 11:27
word search in python
#!/usr/bin/env python3
# vim:sw=4:ts=4:et:
#
# based on https://www.tutorialspoint.com/word-search-in-python
BOARD = [
['A', 'B', 'C', 'E'],
['S', 'F', 'R', 'S'],
['A', 'D', 'E', 'E'],
['T', 'I', 'G', 'R'],
@defanator
defanator / need-restart.sh
Created October 26, 2022 18:15
find services using deleted libraries
#!/bin/bash
PIDS=$(ps h --ppid 2 -p 2 --deselect | awk '{ print $1}' | xargs)
for P in $PIDS
do
lsof -p $P | grep DEL | egrep -v "/dev/|/\[aio\]|/SYSV|/memfd:"
done
@defanator
defanator / find-images.sh
Last active October 20, 2022 11:38
Find AWS AMI images of popular distros
#!/bin/bash
LIMIT=1
usage() {
echo "usage: $(basename $0) [-l N] distro arch [arch...]" >&2
exit 1
}
rhel() {
@defanator
defanator / signing-gpg-keys.md
Created June 20, 2022 14:34 — forked from F21/signing-gpg-keys.md
Signing someone's GPG key

This is a quick guide of the commands we use to sign someone's GPG key in a virtual key signing party.

Note: The steps cover only the technical aspects of signing someone's key. Before signing someone's key, you must verify their identity. This is usually done by showing government-issued ID and confirming the key's fingerprint

The commands will work for both GPG and GPG2.

I use Julian's key for the examples. His key id is 2AD3FAE3. You should substitute with the appropriate key id when running the commands.

Signing the key

  1. List the keys currently in your keyring: gpg --list-keys.
@defanator
defanator / query-phpfpm-status.sh
Created February 4, 2022 16:00
Query php-fpm status from multiple instances/sockets
#!/bin/bash
# vim:sw=4:ts=4:et:
ENDPOINTS="/run/php/php7.4-fpm1.sock:/status1 /run/php/php7.4-fpm2.sock:/status2 /run/php/php7.4-fpm3.sock:/status3"
ENDPOINTS="$ENDPOINTS /run/php/php8.0-fpm1.sock:/status1 /run/php/php8.0-fpm2.sock:/status2 /run/php/php8.0-fpm3.sock:/status3"
for endpoint in $ENDPOINTS; do
socket=${endpoint%:*}
script=${endpoint##*:}
sudo -u nginx SCRIPT_NAME=${script} SCRIPT_FILENAME=${script} QUERY_STRING=full REQUEST_METHOD=GET cgi-fcgi -bind -connect ${socket}