Skip to content

Instantly share code, notes, and snippets.

View fixmycode's full-sized avatar

Pablo Albornoz fixmycode

  • Syllable Corporation
  • Santiago, Chile
View GitHub Profile
@nymous
nymous / README.md
Last active April 16, 2024 00:23
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

@genomics-geek
genomics-geek / setup_MacOSX_env.md
Last active November 20, 2017 17:58
Setting up your MacOSX machine as a dev machine
@Potherca
Potherca / reload-dashing-dashboard.md
Last active March 5, 2019 20:53
Reload a Dashing Dashboard

To reload a Dashing dashboard:

curl -i -d '{"auth_token": "MY_AUTH_TOKEN", "event": "reload"}' http://dashing:3030/dashboards/mydashboard
@skyfishjy
skyfishjy / CursorRecyclerViewAdapter.java
Last active December 16, 2023 08:55
CursorRecyclerViewAdapter
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software

Flying Widgets adds CSS3 transitions to your dashboard, allowing you to cycle through multiple widget sets on a single TV without page reloads, using stylish CSS3 transitions. You can even still re-order your widgets and save their locations!

Note that sinatra-cyclist is a potential alternative if the machine you use to display your dashboards is lacking in graphics horsepower.

To use, put this file in assets/javascripts/cycleDashboard.coffee. Then find this line in application.coffee:

    $('.gridster ul:first').gridster
@jwalton
jwalton / FlyingWidgets.md
Last active October 13, 2022 07:03
CSS3 Transitions for Dashing Dashboards

Flying Widgets adds CSS3 transitions to your dashboard, allowing you to cycle through multiple widget sets on a single TV without page reloads, using stylish CSS3 transitions. You can even still re-order your widgets and save their locations!

Note that sinatra-cyclist is a potential alternative if the machine you use to display your dashboards is lacking in graphics horsepower.

To use, put this file in assets/javascripts/cycleDashboard.coffee. Then find this line in application.coffee:

    $('.gridster ul:first').gridster
@melekes
melekes / README.md
Last active August 8, 2018 05:19
Youtube Dashing widget

Youtube

Description

Dashing widget to play video from Youtube.

Installation

  1. Install Youtube widget