Fun Blender Stuff

by Ducky 3D, video playlist:
https://www.youtube.com/playlist?list=PLNShHVjao84dfLoy0Xljoo0LEtxJRdvYu

Replacement.AI

https://replacement.ai
https://news.ycombinator.com/item?id=45634095

ā€œAI will probably most likely lead to the end of the world, but in the meantime, there’ll be great companies.ā€ Sam Altman, CEO of OpenAI

0x0.st

https://0x0.st

tldr: Share a file (no web interface, curl only) up to 512Mib for at least 30 days.

curl -F'file=@yourfile.png' https://0x0.st

Windows, add an upload entry to Total Commander Start menu:

  1. Unpack curl for win to some place like: %COMMANDER_PATH%..\util\curl\bin\
  2. Make a new start entry with title like ā€˜upload to 0x0.st (single file, max 512 M)’, with parameters:

     Title: upload to 0x0 (single file, max 512M)
     Command: cmd /k
     Parameters: curl -F "file=@%Q%P%N" https://0x0.st
     Start path: %COMMANDER_PATH%\..\util\curl\bin\
    

where %P is the source path to be inserted into the command line, including a backslash () at the end, and %N places the filename under the cursor into the command line. %Q Turn off automatic quotation marks around certain parameters like %P%N when the name contains a space. The user will then have to place them by himself. < From TC help.

A slightly more complex version of ā€˜Parameters’ would be:

curl -F "file=@%Q%P%N" https://0x0.st && certutil -hashfile "%Q%P%N" MD5 | find /v "hash" && echo %Q%N

edit: They say, that %Q is only needed once, so this would be the same:

%Qcurl -F "file=@%P%N" https://0x0.st && certutil -hashfile "%P%N" MD5 | find /v "hash" && echo %N

which shall return md5sum and filename under the 0x0 url, for example

https://0x0.st/KQqA.jpg
b4d6c9d0d4840490c0739e0a46c47391
image.jpg

And Uber version, which also stores url to clipboard and shows some curl progress:

curl -# -F "file=@%Q%P%N" -Fsecret= https://0x0.st | clip && powershell -Command "$t=(Get-Clipboard).Trim(); Write-Host $t -NoNewline" && echo. && certutil -hashfile "%P%N" MD5 | find /v "hash" && echo %N

Super mega version, a batch script written by KozakMak, that can upload multiple files. Put the script uploader.bat next to the curl and patch to the new menu item like this:

Title: upload to 0x0 via batch script (multiple files, max per file 512M)
---
Command: uploader.bat
Parameters: %P%S
Start path: %COMMANDER_PATH%\..\util\curl\bin\

Note, that there is no %Q in this case.

Sway on Trixie

Install

apt install sway

brings bunch of goodies with it (including foot terminal).

Keyboard

Change keyboard layout:

sway input type:keyboard xkb_layout <country code>

or in sway config, this seems to work:

#keyboard
input "1:1:AT_Translated_Set_2_keyboard" {
    xkb_layout <country code>
}

Copy foot and sway configs to your home dir.

Sway wiki.

Change default monospaces font for a user

mkdir -p .config/fontconfig
cd .config/fontconfig
vim fonts.conf

put

<match target="pattern">
  <test name="family" qual="any">
    <string>monospace</string>
  </test>
  <edit binding="strong" mode="prepend" name="family">
    <string>EnvyCodeR Nerd Font Mono</string>
  </edit>
</match>

foot theme

sudo apt install foot-themes
# they will appear in /usr/share/foot/themes

in .config/foot/foot.ini

include=/usr/share/foot/themes/catppuccin-frappe

So far
image

Built-in bar status_command

A bash script in $HOME/bin/swayStatusCommand

#!/bin/bash

main () {

    awk '/MemTotal/ {t=$2} /MemAvailable/ {a=$2} END {printf("%.1f", a/t*100)}' /proc/meminfo
    echo -n "% memory free | "
    date +'%Y-%m-%d %H:%M'

}

    print="$(main)"
    echo "$print"

and in sway config under ā€˜bar’

status_command while $HOME/bin/swayStatusCommand; do sleep 3; done

will display free mem in percents before the clock.

image

Foot having dynamic titles

In .zshrc add

# term info for foot?
# Called when executing a command
function preexec {
    print -Pn "\e]0;${(q)1}\e\\"
}

Or easier/better looking, just disable titlebars in sway config

# border
default_border pixel 6
default_floating_border pixel 6
#for_window [app_id="foot"] border pixel 4
# hide split indicator borders when only one window?
hide_edge_borders smart

Resizing with mice will be easier on fatter borders btw.

image

gtk stuff

Use gnome-tweaks to change font(cuprum) or nwg-look to change theme.

image image

wmenu-run

In sway config replace

set $menu wmenu-run

with

set $menu wmenu-run -b -l 5 -f "monospace 14"

to have wmenu show at the bottom of the screen and in vertical fashion. Change some shortkeys in sway config

# Swap focus between the tiling area and the floating area
# was $mod+spaces
bindsym $mod+t focus mode_toggle

# Start your launcher
bindsym $mod+d exec $menu
bindsym $mod+space exec $menu

image

wallpaper and making sway bar transparent (why not)

output * bg /home/b/wallpapers/bunsenDark2.png fill
# and in bar colors section
background #30344600

image

tools

grim        takes screenshots
viewnior    shows pictures
nmcli       manage connection

nmcli notes

Scan for networks:

nmcli device wifi rescan 

List available networks:

nmcli device wifi list 

Connect to a network (prompt for password):

sudo nmcli device wifi connect 'WIFI_SSID' --ask 

catppuccin theme for geany

https://github.com/catppuccin/geany

image

other ppl configs (examples)

https://gist.github.com/rmrt1n/10c24dc597f5b31f432694fb95329bff
https://github.com/rbnis/legacy-dotfiles/blob/master/.config/sway/config

clipboard (clipman?)

to be continued …

HLS streaming experiment

HLS

Note: Code written by AI. All experiments done on win10 machine.

Goal: Stream my desktop for the purpose of teaching.
More: Provide a remote user with a link that can be opened in browser (or/and VLC). Don’t bother with sound. Use GPU for video encoding to reduce propeller noise.

python server.py

from http.server import HTTPServer, SimpleHTTPRequestHandler

class CORSHandler(SimpleHTTPRequestHandler):
    def end_headers(self):
        self.send_header('Access-Control-Allow-Origin', '*')
        super().end_headers()

port = 8080
server = HTTPServer(('0.0.0.0', port), CORSHandler)
print(f"Serving on http://localhost:{port}")
server.serve_forever()

stream.bat

ffmpeg -f gdigrab -video_size 1920x1080 -framerate 25 -i desktop ^
-c:v h264_nvenc -preset p6 -tune ull ^
-b:v 6000k -maxrate 6000k -bufsize 1200k ^
-g 50 ^
-f hls -hls_time 1 -hls_list_size 3 ^
-hls_flags delete_segments+append_list+omit_endlist ^
-hls_segment_type fmp4 -hls_fmp4_init_filename init.mp4 ^
stream.m3u8
  • Latency may be reduced by using smaller ā€˜-bufsize’, but the video quality will suffer (at some point very visible jumping).

or/and possibly better

stream_gfxcapture.bat (seems to reduce latency for some reason, in loopback mode i get close to 3s. Note that we are now in Variable-Frame-Rate mode.)

ffmpeg -filter_complex gfxcapture=monitor_idx=0:output_fmt=8bit:max_framerate=50 ^
-c:v h264_nvenc -preset p6 -tune ull ^
-b:v 6000k -maxrate 6000k -bufsize 1200k ^
-g 50 ^
-f hls -hls_time 1 -hls_list_size 3 ^
-hls_flags delete_segments+append_list+omit_endlist ^
-hls_segment_type fmp4 -hls_fmp4_init_filename init.mp4 ^
stream.m3u8

player.htm

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>HLS Stream</title>
  <style>
    body { background: #000; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; }
    video { width: 80%; height: auto; }
  </style>
</head>
<body>
  <video id="video" controls autoplay muted></video>

  <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
  <script>
    const video = document.getElementById('video');
    const hlsUrl = 'stream.m3u8'; // your HLS playlist

    if (Hls.isSupported()) {
      const hls = new Hls({
        // optional low-latency tuning
        liveSyncDurationCount: 3, 
        maxBufferLength: 10
      });
      hls.loadSource(hlsUrl);
      hls.attachMedia(video);
      hls.on(Hls.Events.MANIFEST_PARSED, () => video.play());
    } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
      // Safari native HLS support
      video.src = hlsUrl;
  video.addEventListener('loadedmetadata', () => video.play());
} else {
  alert("HLS not supported in this browser");
}
</script>
</body>
</html>

Notes

Latency is significant (5 - 30s). CPU usage is still high, possibly ffmpeg is doing something weird (-video_size ? Can’t i just select monitor 1 somehow?). Stuff to try. < FIXED, gfxcapture is the king.

There is also (very similar?) DASH standard, where one could use HEVC encoding, but chrome/firefox will not work with that (mpv/vlc should).

Autojump to Zoxide

Install zoxide from the page, the curl command

https://github.com/ajeetdsouza/zoxide
Version in debian 13 is to old to support the import –from command.

Import db from autojump

zoxide import --from=autojump ".local/share/autojump/autojump.txt" --merge

in .zshrc add

# zoxide
eval "$(zoxide init zsh)"

Make sure zoxide is on $PATH, or in .zshrc add

# /home/b/.local/bin for zoxide
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

Alias j to z

in .bash_aliases or similar file

# autojump to zoxide
alias j='z'

Apt remove autojump, clean autojump entries from .zshrc.

Besides ā€˜z’ command, there is also ā€˜zi’ which provides interactive fuzzy search over zoxide history.

Debate: https://news.ycombinator.com/item?id=45342943.

Fart Button in JavaScript (Full Course)

https://www.youtube.com/watch?v=K9V8UA-oJBE

tsoding / Implementing a Fart Button Website