Skip to content

Instantly share code, notes, and snippets.

@agraul
agraul / bundle_helper.bash
Last active May 24, 2022 09:07
Salt Bundle Helper Script
#!/usr/bin/bash
function setup () {
ALL_PROJECTS=$(osc ls)
BUNDLE_FROM="systemsmanagement:saltstack:bundle:testing"
BUNDLE_TO="systemsmanagement:saltstack:bundle"
FROM_PREFIX="$BUNDLE_FROM:"
TO_PREFIX="$BUNDLE_TO:"
@agraul
agraul / create_pre_flight.py
Created November 29, 2021 13:21
Crude pre_flight_script.sh generation based on Uyuni DB
#!/usr/bin/python3
import sys
import textwrap
from spacewalk.server import rhnSQL
if len(sys.argv) < 2:
print("Call like `python3 create_pre_flight.py $minion_id`")
sys.exit(1)
minion_id = sys.argv[1]
@agraul
agraul / modules_state_py.diff
Last active October 27, 2021 16:09
modules/state.py diff
diff --git a/salt/modules/state.py b/salt/modules/state.py
index b439f79e57e..71ba499ffb6 100644
--- a/salt/modules/state.py
+++ b/salt/modules/state.py
@@ -118,7 +118,7 @@ def _get_pillar_errors(kwargs, pillar=None):
return (
None
if kwargs.get("force")
- else (pillar or {}).get("_errors", __pillar__.get("_errors")) or None
+ else (pillar or __pillar__).get("_errors", None)
@agraul
agraul / extract-initrd.sh
Last active June 3, 2021 13:48
Extract initrd on openSUSE
#!/bin/bash
set -ex
if [ -f "$1" ] ; then
if [ -f /usr/lib/dracut/skipcpio ]; then
/usr/lib/dracut/skipcpio $1 > initrd.xz;
xz -d initrd.xz;
cpio -idv < initrd;
else
echo -e "\nextracting directories..."
@agraul
agraul / .mbsyncrc
Created April 24, 2020 09:51
Example mbsyncrc for mailbox.org
# These settings can also go under an "Account" section, but then the
# "IMAPStore" section needs to reference the account. This is not
# needed for just one store per account.
IMAPStore mailbox-remote
Host imap.mailbox.org
User alexander.graul@mailbox.org
PassCmd "gpg --quiet --decrypt ~/.mbsync-pw-mailbox.gpg"
SSLType STARTTLS
MaildirStore mailbox-local

Keybase proof

I hereby claim:

  • I am agraul on github.
  • I am agraul (https://keybase.io/agraul) on keybase.
  • I have a public key whose fingerprint is 3D01 4200 5397 1454 F57A 4C94 6A86 EBDF 0E92 26D7

To claim this, I am signing this object:

@agraul
agraul / explanation-ip-addresses.md
Last active November 20, 2018 08:57
YaST Hostnames - Test plan

Complete /etc/host:

127.0.0.1 localhost
130.57.5.70 suse.com suse.br suse.ae
130.57.5.70 suse.com suse.br suse.ae

::1 localhost ipv6-localhost ipv6-loopback
fe00::0 ipv6-localnet
1001:db8:0:0:0:ff00:10:8000 äbç
@agraul
agraul / example.rb
Created October 13, 2018 11:52
Nokigiri OBS Collection parsing
require 'multi_xml'
single_bin_response = <<~XML
<collection matches="1">
<binary name="neofetch-git"/>
</collection>
XML
multi_bin_response = <<~XML
<collection matches
@agraul
agraul / vim-plugins.md
Last active October 7, 2018 10:26
Vim Plugins getting started

General

  • Use a plugin manager (my favorite one is vim-plug)
  • Vim is not an IDE, just a text editor. Use shell tools and cli applications instead of stuffing everything into Vim (tmux can help with this)
  • I prefer Neovim over Vim, the community drives new features (which only get accepted in Vim after Neovim has proven people want it, Vim's upstream is a bit stubborn) and some plugins that I use require extra dependencies in Vim but not in Neovim

Plugins

The following notation maps to GitHub. tpope/vim-surround can be found at https://github.com/tpope/vim-surround

Top Tier

@agraul
agraul / auto_playlist.py
Last active January 27, 2017 03:01
auto_playlist.py - generate playlist of all Music in ~/Music
#!/usr/bin/python3
import os
import re
# auto_playlist.py - generate playlist of all Music in ~/Music. by Alexander Graul
music_path = os.path.expanduser('~/Music/')
# Ask for name for new playlist file with fallback to "playlist.m3u"
playlist_file_name = input("Please enter a name for the playlist:\t")
if playlist_file_name == '':
playlist_file_name = 'playlist'