Skip to content

Instantly share code, notes, and snippets.

@rawsh
rawsh / package.json
Created March 10, 2018 18:41
Mailgun subscribers for a static website.
{
"name": "nodelist",
"version": "1.0.0",
"description": "Mailing lists for DevPy.me",
"main": "main.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Robert Washbourne",
"license": "ISC",
@mehemmelbachir
mehemmelbachir / firebase_auth_backend.py
Created July 9, 2018 08:41
Firebase authentication class for DJANGO Backend.
from django.contrib.auth import get_user_model
from firebase_admin import credentials, auth
from firebase_admin.auth import UserRecord, AuthError
import firebase_admin
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
User = get_user_model()
@smartexpert
smartexpert / snippets.md
Last active January 30, 2021 12:37
Snippets

Create an empty file in Windows

This is to emulat touch file.extention on Mac

copy NUL filename.txt

Change conda auto activate base environment

conda config --set auto_activate_base false

Create new python3 virtual environment

python3 -m venv env

@ines
ines / streamlit_prodigy.py
Created October 3, 2019 20:37
Streamlit + Prodigy
"""
Example of a Streamlit app for an interactive Prodigy dataset viewer that also lets you
run simple training experiments for NER and text classification.
Requires the Prodigy annotation tool to be installed: https://prodi.gy
See here for details on Streamlit: https://streamlit.io.
"""
import streamlit as st
from prodigy.components.db import connect
from prodigy.models.ner import EntityRecognizer, merge_spans, guess_batch_size
@tvst
tvst / session_id.py
Last active May 18, 2023 12:05
Hack to get a session-specific ID in Streamlit. See https://discuss.streamlit.io/t/session-specific-caching/271
import streamlit.ReportThread as ReportThread
from streamlit.server.Server import Server
def get_session_id():
# Hack to get the session object from Streamlit.
ctx = ReportThread.get_report_ctx()
this_session = None
version: '3'
services:
traefik:
image: traefik:v2.0
container_name: traefik
restart: unless-stopped
security_opt:
- no-new-privileges:true
networks:
# MIT LICENSE
import datetime
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import numpy as np
import dash_core_components as dcc
import dash_html_components as html
import dash
@vrslev
vrslev / main.py
Last active September 15, 2025 02:36
Automatic browser reloading in FastAPI
import os
import arel
from fastapi import FastAPI, Request
from fastapi.templating import Jinja2Templates
app = FastAPI()
templates = Jinja2Templates("templates")
if _debug := os.getenv("DEBUG"):
@veekaybee
veekaybee / normcore-llm.md
Last active April 7, 2026 05:02
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@EcZachly
EcZachly / groups.sql
Created November 6, 2023 21:11
How to write an algorithm to group people in optimized groups based on timezone and track
-- first query all the users
WITH offsets AS (SELECT a.*,
EXTRACT(hour FROM ptn.utc_offset) AS utc_offset
FROM bootcamp.attendees a
JOIN pg_timezone_names ptn ON a.timezone = ptn.name
WHERE a.bootcamp_version = 3
AND a.timezone IS NOT NULL
AND a.content_delivery = 'Live'::text
),
-- then aggregate the users by track and offset, we want matching timezones to fill up first