EZT XML to srt

How to convert xml eztitles subtitles to plain old srt?

This one can:
https://www.videohelp.com/software/Subtitle-Edit

Terminal Trove

TUI and CLI tools with handy and quick install instructions

https://terminaltrove.com/new/
https://news.ycombinator.com/item?id=39975887

Custom HDRI

https://www.youtube.com/watch?v=MASbLjQ9S_Y

An HDRI, which stands for High Dynamic Range Image, is a 360° image that is wrapped around an image or even a 3D model for lighting and background purposes.

Reporting to duty

sad doge

The question of free will

https://www.youtube.com/watch?v=pFg1ysJ1oUs

Notes from an AI - you.com / genius mode:

…fascinating discussion between Neil deGrasse Tyson, Chuck Nice, and neuroscientist Robert Sapolsky. Here are the five main highlights:

Free Will Discussion: The conversation revolves around the concept of free will. Sapolsky argues that free will is non-existent, and our actions and decisions are a result of our biology and environment.

Influence of Biology and Environment: According to Sapolsky, our actions are influenced by various factors, including our brain activity, upbringing, hormones, and even our diet. He suggests that our decisions are not made freely but are the outcome of these influences.

Implications for Society: The discussion also explores the societal implications of this viewpoint. If free will doesn’t exist, it could necessitate a reevaluation of our moral code, criminal justice system, and notions of responsibility, punishment, and reward. Sapolsky believes that understanding the absence of free will could lead to a more compassionate society.

Challenges to the Concept of Free Will: Tyson challenges Sapolsky’s view by questioning how it could be falsified. Sapolsky responds that to disprove his theory, one would need to demonstrate a neuron or network of neurons acting independently of its history. He also dismisses the idea that quantum physics could provide a mechanism for free will, arguing that it would only introduce randomness, not free will.

Potential for Change: Despite the absence of free will, Sapolsky argues that change is still possible. He suggests that education and social enlightenment can lead to changes in behavior and thinking. He also believes that understanding the lack of free will could lead to a more compassionate society, as it would shift the focus from punishment to understanding and helping individuals.

Best Practices for API Key Safety

https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety

echo "export SOME_API_KEY='yourkey'" >> ~/.zshrc
# or .~/bashrc

and the script can then just read the key

key="$SOME_API_KEY"

Note that the key is still stored in plain text.

Something about encryption here.

Chessboard.js and fen-to-svg.py

The easiest way to embed a chess board on your site.

https://chessboardjs.com/download

Ruy Lopez example:

Multiple boards

Notes:

  • If one doesn’t know js that well, this is pain to setup
  • Pieces are pngs for some reason, why not svgs? (FIXED)

Relevant Code of this post

Where chessboard part (js, img, css) is hosted on ‘my’ server in /public/js/chessboard/..

    ## Ruy Lopez example:

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <link rel="stylesheet" href="/public/js/chessboard/css/chessboard-1.0.0.min.css">
    <script src="/public/js/chessboard/js/chessboard-1.0.0.min.js"></script>

    <div id="ruyLopez" style="width: 550px"></div>

    <script>
    var config = {
    pieceTheme: '/public/js/chessboard/img/chesspieces/svg/{piece}.svg',
    position: 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R',
    draggable: true,
    dropOffBoard: 'trash'
    }
    var board = Chessboard('ruyLopez', config)
    </script>

    ## Multiple boards

    <div id="board1" style="width: 200px; display: inline-block;"></div>
    <div id="board2" style="width: 200px; display: inline-block;"></div>
    <div id="board3" style="width: 200px; display: inline-block;"></div>

    <script>
    var board1 = Chessboard('board1', {
    position: 'start',
    pieceTheme: '/public/js/chessboard/img/chesspieces/svg/{piece}.svg',
    showNotation: false
    })

    var board2 = Chessboard('board2', {
    position: 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R',
    pieceTheme: '/public/js/chessboard/img/chesspieces/svg/{piece}.svg',
    showNotation: false
    })

    var board3 = Chessboard('board3', {
    position: 'r1k4r/p2nb1p1/2b4p/1p1n1p2/2PP4/3Q1NB1/1P3PPP/R5K1',
    pieceTheme: '/public/js/chessboard/img/chesspieces/svg/{piece}.svg',
    showNotation: false
    })
    </script>

FEN to svg chessboard using python

Using venv:

# make folder to host virtual enviroment
mkdir chess && cd chess
python3 -m venv .
source ./bin/activate
which python
# should return non-system-wide binary:
/home/b/chess/bin/python
python3 -m pip install --upgrade pip
pip install python-chess

Get this script in the chess directory as well:
https://gist.github.com/bngsudheer/47a150aa8ac3d2dcc9f8a0c34dbafa80

Run as:

python ./fen-to-svg.py 'r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R b KQkq - 3 3' test

And voila:

r . b q k b n r
p p p p . p p p
. . n . . . . .
. B . . p . . .
. . . . P . . .
. . . . . N . .
P P P P . P P P
R N B Q K . . R

to remove coordinates and border, the modified fen-to-svg.py script would look like:

import chess, sys
import chess.svg

# Install python-chess to your Python3 virtualenv
# virtualenv -p python3 ~/path/to/myvenv
# source /path/to/myvenv/bin/activate
# Usage: python3 fen-to-svg.py 'myfenstring' outputfilename
# or /path/to/myvenv/bin/python3 fen-to-svg.py 'myfenstring' outputfilename
fen = sys.argv[1]
file_name = '{}.svg'.format(sys.argv[2])

board = chess.Board(fen)

boardsvg = chess.svg.board(board = board, coordinates = False, borders = False)
with open(file_name, "w") as f:
    f.write(boardsvg)

rendering as:

r . b q k b n r
p p p p . p p p
. . n . . . . .
. B . . p . . .
. . . . P . . .
. . . . . N . .
P P P P . P P P
R N B Q K . . R