This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import sys | |
import itertools | |
import os | |
import numpy as np | |
import pandas as pd | |
import pyarrow as pa | |
import psutil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import json | |
from pathlib import Path | |
class ActionConfig: | |
def __init__(self, validator=None): | |
self.validator = validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from http import HTTPStatus | |
from urllib.request import HTTPError, Request, urlopen | |
def read_response_json(response): | |
if "application/json" in response.headers["Content-Type"]: | |
return json.loads(response.read().decode("utf8")) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenSAFELY Github actions | |
========================= | |
Central repository of github workflows that can be referenced from OpenSAFELY projects. | |
Note: these don't yet exist, I'm trying to figure out what we want. | |
| Study Actions | Description | Stage | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $upstream_http_www_authenticate $auth_header { | |
~(.*)ghcr.io(.*) $1example.com$2; | |
} | |
server { | |
server_name example.com | |
... | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_socketio import SocketIO | |
import talisker.flask | |
app = Flask(__name__) | |
talisker.flask.register(app) | |
socketio = SocketIO(app) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script will create xenial and trusty lxd images that will be used by the | |
# lxd provider in juju 2.1+ It is for use with the lxd provider for local | |
# development and preinstalls a common set of production packages. | |
# | |
# This is important, as between them, basenode and layer-basic install ~111 | |
# packages, before we even get to any packages installed by your charm. | |
# | |
# It also installs some helpful development tools, and pre-downloads some |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
_UID=$(id -u) | |
GID=$(id -g) | |
# give lxd permission to map your user/group id through | |
grep root:$_UID:1 /etc/subuid -qs || sudo usermod --add-subuids ${_UID}-${_UID} --add-subgids ${GID}-${GID} root | |
# set up a separate key to make sure we can log in automatically via ssh | |
# with $HOME mounted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check(self, request): | |
"""Nagios health check""" | |
start = {} | |
def nagios_start(status, headers, exc_info=None): | |
# save status for inspection | |
start['status'] = status | |
start['headers'] = headers | |
response = self.app(request.environ, nagios_start) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# standard wsgi middleware | |
def some_wsgi_middleware(app): | |
def middleware(environ, start_response) | |
# here's the trick - set status/headers in the function scope | |
status = headers = None | |
def custom_start_response(status, headers, exc_info): | |
# they get overwritten here from func args | |
pass | |
NewerOlder