This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { encode } from "fast-png"; | |
import type { GeoTIFFImage, ReadRasterResult } from "geotiff"; | |
import { fromUrl, Pool } from "geotiff"; | |
import type { RasterSourceSpecification } from "maplibre-gl"; | |
import maplibregl from "maplibre-gl"; | |
const tileSize = 256; | |
const decoderPool = new Pool(); | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
import { storeToRefs } from 'pinia'; | |
const notifyStore = useNotifyStore(); | |
const { notifications } = storeToRefs(notifyStore); | |
</script> | |
<template> | |
.... | |
<div class="toast toast-end toast-top"> | |
<div v-for="notification in notifications" :class="notification.type"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pickle | |
import warnings | |
import numpy as np | |
import pandas as pd | |
from sklearn.model_selection import train_test_split | |
from tensorflow.keras.callbacks import EarlyStopping | |
from tensorflow.keras.layers import Dense | |
from tensorflow.keras.layers import Dropout |
“Don’t move to that London” warned my northern grandfather once. “It’s full of spivs”.
The Oxford Dictionary (somewhat chauvinistically) defines a spiv as:
A man, typically a flashy dresser, who makes a living by disreputable dealings
“But I work in IT” I told him. “engineers aren’t like that”.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rate limiting with Celery + Django + Redis | |
# Multiple Fixed Windows Algorithm inspired by Figma https://www.figma.com/blog/an-alternative-approach-to-rate-limiting/ | |
# and Celery's sometimes ambiguous, vague, and one-paragraph documentation | |
# | |
# Celery's Task is subclassed and the is_rate_okay function is added | |
# celery.py or however your App is implemented in Django | |
import os | |
import math |
Just create a new InterceptHandler and add it to your app. Different settings should be configured in your config file, so that it is easy to change settings.
Logging is then as easy as:
from loguru import logger
logger.info("I am logging from loguru!")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# coding: UTF-8 | |
''' | |
Setup apc mini colors without Ablton Live | |
---------- | |
> brew install portmidi |
my database had 72k annotations at the time I ran these benchmarks, here's the result:
$ python scripts/batch_bench.py conf/development-app.ini dumb
Memory summary: start
types | # objects | total size
=========== | =========== | ============
dict | 13852 | 12.46 MB
frozenset | 349 | 11.85 MB
VM: 327.29Mb
NewerOlder