Skip to content

Instantly share code, notes, and snippets.

View jph00's full-sized avatar
🦘
roo

Jeremy Howard jph00

🦘
roo
View GitHub Profile
@jph00
jph00 / starlette.md
Created June 26, 2024 05:23
Starlette docs

index.md

starlette

✨ The little ASGI framework that shines. ✨

@jph00
jph00 / contrastive.js
Created July 5, 2024 22:07
Chrome tampermonkey helper for the elderly
// ==UserScript==
// @name Keyboard Shortcut Scripts
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Run scripts with keyboard shortcuts
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
@jph00
jph00 / cf_adddns.py
Created July 18, 2024 21:55
Add a cloudflare DNS record (A or CNAME)
# https://github.com/cloudflare/cloudflare-python/blob/main/api.md
from fastcore.script import *
from cloudflare import Cloudflare
@call_parse
def add_dns_record(
record_type: str, # Type of DNS record (CNAME or A)
target: str, # Target IP address or domain name
record: str, # Record name (without the zone)
zone: str, # Zone name
@jph00
jph00 / fasthtml-eg.md.txt
Last active October 10, 2024 15:27
fasthtml by example
# FastHTML By Example
An alternative introduction
There are lots of non-FastHTML-specific tricks and patterns involved in building web apps. The goal of this tutorial is to give an alternate introduction to FastHTML, building out example applications to show common patterns and illustrate some of the ways you can build on top of the FastHTML foundations to create your own custom web apps. A secondary goal is to have this be a useful document to add to the context of an LLM to turn it into a useful FastHTML assistant - in fact, in some of the examples we’ll see this kind of assistant in action, thanks to this custom GPT.
Let’s get started.
## FastHTML Basics
@jph00
jph00 / fasthtml-eg.sml.md
Last active July 8, 2025 04:35
FastHTML by example (small)

FastHTML By Example

An alternative introduction

There are lots of non-FastHTML-specific tricks and patterns involved in building web apps. The goal of this tutorial is to give an alternate introduction to FastHTML, building out example applications to show common patterns and illustrate some of the ways you can build on top of the FastHTML foundations to create your own custom web apps. A secondary goal is to have this be a useful document to add to the context of an LLM to turn it into a useful FastHTML assistant - in fact, in some of the examples we’ll see this kind of assistant in action, thanks to this custom GPT.

Let’s get started.

FastHTML Basics

@jph00
jph00 / discord-oauth.md
Created August 18, 2024 05:15
Discord oauth

OAuth2 Discord information

OAuth2 enables application developers to build applications that utilize authentication and data from the Discord API. Within Discord, there are multiple types of OAuth2 authentication. We support the authorization code grant, the implicit grant, client credentials, and some modified special-for-Discord flows for Bots and Webhooks.

Shared Resources

The first step in implementing OAuth2 is registering a developer application and retrieving your client ID and client secret. Most people who will be implementing OAuth2 will want to find and utilize a library in the language of their choice. For those implementing OAuth2 from scratch, please see RFC 6749 for details. After you create your application with Discord, make sure that you have your client_id and client_secret handy. The next step is to figure out which OAuth2 flow is right for your purposes.

OAuth2 URLs
@jph00
jph00 / discord-app-cmd.md
Created August 18, 2024 06:02
Discord application commands

Discord Application Commands

Application commands are native ways to interact with apps in the Discord client. There are 3 types of commands accessible in different interfaces: the chat input, a message's context menu (top-right menu or right-clicking in a message), and a user's context menu (right-clicking on a user).

Application Command Object

Application Command Naming

CHAT_INPUT command names and command option names must match the following regex ^[-_\p{L}\p{N}\p{sc=Deva}\p{sc=Thai}]{1,32}$ with the unicode flag set. If there is a lowercase variant of any letters used, you must use those. Characters with no lowercase variants and/or uncased letters are still allowed. USER and MESSAGE commands may be mixed case and can include spaces.

@jph00
jph00 / discord-app-user.md
Created August 18, 2024 18:03
Developing A User-Installable Discord App

Developing A User-Installable Discord App

Discord apps can be installed to servers, users, or both. This guide will walk you through building a basic game integration app that is installable to both Discord users and servers.

While the tutorial will focus on supporting different installation contexts, we'll be building a basic game integration along the way with a wiki lookup with user-specific bookmarking and a server leaderboard. The app has four commands (/link, /profile, /leaderboard, and /wiki) that can be run in different installation and interaction contexts (which are concepts we'll dig into later in the tutorial).

Resources used in this guide

Overview of the tools and technologies we'll use

@jph00
jph00 / discord-interact.md
Created August 18, 2024 18:41
Discord Interactions

Discord Interactions

An Interaction is the message that your application receives when a user uses an application command or a message component.

For Slash Commands, it includes the values that the user submitted.

For User Commands and Message Commands, it includes the resolved user or message on which the action was taken.

For Message Components it includes identifying information about the component that was used. It will also include some metadata about how the interaction was triggered: the guild_id, channel, member and other fields. You can find all the values in our data models below.

@jph00
jph00 / html_to_markdown_conversion_test.md
Created August 21, 2024 04:11
Gist created from web2md

HTML to Markdown Conversion Test

Text Formatting

This paragraph contains bold text , italic text , and inline code.

Lists

Unordered List