Skip to content

Instantly share code, notes, and snippets.

View itsbrex's full-sized avatar
🎯
focusing

Brian Roach itsbrex

🎯
focusing
View GitHub Profile
@Olshansk
Olshansk / llm.sh
Last active September 12, 2024 21:51
A bash wrapper around python's mlx_whisper to leverage the GPU on a mac for transcription
# 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'])
"
}
@disler
disler / README.md
Created March 31, 2024 14:34
Use these Prompt Chains to build HIGH QUALITY AI Agents (Agentic Building Blocks)

Setup

  1. Create a new directory with these three files (requirements.txt, main.py, README.md)
  2. python -m venv venv
  3. source venv/bin/activate
  4. pip install -r requirements.txt
  5. python main.py
  6. Update main() to run the example prompt chains
@dmurawsky
dmurawsky / ProgressBar.tsx
Last active July 26, 2024 10:01
Progress bar using Tailwind CSS
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>
))}
@cliffordp
cliffordp / bypass-cloudflare-email-protection.js
Created February 16, 2024 16:31 — forked from neopunisher/bypass-cloudflare-email-protection.js
How to circumvent Cloudflare's [email protected] thing, WITHOUT enabling Javascript
// 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;
@itsbrex
itsbrex / building-sync-systems.md
Created February 5, 2024 06:43 — forked from pesterhazy/building-sync-systems.md
Building an offline realtime sync engine

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.

Overview articles

@adrianhorning08
adrianhorning08 / index.js
Created January 5, 2024 23:35
Create CSV on frontend
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";
@nberlette
nberlette / hook.ts
Last active August 2, 2024 14:19
`Hook`: git hooks integration with Deno's task runner
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];
@jbflow
jbflow / read_live_logs.py
Created December 14, 2023 02:21
Reads the Ableton log.txt file continuously and outputs all Remote Script related messages. Takes the live version as an argument. Needs Python 3 installed to run
#!/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
@jbflow
jbflow / copy_remote_script.sh
Last active December 14, 2023 05:10
Copies a MIDI Remote Script from a working git repo into Ableton Lives Remote Scripts folder in the User library. Creating folders as necessary, excluding .git repo and has overwrite protection.
#!/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
@jart
jart / rename-pictures.sh
Created December 12, 2023 15:24
Shell script for renaming all images in a folder
#!/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: