2015-10-21
- jennifer
- martym
import z from "zod"; | |
export async function safeFetch<T>( | |
schema: z.Schema<T>, | |
input: RequestInfo, | |
init?: RequestInit | |
): Promise<T> { | |
const response = await fetch(input, init); | |
if (!response.ok) { |
# NOTE: | |
# You can find an updated, more robust and feature-rich implementation | |
# in Zeno Build | |
# - Zeno Build: https://github.com/zeno-ml/zeno-build/ | |
# - Implementation: https://github.com/zeno-ml/zeno-build/blob/main/zeno_build/models/providers/openai_utils.py | |
import openai | |
import asyncio | |
from typing import Any |
This tutorial is dated Oct 2021, if it's much further on than that this information might be out of date.
This is a guide on setting up a static HTTPS website on your raspberry pi using docker and nginx. The aim is to have this running on the raspberry pi and to be able to access it from a host computer on the same local network. You should already be able to ssh into your pi from your host computer and have raspberry pi OS set up.
You can register the mixin class in the register
method of a Laravel service provider:
use Illuminate\Foundation\Testing\TestResponse;
TestResponse::mixin(TestResponseMixin::class);
A lot of people land when trying to find out how to calculate CPU usage metric correctly in prometheus, myself included! So I'll post what I eventually ended up using as I think it's still a little difficult trying to tie together all the snippets of info here and elsewhere.
This is specific to k8s and containers that have CPU limits set.
To show CPU usage as a percentage of the limit given to the container, this is the Prometheus query we used to create nice graphs in Grafana:
sum(rate(container_cpu_usage_seconds_total{name!~".*prometheus.*", image!="", container_name!="POD"}[5m])) by (pod_name, container_name) /
; Max memory per instance | |
memory_limit = 128M | |
;The maximum size of an uploaded file. | |
upload_max_filesize = 128M | |
;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize | |
post_max_size = 128M |
// moved to https://github.com/vahid-ashrafian/go-promise-caching |
#!/usr/bin/env python3 | |
"""Backs up and restores data-only volumes to/from host backup directory using | |
rsync. Only backup named volumes, which is arbitrarily set to ones having a name | |
length < 40 characters. | |
1. Create a Docker image containing rsync (named rsync) | |
https://github.com/firecat53/dockerfiles/tree/master/rsync | |
``docker build -t rsync .`` |