Skip to content

Instantly share code, notes, and snippets.

View troykelly's full-sized avatar
💭
I may be slow to respond.

Troy Kelly troykelly

💭
I may be slow to respond.
View GitHub Profile
@troykelly
troykelly / README.md
Last active March 14, 2024 06:18
Odoo Backup and Restore Scripts

Odoo Backup and Restore Scripts

These scripts provide a simple way to backup and restore Odoo databases and their associated filestores.

Overview

  • backup.sh: Creates a compressed backup of the Odoo database and filestore.
  • restore.sh: Restores an Odoo database and filestore from the created backup.

Prerequisites

@troykelly
troykelly / README.md
Created January 21, 2024 02:55
Cleans up duplicate go2rtc ffmpeg ingestion processes

ffmpeg Duplicate Process Terminator

This script checks for duplicate ffmpeg processes running on the system and sends a SIGHUP signal to the unwanted ones to terminate them. If a process does not terminate after a certain timeout, the script sends a SIGKILL signal to force the termination.

The script lists out the processes using ps -aux command and identifies the ffmpeg processes. The script then groups the processes by their stream id (the streams are initiated to create/encode video feeds) and send termination signals to any duplicate processes.

Usage

The script can be used with optional command-line argument -t or --timeout which specifies the timeout interval in seconds after which a SIGKILL signal is sent if the process is still running after receiving a SIGHUP signal. If no timeout is specified, it defaults to 15 seconds or uses the environment variable FFMPEG_MONITOR_HUP_TIMEOUT if set.

@troykelly
troykelly / README.md
Last active January 15, 2024 04:38
iSCSI Cleanup if you are using TrueNAS

iSCSI Cleanup for Proxmox VE

This script identifies and removes invalid iSCSI targets from a Proxmox VE (PVE) server. It obtains the IPv4/IPv6 addresses of the iSCSI servers, compares them against the IP addresses of iSCSI targets on the PVE server, and removes any invalid targets.

This script is important for maintaining the efficiency and health of iSCSI links in a PVE environment, thereby ensuring optimum storage performance.

Installation

You should have root access to the PVE server to install this script.

@troykelly
troykelly / README.md
Last active December 19, 2023 22:57
A script and service to automatically upgrade on shutdown for Debian / Ubuntu

Auto-Updater for Debian/Ubuntu

The auto-updater is a tool designed to perform an unattended and full system upgrade, including package cleanup, upon system shutdown. It ensures that your Debian/Ubuntu system is upgraded regularly, without manual intervention.

Overview

The tool consists of two parts:

  1. A bash script (auto-updater) that runs apt-get full-upgrade, apt-get autoremove, and apt-get autoclean.
  2. A Systemd service (auto-updater.service) that triggers the script on system shutdown.
@troykelly
troykelly / README.md
Last active February 8, 2024 10:41
Rebuild and Refresh Collation Version for PostgreSQL

PostgreSQL Collation and Reindexing Utility

Overview

The reindex_and_refresh_collation.sh script is created to automate the process of reindexing tables and refreshing the collation version for all user databases in a PostgreSQL server. This utility is particularly useful when you've updated the locale or collation libraries on the system where PostgreSQL is installed, as these updates could cause mismatches between the databases' expected collation version and the operating system's provided version.

What It Does

  • Retrieves a list of all user databases (excluding system templates) on the PostgreSQL server.
@troykelly
troykelly / stream.html
Last active September 27, 2023 01:53
go2rtc enhanced streaming html
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>go2rtc - Stream</title>
<style>
body {
background: black;
margin: 0;
padding: 0;
@troykelly
troykelly / README.md
Created June 23, 2023 08:15
Converting PEM to P12

How to Convert a PEM Certificate to P12 using Docker on Windows and MacOS

Step 1: Start the Docker container

For MacOS:

$ docker run --rm -it -v /absolute/path/to/your/certificates:/certificates alpine /bin/sh -c "apk add --no-cache openssl && sh"

For Windows (assuming you are using PowerShell):

@troykelly
troykelly / INTEGRATION.md
Last active March 29, 2024 14:17
Automatically mount rclone mounts

Automatic Rclone Mounting and Unmounting on macOS

Prerequisites

  • rclone configured with remotes.
  • The mounting script is properly set up.
  • brew package manager for installing sleepwatcher.

Steps

@troykelly
troykelly / 90-elasticsearch.conf
Last active March 23, 2024 02:05
Build a docker machine with rclone
vm.max_map_count=262144
@troykelly
troykelly / 99-ipv6.conf
Last active May 13, 2023 05:15
Docker IPv6 Support with DHCP-PD
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.default.forwarding=1
net.ipv6.route.max_size=16384
net.ipv6.conf.eth0.accept_ra=2