Skip to content

Instantly share code, notes, and snippets.

@jurrian
jurrian / settings.py
Created September 30, 2021 10:20
Client-side rate limiting for Sentry
import logging
import sentry_sdk
from ratelimitingfilter import RateLimitingFilter
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
# Sentry
sentry_logging = LoggingIntegration(
level=logging.INFO, # Capture info and above as breadcrumbs
@giannisp
giannisp / gist:ebaca117ac9e44231421f04e7796d5ca
Last active March 1, 2024 14:39
Upgrade PostgreSQL 9.6.5 to 10.0 using Homebrew (macOS)
After automatically updating Postgres to 10.0 via Homebrew, the pg_ctl start command didn't work.
The error was "The data directory was initialized by PostgreSQL version 9.6, which is not compatible with this version 10.0."
Database files have to be updated before starting the server, here are the steps that had to be followed:
# need to have both 9.6.x and latest 10.0 installed, and keep 10.0 as default
brew unlink postgresql
brew install postgresql@9.6
brew unlink postgresql@9.6
brew link postgresql
@ksindi
ksindi / reactor.py
Created December 26, 2015 20:46 — forked from jpanganiban/reactor.py
A Very Simple Reactor Pattern Implementation in Python (with Gevent)
#!/usr/bin/env python
from gevent import monkey
monkey.patch_all() # Patch everything
import gevent
import time
class Hub(object):
"""A simple reactor hub... In async!"""