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/env xcrun -sdk macosx swift | |
// import Foundation | |
import SwiftUI | |
import AppKit | |
/** | |
Minimal UI for ollama | |
## Dev: |
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/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() { |
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/env python3 | |
import json | |
# import sys | |
import logging | |
import os | |
import pathlib | |
import subprocess | |
import time |
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
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]) |
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/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 |
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
$ yt-dlp 'https://www.bilibili.com/video/BV15V411K7yE/' | |
$ ffmpeg -i INPUT.mp4 -ar 16000 -ac 1 -c:a pcm_s16le /tmp/output.wav | |
$ ~/P/a/whisper.cpp: ./main -m ./models/ggml-base.bin -f /tmp/output.wav -l zh |
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
// cargo add serde --features derive | |
// cargo add serde_json | |
// cargo add reqwest --features json | |
// cargo add tokio --features full | |
pub struct Httpbin { | |
client: reqwest::Client, | |
token: String, | |
data: Option<serde_json::Value>, | |
} |
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/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
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/bash | |
client_id= | |
client_secret= | |
port=8888 | |
redirect_uri=http%3A%2F%2Flocalhost%3A$port%2Fcallback | |
auth_endpoint=https://accounts.spotify.com/authorize/?response_type=code\&client_id=$client_id\&redirect_uri=$redirect_uri | |
tmp_code=/tmp/.sp_code | |
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
html#main-window { | |
--color-bg: #1e1f29; | |
--toolbar-bgcolor: var(--color-bg) !important; | |
--gap-between-tabs: 0px; | |
--margin-after-tab-list: 8x; | |
--margin-before-tab-list: 8px; | |
--tab-height: 32px; | |
--tab-icon: 16px; | |
--tabs-container-height: 85px; |
NewerOlder