MonsterUI TableFromDicts
MonsterUI can display tables from dict lists which is perfect for debugging stuff involving app storing/saving things in the DB With fastlite (fasthtml default) database: `TableFromDicts(header_data...
Quick knowledge sharing posts
MonsterUI can display tables from dict lists which is perfect for debugging stuff involving app storing/saving things in the DB With fastlite (fasthtml default) database: `TableFromDicts(header_data...
How to customize the social media preview card that appears when your GitHub repo is shared on social platforms. ## The Solution Add a social media image to your repo's settings: 1. Go to your repo...
# Domain-Based Routing for Multi-Site Deployments Today I learned you can deploy the same page but have it behave differently based on the domain it's accessed from. This lets you run multiple sites ...
# Python textwrap.dedent for Clean Multiline Strings Today I learned about `textwrap.dedent()` which removes leading whitespace from each line of text. Handy anytime you have multiline strings assig...
# Today I Learned `nbdev` has a single notebook export command that allows you to export notebooks without them being treated as a library. This is done with the command `nb_export`. In order to ap...
# Today I Learned There's a magic terminal ccommand that can download youtube videos thanks to [Hamel's twitter post](https://x.com/HamelHusain/status/1825751477060522435) [This](https://github.com/...
# Today I Learned I needed find all the draft blog posts I had. My draft blog posts were mixed in with real blog posts, and after not looking at the blog for a while I did not remember what posts I ...
# Today I Learned You can set up a delated redirect with the Meta HTML tag. Conveniently you can use this in a 404 exception handler if your site moved to catch any possible route/link users go to. ...
>Problem Source: Leetcode ## Problem Description You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation. Evaluate the expression. Return an ...
>Problem Source: Leetcode ## Problem Description Design a stack that supports `push`, `pop`, `top`, and retrieving the minimum element in constant time. Implement the `MinStack` class: + `MinStac...
> Problem Source: Leetcode ## Problem Description Given `n` non-negative integers representing an elevation map where the width of each bar is `1`, compute how much water it can trap after raining. ...
> Problem Source: Leetcode ## Problem Description You are given an integer array `height` of length `n`. There are n vertical lines drawn such that the two endpoints of the `ith` line are `(i, 0)` a...
>Problem Source: Leetcode ## Problem Description Given an integer array nums, return all the triplets `[nums[i], nums[j], nums[k]]` such that `i != j`, `i != k`, and `j != k`, and `nums[i] + nums[j...
>Problem Source: Leetcode ## Problem Description Given a 1-indexed array of integers `numbers` that is already sorted in non-decreasing order, find two numbers such that they add up to a specific `...
>Problem Source: Leetcode ## Problem Description A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads th...
>Problem Source: Leetcode ## Problem Description Given an unsorted array of integers `nums`, return the length of the longest consecutive elements sequence. You must write an algorithm that runs i...
>Problem Source: Leetcode ## Problem Description Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original li...
> Problem Source: Leetcode ## Problem Description Determine if a `9 x 9` Sudoku board is valid. Only the filled cells need to be validated according to the following rules: 1. Each row must contain...
>Problem Source: Leetcode ## Problem Description Given an integer array `nums`, return an array answer such that `answer[i]` is equal to the product of all the elements of nums except `nums[i]`. T...
>Problem Source: Leetcode ## Problem Description Given an integer array `nums` and an integer `k`, return the `k` most frequent elements. You may return the answer in any order. ### tests ```pyt...
>Problem Source: Leetcode ## Problem Description Given an array of strings `strs`, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rea...
>Problem Source: Leetcode ## Problem Description Given an integer array `nums`, return `true` if any value appears at least twice in the array, and return `false` if every element is distinct. ###...
>Problem Source: Leetcode ## Problem Description Given two strings `s` and `t`, return `true` if `t` is an anagram of `s`, and `false` otherwise. An Anagram is a word or phrase formed by rearrangi...
>Problem Source: Leetcode ## Problem Description You are given two positive integers `low` and `high`. An integer `x` consisting of `2 * n` digits is symmetric if the sum of the first `n` digits o...
>Problem Source: Leetcode ## Problem Description Given an array of integers `arr`, sort the array by performing a series of pancake flips. In one pancake flip we do the following steps: 1. Choose...
>Problem Source: Leetcode ## Problem Description Given an integer `x`, return `true` if `x` is a palindrome, and `false` otherwise. You cannot convert to string. ### tests ```python def test(fn)...
>Problem Source: Leetcode ## Problem Description Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each ...
>Problem Source: Leetcode ## Problem Description Given a string s containing just the characters `(`, `)`, `{`, `}`, `[` and `]`, determine if the input string is valid. An input string is valid i...
# Today I Learned How to run a python script on a cron using github actions, or on push of a branch. Key parts of `workflow.yaml` Define the how the job runs and what the triggers are ```yaml name...
# Today I Learned Today I learned that it's very easy to make multi-column layouts in [quarto](https://quarto.org). By having this ability to easily create and control the width of columns in differ...
# Today I Learned Today I learned that you can control what markdown renders. This is called [conditional content in the Quarto docs](https://quarto.org/docs/authoring/conditional.html). When I cre...
# Today I Learned You should be really careful about random state when parallel processing. If you aren't careful, the random seed will be copied over to other processes and each process will genera...
# Today I Learned `Shelve` is dictionary database that stored in a single file without installation needed. It's like a nosql version of sqlite. There's some really cool things about shelve: + You...
# Today I Learned I needed to use an EC2 instance to run a jupyter notebook. Here's the steps it took to set do it. # How to 1. Launch EC2 instance 1. SSH into instance 1. Run JupyterLab in EC2 `j...
# Today I Learned I always assumed it was possible to pass secrets github actions, but I never really dove into it until now. So today I learned how to add secrets to github for use in the CI/CD for...
# Today I Learned Jupyter notebooks are JSON files that can be manipulated easily. To read them: ```python import json nb = json.load(open(fpath)) ``` To clear outputs ```python for cell in nb['c...