Skip to content

Instantly share code, notes, and snippets.

View LevitatingBusinessMan's full-sized avatar
🕴️
Levitating

Rein Fernhout LevitatingBusinessMan

🕴️
Levitating
View GitHub Profile
@LevitatingBusinessMan
LevitatingBusinessMan / nginx.conf
Created December 10, 2025 01:21
configure nginx for a local cgi
load_module /usr/lib64/nginx/modules/ngx_http_cgi_module.so;
error_log /dev/stderr;
daemon off;
user rein;
events {}
http {
access_log /dev/stdout;
server {
@LevitatingBusinessMan
LevitatingBusinessMan / _service
Created October 13, 2025 20:29
obsc_scm example
<services>
<service mode="manual" name="obs_scm">
<param name="url">https://github.com/LevitatingBusinessMan/collectrack.git</param>
<param name="versionformat">@PARENT_TAG@~@TAG_OFFSET@</param>
<param name="scm">git</param>
<param name="changesgenerate">enable</param>
<param name="changesauthor">me@levitati.ng</param>
</service>
<service name="tar" mode="buildtime"/>
<service name="set_version" mode="manual"/>
@LevitatingBusinessMan
LevitatingBusinessMan / systemd-status-notify.fish
Last active February 18, 2025 10:56
systemd service to email status of systemd services
#!/usr/bin/env fish
if test (count $argv) -lt 1
echo "Usage: $(status --current-filename) <systemd unit>"
exit 1
end
set sstatus (systemctl --full --lines 0 status $argv[1] | string collect); or exit
set log (journalctl -b -n 50 -u $argv[1] | string collect); or exit
if systemctl -q is-failed $argv[1]
set prefix Failed
@LevitatingBusinessMan
LevitatingBusinessMan / transmission2deluge.rb
Created February 16, 2025 17:04
Copy torrents form transmission to deluge
#!/usr/bin/env ruby
require 'json'
torrent_ids = `transmission-remote -l`.lines.drop(1).map{_1.split(" ").first.sub("*","")}[..-2]
json = JSON.parse `transmission-remote -t #{torrent_ids.join(",")} --json --info`
torrents = json["arguments"]["torrents"]
puts "found #{torrents.length} torrents"
for torrent in torrents
@LevitatingBusinessMan
LevitatingBusinessMan / tsopen.fish
Created February 16, 2025 15:06
Open torrent directory via transmission-remote-gtk
#!/usr/bin/env fish
if test (count $argv) -lt 1
echo "Usage: tsopen.fish %{full-path}"
echo "See also https://github.com/transmission-remote-gtk/transmission-remote-gtk/wiki/Local-Command-usage"
else
for fullpath in $argv
set dir (mktemp -d)
sshfs archpi.rlyeh:$fullpath $dir; or notify-send tsopen.fish "failed to ssh"; and exit
open $dir
end
@LevitatingBusinessMan
LevitatingBusinessMan / slimcgi
Created December 11, 2024 03:49
Like slimrb but sets headers and exposes CGI
#!/usr/bin/env ruby
require "cgi"
require "slim"
$cgi = CGI.new
$cgi.out("text/html") do
Slim::Template.new { ARGF.read }.render
end
#!/usr/bin/env ruby
volumes = `run0 btrfs subvolume list -p #{ARGV[0] || "/"}`.lines.map do
|l| l.match /^ID (?<ID>\d+) gen (?<GEN>\d+) parent (?<PARENT>\d+) top level (?<TOPLEVEL>\d+) path (?<PATH>\S+)$/
end
edges = volumes.map do
|v| "#{v[:PARENT]!="5" ? "\"#{volumes.find{|p| p[:ID] == v[:PARENT]}[:PATH]}\" -> \"#{v[:PATH]}\"" : "\"#{v[:PATH]}\""};\n"
end
puts "digraph {\n#{edges.map{|e|"\t"+e}.join}}"
@LevitatingBusinessMan
LevitatingBusinessMan / opensuse
Last active November 25, 2024 18:32
My bedrock brl-fetch script for opensuse tumbleweed
#!/bedrock/libexec/busybox sh
#
# OpenSUSE bootstrap support
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# Copyright (c) 2016-2021 Rein Fernhout (LevitatingBusinessMan) <me@levitati.ng>
#
@LevitatingBusinessMan
LevitatingBusinessMan / vmware-loempiashop.md
Last active November 5, 2024 17:46
de loempiashop gemaakt met vmware

Een loempiashop box maken met VMWare

Na het success van de lxc nu de vmware variant.

Downloaden van de image

Je kan de Debian cloud vm hier vinden: https://www.debian.org/distrib/

Download dan de "local QEMU virtual machine" in qcow2 format.

Of volg deze link (bookworm release):

@LevitatingBusinessMan
LevitatingBusinessMan / archnews
Created October 16, 2024 09:16
Print archnews rss feed
#!/usr/bin/env ruby
require 'rss'
require 'open-uri'
require 'rainbow/refinement'
using Rainbow
puts 'https://archlinux.org/'
url = 'https://archlinux.org/feeds/news/'
URI.open(url) do |rss|