Skip to content

Instantly share code, notes, and snippets.

View knowsuchagency's full-sized avatar
💭
hustlin'

Stephan Fitzpatrick knowsuchagency

💭
hustlin'
View GitHub Profile
@knowsuchagency
knowsuchagency / app.py
Created January 24, 2023 15:51
chalice-spec example
from apispec import APISpec
from chalice import Chalice, BadRequestError, Response
from chalice_spec import PydanticPlugin, ChalicePlugin, Docs, Operation
from pydantic import BaseModel, ValidationError
APP_NAME = "chalice-spec example"
app = Chalice(app_name=APP_NAME)
spec = APISpec(
@knowsuchagency
knowsuchagency / typecheck.py
Last active January 22, 2024 12:19
A cell magic to enable the use of mypy within jupyter notebooks
"""
Add mypy type-checking cell magic to jupyter/ipython.
Save this script to your ipython profile's startup directory.
IPython's directories can be found via `ipython locate [profile]` to find the current ipython directory and ipython profile directory, respectively.
For example, this file could exist on a path like this on mac:
/Users/yourusername/.ipython/profile_default/startup/typecheck.py
@knowsuchagency
knowsuchagency / scratch_256.py
Last active November 3, 2023 23:12
refreshable header issue
from nicegui import ui
@ui.refreshable
def app():
username, set_username = ui.state("")
with ui.header():
with ui.tabs().classes("w-full") as tabs:
@knowsuchagency
knowsuchagency / Dockerfile
Created July 16, 2018 05:08
Makefile Docker Git GitHub multi-stage build ssh private key recipe
FROM python:3 as build-system
RUN pip install -U pip
COPY requirements.txt requirements.txt
### create temporary image used to download and vendor packages using private key ###
FROM build-system as intermediate
# add credentials on build
@knowsuchagency
knowsuchagency / markdown.md
Created May 15, 2023 14:11
textual markdown

Zappa Rocks!

Zappa - Serverless Python

CI Coverage PyPI Slack

@knowsuchagency
knowsuchagency / codingame.py
Last active March 23, 2023 13:54
Some example code for codingame smash the code contest. Lets you look up board state using (x, y) coordinates and un-fucks the print function.
from functools import partial
from collections import namedtuple, MutableMapping, Counter, deque
from operator import itemgetter, attrgetter
import sys
import random
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
@knowsuchagency
knowsuchagency / dags.tf
Created March 14, 2023 20:46
deploy dags terraform configu
provider "aws" {
region = "us-east-1"
}
data "aws_s3_bucket" "dev" {
bucket = "..."
}
# Create a data source for each file in dags folder
data "local_file" "dags" {
@knowsuchagency
knowsuchagency / utils.py
Created June 17, 2022 06:18
streamlit login form
import streamlit as st
def login_form():
if not ("username" in st.session_state and "password" in st.session_state):
st.write("## Login")
with st.form("Login"):
@knowsuchagency
knowsuchagency / fetch_eventbridge_schema.py
Created May 12, 2021 19:35
fetch schemas from EventBridge
import json
import shlex
import subprocess as sp
from pprint import pprint
registry = "foo"
schema_name = "bar"
cmd = f"aws schemas describe-schema --registry-name={registry} --schema-name={schema_name}"

Keybase proof

I hereby claim:

  • I am knowsuchagency on github.
  • I am knowsuchagency (https://keybase.io/knowsuchagency) on keybase.
  • I have a public key ASAKuhfVCmbp9CQYo_XqUJbZimqKmucZbnvt8kVnW2iSggo

To claim this, I am signing this object: