Skip to content

Instantly share code, notes, and snippets.

@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 / 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
@Alveel
Alveel / regex-test.py
Last active January 3, 2020 19:19
Multiline regex, end of string anchor and newlines
#!/usr/bin/env python3
import re
volume_statistics_pattern = re.compile(r'''
^Starting\ time\ of\ crawl:\ (?P<crawl_start>\w{3}\ \w{3}\s+\d{1,2}\ \d{2}:\d{2}:\d{2}\ \d{4})\s+
Ending\ time\ of\ crawl:\ (?P<crawl_end>\w{3}\ \w{3}\s+\d{1,2}\ \d{2}:\d{2}:\d{2}\ \d{4})\s+
Type\ of\ crawl:\ (?P<crawl_type>\w+)\s+
@Alveel
Alveel / zfs.md
Last active February 18, 2022 15:04
My ZFS setup for backuppc

Partitioning

# Logical volume is on an SSD/NVMe
lvcreate <vgname> --size 4G --name slog

zpool create tank raidz2 -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 -O normalization=formD -O mountpoint=/opt/backups -O xattr=sa \
    /dev/vdb /dev/vdc /dev/vdd /dev/vde /dev/vdf /dev/vdg
zfs create tank/backuppc
zfs create tank/incoming
@Alveel
Alveel / otpmenu.sh
Last active August 1, 2019 08:20
passmenu for pass-otp
#!/usr/bin/env bash
shopt -s nullglob globstar
otp_dir=totp
prefix=${PASSWORD_STORE_DIR-~/.password-store}
password_files=( "$prefix"/"$otp_dir"/*.gpg )
password_files=( "${password_files[@]#"$prefix"/}" )
password_files=( "${password_files[@]%.gpg}" )
@Alveel
Alveel / my.patch
Created May 29, 2019 09:38
Patch for AUR package kubernetes-helm to use the release tarball instead of raw git repo
diff --git a/.SRCINFO b/.SRCINFO
index 1de7c00..a23e1cc 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -15,8 +15,8 @@ pkgbase = kubernetes-helm
optdepends = kubectl: check cluster status
optdepends = kubectl-bin: check cluster status - binary package
conflicts = kubernetes-helm-bin
- source = https://github.com/helm/helm/archive/v2.14.0.tar.gz
- sha256sums = 5ee68580431254044996da0d2347a394e917e18a81047cc1b0f3d8949a371d75