15. 3. 2024
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
Note that the key is still stored in plain text.
Something about encryption here.
5. 3. 2024
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
4. 3. 2024
Similar 4k version of it.
^Blender eevee + some post.
3440x1440 version with some post exposure change.
^Just a sphere with some blendkit materials.
2024, 4k cycles
Original post date: 2020-11-02
28. 2. 2024
It uses tabs by default, to use 4 spaces:
shfmt formats shell programs. If the only argument is a dash (‘-‘) or no arguments are given, standard input will be used. If a given path is a directory, all shell scripts found under that directory will be used.
27. 2. 2024
Scripts
3 simple scripts to blurp last or middle or scene detected frames to tty.
edit: There is also a version of scene detected that generates some html < This is the hero version.
Bug hunt (sceneFrameMitHtml)
edit: Known bugs: When the scene counter reaches 1000, things break. edit2: Most likely, almost certainly the bug is already at the ffmeg line:
# first frame, I want as well
ffmpeg -hide_banner -loglevel panic -i "$1" -vf "${crop}" -vframes 1 -pix_fmt rgb24 "$tmp/make/000.png" || exit
# scene detect
ffmpeg -hide_banner -loglevel info -nostats -i "$1" -threads 0 -vf "${crop},select=gt(scene\,0.4)",showinfo -pix_fmt rgb24 -vsync vfr "$tmp/make/%03d.png" 2> "$tmp/detect.log" >/dev/null &
pid="$!"
where %03d can obviously only host 999 numbers, duh. FIX THE SCRIPT.
edit3: Another bug was in this grep:
var="$(grep "n: \+$frame " "$tmp/detect.log")"
but detect.log gaining 1000ths detection will actually not match (there is no space no more in front of the number), possible solution would be:
# \s matches any whitespace chars (including newline, tab), and you can use * to match ZERO or more of them
var="$(grep "n:\s*$frame " "$tmp/detect.log")";
Probably fixed.
Demos & screenshots
lastFrame demo
sceneFrame demo
https://www.youtube.com/watch?v=VzYZWDprddI
p.s. Also tested with kitty term and seems to work fine
(This post and scripts were first posted 22. 6. 2022.)
26. 2. 2024
Wikipedia :
The film explores philosophical themes such as existentialism, nihilism, surrealism, and absurdism, as well as themes such as neurodivergence, depression, generational trauma, and Asian American identity.
The shooting script (pdf).