Skip to content

Instantly share code, notes, and snippets.

View michaelkrupp's full-sized avatar
👋
moved to GitLab

Michael Krupp michaelkrupp

👋
moved to GitLab
View GitHub Profile
from bs4 import BeautifulSoup
from distutils.util import strtobool
from glob import iglob
from markdown import Extension
from markdown.preprocessors import Preprocessor
import re
import codecs
import os
RE_ALL_SNIPPETS = re.compile(
@michaelkrupp
michaelkrupp / bitcoin-cpuminer.sh
Created February 21, 2018 08:25 — forked from NamPNQ/bitcoin-cpuminer.sh
install a bitcoin cpuminer on ubuntu/debian
# install dependencies
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm git gcc -y
# clone cpuminer
git clone https://github.com/pooler/cpuminer.git
# compile
cd cpuminer
./autogen.sh
./configure CFLAGS="-O3"
@michaelkrupp
michaelkrupp / s1.sqf
Created April 14, 2017 00:09
ARMA3 - Tag der Freiheit
// === S1 : ALPHA : TEAM LEADER : 24.13kg =====================================
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;
@michaelkrupp
michaelkrupp / 1
Created February 10, 2015 16:49
treesize
du -k --max-depth=1 | sort -nr | awk '
BEGIN {
split("KB,MB,GB,TB", Units, ",");
}
{
u = 1;
while ($1 >= 1024) {
$1 = $1 / 1024;
u += 1
}
@michaelkrupp
michaelkrupp / patch.sls.mako
Last active August 29, 2015 14:06
patching salt via salt
<%
from distutils.version import StrictVersion
saltversion = StrictVersion(grains.get('saltversion', 'UNKNOWN_VERSION'))
saltversion_min = StrictVersion(pillar.get('bootstrap.salt.min_version'))
saltpatches = pillar.get('bootstrap.salt.patches', { })
%>
Make sure we're not running an outdated version
% if saltversion < saltversion_min:
@michaelkrupp
michaelkrupp / README.md
Last active January 11, 2020 22:55
saltstack settings

Coming from puppet I really got used to the hierarchical data structure hiera provides. It's easy to use, yet pretty powerful when used in combination with the module_data puppet module, which allows you to put your hiera-data in the module directory itself, while still being able to globally override stuff from the main hiera source.

The approach I present here allows you to do something similar with salt and it's pillar data by using Jinja2 only. No additional modules whatsoever are required for this to work.

Configuration data is being split up into four levels:

  • state defaults
  • filtered state defaults
  • pillar data
  • filtered pillar data