- Create a new directory with these three files (requirements.txt, main.py, README.md)
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python main.py
- Update
main()
to run the example prompt chains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A one liner to leverage the GPU on a mac to transcribe audio files | |
# Inspired by https://simonwillison.net/2024/Aug/13/mlx-whisper/ | |
llm_transcribe_recording () { | |
local file_path="$1" | |
python3 -c " | |
import mlx_whisper | |
result = mlx_whisper.transcribe('$file_path', path_or_hf_repo='mlx-community/distil-whisper-large-v3') | |
print(result['text']) | |
" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function ProgressBar({ currentLevel }: { currentLevel: number }) { | |
return ( | |
<div className="flex justify-between items-center font-mono relative"> | |
{Array.from({ length: 9 }, (_, i) => i).map((index) => ( | |
<div | |
key={index} | |
className={`absolute h-1 z-0 ${index < currentLevel - 1 ? "bg-white" : "bg-zinc-800"}`} | |
style={{ left: `calc(${(index / 10) * 100}% + 4%)`, width: `11%` }} | |
></div> | |
))} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://raddle.me/f/Privacy/3722/how-to-circumvent-cloudflare-s-email-protected-thing-without with the help of chatGPT | |
function fixObfuscatedEmails() { | |
const elements = document.getElementsByClassName('__cf_email__'); | |
for (let i = 0; i < elements.length; i++) { | |
const element = elements[i]; | |
const obfuscatedEmail = element.getAttribute('data-cfemail'); | |
if (obfuscatedEmail) { | |
const decodedEmail = decrypt(obfuscatedEmail); | |
element.setAttribute('href', 'mailto:' + decodedEmail); | |
element.innerHTML = decodedEmail; |
So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.
-
Database in a browser, a spec (Stepan Parunashvili)
What problem are we trying to solve with a sync system?
-
The web of tomorrow (Nikita Prokopov)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createCSV(data, fileName) { | |
const headers = Object.keys(data[0]); | |
const csvContent = [ | |
headers.join(","), | |
...data.map((row) => | |
headers | |
.map((header) => { | |
const value = row[header]; | |
if (value === null) return "null"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TASK_NAME_REGEXP = /^[a-z\^\$][a-z0-9\-_$:.\^]*$/i; | |
type TaskConfig = { [key: string]: string }; | |
type HooksConfig<K extends MaybeHookNames = Hook.Name> = { | |
readonly [P in K]: string | string[]; | |
}; | |
type HookNames = typeof Hook.names[number]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# Reads Live logs in log.txt, supply with live version as argument | |
# chmod +x read_live_logs.py | |
# sudo cp read_live_logs.py /usr/local/bin | |
# Create an alias for quicker useage | |
# cd ~/. | |
# vim .zshrc | |
# Press i | |
# alias rll="read_live_logs.py" | |
# Press Esc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Run the following commands to add to your terminal | |
# sudo cp copy_remote_script.sh /usr/local/bin | |
# cd /usr/local/bin | |
# chmod +x copy_remote_script.sh | |
# now from your remote script directory you can run 'sh copy_remote_script.sh . <SCRIPTNAME>' And it will do everything for you. | |
# If you want to shorten it you can add an alias | |
# cd ~/. | |
# vim .zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# rename-pictures.sh | |
# Author: Justine Tunney <jtunney@gmail.com> | |
# License: Apache 2.0 | |
# | |
# This shell script can be used to ensure all the images in a folder | |
# have good descriptive filenames that are written in English. It's | |
# based on the Mistral 7b and LLaVA v1.5 models. | |
# | |
# For example, the following command: |
NewerOlder