Skip to content

Instantly share code, notes, and snippets.

@riziles
riziles / mini_trogon.py
Created August 4, 2025 08:18
Convert Python function to Textual app
"""Stuff."""
from collections.abc import Callable
from inspect import BoundArguments
import cyclopts
from cyclopts.exceptions import CycloptsError
from cyclopts.help import format_doc, resolve_help_format
from textual.app import App, ComposeResult
from textual.widgets import Button, Input, Label, RichLog
@riziles
riziles / simpleApp.mjs
Last active November 9, 2024 18:47
Node.js script to render html with Lit SSR, serve with Express and open in browser with `open`
import open from 'open'
import { apps } from 'open'
import express from 'express'
import { html } from 'lit-html/static.js'
import { render } from '@lit-labs/ssr'
import { collectResultSync } from '@lit-labs/ssr/lib/render-result.js'
const render2 = x => collectResultSync(render(x))
const app = express()
<script>
import { Modal, modalStore } from '@skeletonlabs/skeleton';
function triggerAlert() {
const alert = {
type: 'alert',
title: 'Example Alert',
body: `<div class = "pb-12 h-60 overflow-auto">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur at mauris ut nisl molestie eleifend ac a neque. Nunc sit amet malesuada orci. Sed id consequat neque. Pellentesque vel urna varius, fringilla odio et, congue diam. Nulla facilisi. Donec gravida, erat nec pharetra placerat, metus neque tincidunt tortor, feugiat luctus mauris ligula molestie purus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras condimentum hendrerit erat at egestas. Quisque porta diam ante, vitae mollis lorem tristique in. In vel dolor auctor nunc interdum laoreet vel sed nisi. Aliquam tincidunt tempus ornare. Nunc nisl libero, ornare id augue ac, molestie pulvinar nibh. Quisque diam purus, sodales nec erat ut, varius porttitor nulla. <br /><br /><a href="https://google.co
@riziles
riziles / cheating.py
Created June 25, 2022 21:29
N-body problem in Python?
# Just trying to cheat at the Benchmarks Game
# https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/nbody.html
def wrapper(n):
def combinations(l):
result = []
for x in range(len(l) - 1):
ls = l[x+1:]
for y in ls:
@riziles
riziles / index.html
Last active April 4, 2022 20:27
Tic Tac Toe
<div id="errors" style="
background: #c00;
color: #fff;
display: none;
margin: -20px -20px 20px;
padding: 20px;
white-space: pre-wrap;
"></div>
<div id="root"></div>
<script>