Skip to content

Instantly share code, notes, and snippets.

View bodsch's full-sized avatar

Bodo Schulz bodsch

View GitHub Profile
@bodsch
bodsch / graphite_send
Created March 6, 2019 05:45
Shell script to submit "metrics" to graphite.
#!/bin/sh
#
# About
# -----
# This script sends simple system-metrics to a remote graphite server.
#
#
# Metrics
# -------
# The metrics currently include the obvious things such as:
@bodsch
bodsch / add-dynamic-group-var.bash
Created April 8, 2019 14:37 — forked from kenny-evitt/add-dynamic-group-var.bash
Files for Ansible for supporting dynamic host variables retrieved from a local SQLite database
#!/usr/bin/env bash
group_name="$1"
var_name="$2"
var_value="$3"
./create_dynamic_vars_db.py
sqlite3 dynamic_vars.db "INSERT OR REPLACE INTO group_vars ( group_name, var_name, var_value ) VALUES ( '${group_name}', '${var_name}', '${var_value}' );"
@bodsch
bodsch / tmux-cheatsheet.markdown
Created August 12, 2019 07:37 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@bodsch
bodsch / ansible-summary.md
Created December 5, 2019 19:35 — forked from AdamOssenford/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

- name: schedule downtime
uri:
url: "https://{{ icinga_host }}:{{ icinga_port | default(5665) }}/v1/actions/schedule-downtime"
user: "{{ icinga_user }}"
password: "{{ icinga_password }}"
force_basic_auth: True
validate_certs: False
method: POST
headers:
Accept: "application/json"
@bodsch
bodsch / README.md
Last active August 11, 2021 13:05 — forked from int128/README.md
Transparent proxy for Docker containers

Transparent proxy for Docker containers

If the Docker host is placed inside a proxy server, it needs to add the proxy configuration to each Dockerfile such as ENV http_proxy.

Following allows transparent access from the container to outside without any proxy configuration.

  1. Set up the transparent proxy
  2. Apply iptables rule for the transparent proxy
@bodsch
bodsch / haproxy.cfg
Created November 29, 2021 10:57 — forked from tikenn/haproxy.cfg
Let's Encrypt Auto-Renewal script for HAProxy
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@bodsch
bodsch / ansible_replace_the_value_of_dic_variable.yaml
Created February 15, 2022 04:07 — forked from hatsari/ansible_replace_the_value_of_dic_variable.yaml
ansible replace the value of dictionary variable
---
### ref: https://stackoverflow.com/questions/48825583/in-ansible-how-do-you-change-a-existing-dictionary-hash-values-using-a-variable
- name: replace the value of dictionary variable
hosts: localhost
gather_facts: no
vars:
fact_process:
cmd_check: ok
cmd_name: node1
cmd_status: error
@bodsch
bodsch / check_redis.py
Created September 5, 2022 17:49 — forked from luanntvn/check_redis.py
Redis health and memory check for Nagios
#!/usr/bin/python
#
# LICENSE: MIT
#
# Copyright (C) 2014 Samuel Stauffer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation
@bodsch
bodsch / diff_side_by_side.py
Created October 24, 2022 13:45 — forked from jlumbroso/diff_side_by_side.py
Side-by-Side Diff Comparison in Python
# Code licensed LGPLv3 by Jérémie Lumbroso <[email protected]>
import difflib
import itertools
import textwrap
import typing
def side_by_side(
left: typing.List[str],