Skip to content

Instantly share code, notes, and snippets.

View steinbrueckri's full-sized avatar
🤘

Richard Steinbrück steinbrueckri

🤘
View GitHub Profile
@liviaerxin
liviaerxin / README.md
Last active April 28, 2024 21:13
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@marco79cgn
marco79cgn / dm-toilet-paper.js
Last active February 29, 2024 17:35
iOS Widget, das die Anzahl an Klopapier Packungen in deiner nächsten dm Drogerie anzeigt (für die scriptable.app)
// dm Klopapier Widget
//
// Copyright (C) 2020 by marco79 <marco79cgn@gmail.com>
//
// Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
// IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
@kevinkub
kevinkub / incidence.js
Last active June 27, 2023 12:53
COVID-19 Inzidenz-Widget für iOS innerhalb Deutschlands 🇩🇪
// Licence: Robert Koch-Institut (RKI), dl-de/by-2-0
class IncidenceWidget {
constructor() {
this.previousDaysToShow = 31;
this.apiUrlDistricts = (location) => `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=1%3D1&outFields=RS,GEN,cases7_bl_per_100k,cases7_per_100k,BL&geometry=${location.longitude.toFixed(3)}%2C${location.latitude.toFixed(3)}&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelWithin&returnGeometry=false&outSR=4326&f=json`
this.apiUrlDistrictsHistory = (districtId) => `https://services7.arcgis.com/mOBPykOjAyBO2ZKk/ArcGIS/rest/services/Covid19_hubv/FeatureServer/0/query?where=IdLandkreis%20%3D%20%27${districtId}%27%20AND%20Meldedatum%20%3E%3D%20TIMESTAMP%20%27${this.getDateString(-this.previousDaysToShow)}%2000%3A00%3A00%27%20AND%20Meldedatum%20%3C%3D%20TIMESTAMP%20%27${this.getDateString(1)}%2000%3A00%3A00%27&outFields=Landkreis,Meldedatum,AnzahlFall&outSR=4326&f=json`
this.stateToAbbr = {
@coodix
coodix / gist:4fc9e68eef869e183cd42c662b7a6050
Created September 24, 2020 11:08
1password op cli load keys to ssh agent
op list items --tags ssh | op get item - --fields title | parallel -l 1 'op get item {} --fields notesPlain | ssh-add -'
@boina-n
boina-n / bash-smtp.sh
Created June 1, 2020 17:58
Send email with bash in in TLS, SSL or in plain text
#!/bin/bash
subject="Subject of my email"
txtmessage="This is the message I want to send"
username='mail@exemple.com'
password='************'
From="mail01@exemple.com"
rcpt='testemail5739230@yopmail.com'
from_name='N BOINA'
rcpt_name='Nicolas Hulot'
@ggamel
ggamel / palenight.js
Last active May 3, 2022 16:32
Material Palenight Color Scheme for Blink Shell
// Material Palenight Color Scheme for Blink Shell
// by Greg Gamel (https://github.com/ggamel) (https://greg.is)
black = '#292d3e';
red = '#f07178'; // red
green = '#c3e88d'; // green
yellow = '#ffcb6b'; // yellow
blue = '#82aaff'; // blue
magenta = '#c792ea'; // pink
cyan = '#89ddff'; // cyan
@thbkrkr
thbkrkr / gcloud-ssh-sysctl-vmmaxmapcount.sh
Created November 7, 2019 19:42
Set vm.max_map_count=262144 on the nodes of a GKE cluster #k8s
#!/bin/bash -eu
# Increase Virtual Memory for Elasticsearch on GKE
# https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html
# Dependencies: kubectl, gcloud, jq
nodes() {
kubectl get nodes -o custom-columns=n:.metadata.name --no-headers
}
@agoldis
agoldis / delete-github-package.graphql
Created October 25, 2019 05:26
Github - delete private package
# get version id
query($name: String!, $owner: String!) {
repository(name: $name, owner: $owner) {
id
name
registryPackages(first: 10) {
nodes {
versions(first: 10) {
nodes{
id
@iaindooley
iaindooley / delete_older_than_1_year
Created February 21, 2019 06:50
Delete cards older than 1 year
//schedule this function to run tomorrow at 3am using a time trigger
//in your Trellinator configuration sheet. It will then
//execute daily
function deleteOlderThanOneYear(board,signature,original_time)
{
new Board(board).list("Completed").cards().each(function(card)
{
if(card.movedToList() < Trellinator.now().minusDays(365))
{
card.archive();
@wadefletch
wadefletch / todo.py
Last active April 10, 2024 14:57
Print from Todoist API to USB Thermal Printer
import todoist
from escpos import printer
therm = printer.Usb(0x0416, 0x5011) # connect to printer
api = todoist.TodoistAPI('79d4d663cc5011ab78cd7004e26a1a060572c823') # connect to todoist
api.sync() # get new data from todoist
therm.image('name.png') # print header image
therm.text('\n') # add a blank line