Note
Highlights information that users should take into account, even when skimming.
Tip
Optional information to help a user be more successful.
Important
Crucial information necessary for users to succeed.
[!WARNING]
use regex::Regex; | |
fn clean_filename(filename: &str) -> Option<String> { | |
// Regex to match the date/time prefix | |
let date_prefix_re = Regex::new( | |
r"^\d{4}-\d{2}-\d{2}([-T]\d{2}([:-]\d{2})?([:-]\d{2})?)?-", | |
) | |
.unwrap(); | |
// Regex to remove the `.md` extension | |
let extension_re = Regex::new(r"\.md$").unwrap(); |
# Somewhere on your project: foo/validate.py | |
from functools import wraps | |
def validate_kwargs(*checks, required=()): | |
def decorator(func): | |
@wraps(func) | |
def wrapper(**kwargs): | |
for key, check, expected in checks: | |
if key in kwargs and not check(kwargs[key], expected): |
Note
Highlights information that users should take into account, even when skimming.
Tip
Optional information to help a user be more successful.
Important
Crucial information necessary for users to succeed.
[!WARNING]
:root { | |
--almost-white: #fdf6e3; | |
--almost-black: #586e75; | |
--link-fg: #2aa198; | |
--fg: #586e75; | |
--status-info-bg: #eee8d5; | |
--status-focus-info-bg: #eee8d5; | |
--single-border: 0.2rem solid #cb4b16; | |
--boxshadow-border: none; | |
--double-border: none; |
import ipaddress | |
import json | |
import os | |
import subprocess | |
from enum import Enum | |
import uvicorn | |
from dotenv import load_dotenv | |
from fastapi import ( | |
BackgroundTasks, |
{ | |
"workbench.startupEditor": "newUntitledFile", | |
"editor.fontSize": 14, | |
"editor.lineHeight": 1.8, | |
"javascript.suggest.autoImports": true, | |
"javascript.updateImportsOnFileMove.enabled": "always", | |
"editor.rulers": [80, 120], | |
"extensions.ignoreRecommendations": true, | |
"typescript.tsserver.log": "off", | |
"files.associations": { |
### requires the script lf-pick on path | |
### Requires lf installed https://github.com/gokcehan/lf | |
### lf has the keybindings: <space> select file, lowercase `l` accept selection | |
### or use arrow right to open the file | |
### This allows selecting multiple files with space and then hit `l` to open | |
# touch ~/.local/bin/lf-pick | |
# chmod +x ~/.local/bin/lf-pick | |
# function lfp(){ | |
# local TEMP=$(mktemp) | |
# lf -selection-path=$TEMP |