Skip to content

Instantly share code, notes, and snippets.

@sts
sts / openidc_otp_validation.sh
Last active March 11, 2024 16:52
Keycloak OTP Validation API
BASE_URL=https://localhost:8081/auth
CLIENT_ID=curl-test
CLIENT_SECRET=
USERNAME=
PASSWORD=
REALM=validation-test
OTP_CODE=027253
# OpenID Access Token via "Resource Owner Password Credentials Grant"
@sts
sts / beg_redirect.map
Created November 3, 2023 19:49 — forked from sinfere/beg_redirect.map
HAProxy Redirecting based on an HTTP Query or a Map with a fallback redirect based on host header
# This file contains only partial paths to match on
# This file should reside in the same directory as the haproxy.cfg simply due to the way it is configured in the sample snippet-but they can go anywhere in the /etc/haproxy directory
/my-partial- https://subdomain3.mydomain.com/my-new-full-path
@sts
sts / gist:b6dbd6a4835ce881ea2fdfa18f270b90
Created July 10, 2023 19:41
Rspamd Stack Trace multimap lookup
2023-07-07 15:37:08 #28448(normal) <0bb87a>;
task; lua_task_insert_result_common: symbol insertion issue: unknown symbol RSPAMD_RULE_XXXX; trace:
[1]:{/usr/share/rspamd/plugins/multimap.lua:592 - insert_results [Lua]};
[2]:{/usr/share/rspamd/plugins/multimap.lua:621 - callback [Lua]};
[3]:{/usr/share/rspamd/plugins/multimap.lua:444 - cb [Lua]};
[4]:{/usr/share/rspamd/lualib/lua_maps.lua:223 - get_key [Lua]};
[5]:{/usr/share/rspamd/plugins/multimap.lua:491 - match_element [Lua]};
[6]:{/usr/share/rspamd/plugins/multimap.lua:640 - match_rule [Lua]};
[7]:{/usr/share/rspamd/plugins/multimap.lua:762 - match_content [Lua]};
[8]:{/usr/share/rspamd/plugins/multimap.lua:918 - process_func [Lua]};
@sts
sts / haproxy_maintenance.conf
Last active January 11, 2023 11:12
HAProxy Maintenance Page
#
# Proof of concept for a HAProxy maintenance mode
#
#
# Control the maintenance page during runtime using the stats socket:
#
# To put the whole site in maintenance mode (for all IPs):
# > add acl #0 0.0.0.0/0
#
# To exclude your own ip, so you are able to test things out:
@sts
sts / coraza-ruleloader
Last active August 17, 2022 14:35
Core Ruleset Loader
#!/bin/bash
# Copyright 2022, Stefan Schlesinger
#
# Coraza Core Ruleset Downloader
# - download, manage and activate local copies of CRS versions
#
# Usage:
# coraza-ruleloader 4.0.0-rc1
# coraza-ruleloader 4.0.0-rc1 /etc/coraza
#
@sts
sts / clustercheck.socket
Last active November 2, 2021 15:06
Percona XDB Clustercheck with SystemD
# /etc/systemd/system/clustercheck.socket
[Unit]
Description=MySQL Clustercheck Socket
[Socket]
ListenStream=9200
Accept=true
[Install]
cask_args appdir: "/Applications"
tap "homebrew/cask"
tap "homebrew/cask-fonts"
brew "ack"
brew "curl"
brew "git"
brew "gnupg"
brew "jq"
brew "mas"
### Keybase proof
I hereby claim:
* I am sts on github.
* I am sschlesi (https://keybase.io/sschlesi) on keybase.
* I have a public key ASAV9NSsFHu01baGfgmWptTbljOwbe3XnM8Ixui27GnkYAo
To claim this, I am signing this object:
@sts
sts / usr_bin_app
Created December 13, 2016 10:17
Deploy Ruby CLI with Bundler
#!/usr/bin/env bash
set -e
export BUNDLE_GEMFILE=/usr/share/app/Gemfile
export BUNDLE_PATH=/usr/share/app/vendor
unset BUNDLE_IGNORE_CONFIG
#Test: bundle install --verbose --deployment
exec /usr/bin/ruby -rbundler/setup /usr/share/app/bin/app.rb $@
@sts
sts / gist:fc11968ff96aacf44a4f249b70d3ab24
Created November 18, 2016 12:54
debian-jenkins-glue usage
distribution=$distribution
export REPOS=$distribution
export DIST=$distribution
export USE_FREIGHT=true
export FREIGHT_BASE=/srv/freight
export FREIGHT_REPOSITORY=managed
export KEY_ID=DEADBEEF # please adjust, or edit /etc/freight.conf
/usr/bin/build-and-provide-package
# Creates: