Skip to content

Instantly share code, notes, and snippets.

View chrisguidry's full-sized avatar

Chris Guidry chrisguidry

View GitHub Profile
@chrisguidry
chrisguidry / stream_subscriber.py
Last active August 16, 2023 01:59
Stream the events from a Prefect Cloud workspace over Websockets
from uuid import UUID
import orjson
import pendulum
import rich.console
from websockets.client import connect
from websockets.exceptions import ConnectionClosedError
from prefect.cli import root
from prefect.cli._types import PrefectTyper
@chrisguidry
chrisguidry / custom_timeline_indices.sql
Created November 12, 2022 12:33
Some indices to help your Mastodon PostgreSQL performance
-- If you find this query is popping up on your Mastodon's slow query list
--
-- SELECT "statuses"."id", "statuses"."updated_at" FROM "statuses"
-- INNER JOIN "accounts" ON "accounts"."id" = "statuses"."account_id"
-- WHERE "statuses"."visibility" = $1 AND "accounts"."suspended_at" IS NULL
-- AND "accounts"."silenced_at" IS NULL AND (statuses.reply = $4 OR
-- statuses.in_reply_to_account_id = statuses.account_id) AND
-- (statuses.reblog_of_id IS NULL) AND "statuses"."deleted_at" IS NULL
-- AND "statuses"."language" = $2 AND "statuses"."id" < $5
-- ORDER BY "statuses"."id" DESC LIMIT $3
@chrisguidry
chrisguidry / 0_reuse_code.js
Created February 3, 2017 16:41
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@chrisguidry
chrisguidry / gist:51fbee52f62ff88bb2cde8db01840ad6
Last active July 7, 2016 14:10
How do I do this correctly with pytest?
@pytest.fixture
def error_condition_one(some_fixture):
...set up one type of error condition...
...for example, an error response with httpretty, or a mock...
@pytest.fixture
def error_condition_two(another_fixture):
...set up a different error condition...
@pytest.mark.parametrize('error_condition', [

Keybase proof

I hereby claim:

  • I am chrisguidry on github.
  • I am chrisguidry (https://keybase.io/chrisguidry) on keybase.
  • I have a public key whose fingerprint is C880 D9E2 7AEB 6C1F 6FE2 27AB 9F1C A316 3FE5 0758

To claim this, I am signing this object: