commit 8f412e11cd2afb8284b29efbd54d6dfd9ce3a2c8
parent 4b858ed1beca1e453e62cc6c09367ba3f4f4d8d6
Author: ling0x <ling0x@users.noreply.github.com>
Date: Thu, 16 Jul 2026 15:43:58 +0100
refactor: updates
Diffstat:
4 files changed, 197 insertions(+), 34 deletions(-)
diff --git a/commands/piper-tts.txt b/commands/piper-tts.txt
@@ -1,32 +0,0 @@
-Install Piper on archlinux:
-
-yay -S piper-tts-bin
-
-Install voices:
-
-yay -S piper-voices-en-us
-yay -S piper-voices-en-gb
-yay -S piper-voices-zh-cn
-
-How to use it to play audio directly:
-
-cat test.txt | piper-tts \
- --model /usr/share/piper-voices/en/en_US/bryce/medium/en_US-bryce-medium.onnx \
- --output-raw | aplay -r 22050 -f S16_LE -t raw -
-
-====================================================================
-
-Speech Dispatcher
-
-/etc/speech-dispatcher/modules/piper-tts-generic.conf
-
-Here you set up the default voice for reading PDFs which can
-integrate with Okular or Calibre
-
-Restart:
-
-systemctl --user status speech-dispatcher
-
-Test saying sth:
-
-spd-say "This is a test"
diff --git a/commands/stable-diffusion-cpp.txt b/commands/stable-diffusion-cpp.txt
@@ -0,0 +1,80 @@
+Stable Diffusion CPP
+
+mkdir -p ~/models/flux
+cd ~/models/flux
+
+
+1. Download the VAE from the official FLUX.1-dev repository:
+
+hf download black-forest-labs/FLUX.1-dev \
+ ae.safetensors \
+ --local-dir ~/models/flux
+
+2. Download both text encoders:
+
+hf download comfyanonymous/flux_text_encoders \
+ clip_l.safetensors \
+ t5xxl_fp16.safetensors \
+ --local-dir ~/models/flux
+
+3. Download the GGUF model
+
+For your command, you need a FLUX.1-schnell GGUF file—not the original flux1-schnell.safetensors. The project recommends using preconverted GGUF weights, rather than FP16 FLUX weights, because of FP16 overflow issues and the VRAM benefits of quantization.
+
+3.1 First, list the files in a compatible GGUF repository:
+
+hf repo-files leejet/FLUX.1-schnell-GGUF
+
+3.2 Then download the exact filename listed there. For example, if it lists flux1-schnell-q8_0.gguf:
+
+hf download leejet/FLUX.1-schnell-GGUF \
+ flux1-schnell-q8_0.gguf \
+ --local-dir ~/models/flux
+
+or
+
+hf download gpustack/FLUX.1-schnell-GGUF \
+ flux1-schnell-q4_k.gguf \
+ --local-dir ~/models/flux
+
+If the repository or filename differs, use the exact owner/repository and filename returned by hf repo-files. The official project documentation links to preconverted FLUX.1-schnell GGUF weights but does not guarantee a particular repository filename permanently.
+
+4. Run it correctly
+
+Your pasted command has a shell formatting issue: a backslash must be the final character on its line. Use this:
+
+./build/bin/sd-cli \
+ --diffusion-model ~/models/flux/flux1-schnell-q8_0.gguf \
+ --vae ~/models/flux/ae.safetensors \
+ --clip_l ~/models/flux/clip_l.safetensors \
+ --t5xxl ~/models/flux/t5xxl_fp16.safetensors \
+ --prompt "A cinematic photo of Vienna at blue hour after rain, reflections on wet cobblestones, warm café lights" \
+ --width 1024 \
+ --height 1024 \
+ --steps 4 \
+ --cfg-scale 1.0 \
+ --sampling-method euler \
+ --diffusion-fa \
+ --seed -1 \
+ --output ~/Pictures/flux-schnell.png \
+ --verbose
+
+If run out of memory, then put the large T5-XXL encoder in system RAM, keep the diffusion model on the RTX 4090, and use a lower quantization than Q8 if needed:
+
+ ./build/bin/sd-cli \
+ --diffusion-model ~/models/flux/flux1-schnell-q4_k.gguf \
+ --vae ~/models/flux/ae.safetensors \
+ --clip_l ~/models/flux/clip_l.safetensors \
+ --t5xxl ~/models/flux/t5xxl_fp16.safetensors \
+ --clip-on-cpu \
+ --vae-on-cpu \
+ --prompt "A cinematic photo of Vienna at blue hour after rain, reflections on wet cobblestones, warm café lights" \
+ --width 1024 \
+ --height 1024 \
+ --steps 4 \
+ --cfg-scale 1.0 \
+ --sampling-method euler \
+ --diffusion-fa \
+ --seed -1 \
+ --output ~/Pictures/flux-schnell.png \
+ --verbose
+\ No newline at end of file
diff --git a/commands/tts.txt b/commands/tts.txt
@@ -0,0 +1,47 @@
+Install Piper on archlinux:
+
+yay -S piper-tts-bin
+
+Install voices:
+
+yay -S piper-voices-en-us
+yay -S piper-voices-en-gb
+yay -S piper-voices-zh-cn
+
+How to use it to play audio directly:
+
+cat test.txt | piper-tts \
+ --model /usr/share/piper-voices/en/en_US/bryce/medium/en_US-bryce-medium.onnx \
+ --output-raw | aplay -r 22050 -f S16_LE -t raw -
+
+====================================================================
+
+Speech Dispatcher
+
+/etc/speech-dispatcher/modules/piper-tts-generic.conf
+
+Here you set up the default voice for reading PDFs which can
+integrate with Okular or Calibre
+
+Restart:
+
+systemctl --user status speech-dispatcher
+
+Test saying sth:
+
+spd-say "This is a test"
+
+====================================================================
+Kokoro
+
+Spin up a dockerized kokoro: https://github.com/hwdsl2/docker-kokoro/
+
+and then try it:
+
+jq -n --rawfile t ~/transcript.txt \
+ '{model:"tts-1", input:$t, voice:"af_heart", response_format:"wav"}' \
+ | curl -s http://127.0.0.1:8880/v1/audio/speech \
+ -H "Content-Type: application/json" \
+ -d @- \
+ --output /tmp/speech.wav \
+ && ffplay -nodisp -autoexit /tmp/speech.wav
diff --git a/web_development/svelte.txt b/web_development/svelte.txt
@@ -5,7 +5,6 @@
A useful pattern is for a function, such as tooltip in this example, to return
an attachment:
-```ts
<script lang="ts">
import tippy from 'tippy.js';
import type { Attachment } from 'svelte/attachments';
@@ -25,4 +24,72 @@ an attachment:
<button {@attach tooltip(content)}>
Hover me
</button>
-```
+
+## Interesting syntax here (root.svelte by rich harris):
+
+<script lang="ts">
+ import { afterNavigate } from '$app/navigation';
+ import type { Page } from '@sveltejs/kit';
+ import type { RenderNode } from '../types.js';
+
+ interface Props {
+ page: Page;
+ tree: RenderNode;
+ components: any[];
+ resetters: Array<(() => void) | undefined>;
+ form?: any;
+ error?: App.Error;
+ }
+
+ const { page, components, resetters, tree, form, error }: Props = $props();
+
+ let mounted = $state(false);
+ let navigated = $state(false);
+ let title = $state('');
+
+ afterNavigate(() => {
+ if (mounted) {
+ navigated = true;
+ title = document.title || 'untitled page';
+ } else {
+ mounted = true;
+ }
+ });
+</script>
+
+{#snippet node(n: RenderNode, depth: number)}
+ {const Component = $derived(n.component)}
+ {const Error = $derived(n.error)}
+ {const data = $derived(n.data)}
+
+ <svelte:boundary onerror={(_, reset) => (resetters[depth] = reset)}>
+ {#if n.child}
+ <!-- svelte-ignore binding_property_non_reactive -->
+ <Component bind:this={components[depth]} {data} {form} params={page.params}>
+ {@render node(n.child, depth + 1)}
+ </Component>
+ {:else}
+ <!-- svelte-ignore binding_property_non_reactive -->
+ <Component bind:this={components[depth]} {data} {form} params={page.params} {error} />
+ {/if}
+
+ {#snippet failed(error)}
+ <Error {error} />
+ {/snippet}
+ </svelte:boundary>
+{/snippet}
+
+{@render node(tree, 0)}
+
+{#if mounted}
+ <div
+ id="svelte-announcer"
+ aria-live="assertive"
+ aria-atomic="true"
+ style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"
+ >
+ {#if navigated}
+ {title}
+ {/if}
+ </div>
+{/if}