Skip to content

Instantly share code, notes, and snippets.

View jagd's full-sized avatar

C. Wu jagd

  • Germany
View GitHub Profile
@jagd
jagd / build.sh
Created July 9, 2025 07:48
Note for compling chipStar
#!/bin/sh
# Dependency:
# spirv-llvm-translator
# opencl-icd-loader opencl-headers
#
# level-zero-loader level-zero-headers
# or
. /opt/intel/oneapi/setvars.sh
@jagd
jagd / babyphone.py
Last active August 25, 2025 18:34
Script to use my old laptop as Babyphone
#!/usr/bin/env python3
"""
Script to use my old laptop as Babyphone.
Turn on monitor (tty) back light in the evening.
Require root to change the tty color scheme to white and tune the screen brightness.
pip install opencv-python flask flask-socketio simple-websocket sounddevice
"""
import datetime
@jagd
jagd / vimrc.vim
Created May 12, 2025 08:26
Portable solution to correct grammar and improve text in VIM using OpenAI-compatible API
" let g:llm_grammar_apiurl = 'https://api.groq.com/openai/v1/chat/completions'
" let g:llm_grammar_model = 'llama3-70b-8192'
let g:llm_grammar_apikey = 'YOUR KEY'
vnoremap <silent> <leader>ll :<C-u>call LLMGrammarVisual()<CR>
function! LLMGrammarVisual()
let l:start = line("'<")
let l:end = line("'>")
let l:lines = getline(l:start, l:end)
let l:text = join(l:lines, "\n")
#!/usr/bin/perl
#
# Script to calibrate the measured result
#
# Author: wuchuanren@gmail.com
# Date: 01.Jun. 2013
#
use strict;
@jagd
jagd / feko.vim
Created April 4, 2011 12:16
.vimrc patch for editfeko / prefeko (*.pre) syntax highlight
"" feko
autocmd BufNewFile,BufRead *.pre set filetype=feko
autocmd filetype feko call Feko()
function! Feko()
"" Syntax Highlight
set syntax=feko
@jagd
jagd / gist:805782
Created February 1, 2011 12:13
Miller-Rabin in Haskell
{-
x^(n-1) % n == 1
k == n-1 == d*(2^m)
und
a^d % n == (1 || n-1)
oder irgendeine
a^(d * (2^i)) % n == n-1
davon, i = 1, 2, 3 ... m
-}
@jagd
jagd / gist:804850
Created January 31, 2011 21:29
Miller-Rabin in C for uint32_t
int MillerRabin(uint32_t a, int n)
{
/* x^(n-1) % n == 1 */
/* k == n-1 == d*(2^m) */
/* davon :
* a^d % n == 1
* oder
* a^(d * (2^i)) % n == n-1
* davon, i = 1, 2, 3 ...