Skip to content

Instantly share code, notes, and snippets.

View yanyaoer's full-sized avatar

yanyaoer yanyaoer

View GitHub Profile
@yanyaoer
yanyaoer / 1.scribe.sh
Last active May 12, 2025 07:16
scribe.sh -- transcribe online video to subtitles
#!/usr/bin/env bash
url=$1
utc=$(date +%s)
whisper_bin=~/Projects/agi/whisper.cpp/main
whisper_model=~/projects/agi/whisper.cpp/models/ggml-large.bin
wav_file=/tmp/$utc.wav
yt-dlp $url -k -x --audio-format wav --postprocessor-args '-ar 16000 -ac 1' -o $wav_file
#ffmpeg -i "$url" -ar 16000 -ac 1 -c:a pcm_s16le $wav_file
@yanyaoer
yanyaoer / Llama.lua
Created July 10, 2024 03:49
Run Llama.cpp inside neovim
local function get_visual_selection()
local s_start = vim.fn.getpos("'<")
local s_end = vim.fn.getpos("'>")
local n_lines = math.abs(s_end[2] - s_start[2]) + 1
local lines = vim.api.nvim_buf_get_lines(0, s_start[2] - 1, s_end[2], false)
lines[1] = string.sub(lines[1], s_start[3], -1)
if n_lines == 1 then
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3] - s_start[3] + 1)
else
lines[n_lines] = string.sub(lines[n_lines], 1, s_end[3])
@yanyaoer
yanyaoer / gitlab-cr.py
Created July 22, 2024 06:37
gitlab-cr with llm
#!/usr/bin/env python3
import json
# import sys
import logging
import os
import pathlib
import subprocess
import time
@yanyaoer
yanyaoer / app-choose.sh
Created September 20, 2024 08:03
simple app/shortcuts/cli luncher on macos
#!/usr/bin/env bash
# brew install choose-gui
# https://github.com/chipsenkbeil/choose?tab=readme-ov-file#open-apps-from-the-applications-directories
# bindkey with .skhdrc
# ctrl + alt + shift + cmd - r : app-choose.sh
shopt -s nullglob globstar
candidate() {
@yanyaoer
yanyaoer / mini-ollama.swift
Last active February 6, 2025 12:16
minimal ui for ollama
#!/usr/bin/env xcrun -sdk macosx swift
// import Foundation
import SwiftUI
import AppKit
/**
Minimal UI for ollama
## Dev:
@yanyaoer
yanyaoer / soulseek.py
Last active January 20, 2025 09:08
voice assistant with computer-use
#! /usr/bin/env -S uv run
# /// script
# requires-python = "==3.11.*"
# dependencies = ["RealtimeSTT==0.3.92", "open-interpreter"]
# ///
"""
# quickstart
$ DEEPSEEK_API_KEY=(pass deepseek_api) uv run soulseek.py
"""
@yanyaoer
yanyaoer / test_camera.py
Created February 8, 2025 05:49
[yolo] track object with camera
#! /usr/bin/env -S uv run
# /// script
# requires-python = "==3.11"
# dependencies = ["opencv-python", "ultralytics"]
# ///
"""
$ pip install opencv-python ultralytics
$ python test_camera.py