Skip to content

Instantly share code, notes, and snippets.

"""
A OpenID Connect frontend module for the satosa proxy
"""
import json
import logging
from collections import defaultdict
from urllib.parse import urlencode, urlparse
from jwkest.jwk import rsa_load, RSAKey
@c00kiemon5ter
c00kiemon5ter / sign-and-archive-pdf.sh
Created July 31, 2018 10:50
Sign a pdf with GPG and archive it along with the generated files - used to sign invoices
#!/bin/sh
# XXX: change XXX_EMAIL_IDENTITY to the email address that holds the sign key
set -e
log() {
msg="$*"
datetime="$(date --utc --iso-8601='ns')"
printf -- ':: %s %s\n' "$datetime" "$msg"
}
@c00kiemon5ter
c00kiemon5ter / wp-http-to-https.sh
Created July 22, 2018 19:19
Migrate a WordPress multisite from http to https using wp-cli
#!/bin/sh
set -e
set -x
_prog_name="${0##*/}"
LOGFILE="/tmp/${_prog_name}.log"
# XXX change wp_root to match the root of your multisite wordpress installation
wp_root='/var/www/wordpress-multisite-root-directory/'
@c00kiemon5ter
c00kiemon5ter / fallback_processor.py
Created July 17, 2017 16:07
SATOSA draft fallback processor for the AttributeProcessor microservice
from ..attribute_processor import AttributeProcessorError
from .base_processor import BaseProcessor
CONFIG_KEY_ERROR = 'on_error'
CONFIG_KEY_ERROR_DEFAULT = ''
CONFIG_KEY_FALLBACK = 'fallbacks'
CONFIG_KEY_FALLBACK_DEFAULT = []
@c00kiemon5ter
c00kiemon5ter / create-superuser.py
Created June 16, 2017 11:31
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
"""
Extend createsuperuser command to allow non-interactive creation of a
superuser with a password.
Instructions:
mkdir -p path-to-your-app/management/commands/
touch path-to-your-app/management/__init__.py
touch path-to-your-app/management/commands/__init__.py
#!/bin/sh
: "${dbname:="foodb"}"
: "${dumpdir:="./tables"}"
dbuser=root
dbpass=root
mkdir -p "$dumpdir"
@c00kiemon5ter
c00kiemon5ter / brew-cask-upgrade.sh
Last active July 3, 2022 04:02
a portable shell script to upgrade cask packages
#!/bin/sh
help=0
latest=0
verbose=0
status=0
usage() {
cat <<-EOF
${0##*/} [options]
@c00kiemon5ter
c00kiemon5ter / keybase.md
Created August 22, 2014 14:04
keybase github identity verification

Keybase proof

I hereby claim:

  • I am c00kiemon5ter on github.
  • I am c00kiemon5ter (https://keybase.io/c00kiemon5ter) on keybase.
  • I have a public key whose fingerprint is B154 5192 03FB 2174 EB7C 0D1B DD5E 8CCC BCA1 8B31

To claim this, I am signing this object:

@c00kiemon5ter
c00kiemon5ter / cdata2math.awk
Last active December 25, 2015 13:59
convert CDATA math blocks, to figure@asset,math/p tags
#!/bin/awk -f
#
# script and figure tags are expected to start and end in the same line
#
# [good] <figure class="foo" id="bar"> [bad] <script type=
# "foo">
#
# if a figure is met extract the
# data-fignum field and value
@c00kiemon5ter
c00kiemon5ter / cube_mcp23017.ino
Last active December 24, 2015 01:59
controlling a 3x3 led cube through mcp23017 with arduino. Included effects: blink, cube slices, up down, cube sides, zig zag, spin and rain.
/* Cube project throug mcp23017 */
#include <Wire.h>
static const byte MCP_ADDR = 0x20; // I2C Address of MCP23017 Chip
static const byte GPIO_A = 0x12; // Register Address of Port A
static const byte GPIO_B = 0x13; // Register Address of Port B
/* global state of gpio ports */
static byte gpio_a;
static byte gpio_b;