Skip to content

Instantly share code, notes, and snippets.

@eljojo
eljojo / test-ups.sh
Created February 25, 2025 01:35
script to regularly test UPS using NUT
#!/bin/bash
set -euo pipefail
# Configuration
UPS_NAME="my-ups"
UPS_USER="ups-admin"
UPS_PASS="super-secret-password"
EMAIL_RECIPIENT="[email protected]"
CHECK_INTERVAL=10 # Seconds between status checks
@iamssen
iamssen / replace-all-import-extensions.ts
Last active April 4, 2025 20:22
TypeScript Import/Export Extension Replacer: Convert .js to .ts/.tsx Automatically
import { copy } from 'fs-extra';
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import ts from 'typescript';
// Obtain current file path and directory using ES module APIs
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@b-
b- / komodo-core.butane.yaml
Last active January 24, 2025 14:29
provision fedora coreos with ucore, komodo core, and komodo periphery as a systemd service
variant: fcos
version: 1.4.0
passwd:
users:
- name: core
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPDx+KV/SW4RGIeKA2FHU9S7bZgnJMy77N6lBeo2n8sJ
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKvsoJVOLJ3FshnAF5sJTpCxjNu2MAcCsN/hq0/qIBAe
password_hash: $y$j9T$Pb/.....
storage:
@joemasilotti
joemasilotti / .rouge-line-focusing.md
Last active April 17, 2025 15:19
Rouge syntax highlighting with line focusing

This gist shows how I'm using Rouge to highlight individual lines of code. On top of the existing syntax highlighting.

I'm using Sitepress which uses markdown-rails under the hood. But this should be applicable to any application rendering markdown with Redcarpet - sub out ApplicationMarkdown as your renderer.

Append @[] when setting the language in a fenced code block to highlight lines of code. Dashes will cover the range, inclusive. Commas will highlight each line.

Examples:

```swift@[4-6]
@HStep20
HStep20 / tag_sonarr_radarr_media_with_overseer_users.py
Last active March 12, 2025 13:07
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances
"""
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances, then create a filter in each connected -arr application for the users you specify.
It is forward compatible with the future User Tagging feature of overseer, and formats the tag in the same 'id - lowercase username' pattern Overseer will
It only uses built in python libraries, so you should be able to download and run without much hassle.
NOTE: YOU ARE REQUIRED TO USE IP:PORT CONNECTIONS FOR YOUR SONARR/RADARR INSTANCES INSIDE OF OVERSEERR
This will NOT utilize docker-compose style hostnames at the moment, and I don't use them personally, so I don't see myself adding them
Steps to use:
@nielsvanvelzen
nielsvanvelzen / jf-dev-auth.md
Last active April 22, 2025 17:35
Jellyfin API Authorization

Jellyfin API Authorization

To start using the Jellyfin API, authorization is probably the first thing you'll need to do. Jellyfin's authorization options can be a bit confusing because there are a lot of deprecated options.

Generally there are three ways to authenticate: no authorization, user authorization with an access token or authorization with an API key. The first way is easy, just do nothing. But most often you'll need to use either the access token or API key.

Sending authorization values

There are multiple methods for transmitting authorization values, however, some are outdated and scheduled to be removed. It's recommend to use the Authorization header. If header auth isn't an option, the token may be sent through the ApiKey query parameter. Sending secure data in a query parameter is unsafe as the changes of it leaking (via logs, copy-paste actions or by other means) are high. Only use this method as a last resort.

@unraze
unraze / elegoo_neptune_3.def.json
Created August 24, 2022 03:45
Official Elegoo Neptune 3 Cura Machine Profile
{
"version": 2,
"name": "ELEGOO NEPTUNE 3",
"inherits": "fdmprinter",
"metadata": {
"visible": true,
"author": "ELEGOO",
"manufacturer": "ELEGOO",
"category": "ELEGOO",
"file_formats": "text/x-gcode",
@scyto
scyto / docker-swarm-architecture.md
Last active April 23, 2025 06:12
My Docker Swarm Architecture

This (and related gists) captures how i created my docker swarm architecture. This is intended mostly for my own notes incase i need to re-creeate anything later! As such expect some typos and possibly even an error...

Installation Step-by-Step

Each major task has its own gist, this is to help with maitainability long term.

  1. Install Debian VM for each docker host
  2. install Docker
  3. Configure Docker Swarm
  4. Install Portainer
  5. Install KeepaliveD
  6. Using VirtioFS backed by CephFS for bind mounts (migrating from glsuterFS - WIP)

Using keepalived for node ingress and dns relaibility

This assumes you have installed a docker swarm

Introduction

When one has a docker swarm a container running on any node in the swarm can be accesed using any IP address of any swarm memeber.

For example if you had a single web server running on port 80, on one node of a swarm you could access the web server with any of the following IP addresses:

  • server1-ip:80
  • server2-ip:80