Skip to content

Instantly share code, notes, and snippets.

View szapp's full-sized avatar

Sören Zapp szapp

View GitHub Profile
@nikspyratos
nikspyratos / protonpass_to_keepassxc.js
Created November 26, 2023 07:20
Proton Pass json export file -> KeePassXC import CSV
#!/usr/bin/env node
const fs = require('fs');
function convertProtonPassToJson(protonPassJson) {
// Parse the JSON input
const data = JSON.parse(protonPassJson);
// Define an array to hold CSV lines
let csvLines = [];
@nymous
nymous / README.md
Last active March 14, 2026 08:04
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@bramses
bramses / README.md
Last active February 28, 2024 18:24
Uploading a file from iOS Shortcuts to Cloudflare Workers

Create a Shortcut with two steps:

  1. select photos
  2. get contents from url
  3. set method to post
  4. set request body to form
  5. use magic variable to set file as result of last step
@ycanerol
ycanerol / readks.py
Last active December 3, 2020 16:12
Preprocess kilosort data
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
import os
import numpy as np
import pandas as pd
@ycanerol
ycanerol / multiSTAbrowser.py
Created March 12, 2019 16:56
Multi-STA browser with slider
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.widgets import Slider
import iofuncs as iof
import plotfuncs as plf
@hmaarrfk
hmaarrfk / matlab_remove_trailing_whitespace
Last active April 1, 2021 19:48
To remove a Matlab trailing whitespace in the editorOriginal Author: Sam Roberts http://stackoverflow.com/questions/19770347/how-to-auto-remove-trailing-whitespaces-on-save-in-matlabModified by Mark Harfouche to remember cursor location
% To remove a Matlab trailing whitespace in the editor
% Original Author: Sam Roberts
% Improved by: Simone Gaiarin <simgunz@gmail.com>
% http://stackoverflow.com/questions/19770347/how-to-auto-remove-trailing-whitespaces-on-save-in-matlab
% Modified by Mark Harfouche to remember cursor location
%
%
% Temp variable for shortcut. Give it an unusual name so it's unlikely to
% conflict with anything in the workspace.
shtcutwh__ = struct;
@matagus
matagus / hgrc
Created June 9, 2010 13:34
colorize your hg output <3
[extensions]
# enable color extension
color =
# enable extdiff extension (Extended Diff)
hgext.extdiff =
[extdiff]
# configure extended diff to use colordiff (requires colordiff installed in your system)
cmd.cdiff = colordiff
opts.cdiff = -uprN