Skip to content

Instantly share code, notes, and snippets.

View luckylittle's full-sized avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / pre-commit.sh
Last active July 3, 2024 08:00
Pre-commit git hook for Helm charts - it does not allow you to commit without changing the version in Chart.yaml
#!/bin/bash
set -e
#####################################################
## TO INSTALL THIS GIT HOOK: ##
## touch .git/hooks/pre-commit ##
## echo '!/bin/sh'> .git/hooks/pre-commit ##
## echo './pre-commit.sh' >> .git/hooks/pre-commit ##
## chmod +x pre-commit.sh .git/hooks/pre-commit ##
#####################################################
@luckylittle
luckylittle / hosts_file_selection.sh
Created June 27, 2024 01:13
Replace the /etc/hosts file with different versions
#!/bin/bash
# Paths to the different hosts files
HOSTS_ADBLOCKER="/etc/hosts_adblocker"
HOSTS_DEFAULT="/etc/hosts_default"
HOSTS="/etc/hosts"
# Function to replace the /etc/hosts file
replace_hosts() {
local selected_file=$1
@luckylittle
luckylittle / codefresh.yml
Last active June 24, 2024 07:49
Codefresh pipeline to publish Helm charts from a Github repo to JFrog Artifactory
version: '1.0'
##
## Project variables:
## JFROG_GLOBAL_CONFIG = <REDACTED>
## GLOBAL_GIT_PROVIDER = github
## HELM_IMAGE = <REDACTED>/codefresh-image:latest
## ARTIFACTORY_REPO_PATH = common-release-helm
##
@luckylittle
luckylittle / SabNZBd.desktop
Created June 20, 2024 02:14
Desktop file for Pythonized SabNZBd
[Desktop Entry]
Name[en_CA]=SabNZBd
Name[en_GB]=SabNZBd
Name=SabNZBd
Comment=SabNZBd
Keywords=shell;prompt;command;commandline;cmd;
TryExec=/home/lmaly/Projects/sabnzbd/START.sh
Exec=/usr/bin/zsh -c "cd /home/lmaly/Projects/sabnzbd ; ./START.sh"
Icon=/home/lmaly/Projects/sabnzbd/interfaces/Config/templates/staticcfg/ico/android-192x192.png
Type=Application
@luckylittle
luckylittle / at_1658_close_vbox_machine.sh
Created June 20, 2024 01:17
Gracefully shut down the Virtualbox machine at a specific time
#!/bin/zsh
at 16:58 <<END
/usr/lib/virtualbox/VBoxManage controlvm "{10a78d46-53a7-4483-a602-183436c6bcc2}" acpipowerbutton
noti -t "at_1658_close_vbox_machine.sh" -m "Windows10Ent has been shut down\!" -o
END
@luckylittle
luckylittle / k4mobidedrm.py
Last active June 4, 2024 04:33
Patched k4mobidedrm/kfxdedrm
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# k4mobidedrm.py
# Copyright © 2008-2020 by Apprentice Harper et al.
__license__ = 'GPL v3'
__version__ = '6.0'
# Engine to remove drm from Kindle and Mobipocket ebooks
@luckylittle
luckylittle / autobrr_backup.zsh
Last active April 11, 2024 01:53
Bash script to backup the main settings & filters from autobrr (until proper db backup exists)
#!/bin/zsh
export AUTOBRR_HOST="127.0.0.1"
export AUTOBRR_API_KEY="abcdefghijklmnopqrstuvwxyz"
# Backup indexers
curl -X GET "http://${AUTOBRR_HOST}:7474/api/indexer" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_indexers$(date +%Y%m%d).json
# Backup IRCs
curl -X GET "http://${AUTOBRR_HOST}:7474/api/irc" -H "X-API-Token: ${AUTOBRR_API_KEY}" | jq > autobrr_ircs$(date +%Y%m%d).json
# Backup RSS Feeds
@luckylittle
luckylittle / oc_neat.zsh
Last active April 4, 2024 01:49
Clean up unnecessary metadata from Openshift YAML files
# wget https://github.com/itaysk/kubectl-neat/releases/download/v2.0.3/kubectl-neat_linux_amd64.tar.gz
# tar xvzf kubectl-neat_linux_amd64.tar.gz
# sudo mv -v kubectl-neat /usr/local/bin/
cat << EOF | oc neat [2024-04-04 | 12:46:23]
apiVersion: v1
kind: Pod
metadata:
annotations:
openshift.io/scc: anyuid
@luckylittle
luckylittle / wav_to_flac.zsh
Created February 21, 2024 00:28
WAV to FLAC in all subdirectories
#!/bin/zsh
find . -type f -iname "*.wav" -execdir sh -c 'flac --compression-level-8 --verify "{}"' \;
@luckylittle
luckylittle / create-container-radarr.sh
Created October 19, 2023 23:44
Run radarr and sonarr inside Podman
#!/bin/bash
podman run -d \
--conmon-pidfile=/home/lmaly/radarr.pid \
--name=radarr \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Australia/Sydney \
-p 7878:7878 \
-v /home/lmaly/radarr:/config \
--restart unless-stopped \