Skip to content

Instantly share code, notes, and snippets.

View mustafasegf's full-sized avatar

Mustafa Zaki Assagaf mustafasegf

View GitHub Profile
# credit: https://github.com/Nordth/humanize-ai-lib/blob/main/src/humanize-string.ts
import re
_HIDDEN_CHARS = re.compile(
r"[\u00AD\u180E\u200B-\u200F\u202A-\u202E\u2060\u2066-\u2069\uFEFF]"
)
_TRAILING_WS = re.compile(r"[ \t\x0B\f]+$", re.MULTILINE)
_NBSP = re.compile(r"\u00A0")
_DASHES = re.compile(r"[—–]+") # em- & en-dashes → ASCII hyphen
_DQUOTES = re.compile(r"[“”«»„]") # curly / guillemets → "
@stenuto
stenuto / hls.sh
Created November 7, 2024 16:58
HLS ffmpeg script
#!/bin/bash
# Function to display usage information
usage() {
echo "Usage: $0 /path/to/input.mp4 [ /path/to/output_directory ]"
exit 1
}
# Check if at least one argument (input file) is provided
if [ $# -lt 1 ]; then
@t3dotgg
t3dotgg / page.tsx
Created February 26, 2024 21:21
Example of a page refreshing content using unstable_cache in Next.js App Router
import { revalidateTag, unstable_cache } from "next/cache";
import { db } from "~/server/db";
import { todoItems } from "~/server/db/schema";
const getTodos = unstable_cache(
async () => {
return await db.query.todoItems.findMany();
},
["todoItems"],
{
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'