Skip to content

Instantly share code, notes, and snippets.

View lazyfrosch's full-sized avatar
📢
Hack the planet! Hack the planet!

Markus Frosch lazyfrosch

📢
Hack the planet! Hack the planet!
View GitHub Profile
@lazyfrosch
lazyfrosch / Dockerfile
Created April 14, 2020 09:58
Testing Icinga 2 deps on CentOS 8
# Just an example to test dependencies
FROM centos:8
RUN yum install -y mariadb mariadb-server
RUN yum install -y https://packages.icinga.com/epel/icinga-rpm-release-8-latest.noarch.rpm
RUN yum install -y icinga2 icinga2-ido-mysql
RUN ldd /usr/lib64/icinga2/libmysql_shim.so \
@lazyfrosch
lazyfrosch / nginx-site.conf
Last active April 3, 2020 10:44
Icinga2 proxy through Nginx
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html;
server_name icinga.example.com;
location ~ ^/icinga2 {
return 301 https://$server_name$request_uri;
@lazyfrosch
lazyfrosch / bluetooth-a2dp.png
Last active June 15, 2022 09:57
Toggle Bluetooth Profiles with Pulseaudio
bluetooth-a2dp.png
<?php
$list = array(array("key1"=>"value","key4"=>"value"),array("key3"=>"value"),array("key2"=>"value"));
function uniqueKeysOfList($list) {
$keys = [];
foreach ($list as $obj) {
foreach ($obj as $k => $v) {
$keys[$k] = 1;
@lazyfrosch
lazyfrosch / ansible-replace.yml
Last active February 21, 2020 15:19
Ansible Icinga Plugin constants
- name: Icinga 2 const
hosts:
- test
tasks:
- name: Determine PluginDir for default
set_fact:
icinga2_plugin_dir: /usr/lib/nagios/plugins
- name: Determine PluginDir for RedHat
@lazyfrosch
lazyfrosch / patch.diff
Created February 20, 2020 09:34
Icinga Director Hack to allow ServiceSet Import of templates (the service sets themselve)
diff --git a/library/Director/Objects/ImportSource.php b/library/Director/Objects/ImportSource.php
index a58aa195..e9b115c5 100644
--- a/library/Director/Objects/ImportSource.php
+++ b/library/Director/Objects/ImportSource.php
@@ -119,7 +119,7 @@ class ImportSource extends DbObjectWithSettings implements ExportInterface
$this->loadedRowModifiers = $this->fetchRowModifiers();
}
$current = $this->loadedRowModifiers;
- if ($current !== null && count($current) !== count($modifiers)) {
+ if (empty($current) || count($current) !== count($modifiers)) {
@lazyfrosch
lazyfrosch / git-all
Last active January 17, 2020 12:32
One of my favorite git shortcut, run actions on a deeper git tree with multiple repositories
#!/bin/bash
# git-all
#
# Copyright (c) 2019 Markus Frosch <markus@lazyfrosch.de>
#
# Licensed under GPL-2+
rc=0
color() {
@lazyfrosch
lazyfrosch / git-filter-secrets
Last active January 8, 2020 12:54
An example how to filter secrets from git commits
#!/bin/bash
set -e
case "$1" in
init)
git config filter.git-filter-secrets.smudge "git-filter-secrets smudge"
git config filter.git-filter-secrets.clean "git-filter-secrets clean"
git config filter.git-filter-secrets.required true
echo "Configuration updated"
@lazyfrosch
lazyfrosch / nagvis-reset-password.md
Last active May 2, 2023 21:58
How to create a new admin or reset password for NagVis
@lazyfrosch
lazyfrosch / time.py
Created November 21, 2019 15:00
Time parsing and conversion in Python
from datetime import datetime
from pytz import timezone
from dateutil.parser import parse
def get_unix_time(time_string, tz_name):
# parse the time input (without timezone)
ts = parse(time_string)
# localize to the specified timezone
tz = timezone(tz_name)