Skip to content

Instantly share code, notes, and snippets.

@rcscott
rcscott / claude-branch-session.sh
Created April 10, 2026 12:39
claude-branch-session.sh
# Wrapper function to launch Claude and either create a new session for the branch
# or resume a past session based on the branch name
function c() {
local name=$(git branch --show-current)
if [[ "$name" == "main" ]]; then
claude
return
fi
class ExampleDatabaseRouter(object):
"""
Determine how to route database calls for an app's models (in this case, for an app named Example).
All other models will be routed to the next router in the DATABASE_ROUTERS setting if applicable,
or otherwise to the default database.
"""
def db_for_read(self, model, **hints):
"""Send all read operations on Example app models to `example_db`."""
if model._meta.app_label == 'example':
###
# Parse video ID from URL
# Works for YouTube and Vimeo URLs, see test URLs below
#
# Returns a list including the parsed ID and the content provider (youtube or vimeo)
# e.g. ['id12345', 'youtube']
# If no match is found, function assumes parameter is a YouTube ID
#
# @author: rcscott
#