Skip to content

Instantly share code, notes, and snippets.

View skroczek's full-sized avatar
👋
Still working from home.

Sebastian Kroczek skroczek

👋
Still working from home.
View GitHub Profile
@skroczek
skroczek / kurl
Last active March 20, 2021 09:03
Defines the alias `kurl` and the required environment variables to reach the default k8s service from inside a Pod.
export SERVICE_ACCOUT_PATH="/var/run/secrets/kubernetes.io/serviceaccount"
export CACERT_PATH="${SERVICE_ACCOUT_PATH}/ca.crt"
export TOKEN_PATH="${SERVICE_ACCOUT_PATH}/token"
token=$(cat ${TOKEN_PATH} 2>/dev/null)
if [ $? -ne 0 ]; then
echo "Error: Unable to get token from ${TOKEN_PATH}"
unset SERVICE_ACCOUT_PATH
unset CACERT_PATH
unset TOKEN_PATH
exit 1
@skroczek
skroczek / config_obj.py
Last active December 19, 2018 11:18
Ansible module example for handling ConfigObj files, with check mode and diff
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
__author__ = "Sebastian Kroczek"
__copyright__ = "Copyright 2018"
__credits__ = ["Sebastian Kroczek"]
__license__ = "MIT"
__email__ = "[email protected]"
@skroczek
skroczek / rspamd-learn-ham.sh
Created August 1, 2018 09:05
rspamd learn spam and ham from imap-server using curl. Randomize rspamd frontends with fallback.
#!/bin/bash
function log_error() { echo `date '+%Y-%m-%d %H:%M:%S'` ERROR: $1 >&2; }
function log() { echo `date '+%Y-%m-%d %H:%M:%S'` INFO: $1; }
MAIL=$(tee)
SERVER_LIST="['10.10.115.15', '10.10.115.16']"
PASSWORD="p455w0rD"
@skroczek
skroczek / apache-balancer.sh
Last active January 20, 2016 11:12 — forked from SeonghoonKim/apache-balancer.sh
Apache HTTPD balancer-manager control script
#! /bin/bash
# Set up a default search path
PATH="/usr/bin:/bin"
CURL=`which curl`
if [ -z "$CURL" ]; then
echo "curl not found"
exit 1
fi