Skip to content

Instantly share code, notes, and snippets.

View thewh1teagle's full-sized avatar
💭
coding

thewh1teagle

💭
coding
  • localhost
  • The martian
View GitHub Profile
@thewh1teagle
thewh1teagle / README.md
Created August 23, 2024 16:00
Build llama.cpp
cmake -B build . -DGGML_VULKAN=ON -DBUILD_SHARED_LIBS=OFF -DGGML_CCACHE=OFF -DCMAKE_BUILD_TYPE=Release
CMAKE_BUILD_PARALLEL_LEVEL=16 cmake --build build --target llama-cli --config Release
@thewh1teagle
thewh1teagle / readme.md
Last active April 25, 2025 04:10
Build whisper with vulkan
git clone https://github.com/ggerganov/whisper.cpp
cd whisper.cpp
git checkout fe36c90
wget.exe https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.26/OpenBLAS-0.3.26-x64.zip
$env:VULKAN_SDK = "C:\VulkanSDK\1.3.290.0"
$env:OPENBLAS_PATH = "$pwd/openblas"
$env:GGML_OPENBLAS = "1"
cmake -B build -DBUILD_SHARED_LIBS=OFF -DGGML_VULKAN=ON -DGGML_CCACHE=OFF -DCMAKE_BUILD_TYPE=Release -DGGML_STATIC=ON
cmake --build build --target main --config Release
@thewh1teagle
thewh1teagle / main.py
Created August 9, 2024 23:40
whisper onnxruntime all in one
"""
export model from https://github.com/microsoft/Olive/tree/main/examples/whisper
Audio should be 16khz mono
ffmpeg -i input.wav -ar 16000 -ac 1 -c:a pcm_s16le output.wav
"""
import numpy as np
import onnxruntime
from onnxruntime_extensions import get_library_path
audio_file = "single.wav"
@thewh1teagle
thewh1teagle / main.py
Last active August 2, 2024 19:12
Audio speech segmentation using pyannote
# python3 -m venv venv
# source venv/bin/activate
# pip3 install onnxruntime numpy librosa
# wget https://github.com/pengzhendong/pyannote-onnx/blob/master/pyannote_onnx/segmentation-3.0.onnx
# wget https://github.com/thewh1teagle/sherpa-rs/releases/download/v0.1.0/motivation.wav -Otest.wav
# python3 main.py
import onnxruntime as ort
import librosa
import numpy as np
@thewh1teagle
thewh1teagle / screenCapturePermission.swift
Created July 23, 2024 16:02
request screen capture permission with swift
import ScreenCaptureKit
import Cocoa
let accessEnabled = CGPreflightScreenCaptureAccess()
func openSystemPreferences() {
let url = "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"
if let nsUrl = URL(string: url) {
NSWorkspace.shared.open(nsUrl)
}
@thewh1teagle
thewh1teagle / README.md
Created July 21, 2024 14:11
build sherpa onnx correctly
cmake -B build -DCMAKE_BUILD_TYPE=Release -DSHERPA_ONNX_ENABLE_C_API=ON -DBUILD_SHARED_LIBS=ON -DSHERPA_ONNX_ENABLE_DIRECTML=ON .
cmake --build build --config Release -j16
@thewh1teagle
thewh1teagle / main.py
Created July 21, 2024 02:09
Inference whisper with onnx runtime
"""
wget https://github.com/thewh1teagle/vibe/raw/main/samples/short.wav
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/asr-models/sherpa-onnx-whisper-tiny.tar.bz2
tar xvf sherpa-onnx-whisper-tiny.tar.bz2
python -m venv venv
pip install -r requirements.txt
python main.py
"""
cargo : Compiling sherpa-rs-sys v0.1.0 (C:\Users\User\Documents\code\sherpa-rs\sys)
At line:1 char:1
+ cargo run --example basic_use 2>error.txt
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( Compiling sh...\sherpa-rs\sys):String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
error: failed to run custom build command for `sherpa-rs-sys v0.1.0 (C:\Users\User\Documents\code\sherpa-rs\sys)`
Caused by:
@thewh1teagle
thewh1teagle / main.rs
Created July 4, 2024 11:44
Hide app from taskbar in tauri windows 11
// windows = { version = "0.58.0", features = ["Win32", "Win32_UI", "Win32_UI_WindowsAndMessaging"] }
#[tauri::command]
fn set_app_visible(app: AppHandle, visible: bool) {
use windows::Win32::UI::WindowsAndMessaging::{
GetWindowLongPtrW, SetWindowLongPtrW, GWL_EXSTYLE, WS_EX_APPWINDOW, WS_EX_TOOLWINDOW,
};
use windows::Win32::Foundation::HWND;
use std::os::raw::c_void;
import sqlite3
conn = sqlite3.connect('company.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS departments (
department_id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL
)