Skip to content

Instantly share code, notes, and snippets.

View JSH32's full-sized avatar
📎
sudo rm -rf /

Josh Rudnik JSH32

📎
sudo rm -rf /
View GitHub Profile
@JSH32
JSH32 / portainer_remove_be.js
Created July 3, 2024 21:10
Remove Portainer Business Edition branding
(function() {
const applyStyles = () => {
// Styles to match based on URL patterns
const styles = [
{
pattern: /.*/,
selectors: [
'#sideview button:has(+ nav)',
'#sideview nav[aria-label="Settings"] li[aria-label="Users"] li:has(a[href="#!/roles"])',
'#sideview nav[aria-label="Settings"] li[aria-label="Authentication logs"]:has(a[href="#!/auth-logs"])',
@JSH32
JSH32 / remove_be.css
Created July 3, 2024 21:01
Portainer remove BE branding
#sideview button:has(+ nav) {
display: none !important;
}
#sideview
nav[aria-label="Settings"]
li[aria-label="Users"]
li:has(a[href="#!/roles"]) {
display: none !important;
}
#sideview
@JSH32
JSH32 / nginx snippet
Last active July 3, 2024 20:59
Remove Portainer BE branding, based on https://github.com/adripo/portainer-ce-clean-layout stylus script but compiled to actual CSS.
# To use you can put this in your location proxy block, will automatically intercept Portainer HTML requests and put the CSS file in there.
proxy_set_header Accept-Encoding "";
proxy_buffering off;
gzip off;
sub_filter_once off;
sub_filter_types text/html;
sub_filter '<base id="base"/>' '<base id="base"/><script src="https://cdn.gisthostfor.me/JSH32-SkOcsSXKYq-remove_be.js"></script><link rel="stylesheet" href="https://cdn.gisthostfor.me/JSH32-T2cOu14Cab-remove_be.css">';
@JSH32
JSH32 / before.rules
Created July 1, 2024 18:49
Port forward out of a tunneled server
# /etc/ufw/before.rules
*nat
:PREROUTING ACCEPT [0:0]
# Port forward example
-A PREROUTING -p tcp --dport 443 -j DNAT --to ip:443
-A PREROUTING -p tcp --dport 80 -j DNAT --to ip:80
# setup routing
-A POSTROUTING -j MASQUERADE
COMMIT
@JSH32
JSH32 / immich_backup.sh
Created April 7, 2024 20:08
Immich backup+db script designed to work with Backblaze B2 and rclone
#!/bin/bash
# Modify with the path to your Immich data/upload directory
IMMICH_DATA_DIR="/mnt/media/immich"
# Modify with the path to your local db backup directory
DB_BACKUP_DIR="/mnt/media/immich_db_backups"
# Your configured rclone path to B2 bucket
B2_BUCKET="backblaze:hydronbackup"
# Database container name
DB_CONTAINER_NAME="immich_postgres"
@JSH32
JSH32 / data.csv
Last active December 3, 2023 05:05
EKG R-Peak detection algorithm (Pan–Tompkins algorithm)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
hart
530
518
506
494
483
472
462
454
446
@JSH32
JSH32 / classdumper.java
Created August 2, 2023 18:26
Dump classes at runtime minecraft server
java
package com.yourplugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.*;
import java.nio.file.*;
import java.lang.instrument.*;
import java.security.ProtectionDomain;
@JSH32
JSH32 / media-stack.yml
Last active April 11, 2024 19:08
My media stack file for media server
version: "3.8"
services:
jellyfin:
image: jellyfin/jellyfin
volumes:
- jellyfin-config:/config
- jellyfin-cache:/cache
- ${MEDIA_LOCATION}:/media
# This is for menu links https://jellyfin.org/docs/general/clients/web-config/#custom-menu-links
package com.github.jsh32.paradoxia.commons
import net.minestom.server.MinecraftServer
import net.minestom.server.command.builder.Command
import net.minestom.server.event.EventNode
import org.koin.core.component.KoinComponent
import org.koin.core.context.loadKoinModules
import org.koin.core.context.unloadKoinModules
import org.koin.core.definition.Definition
import org.koin.core.module.Module
@JSH32
JSH32 / state.hpp
Last active June 30, 2022 04:27
Reactive State
#pragma once
template <class Container, class F>
auto erase_where(Container& c, F&& f) {
return c.erase(std::remove_if(c.begin(), c.end(), std::forward<F>(f)),
c.end());
}
/**
* @brief Reactive state. Listeners will be registered as callbacks to state