Skip to content

Instantly share code, notes, and snippets.

View spookyuser's full-sized avatar
🌎
reading and writing

spookyuser

🌎
reading and writing
View GitHub Profile
@anandmt
anandmt / NEXT_TYPESCRIPT.json
Last active October 9, 2023 09:17
VSCODE_SNIPPETS
{
"Next Typescript React Functional Component": {
"prefix": "fc",
"body": [
"import { FC } from 'react';",
"",
"interface ${TM_FILENAME_BASE}Props {",
" $1",
"}",
"",
@RogerWebb
RogerWebb / bigchalice.py
Created February 2, 2023 21:29
Deploy AWS Chalice Project via Docker and Serverless Application Model
import boto3, json, os, shutil, subprocess
from argparse import ArgumentParser
"""
Big Chalice Deployer deployes Chalice Apps using the "chalice package ..." command and
modifies the resulting sam.json template to make use of the Docker deployment process
instead of the default, s3 based, process. Additionally, the ability to delete the
resulting SAM App is available via the CLI.
Usage:
@Sentdex
Sentdex / multi_image_stablediff_video.py
Created September 16, 2022 01:39
example for making stable diffusion video w/ interpolation
from stable_diffusion_videos.stable_diffusion_walk import walk
prompt_n_seed = {
"1965 Porsche 911": 743,
"1975 Porsche 911": 140,
"1985 Porsche 911": 40,
"1995 Porsche 911": 560,
"2005 Porsche 911 directly facing camera": 996,
"2015 Porsche 911": 283,
"2020 Porsche 911": 116,
@Sentdex
Sentdex / imagery_create.py
Created September 16, 2022 01:38
Creating images with Stable Diffusion to find a good seed to go with prompt
import torch
from diffusers import StableDiffusionPipeline
from torch import autocast
import random
import matplotlib.pyplot as plt
import os
prompts = [
"1965 Porsche 911",
@nymous
nymous / README.md
Last active November 15, 2024 19:24
Logging setup for FastAPI, Uvicorn and Structlog (with Datadog integration)

Logging setup for FastAPI

This logging setup configures Structlog to output pretty logs in development, and JSON log lines in production.

Then, you can use Structlog loggers or standard logging loggers, and they both will be processed by the Structlog pipeline (see the hello() endpoint for reference). That way any log generated by your dependencies will also be processed and enriched, even if they know nothing about Structlog!

Requests are assigned a correlation ID with the asgi-correlation-id middleware (either captured from incoming request or generated on the fly). All logs are linked to the correlation ID, and to the Datadog trace/span if instrumented. This data "global to the request" is stored in context vars, and automatically added to all logs produced during the request thanks to Structlog. You can add to these "global local variables" at any point in an endpoint with `structlog.contextvars.bind_contextvars(custom

@jvacek
jvacek / Remove unused python imports on save in VSCode.md
Last active June 18, 2023 10:20
Remove unused python imports on save in VSCode

Auto-remove unused python imports in VSCode on save

I could not find a proper full configuration for this online, and I know I'll need this again in the future.

There are two ways to achieve this with some plugins; one via hitting the shell and doing an in-place replace, the other is by doing it with extensions configurable in vscode. Both should give you the same results.

Install VSCode extensions needed:

If running via bash:

@stuhlmueller
stuhlmueller / codex-refactor.el
Last active February 20, 2022 09:55
OpenAI Codex for refactoring in Emacs
(defun codex-refactor (&optional b e)
(interactive "r")
(shell-command-on-region b e "codex-refactor.py" nil nil))
# tools from https://github.com/ibraheemdev/modern-unix
tap "cantino/mcfly"
tap "clementtsang/bottom"
brew "bat"
brew "exa"
brew "lsd"
brew "git-delta"
brew "dust"
brew "duf"
brew "broot"
@davestewart
davestewart / README.md
Last active April 8, 2024 11:00
Decompile JavaScript from source maps

Decompile JavaScript from source maps

Overview

Modern JavaScript build tools compile entire folder structures of JavaScript code into single, minified files that are near-impossible to read, but can also include source maps which can be used to display the original code in tools such as the Chrome DevTools Sources panel.

These source maps can be processed to extract mainly meaningful code and file structures, by installing a package calling Shuji and running a simple bash command.

Generally, production builds shouldn't include source maps, but if you do manage to lose your source files, or for some (obviously, ethical!) reason need to view the original files, and you happen to have / find the source maps, you're good to go.

@mickeypash
mickeypash / gist:b0b22ab84495fe4b033895a79dd78468
Last active September 28, 2024 22:21
George Hotz - talking hour - 2020-08-31