Skip to content

Instantly share code, notes, and snippets.

@jph00
jph00 / fasthtml-eg.sml.md
Last active January 1, 2025 19:40
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

_ _ _ ____ _ _
| | | | __ _ ___| | __ | __ ) __ _ ___| | _| |
| |_| |/ _` |/ __| |/ / | _ \ / _` |/ __| |/ / |
| _ | (_| | (__| < | |_) | (_| | (__| <|_|
|_| |_|\__,_|\___|_|\_\ |____/ \__,_|\___|_|\_(_)
A DIY Guide
i=0;eval( source= %w?"zl ib,bas e64,securerand om".split( ', ').eac
h{|x|require(x)};data=Zlib.inflate (Base64.urls afe_decode64(sou rce.split("#")[4+i ])).unpack("C* ").flat_ma p{|x|[x/8,x/
8,x%8,x%8]};palette=[0x48b0d5,0x8d cee5,0xffffff,0x3a90 ad,0xe0c3b8,0xef d5c6,0].map{|x|[x> >16,(x>>8)&0xff, x&0xff]};all_source=('i='+((i+1)%2
).to_s+';eval(source=%w'+63.chr+source +63.chr+".join)");ch ars=al l_sour ce.chars;width=46; height=24;missin g=width*2*height-chars.size;chars+
=["^"]*missing;c hars=c hars.e ach_slice( width* 2).fla t_map{ _1.join.gs ub(/\x5e{2,}/) {|x|"#"+Se cureRandom.urlsafe_base6
4(x.size-1)[0,x. size-1 ]}.cha rs};pu ts(cha rs .zip(dat a).map{| l,c|"\e[ 48
;2;#{palette[c].join (";")}m" +l}.
@jemo07
jemo07 / Armv8-a_opcoded.md
Last active January 1, 2025 19:38
Armv8-a opcodes list

ARMv8-A opcodes with their corresponding details:

Mnemonic Format With (bits) Binary Hex Shamt Binary Start (Hex) End (Hex)
ADC R 6 000110 6 - - -
ADD R 6 000010 2 000000 A0A 0B
ADDI I 6 100100 24 - - -
ADR I 6 100101 25 - - -
AND R 6 000010 2 000100 A0A 0B
ANDI I 6 100100 24 - - -
@Klerith
Klerith / seed.ts
Created July 12, 2022 18:55
Nest-Teslo Seed
interface SeedProduct {
description: string;
images: string[];
stock: number;
price: number;
sizes: ValidSizes[];
slug: string;
tags: string[];
title: string;
type: ValidTypes;
@primaryobjects
primaryobjects / m3u8.md
Last active January 1, 2025 19:32
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@tp7
tp7 / MtModes.avsi
Last active January 1, 2025 19:31
Avisynth+ MT modes definitions
###########################################################################
# DO NOT OPEN THIS DOCUMENT IN GOOGLE TRANSLATE OR BAD THINGS WILL HAPPEN #
###########################################################################
# General info:
# 1. Do not include core filters in the list
# 2. Specify the lowest mode that produces correct output with any settings.
# For example if something works with MT_MULTI_INSTANCE on some parameters and MT_SERIALIZED with other, MT_SERIALIZED should be used
# You can of course specify this in comments so people who do want to get MAXIMUM PERFORMANCE can modify the script themselves.
# 3. Do not specify MT modes for runtime filters. Behaviour of runtime filtering with mt is not very well known yet.
# 4. In case it isn't obvious, NICE_FILTER - mt mode 1, MULTI_INSTANCE - mt mode 2, SERIALIZED - mt mode 3. Variables are defined by avs+ core.
@thanasishadow
thanasishadow / pack making mods
Last active January 1, 2025 19:29
A list of mods which are useful for modpack makers
Mine/Craft Tweaker - Create/Change crafting table or furnace recipes.
Content Tweaker - Create new blocks, items, liquids and much more.
Mod Tweaker - Adds mod compatibility to Craft Tweaker.
Game Stages (And addons) - Prevent players from accessing dimensions/items/mobs/materials/waila information before they reach a certain point.
Gendustry - Create custom bees, combs, bee mutations and squeezer/carpenter recipes.
Block Drop Tweaker - Change what certain blocks drop.
Custom Stuff - Create custom items, blocks, recipes, world gen and oredicts.
Custom Things - Create custom items/blocks.
Modular Machinery - Create custom machines.
Artisan Worktables - Adds many variations of the crafting table and many more crafting tools.
@varnav
varnav / adsb-feed-rpi.sh
Last active January 1, 2025 19:29
Script will install multiple ADS-B feeders to Raspberry Pi OS
#!/bin/bash -ex
# Script will install multiple ADS-B feeders to Raspberry Pi OS
# Before running make sure you have your coordinates (lat/lon in a form of DD.DDDD) and antenna height (in both feet and m) handy.
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
@veox
veox / erc20.abi.json
Created January 21, 2018 14:59
ERC20 ABI in JSON format
[
{
"constant": true,
"inputs": [],
"name": "name",
"outputs": [
{
"name": "",
"type": "string"
}