Skip to content

Instantly share code, notes, and snippets.

View Alveel's full-sized avatar

Alwyn Kik Alveel

  • 07:44 (UTC +02:00)
View GitHub Profile
@Alveel
Alveel / truenas.xml
Created February 4, 2025 21:14
Base TrueNAS libvirt definition
<domain type='kvm'>
<name>truenas</name>
<memory unit='KiB'>8388608</memory>
<currentMemory unit='GiB'>8</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-q35-9.2'>hvm</type>
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
@Alveel
Alveel / bash_log_utils.sh
Last active August 1, 2024 13:57
Bash library to echo messages with a colour depending on the provided log level
#!/usr/bin/env sh
BLUE='\033[0;34m'
NC='\033[0m' # No Color
log() {
# Log levels: error (red), info (green), warn (yellow), critical (bold red)
case $1 in
error) level='\033[0;31mERROR' ;;
info) level='\033[0;32mINFO' ;;
@Alveel
Alveel / rclone-bisync.sh
Last active September 10, 2024 12:23
script to run rclone bisync in the background as a cronjob or systemd timer, sending a notification to the user if something goes wrong
#!/usr/bin/env bash
#
# This script runs rclone bisync between two paths and sends a notification to
# the user if something goes wrong with notify-send.
# It is intended to run frequently with a cronjob or systemd user timer.
#
# rclone-bisync path1 path2 [--resync] [--verbose] [--dry-run]
#
verbose=false
@Alveel
Alveel / subscription.yaml
Created June 21, 2023 16:21
Ansible async
---
# as the subscription manager task is rather slow
- name: Test to see if system is already subscribed
ansible.builtin.command: subscription-manager status
register: rhsm_status
changed_when: false
failed_when: rhsm_status.rc > 1
async: 60 # wait for up to one minute for the task to complete
poll: 4
@Alveel
Alveel / etc pam.d sshd
Last active February 11, 2025 11:10
PAM SSH login Discord & Telegram notification script
# ...
# At/near the bottom, add:
# Login notifications
session required pam_exec.so /usr/local/sbin/sshlogin-alert.sh
# Standard Un*x password updating.
@include common-password
@Alveel
Alveel / kubectl_unknown_command.py
Last active May 31, 2023 12:03
The Fuck match multiple suggestions
import re
from thefuck.utils import get_all_matched_commands, replace_command, for_app
supported_cmds = 'kubectl', 'oc'
@for_app(*supported_cmds, at_least=1)
def match(command):
return ("error: unknown command" in command.output and
"Did you mean this?" in command.output)
@Alveel
Alveel / convert.py
Last active April 7, 2022 10:57
Convert Apple HEIC to JPEG, without any changes
#!/usr/bin/env python3
# Convert HEIC images in the current working directory to JPEG
# Uses Python's Wand library, and Pathlib
# https://docs.wand-py.org/en/0.6.7/index.html
from pathlib import Path
from wand.image import Image
heic = Path('./').glob('*.heic')
for f in heic.__iter__():
with Image(filename=f) as original:
@Alveel
Alveel / settings.json
Created April 18, 2021 23:54
Windows Terminal theme for Solarized Dark Higher Contrast
{
// Source: https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/windowsterminal/Solarized%20Dark%20Higher%20Contrast.json
"name": "Solarized Dark Higher Contrast",
"black": "#002831",
"red": "#d11c24",
"green": "#6cbe6c",
"yellow": "#a57706",
"blue": "#2176c7",
"purple": "#c61c6f",
"cyan": "#259286",
@Alveel
Alveel / cluster-oauth.yaml
Last active March 22, 2021 16:18
group-sync-operator user/group mapping issue
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- mappingMethod: claim
name: $name
openID:
claims:
@Alveel
Alveel / 9.0.31.sh
Created March 3, 2020 11:20
Tomcat catalina.sh 9.0.6 vs 9.0.31
bash -x tomcat/bin/catalina.sh run
+ cygwin=false
+ darwin=false
+ os400=false
+ hpux=false
+ case "`uname`" in
++ uname
+ PRG=tomcat/bin/catalina.sh
+ '[' -h tomcat/bin/catalina.sh ']'
++ dirname tomcat/bin/catalina.sh