Skip to content

Instantly share code, notes, and snippets.

View jschmid1's full-sized avatar

Joshua Schmid jschmid1

View GitHub Profile
return {
name = "jwe-decrypt",
fields = {
{ consumer = typedefs.no_consumer },
{ config = {
type = "record",
fields = {
{ lookup_header_name = {
type = "string",
required = true,
return {
name = "keys",
dao = "kong.db.dao.keys",
primary_key = { "id" },
cache_key = { "kid", "set" },
endpoint_key = "name",
workspaceable = true,
ttl = true,
fields = {
{
[kong-ee-a64e24952:/kong]# http :8001/jwk-sets name=test jwks:='[{"kid": "123"}, {"kid": "567"}]'
{{
"consumer": null,
"created_at": 1666961701,
"id": "3d37569b-c4db-410e-a7e3-7fba93c4cba4",
"jwk_ttl": null,
"jwks": [
{
"alg": null,
@jschmid1
jschmid1 / jwks.lua
Last active November 4, 2022 13:52
{
name = "jwks",
dao = "kong.plugins.jwks.daos.jwks",
primary_key = { "id" },
cache_key = { "kid", "set" },
endpoint_key = "name",
ttl = true,
fields = {
{
id = typedefs.uuid,
{
name = "jwk_sets",
dao = "kong.plugins.jwks.daos.jwk_sets",
primary_key = { "id" },
cache_key = { "name" },
endpoint_key = "name",
admin_api_name = "jwk-sets",
ttl = true,
fields = {
{
-- in a it/describe block you can do this to simulate a side-effect
-- similar to python-unittest's side_effect https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.side_effect
local called = false
local side_effect = function()
-- adding a side_effect that causes to fail the `request_uri` the first time
-- but succeed the second time.
if not called then
called = true
return false, "err"
@jschmid1
jschmid1 / tmux_window_fuzzy_search.sh
Created November 19, 2021 09:31
Fuzzy search tmux windows
# add this to ~/.bashrc | ~/.zshrc
# put this in ~/.tmux.conf
# bind-key W run "tmux split-window -v 'bash -ci ftpane'"
# to enable it
# This does a couple of things
# mod+W opens a tmux split window with a list of existing windows
# selecting an existing one will bring you there. If the window does
# not exist it will create one with the provided name and switch to it
import json
import pprint
import time
import yaml
from typing import *
def _load_inventory_struct():
with open('inventory_schema.yaml', 'rb') as _fd:
return yaml.safe_load(_fd)
import json
import pprint
import time
import yaml
from typing import *
def _load_inventory_struct():
with open('inventory_schema.yaml', 'rb') as _fd:
return yaml.safe_load(_fd)
specs:
- spec:
# service_name, service_type
key1: val
key3: val
# random k-v pairs on a spec level (created_at) would be a candidate
key1: val
# versioning
version: 1