Skip to content

Instantly share code, notes, and snippets.

import re
def location(string):
match = re.match(r'^([A-Za-z,\s]+),\s*(?:\w+\s+)*\d{1,2},\s*\d{4}', string)
if match:
place = match.group(1)
return place.strip()
else:
return None
import asyncio
import prefect # v2.8.7
from prefect.client import get_client
from prefect import flow, get_run_logger, task, unmapped
"""
Usage:
1. Authenticate to Prefect Cloud
2. Save this script and execute, e.g. `python one-at-a-time.py`
name: Continuous Deployment
on:
push:
branches:
- 'main'
jobs:
main:
runs-on: ubuntu-latest

Kong Ingress Controller as an API Gateway

API gateways are crucial components of [microservice architectures].

The API gateway acts as a single entrypoint into a distributed system, providing a unified interface for clients who don't need to care (or know) that the response to their API call is aggregated from multiple microservices.

Diagram one - API Gateway

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bar
namespace: default
spec:
ingressClassName: kong
rules:
- http:
paths:
apiVersion: apps/v1
kind: Deployment
metadata:
name: bar-deployment
spec:
replicas: 1
selector:
matchLabels:
app: bar
template:
FROM python:3-alpine
WORKDIR /app
RUN echo "Flask==1.1.1" > requirements.txt
RUN pip install -r requirements.txt
COPY bar.py .
EXPOSE 5000
@digitalronin
digitalronin / update-publishing.sh
Last active January 21, 2021 07:45
Script to update MoJ documentation sites created using ministryofjustice/template-documentation-site
#!/bin/sh
TEMPLATE_REPO=https://raw.githubusercontent.com/ministryofjustice/template-documentation-site/main
MAKEFILE=${TEMPLATE_REPO}/makefile
PUBLISH_ACTION=.github/workflows/publish.yml
CHECK_ACTION=.github/workflows/check-links.yml
PUBLISH_YML=${TEMPLATE_REPO}/${PUBLISH_ACTION}
CHECK_YML=${TEMPLATE_REPO}/${CHECK_ACTION}
# Remove local files which are now provided by the publishing docker image
name: Continuous Deployment
on:
workflow_dispatch:
push:
branches:
- 'main'
env:
KUBE_NAMESPACE: ${{ secrets.KUBE_NAMESPACE }}
#!/usr/bin/env ruby
# Script to output bash commands to set environment variables for AWS access
# without needing to store the credentials anywhere.
#
# Use like this:
#
# $ eval $(./export-aws-creds.rb track-a-query-production track-a-query-rds-output)
#