Skip to content

Instantly share code, notes, and snippets.

View bpeterso2000's full-sized avatar

Brian Peterson bpeterso2000

View GitHub Profile
"""
This module provides utilities to run shell commands with enhanced features such as:
- Automatic detection of the operating system prompt symbol.
- Colored command prompt and output using colorama (with fallback if colorama is
not installed).
- Flattening of command arguments that can be strings or sequences of strings.
- Automatic prepending of 'uv run' to Python commands if the 'uv' tool is installed.
- Optional working directory and environment variable support.
- Capturing and displaying command output with customizable colors.
@bpeterso2000
bpeterso2000 / daisyui_navbar.html
Created August 7, 2025 00:52
Responsive DaisyUI nav bar with multi-level drop-down menus, a hamburger menu on mobile devices
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DaisyUI Custom Navbar</title>
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap" rel="stylesheet">
@bpeterso2000
bpeterso2000 / fastnav.css
Last active July 17, 2025 12:50
Beautiful, responsive, accessible menu system with support for sub-menus, search bar, profile and notification icons. Written in HTML 5, CSS 3, and vanilla JavaScript. For use with a dynamic menu generation from data structures
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Menu with Subitems</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap">
<style>
* {
{
"Timestamp": "2025-07-15T15:03:45.123Z",
"Level": "Information",
"Message": "User login successful",
"CorrelationId": "123e4567-e89b-12d3-a456-426614174000",
"Service": "AuthService",
"Environment": "Production",
"UserId": "user123",
"SourceContext": "AuthController",
"Exception": null
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Menu</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400&display=swap">
<style>
* {
'''Concise generation of HTML using Python.'''
import html
import json
import re
import sys
from collections.abc import Iterable, Mapping
from typing import Callable, Generator, NewType, Protocol, Union
from functools import partial
from fasttags import FT
# Tags for all elements in January 7 ,2025 HTML living standard
# http://html.spec.whatwg.org/multipage/indices.html
__all__ = {
'A', 'Abbr', 'Address', 'Area', 'Article', 'Aside', 'Audio', 'B',
'Base', 'Bdi', 'Bdo', 'Blockquote', 'Body', 'Br', 'Button',
'Canvas', 'Caption', 'Cite', 'Code', 'Col', 'Colgroup', 'Data',
'Datalist', 'Dd', 'Del', 'Details', 'Dfn', 'Dialog', 'Div', 'Dl',
'Dt', 'Em','Embed', 'Fieldset', 'Figcaption', 'Figure', 'Footer',
from fasthtml.common import *
from fastlite import Database, Table
from typing import List, Dict, Any
# Initialize FastLite database
db = Database("users.db")
Users = db.t.users
if not Users.exists():
Users.create(id=int, name=str, email=str, pk="id")
@bpeterso2000
bpeterso2000 / html_form_red_asterisk_required_field.py
Created May 13, 2025 01:10
For accessible purposes use SVG for red asterisk on required fields
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Accessible Form with Red Asterisk</title>
<style>
/* Style the asterisk container */
.required-asterisk {
color: red;