I hereby claim:
- I am swilcox on github.
- I am swilcox (https://keybase.io/swilcox) on keybase.
- I have a public key ASDJNfDD2K1ItGxE_HCRahKR18ZBhB-XiPhzWiFY810n5Ao
To claim this, I am signing this object:
| from typing import Annotated | |
| from pydantic import BaseModel, Field | |
| from litestar import Litestar, get, post | |
| class Book(BaseModel): | |
| id: Annotated[int, Field(gt=0, lt=10000)] | |
| title: str | |
| author: str |
| from pydantic import BaseModel | |
| from litestar import Litestar, get, post | |
| class Book(BaseModel): | |
| id: int | |
| title: str | |
| author: str |
| import sys | |
| from tm1637 import TM1637Display | |
| # Define the GPIO pins connected to the TM1637 display | |
| CLK_PIN = 23 # GPIO23 | |
| DIO_PIN = 24 # GPIO24 | |
| def main(display_str=""): |
I hereby claim:
To claim this, I am signing this object:
| """ | |
| Shamelessly lifted from https://github.com/sebest/json-logging-py in order | |
| to simplify customization. | |
| """ | |
| import os | |
| from datetime import datetime | |
| import json | |
| import logging | |
| import socket |
| import redis | |
| import mockredis | |
| from django.conf import settings | |
| from django.core.signals import request_finished | |
| try: | |
| from eventlet.corolocal import local | |
| except ImportError: | |
| from threading import local |
| require 'formula' | |
| class Libstemmer < Formula | |
| # upstream is constantly changing the tarball, | |
| # so doing checksum verification here would require | |
| # constant, rapid updates to this formula. | |
| head 'http://snowball.tartarus.org/dist/libstemmer_c.tgz' | |
| homepage 'http://snowball.tartarus.org/' | |
| end |
| import math | |
| def distance(origin, destination): | |
| #assumes origin and destination are (lat, long) pairs where lat and long are decimals | |
| lat1, lon1 = origin | |
| lat2, lon2 = destination | |
| #radius = 6371 # km <-- use this if metric | |
| radius = 3961 # miles <-- use this if english / miles | |
| dlat = math.radians(lat2-lat1) | |
| dlon = math.radians(lon2-lon1) |
Multi-graph widget for Shopify's dashing to display a comparison style graph (or stacked with a minor modification). Obviously, this is an example that is built heavily on the existing graph widget that is provided with dashing. This widget provides a more clear framework for expanding the graph for multiple series (or nodes) of data. After seeing the example code, it should be fairly easy to expand to 3 or more overlaid graphs (although colors might get tricky). And really, this is just a slightly greater use of the cool rickshaw graphs.
To use this widget:
| """ | |
| Usage info: | |
| Slap this file in a templatetags subdirectory off one of your apps: | |
| In a template: | |
| {% load crappy_page_filters %} | |
| Then... given a situation like you were dealing with Haystack (and Twitter Boostrap style CSS) |