From 1100562e29f6476448b656dbddd4cf22505523f6 Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sun, 10 Mar 2024 14:59:14 +0100 Subject: Move back to JBMAFP --- .../2022-08-13-algae-spotted-on-river-sava.md | 30 +++ content/notes/2023-05-01-cachebusting-in-hugo.md | 16 ++ content/notes/2023-05-05-run-9front-in-qemu.md | 27 +++ .../notes/2023-05-06-git-push-multiple-origins.md | 16 ++ .../notes/2023-05-07-mount-plan9-over-network.md | 22 +++ content/notes/2023-05-08-write-iso-usb.md | 14 ++ content/notes/2023-05-09-catv-weechat-config.md | 20 ++ content/notes/2023-05-10-plan9-screenshot.md | 21 +++ content/notes/2023-05-11-fix-plan9-bootloader.md | 19 ++ .../notes/2023-05-12-install-plan9port-linux.md | 20 ++ .../notes/2023-05-13-download-youtube-videos.md | 24 +++ content/notes/2023-05-14-convert-mkv.md | 21 +++ .../notes/2023-05-15-preview-troff-man-pages.md | 19 ++ content/notes/2023-05-16-mass-set-permission.md | 15 ++ .../2023-05-22-non-blocking-shell-exec-csharp.md | 43 +++++ .../notes/2023-05-23-extend-lua-with-custom-c.md | 53 ++++++ content/notes/2023-05-23-parse-rss-with-lua.md | 39 ++++ content/notes/2023-05-24-fresh-9front-desktop.md | 13 ++ content/notes/2023-05-25-dcss-new-player-guide.md | 97 ++++++++++ content/notes/2023-05-25-show-xterm-colors.md | 83 +++++++++ content/notes/2023-05-25-tmux-sane-defaults.md | 36 ++++ .../2023-05-27-cronjobs-github-with-actions.md | 32 ++++ content/notes/2023-05-27-dcss-on-4k-displays.md | 29 +++ .../notes/2023-05-27-drawing-pixels-in-plan9.md | 82 +++++++++ content/notes/2023-05-28-easy-time-took-in-bash.md | 24 +++ .../2023-05-29-grep-to-less-maintain-colors.md | 24 +++ content/notes/2023-05-31-extending-dte-editor.md | 51 +++++ content/notes/2023-06-01-ewd-manuscripts-ebook.md | 21 +++ content/notes/2023-06-04-bulk-make-thumbnails.md | 20 ++ .../2023-06-21-presentations-with-markdown.md | 77 ++++++++ content/notes/2023-06-24-making-cgit-look-nicer.md | 205 +++++++++++++++++++++ ...023-06-25-alacritty-open-links-with-modifier.md | 34 ++++ ...2023-06-25-development-environments-with-nix.md | 67 +++++++ ...29-10gui-10-finger-multitouch-user-interface.md | 24 +++ .../2023-06-29-60s-ibm-computers-commercial.md | 16 ++ ...-fix-screen-tearing-on-debian-12-xorg-and-i3.md | 22 +++ ...nline-radio-streaming-with-mpv-from-terminal.md | 14 ++ ...7-14-set-color-temperature-of-displays-on-i3.md | 15 ++ ...23-08-01-make-b-w-svg-charts-with-matplotlib.md | 70 +++++++ content/notes/2023-09-18-aws-eb-pyyaml-fix.md | 35 ++++ .../2023-09-25-compile-drawterm-on-fedora-38.md | 23 +++ ...4-using-ffmpeg-to-combine-video-side-by-side.md | 40 ++++ .../2023-11-05-add-lazy-loading-to-jekyll-posts.md | 33 ++++ .../notes/2023-11-07-personal-sane-vim-defaults.md | 59 ++++++ .../notes/2024-02-15-extract-lines-from-file.md | 19 ++ .../notes/2024-02-21-dcss-online-rc-defaults.md | 33 ++++ ...2024-02-23-uninstall-ollama-from-a-linux-box.md | 25 +++ 47 files changed, 1742 insertions(+) create mode 100644 content/notes/2022-08-13-algae-spotted-on-river-sava.md create mode 100644 content/notes/2023-05-01-cachebusting-in-hugo.md create mode 100644 content/notes/2023-05-05-run-9front-in-qemu.md create mode 100644 content/notes/2023-05-06-git-push-multiple-origins.md create mode 100644 content/notes/2023-05-07-mount-plan9-over-network.md create mode 100644 content/notes/2023-05-08-write-iso-usb.md create mode 100644 content/notes/2023-05-09-catv-weechat-config.md create mode 100644 content/notes/2023-05-10-plan9-screenshot.md create mode 100644 content/notes/2023-05-11-fix-plan9-bootloader.md create mode 100644 content/notes/2023-05-12-install-plan9port-linux.md create mode 100644 content/notes/2023-05-13-download-youtube-videos.md create mode 100644 content/notes/2023-05-14-convert-mkv.md create mode 100644 content/notes/2023-05-15-preview-troff-man-pages.md create mode 100644 content/notes/2023-05-16-mass-set-permission.md create mode 100644 content/notes/2023-05-22-non-blocking-shell-exec-csharp.md create mode 100644 content/notes/2023-05-23-extend-lua-with-custom-c.md create mode 100644 content/notes/2023-05-23-parse-rss-with-lua.md create mode 100644 content/notes/2023-05-24-fresh-9front-desktop.md create mode 100644 content/notes/2023-05-25-dcss-new-player-guide.md create mode 100644 content/notes/2023-05-25-show-xterm-colors.md create mode 100644 content/notes/2023-05-25-tmux-sane-defaults.md create mode 100644 content/notes/2023-05-27-cronjobs-github-with-actions.md create mode 100644 content/notes/2023-05-27-dcss-on-4k-displays.md create mode 100644 content/notes/2023-05-27-drawing-pixels-in-plan9.md create mode 100644 content/notes/2023-05-28-easy-time-took-in-bash.md create mode 100644 content/notes/2023-05-29-grep-to-less-maintain-colors.md create mode 100644 content/notes/2023-05-31-extending-dte-editor.md create mode 100644 content/notes/2023-06-01-ewd-manuscripts-ebook.md create mode 100644 content/notes/2023-06-04-bulk-make-thumbnails.md create mode 100644 content/notes/2023-06-21-presentations-with-markdown.md create mode 100644 content/notes/2023-06-24-making-cgit-look-nicer.md create mode 100644 content/notes/2023-06-25-alacritty-open-links-with-modifier.md create mode 100644 content/notes/2023-06-25-development-environments-with-nix.md create mode 100644 content/notes/2023-06-29-10gui-10-finger-multitouch-user-interface.md create mode 100644 content/notes/2023-06-29-60s-ibm-computers-commercial.md create mode 100644 content/notes/2023-07-10-fix-screen-tearing-on-debian-12-xorg-and-i3.md create mode 100644 content/notes/2023-07-10-online-radio-streaming-with-mpv-from-terminal.md create mode 100644 content/notes/2023-07-14-set-color-temperature-of-displays-on-i3.md create mode 100644 content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md create mode 100644 content/notes/2023-09-18-aws-eb-pyyaml-fix.md create mode 100644 content/notes/2023-09-25-compile-drawterm-on-fedora-38.md create mode 100644 content/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md create mode 100644 content/notes/2023-11-05-add-lazy-loading-to-jekyll-posts.md create mode 100644 content/notes/2023-11-07-personal-sane-vim-defaults.md create mode 100644 content/notes/2024-02-15-extract-lines-from-file.md create mode 100644 content/notes/2024-02-21-dcss-online-rc-defaults.md create mode 100644 content/notes/2024-02-23-uninstall-ollama-from-a-linux-box.md (limited to 'content/notes') diff --git a/content/notes/2022-08-13-algae-spotted-on-river-sava.md b/content/notes/2022-08-13-algae-spotted-on-river-sava.md new file mode 100644 index 0000000..6db8c3c --- /dev/null +++ b/content/notes/2022-08-13-algae-spotted-on-river-sava.md @@ -0,0 +1,30 @@ +--- +title: Aerial photography of algae spotted on river Sava +url: /aerial-photography-of-algae-spotted-on-river-sava.html +date: 2022-08-13T12:00:00+02:00 +type: note +draft: false +--- + +This is a bit of a different post than I usually write, but quite interesting +one to me. River Sava has plenty of hydropower plants located down the stream. +This makes regulating the strength of a current easier than normally. Because of +lower stream strength and high temperatures, algae has formed on the river. +This is the first time I've seen something like this in my whole life. + +Below are some photographs taken from a DJI drone capturing the event. + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-0.jpg) + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-1.jpg) + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-2.jpg) + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-3.jpg) + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-4.jpg) + +![Algae on Sava](/assets/posts/algae-sava/dji-algae-5.jpg) + +I will try to get more photos of this in the future days and if something +intriguing shows up will post it again on the blog. diff --git a/content/notes/2023-05-01-cachebusting-in-hugo.md b/content/notes/2023-05-01-cachebusting-in-hugo.md new file mode 100644 index 0000000..588ee69 --- /dev/null +++ b/content/notes/2023-05-01-cachebusting-in-hugo.md @@ -0,0 +1,16 @@ +--- +title: Cache busting in Hugo +url: /cachebusting-in-hugo.html +date: 2023-05-01T12:00:00+02:00 +type: note +draft: false +--- + +```html +\{\{ $cachebuster := delimit (shuffle (split (md5 "6fab11c6669976d759d2992eff1dd5be") "" )) "" \}\} + + +``` + +This `6fab11c6669976d759d2992eff1dd5be` can be random string you generate use. +You can use whatever you want. diff --git a/content/notes/2023-05-05-run-9front-in-qemu.md b/content/notes/2023-05-05-run-9front-in-qemu.md new file mode 100644 index 0000000..4425d7f --- /dev/null +++ b/content/notes/2023-05-05-run-9front-in-qemu.md @@ -0,0 +1,27 @@ +--- +title: Run 9front in Qemu +url: /run-9front-in-qemu.html +date: 2023-05-05T12:00:00+02:00 +type: note +draft: false +--- + +Run 9front in Qemu. This applies to [Plan9](https://9p.io/plan9/) and +[9front](https://9front.org/). + +Download from here http://9front.org/iso/. + +```sh +# Create a qcow2 image. +qemu-img create -f qcow2 $HOME/VM/9front.qcow2.img 30G + +# Run the VM. +qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \ + -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \ + -device virtio-scsi-pci,id=scsi \ + -drive if=none,id=vd0,file=$HOME/VM/9front.qcow2.img \ + -device scsi-hd,drive=vd0 \ + -drive if=none,id=vd1,file=$HOME/VM/ISO/9front.386.iso \ + -device scsi-cd,drive=vd1,bootindex=0 +``` + diff --git a/content/notes/2023-05-06-git-push-multiple-origins.md b/content/notes/2023-05-06-git-push-multiple-origins.md new file mode 100644 index 0000000..91429cd --- /dev/null +++ b/content/notes/2023-05-06-git-push-multiple-origins.md @@ -0,0 +1,16 @@ +--- +title: Push to multiple origins at once in Git +url: /git-push-multiple-origins.html +date: 2023-05-06T12:00:00+02:00 +type: note +draft: false +--- + +Sometimes you want to push to multiple origins at once. This is useful if you +have a mirror of your repository on another server. You can do this by adding +multiple push urls to your git config. This is a shorthand for command above. + +```sh +git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' +``` + diff --git a/content/notes/2023-05-07-mount-plan9-over-network.md b/content/notes/2023-05-07-mount-plan9-over-network.md new file mode 100644 index 0000000..f1558a4 --- /dev/null +++ b/content/notes/2023-05-07-mount-plan9-over-network.md @@ -0,0 +1,22 @@ +--- +title: Mount Plan9 over network +url: /mount-plan9-over-network.html +date: 2023-05-07T12:00:00+02:00 +type: note +draft: false +--- + +- First install libfuse with sudo apt install libfuse-dev. +- Then clone https://github.com/ftrvxmtrx/9pfs and compile it with make. +- Copy 9pfs to your path. + +```sh +# On Plan9 side +ip/ipconfig # enables network +aux/listen1 -tv tcp!*!9999 /bin/exportfs -r tmp # export tmp folder + +# On Linux side +9pfs 172.18.0.1 -p 9999 local_folder # mount +umount local_folder # unmount +``` + diff --git a/content/notes/2023-05-08-write-iso-usb.md b/content/notes/2023-05-08-write-iso-usb.md new file mode 100644 index 0000000..35faf1f --- /dev/null +++ b/content/notes/2023-05-08-write-iso-usb.md @@ -0,0 +1,14 @@ +--- +title: Write ISO to USB Key +url: /write-iso-usb.html +date: 2023-05-08T12:00:00+02:00 +type: note +draft: false +--- + +Write ISO to USB key. Nothing fancy here. + +```sh +sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync +``` + diff --git a/content/notes/2023-05-09-catv-weechat-config.md b/content/notes/2023-05-09-catv-weechat-config.md new file mode 100644 index 0000000..7155c36 --- /dev/null +++ b/content/notes/2023-05-09-catv-weechat-config.md @@ -0,0 +1,20 @@ +--- +title: "#cat-v on weechat configuration" +url: /catv-weechat-config.html +date: 2023-05-09T12:00:00+02:00 +type: note +draft: false +--- + +Set up weechat to connect to #cat-v on oftc. This applies to +[weechat](https://weechat.org/) but should be similar for other irc clients. + +```sh +# Install weechat and launch it and execute the following commands. + +/server add oftc irc.oftc.net -tls +/set irc.server.oftc.autoconnect on +/set irc.server.oftc.autojoin "#cat-v" +/set irc.server.oftc.nicks "nick1,nick2,nick3" +``` + diff --git a/content/notes/2023-05-10-plan9-screenshot.md b/content/notes/2023-05-10-plan9-screenshot.md new file mode 100644 index 0000000..db64e95 --- /dev/null +++ b/content/notes/2023-05-10-plan9-screenshot.md @@ -0,0 +1,21 @@ +--- +title: Take a screenshot in Plan9 +url: /plan9-screenshot.html +date: 2023-05-10T12:00:00+02:00 +type: note +draft: false +--- + +Take a screenshot in Plan9. This applies to [Plan9](https://9p.io/plan9/) and +[9front](https://9front.org/). This will take a screenshot of the screen and +output it to `/dev/screen`. You can then use `topng` to convert it to a png +image. + +```sh +# Instant screenshot. +cat /dev/screen | topng > screen.png + +# Delayed screenshot (5 seconds). +sleep 5; cat /dev/screen | topng > screen.png +``` + diff --git a/content/notes/2023-05-11-fix-plan9-bootloader.md b/content/notes/2023-05-11-fix-plan9-bootloader.md new file mode 100644 index 0000000..69c4408 --- /dev/null +++ b/content/notes/2023-05-11-fix-plan9-bootloader.md @@ -0,0 +1,19 @@ +--- +title: Fix bootloader not being written in Plan9 +url: /fix-plan9-bootloader.html +date: 2023-05-11T12:00:00+02:00 +type: note +draft: false +--- + +If the bootloader is not being written to a disk when installing 9front on real +harware try clearing first sector of the disk with the following command. + +```sh +dd if=/dev/zero of=/dev/sdX bs=512 count=1 + +# If command above doesn't work try this one, wait couple of seconds and +# press delete key to stop the command. +cat /dev/sd*/data +``` + diff --git a/content/notes/2023-05-12-install-plan9port-linux.md b/content/notes/2023-05-12-install-plan9port-linux.md new file mode 100644 index 0000000..2ae5494 --- /dev/null +++ b/content/notes/2023-05-12-install-plan9port-linux.md @@ -0,0 +1,20 @@ +--- +title: Install Plan9port on Linux +url: /install-plan9port-linux.html +date: 2023-05-12T12:00:00+02:00 +type: note +draft: false +--- + +Install Plan9port on Linux. This applies to +[Plan9port](https://9fans.github.io/plan9port/). This is a port of many Plan 9 +programs to Unix-like operating systems. Useful for programs like `9term` and +`rc`. + +```sh +sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev +git clone https://github.com/9fans/plan9port $HOME/plan9 +cd $HOME/plan9/plan9port +./INSTALL -r $HOME/plan9 +``` + diff --git a/content/notes/2023-05-13-download-youtube-videos.md b/content/notes/2023-05-13-download-youtube-videos.md new file mode 100644 index 0000000..2ac6e76 --- /dev/null +++ b/content/notes/2023-05-13-download-youtube-videos.md @@ -0,0 +1,24 @@ +--- +title: Download list of YouTube files +url: /download-youtube-videos.html +date: 2023-05-13T12:00:00+02:00 +type: note +draft: false +--- + +If you need to download a list of YouTube videos and don't want to download the +actual YouTube list (which `yt-dlp` supports), you can use the following method. + +```js +// Used to get list of raw URL's from YouTube's video tab'. +// Copy them into videos.txt. +document.querySelectorAll('#contents a.ytd-thumbnail.style-scope.ytd-thumbnail').forEach(el => console.log(el.href)) +``` + +Download and install https://github.com/yt-dlp/yt-dlp. + +```sh +# This will download all videos in videos.txt. +yt-dlp --batch-file videos.txt -N `nproc` -f webm +``` + diff --git a/content/notes/2023-05-14-convert-mkv.md b/content/notes/2023-05-14-convert-mkv.md new file mode 100644 index 0000000..0aa96fd --- /dev/null +++ b/content/notes/2023-05-14-convert-mkv.md @@ -0,0 +1,21 @@ +--- +title: Convert all MKV files into other formats +url: /convert-mkv.html +date: 2023-05-14T12:00:00+02:00 +type: note +draft: false +--- + +You will need `ffmpeg` installed on your system. This will convert all MKV files +into WebM format. + +```sh +# Convert all MKV files into WebM format. +find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" -vcodec libvpx -acodec libvorbis -cpu-used 5 -threads 8 "${0%%.mp4}.webm"' {} \; +``` + +```sh +# Convert all MKV files into MP4 format. +find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" c:a copy -c:v copy -cpu-used 5 -threads 8 "${0%%.mp4}.mp4"' {} \; +``` + diff --git a/content/notes/2023-05-15-preview-troff-man-pages.md b/content/notes/2023-05-15-preview-troff-man-pages.md new file mode 100644 index 0000000..f5cbade --- /dev/null +++ b/content/notes/2023-05-15-preview-troff-man-pages.md @@ -0,0 +1,19 @@ +--- +title: Previews how man page written in Troff will look like +url: /preview-troff-man-pages.html +date: 2023-05-15T12:00:00+02:00 +type: note +draft: false +--- + +Troff is used to write man pages and it is difficult to read it so this will +preview how it will look like when it is rendered. + +```sh +# On Linux system. +groff -man -Tascii filename + +# On Plan9 system. +man 1 filename +``` + diff --git a/content/notes/2023-05-16-mass-set-permission.md b/content/notes/2023-05-16-mass-set-permission.md new file mode 100644 index 0000000..4a32931 --- /dev/null +++ b/content/notes/2023-05-16-mass-set-permission.md @@ -0,0 +1,15 @@ +--- +title: Change permissions of matching files recursively +url: /mass-set-permission.html +date: 2023-05-16T12:00:00+02:00 +type: note +draft: false +--- + +Replace `*.xml` with your pattern. This will remove executable bit from all +files matching the pattern. Change `+` to `-` to add executable bit. + +```sh +find . -type f -name "*.xml" -exec chmod -x {} + +``` + diff --git a/content/notes/2023-05-22-non-blocking-shell-exec-csharp.md b/content/notes/2023-05-22-non-blocking-shell-exec-csharp.md new file mode 100644 index 0000000..afe7491 --- /dev/null +++ b/content/notes/2023-05-22-non-blocking-shell-exec-csharp.md @@ -0,0 +1,43 @@ +--- +title: Execute not blocking async shell command in C# +url: /non-blocking-shell-exec-csharp.html +date: 2023-05-22T12:00:00+02:00 +type: note +draft: false +--- + +Execute a shell command in async in C# while not blocking the UI thread. + +```c# +private async Task executeCopyCommand() +{ + await Task.Run(() => + { + var processStartInfo = new ProcessStartInfo("cmd", "/c dir") + { + RedirectStandardOutput = true, + UseShellExecute = false, + CreateNoWindow = true + }; + + var process = new Process + { + StartInfo = processStartInfo + }; + + process.Start(); + process.WaitForExit(); + }); +} +``` + +Make sure that `async` is present in the function definition and `await` is used +in the method that calls `executeCopyCommand()`. + +```c# +private async void button_Click(object sender, EventArgs e) +{ + await executeCopyCommand(); +} +``` + diff --git a/content/notes/2023-05-23-extend-lua-with-custom-c.md b/content/notes/2023-05-23-extend-lua-with-custom-c.md new file mode 100644 index 0000000..013616b --- /dev/null +++ b/content/notes/2023-05-23-extend-lua-with-custom-c.md @@ -0,0 +1,53 @@ +--- +title: Extend Lua with custom C functions using Clang +url: /extend-lua-with-custom-c.html +date: 2023-05-23T12:00:00+02:00 +type: note +draft: false +--- + +Here is a boilerplate for extending Lua with custom C functions. This requires +Clang and Lua 5.1 to be installed. GCC can be used instead of Clang, but the +Makefile will need to be modified. + +- nativefunc.c + + ```c + #include + #include + + static int l_mult50(lua_State *L) { + double number = luaL_checknumber(L, 1); + lua_pushnumber(L, number * 50); + return 1; + } + + int luaopen_nativefunc(lua_State *L) { + static const struct luaL_Reg nativeFuncLib[] = { {"mult50", l_mult50}, {NULL, NULL} }; + + luaL_register(L, "nativelib", nativeFuncLib); + return 1; + } + ``` + +- main.lua + + ```lua + require "nativefunc" + print(nativelib.mult50(50)) + ``` + +- Makefile + + ```Makefile + CC = clang + CFLAGS = + INCLUDES = `pkg-config lua5.1 --cflags-only-I` + + all: + $(CC) -shared -o nativefunc.so -fPIC nativefunc.c $(CFLAGS) $(INCLUDES) + + clean: + rm *.so + ``` + diff --git a/content/notes/2023-05-23-parse-rss-with-lua.md b/content/notes/2023-05-23-parse-rss-with-lua.md new file mode 100644 index 0000000..7802c31 --- /dev/null +++ b/content/notes/2023-05-23-parse-rss-with-lua.md @@ -0,0 +1,39 @@ +--- +title: Parse RSS feeds with Lua +url: /parse-rss-with-lua.html +date: 2023-05-23T12:00:00+02:00 +type: note +draft: false +--- + +Example of parsing RSS feeds with Lua. Before running the script install: + +- feedparser with `luarocks install feedparser` +- luasocket with `luarocks install luasocket` + +```lua +local http = require("socket.http") +local feedparser = require("feedparser") + +local feed_url = "https://mitjafelicijan.com/index.xml" + +local response, status, _ = http.request(feed_url) +if status == 200 then + local parsed = feedparser.parse(response) + + -- Print out feed details. + print("> Title ", parsed.feed.title) + print("> Author ", parsed.feed.author) + print("> ID ", parsed.feed.id) + print("> Entries ", #parsed.entries) + + for _, item in ipairs(parsed.entries) do + print("GUID ", item.guid) + print("Title ", item.title) + print("Link ", item.link) + print("Summary ", item.summary) + end +else + print("! Request failed. Status:", status) +end +``` diff --git a/content/notes/2023-05-24-fresh-9front-desktop.md b/content/notes/2023-05-24-fresh-9front-desktop.md new file mode 100644 index 0000000..1d8deed --- /dev/null +++ b/content/notes/2023-05-24-fresh-9front-desktop.md @@ -0,0 +1,13 @@ +--- +title: My brand new Plan9/9front desktop +url: /fresh-9front-desktop.html +date: 2023-05-24T12:00:00+02:00 +type: note +draft: false +--- + +I have been experimenting with Plan9/9front for a week now. Noice! This is how +my desktop looks like. + +![9front desktop](/assets/notes/9front-desktop.png) + diff --git a/content/notes/2023-05-25-dcss-new-player-guide.md b/content/notes/2023-05-25-dcss-new-player-guide.md new file mode 100644 index 0000000..a19e2ea --- /dev/null +++ b/content/notes/2023-05-25-dcss-new-player-guide.md @@ -0,0 +1,97 @@ +--- +title: Dungeon Crawl Stone Soup - New player guide +url: /dcss-new-player-guide.html +date: 2023-05-25T22:00:00+02:00 +type: note +draft: false +--- + +An amazing game deserves an amazing guide. All this material can be find in some +form on another on [craw's](https://github.com/crawl/crawl) official repository. + +- [DCSS Quickstart](/assets/notes/dcss-quickstart.pdf) - Very short introduction to the + game +- [DCSS Manual](/assets/notes/dcss_manual.pdf) - Extensive manual about the game + +![Dungeon Crawl Stone Soup](/assets/notes/dcss.jpg) + +**Movement and Exploration** + +- You can move around with the numpad (try numlock on and off), vi-keys, or + clicking with the mouse. Arrow keys work, though you can't move diagonally + with them. Pressing Shift and a direction will move until you see/hit + something. +- Pressing `>` will take you down a staircase, and `<` to go up a staircase. +- You can open doors by walking into them, and close them with `C`. +- You can autoexplore by pressing `o`. +- You can re-view recent messages with `Ctrl-p`. + +**Monsters and Combat** + +- You can pick up items with `,` or `g`. +- Wield weapons with `w`. Weapons have different stats. + - (You may also engage in Unarmed Combat, though it isn't very effective when + untrained). +- Attack monsters in melee by walking in their direction (or with + Ctrl-direction). +- You can wait with `.` or `s`, passing your turn - such as to get monsters into + a corridor with you. +- You can rest with `5`, waiting until you are fully healed, or something + noteworthy happens. +- Either mouseover and rightclick, or use `x` then `v` on the monster to examine + monsters. Monsters with a red border are 'dangerous' relative to your current + XP level (XL). +- Quiver (often ranged) actions for further use with `Q`. +- You can fire ranged weapons manually with `f`, or auto-target your quiver with + `p` or `Shift-Tab`. Throwing weapons can be thrown immediately, while + launchers (like bows) need to be wielded first. + +**Items and Inventory** + +- View your inventory by pressing `i`. Most item related commands can also be + done with this menu. +- You can wear amour with `W;` amour gives `AC`, while heavier body armour + reduces `EV`. +- Autoexplore will automatically pick up useful items, such as potions and + scrolls, if you aren't in danger. +- You can read scrolls with `r` and drink ("quaff") potions with `q`. +- Equipment items may have brands, with special properties. Branded equipment is + blue when unidentified. +- Equipment items may be artifacts, often with unique properties, and are + unmodifiable. They are written in white. +- You can evoke wands with `V`. +- You can put on jewelry with `P`, and remove it with `R`. +- Gold is used in shops, which can be interacted with by either `>` or `<`. + +**Magic and Spellcasting** + +- Once you find a spellbook, you can memorize spells with `M`. +- You need to be the same XL as the spell's spell level in order to learn it, in + addition to training magical skill (to lower failure rate). +- Cast spells by pressing `z`, then the letter assigned to the spell. You may + also Quiver a spell and then use it like a ranged weapon (with Shift-Tab). +- You can view your memorized spells by pressing `I` (capital-i) or `z`. +- Like HP, you can recover MP by resting (with 5). +- Many spells can be positioned more effectively, or combined with other spells, + in order to get (more effective) use out of them. +- Heavier body amour and shields hamper spellcasting. + +**Gods and Divine Abilities** + +- You may look at a god's overview by praying at their altar (with `>` or `<`). + After praying, you can worship the god by pressing Enter afterwards. +- Gods all have unique features about them. Trog, the god of the tutorial, is + also the god of rage and bloodshed, and so despises spellcasting. +- Gods like and dislike different things. Most gods either like killing things + (like Trog) or exploring new areas (like Elyvilon), rewarding you piety + (divine favor) for doing so. +- You should learn to use and even rely on divine abilities often, as they are + usually very strong. Trog's Berserk gives you 1.5x health, 1.5x speed (to all + valid actions), and a big damage boost. Note that Berserk prevents most + actions other than move and melee attack, and runs out very quickly if you + aren't attacking. And after berserk ends, you are slowed down and can't + berserk again for a short time. +- In addition, the vast majority of abilities consume piety in the process. + Regardless, this ability is very cheap, and the benefits are incredible, so + don't hold back! +- Pressing `^` will let you view your current god, abilities, and piety. diff --git a/content/notes/2023-05-25-show-xterm-colors.md b/content/notes/2023-05-25-show-xterm-colors.md new file mode 100644 index 0000000..79781e2 --- /dev/null +++ b/content/notes/2023-05-25-show-xterm-colors.md @@ -0,0 +1,83 @@ +--- +title: Display xterm color palette +url: /xterm-color-palette.html +date: 2023-05-25T12:00:00+02:00 +type: note +draft: false +--- + +- `bash xterm-palette.sh` - will show you number of max colors available +- `bash xterm-palette.sh -v` - will create a list of all colors with codes + +![xterm color palette](/assets/notes/xterm-palette.png) + +```sh +#!/usr/bin/env bash +# xterm-palette.sh + +trap 'tput sgr0' exit # Clean up even if user hits ^C + +function setfg () { + printf '\e[38;5;%dm' $1 +} + +function setbg () { + printf '\e[48;5;%dm' $1 +} + +function showcolors() { + # Given an integer, display that many colors + for ((i=0; i<$1; i++)) + do + printf '%4d ' $i + setbg $i + tput el + tput sgr0 + echo + done + tput sgr0 el +} + +# First, test if terminal supports OSC 4 at all. +printf '\e]4;%d;?\a' 0 +read -d $'\a' -s -t 0.1 +#include +#include +#include + +void +main() +{ + ulong co; + Image *im, *bg; + co = 0x0000FFFF; + + if (initdraw(nil, nil, argv0) < 0) + { + sysfatal("%s: %r", argv0); + } + + im = allocimage(display, Rect(0, 0, 300, 300), RGB24, 0, DYellow); + bg = allocimage(display, Rect(0, 0, 1, 1), RGB24, 1, co); + + if (im == nil || bg == nil) + { + sysfatal("not enough memory"); + } + + draw(screen, screen->r, bg, nil, ZP); + draw(screen, screen->r, im, nil, Pt(-40, -40)); + + flushimage(display, Refnone); + + // Wait 10 seconds before exiting. + sleep(10000); + + exits(nil); +} +``` + +And then compile with `mk` (mkfile below): + +```makefile +# mkfile + + + + + + + + + + + + + + + + +``` + +Now the markdown file `presentation.md` with presenetation. `---` is used to +separate slides. Other stuff is just pure markdown. + +```md +class: center, middle + +# Main title of the presentation + +--- + +# Fist slide + +Eveniet mollitia nemo architecto rerum aut iure iste. Sit nihil nobis libero iusto fugit nam laudantium ut. Dignissimos corrupti laudantium nisi. + +- Lorem ipsum dolor sit amet, consectetur adipiscing elit. +- Integer aliquet mauris a felis fringilla, ut congue massa finibus. + +--- + +# Slide two + +- Lorem ipsum dolor sit amet, consectetur adipiscing elit. +- Vestibulum eget leo ac dolor venenatis pulvinar. +``` diff --git a/content/notes/2023-06-24-making-cgit-look-nicer.md b/content/notes/2023-06-24-making-cgit-look-nicer.md new file mode 100644 index 0000000..d145cb5 --- /dev/null +++ b/content/notes/2023-06-24-making-cgit-look-nicer.md @@ -0,0 +1,205 @@ +--- +title: "Making cgit look nicer" +url: /making-cgit-look-nicer.html +date: 2023-06-24T13:33:58+02:00 +type: note +draft: false +--- + +For personal use I have a [private Git server](https://git.mitjafelicijan.com) +set up and I use GitHub just as a mirror. By default the cgit theme looks a bit +dated so I made the flowing theme. + +- `/etc/cgitrc` + +```ini +css=/cgit.css +logo=/startrek.gif +favicon=/favicon.png +source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh +about-filter=/usr/lib/cgit/filters/about-formatting.sh + +local-time=1 +snapshots=tar.gz +repository-sort=age +cache-size=1000 +branch-sort=age +summary-log=200 +max-atom-items=50 +max-repo-count=100 + +enable-index-owner=0 +enable-follow-links=1 +enable-log-filecount=1 +enable-log-linecount=1 + +root-title=Place for code, experiments and other bullshit! +root-desc= +clone-url=git@git.mitjafelicijan.com:/home/git/$CGIT_REPO_URL + +mimetype.gif=image/gif +mimetype.html=text/html +mimetype.jpg=image/jpeg +mimetype.jpeg=image/jpeg +mimetype.pdf=application/pdf +mimetype.png=image/png +mimetype.svg=image/svg+xml + +readme=:README.md +readme=:readme.md + +# Must be at the end! +virtual-root=/ +scan-path=/home/git/ +``` + +For `syntax-highlighting-edited.sh` follow instructions on +[https://wiki.archlinux.org/title/Cgit](https://wiki.archlinux.org/title/Cgit#Using_highlight). + +- `/usr/share/cgit/cgit.css` + +```css +* { + font-size: 11pt; +} + +body { + font-family: monospace; + background: white; + padding: 1em; +} + +th, td { + text-align: left; +} + +/* HEADER */ + +#header { + margin-bottom: 1em; +} + +#header .logo img { + display: block; + height: 3em; + margin-right: 10px; +} + +#header .sub.right { + display: none; +} + +/* FOOTER */ + +.footer { + margin-top: 2em; + font-style: italic; +} + +.footer, .footer a { + color: gray; +} + +/* TABS */ + +.tabs a { + margin-bottom: 2em; + display: inline-block; + margin-right: 1em; +} + +.tabs td a:only-child { + display: none; +} + +/* HIDING ELEMENTS */ + +.cgit-panel, .form { + display: none; +} + +/* LISTS */ + +.list td, .list th { + padding-right: 2em; +} + +.list .nohover a { + color: black; +} + +.list .button { + padding-right: 0.5em; +} + +/* COMMIT */ + +.commit-subject { + padding: 1em 0; +} + +.decoration a { + padding-left: 0.5em; +} + +.commit-info th { + padding-right: 1em; +} + +.commit-subject { + padding: 2em 0; +} + +table.diff div.head { + padding-top: 2em; +} + +table.diffstat td { + padding-right: 1em; +} + +/* CONTENT */ + +.linenumbers { + padding-right: 0.5em; +} + +.linenumbers a { + color: gray; +} + +.pager { + display: flex; + list-style-type: none; + padding: 0; + gap: 0.5em; +} + +/* DIFF COLORS */ + +table.diff { + width: 100%; +} + +table.diff td { + white-space: pre; +} + +table.diff td div.head { + font-weight: bold; + margin-top: 1em; + color: black; +} + +table.diff td div.hunk { + color: #009; +} + +table.diff td div.add { + color: green; +} + +table.diff td div.del { + color: red; +} +``` diff --git a/content/notes/2023-06-25-alacritty-open-links-with-modifier.md b/content/notes/2023-06-25-alacritty-open-links-with-modifier.md new file mode 100644 index 0000000..c805053 --- /dev/null +++ b/content/notes/2023-06-25-alacritty-open-links-with-modifier.md @@ -0,0 +1,34 @@ +--- +title: "Alacritty open links with modifier" +url: /alacritty-open-links-with-modifier.html +date: 2023-06-25T17:17:16+02:00 +type: note +draft: false +--- + +Alacritty by default makes all links in the terminal output clickable and this +gets annoying rather quickly. I liked the default behavior of Gnome terminal +where you needed to hold Control key and then you could click and open links. + +To achieve this in Alacritty you need to provide a `hint` in the configuration +file. Config file is located at `~/.config/alacritty/alacritty.yml`. + +```yaml +hints: + enabled: + - regex: "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\ + [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+" + command: xdg-open + post_processing: true + mouse: + enabled: true + mods: Control +``` + +The following should work under any Linux system. For macOS, you will need to +change `command: xdg-open` to something else. + +Now the links will be visible and clickable only when Control key is being +pressed. + +Source: https://github.com/alacritty/alacritty/issues/5246 diff --git a/content/notes/2023-06-25-development-environments-with-nix.md b/content/notes/2023-06-25-development-environments-with-nix.md new file mode 100644 index 0000000..8aa104c --- /dev/null +++ b/content/notes/2023-06-25-development-environments-with-nix.md @@ -0,0 +1,67 @@ +--- +title: "Development environments with Nix" +url: /development-environments-with-nix.html +date: 2023-06-25T16:38:10+02:00 +type: note +draft: false +--- + +Nix is amazing for making reproducible cross OS development environment. + +First you need to [install Nix package +manager](https://nixos.org/download.html). + +- Create a file `shell.nix` in your project folder. +- In the section that has `python3` etc add programs you want to use. These can + be CLI or GUI applications. It doesn't matter to Nix. + +```nix +{ pkgs ? import {} }: + pkgs.mkShell { + nativeBuildInputs = with pkgs.buildPackages; [ + python3 + tinycc + ]; +} +``` + +And then run it `nix-shell`. By default it will look for `shell.nix` file. If +you want to specify a different file use `nix-shell file.nix`. That is about it. + +When the shell is spawned it could happen that your `PS1` prompt will be +overwritten and your prompt will look differently. In that case you need to +either do `NIX_SHELL_PRESERVE_PROMPT=1 nix shell` or add +`NIX_SHELL_PRESERVE_PROMPT` variable to your `bashrc` or `zshrc` file and set it +to `1`. + +I also have a modified `PS1` prompt for Bash that I use and it also catches the +usage of Nix shell. + +```sh +NIX_SHELL_PRESERVE_PROMPT=1 + +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + +is_inside_nix_shell() { + nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)" + if [[ -n "$nix_shell_name" ]]; then + echo " \e[0;36m(nix-shell)\e[0m" + fi +} + +export PS1="[\033[38;5;9m\]\u@\h\[$(tput sgr0)\]]$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ " +``` + +And this is what it looks like when you are in a Nix shell. Otherwise that part +of prompt is omitted + +![PS1 Prompt](/assets/notes/ps1-prompt.png) + +More resources: + +- https://nixos.wiki/wiki/Development_environment_with_nix-shell +- https://nixos.wiki/wiki/Main_Page +- https://itsfoss.com/why-use-nixos/ +- https://mynixos.com/ diff --git a/content/notes/2023-06-29-10gui-10-finger-multitouch-user-interface.md b/content/notes/2023-06-29-10gui-10-finger-multitouch-user-interface.md new file mode 100644 index 0000000..cb012d4 --- /dev/null +++ b/content/notes/2023-06-29-10gui-10-finger-multitouch-user-interface.md @@ -0,0 +1,24 @@ +--- +title: "10/GUI 10 Finger Multitouch User Interface" +url: /10gui-10-finger-multitouch-user-interface.html +date: 2023-06-29T14:51:39+02:00 +type: note +draft: false +--- + +Message from 10/GUI team (page 10gui.com does not exist anymore): + +*Over a quarter-century ago, Xerox introduced the modern graphical user +interface paradigm we today take for granted.* + +*That it has endured is a testament to the genius of its design. But the +industry is now at a crossroads: New technologies promise higher-bandwidth +interaction, but have yet to find a truly viable implementation.* + +*10/GUI aims to bridge this gap by rethinking the desktop to leverage technology +in an intuitive and powerful way.* + + diff --git a/content/notes/2023-06-29-60s-ibm-computers-commercial.md b/content/notes/2023-06-29-60s-ibm-computers-commercial.md new file mode 100644 index 0000000..9c4328b --- /dev/null +++ b/content/notes/2023-06-29-60s-ibm-computers-commercial.md @@ -0,0 +1,16 @@ +--- +title: "60's IBM Computers Commercial" +url: /60s-ibm-computers-commercial.html +date: 2023-06-29T22:13:45+02:00 +type: note +draft: false +--- + +Likely aired during an hour-long program during the 1960s, long commercials such +as this typically aired during hour-long programs. They would *not* have aired +during a half-hour program. + + diff --git a/content/notes/2023-07-10-fix-screen-tearing-on-debian-12-xorg-and-i3.md b/content/notes/2023-07-10-fix-screen-tearing-on-debian-12-xorg-and-i3.md new file mode 100644 index 0000000..dbc3abd --- /dev/null +++ b/content/notes/2023-07-10-fix-screen-tearing-on-debian-12-xorg-and-i3.md @@ -0,0 +1,22 @@ +--- +title: "Fix screen tearing on Debian 12 Xorg and i3" +url: /fix-screen-tearing-on-debian-12-xorg-and-i3.html +date: 2023-07-10T04:21:48+02:00 +type: note +draft: false +--- + +I have been experiencing some issues with Intel® Integrated HD Graphics 3000 +under Debian 12 with Xorg and i3. Using `picom` compositor didn't help. To fix +this issue create new file `/etc/X11/xorg.conf.d/20-intel.conf` as root and put +the following in the file. + +```txt +Section "Device" + Identifier "Intel Graphics" + Driver "intel" + Option "TearFree" "true" +EndSection +``` + +Reboot the system and that should be it. diff --git a/content/notes/2023-07-10-online-radio-streaming-with-mpv-from-terminal.md b/content/notes/2023-07-10-online-radio-streaming-with-mpv-from-terminal.md new file mode 100644 index 0000000..37b0715 --- /dev/null +++ b/content/notes/2023-07-10-online-radio-streaming-with-mpv-from-terminal.md @@ -0,0 +1,14 @@ +--- +title: "Online radio streaming with MPV from terminal" +url: /online-radio-streaming-with-mpv-from-terminal.html +date: 2023-07-10T03:34:45+02:00 +type: note +draft: false +--- + +Recently I have been using my Thinkpad x220 more and there are some constraints +I have faced with it. CPU is not as powerful as on my main machine and I really +want to listen to some music while using the machine. Browsers really are bloat. + +Check out this site https://streamurl.link/ and copy the stream url and then do +`mpv streamlink`. diff --git a/content/notes/2023-07-14-set-color-temperature-of-displays-on-i3.md b/content/notes/2023-07-14-set-color-temperature-of-displays-on-i3.md new file mode 100644 index 0000000..171be4e --- /dev/null +++ b/content/notes/2023-07-14-set-color-temperature-of-displays-on-i3.md @@ -0,0 +1,15 @@ +--- +title: "Set color temperature of displays on i3" +url: /set-color-temperature-of-displays-on-i3.html +date: 2023-07-14T09:19:31+02:00 +type: note +draft: false +--- + +I have been using Gnome's night shift for a while now and I have been missing +this feature under i3wm. This can be done with +[redshift](https://linux.die.net/man/1/redshift). + +- On Debian install with `sudo apt install redshift` +- And then manually set it with `redshift -O 3000` +- Reset the current settings with `redshift -x` diff --git a/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md b/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md new file mode 100644 index 0000000..84fb5e4 --- /dev/null +++ b/content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md @@ -0,0 +1,70 @@ +--- +title: "Make B/W SVG charts with matplotlib" +url: /make-b-w-svg-charts-with-matplotlib.html +date: 2023-08-01T17:04:10+02:00 +type: note +draft: false +--- + +Install pip requirements. + +```sh +pip install matplotlib +pip install pandas +``` + +Example of data being used. + +```text +Epoch,Connect (NLB),Processing (NLB),Waiting (NLB),Total (NLB),Connect (ALB),Processing (ALB),Waiting (ALB),Total (ALB) +1,57.7,315.7,309.4,321.6,9,104.4,98.3,105.7 +2,121.9,114.4,100.3,176.9,5.8,99.1,97.1,101.1 +3,5.3,229.4,231.2,231.4,14.2,83,69.4,87.9 +4,4.2,134.5,112.2,135.3,5.3,132.4,105.5,134.1 +5,5.8,247.4,246.8,248.1,6,74.3,70.2,75.5 +6,9.9,122.9,100.6,122.7,7.5,241.1,79.3,242.3 +7,6.1,170.2,106.4,170.5,7.2,382.4,375.1,383.8 +8,6.6,194.3,201.4,195.5,7.1,130.9,104.8,132.6 +9,6.4,146.1,122.3,147.7,9.4,95.6,74,96.4 +``` + +In the code you can use `df` as dataframes and use the headers like `df["Epoch"]`. +This is how you get a column data with pandas. + +The Python code responsible for generating a chart: + +```python +import csv +import sys + +import matplotlib.pyplot as plt +import pandas as pd + +# Read the data +df = pd.read_csv("data.csv") + +# Settings +plt.title("Connect median NLB vs ALB") +plt.tight_layout(pad=2) +fig = plt.gcf() +fig.set_size_inches(10, 4) + +# Plotting +plt.plot(df["Epoch"], df["Connect (ALB)"], label = "ALB", color="black", linestyle="-") +plt.plot(df["Epoch"], df["Connect (NLB)"], label = "NLB", color="black", linestyle="--") + +# Adding x and y axis labels +plt.xlabel("Epoch", fontstyle="italic") +plt.ylabel("Median value (ms)", fontstyle="italic") + +# Legend +legend = plt.legend() +legend.get_frame().set_linewidth(0) + +# Export as SVG +plt.savefig("plot.svg", format="svg") +``` + +![SVG Chart](/assets/notes/plot.svg) + +The image above is SVG and you can zoom in and out and check that the image is vector. diff --git a/content/notes/2023-09-18-aws-eb-pyyaml-fix.md b/content/notes/2023-09-18-aws-eb-pyyaml-fix.md new file mode 100644 index 0000000..b394eaf --- /dev/null +++ b/content/notes/2023-09-18-aws-eb-pyyaml-fix.md @@ -0,0 +1,35 @@ +--- +title: "AWS EB PyYAML fix" +url: /aws-eb-pyyaml-fix.html +date: 2023-09-18T07:27:29+02:00 +type: note +draft: false +--- + +Recent update of my system completely borked [EB CLI](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-advanced.html) +on my machine. + +I tried installing it with `pip install awsebcli --upgrade --user` and it failed. + +The error was the following. + +```text +Collecting PyYAML<6.1,>=5.3.1 (from awsebcli) + Using cached PyYAML-5.4.1.tar.gz (175 kB) + Installing build dependencies ... done + Getting requirements to build wheel ... error + error: subprocess-exited-with-error + + × Getting requirements to build wheel did not run successfully. + │ exit code: 1 + ╰─> [68 lines of output] +``` + +To fix this issue with PyYAML you must install PyYAML separately. + +Do the following and try installing `eb` again after. + +```sh +echo 'Cython < 3.0' > /tmp/constraint.txt +PIP_CONSTRAINT=/tmp/constraint.txt pip install 'PyYAML==5.4.1' +``` diff --git a/content/notes/2023-09-25-compile-drawterm-on-fedora-38.md b/content/notes/2023-09-25-compile-drawterm-on-fedora-38.md new file mode 100644 index 0000000..a369c66 --- /dev/null +++ b/content/notes/2023-09-25-compile-drawterm-on-fedora-38.md @@ -0,0 +1,23 @@ +--- +title: "Compile drawterm on Fedora 38" +url: /compile-drawterm-on-fedora-38.html +date: 2023-09-25T09:04:28+02:00 +type: note +draft: false +--- + +First install two dependencies: + +```sh +sudo dnf install libX11-devel libXt-devel +``` + +Clone the repo and compile it: + +```sh +git clone git://git.9front.org/plan9front/drawterm +cd drawterm +CONF=unix make +``` + +That should produce `drawterm` binary. diff --git a/content/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md b/content/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md new file mode 100644 index 0000000..294f77b --- /dev/null +++ b/content/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md @@ -0,0 +1,40 @@ +--- +title: "Using ffmpeg to combine videos side by side" +url: /using-ffmpeg-to-combine-video-side-by-side.html +date: 2023-11-04T09:04:28+02:00 +type: note +draft: false +--- + +I had a 4 webm videos (each 492x451) that I wanted to combine to be played side +by side and I tried [iMovie](https://support.apple.com/imovie) and +[Kdenlive](https://kdenlive.org/) and failed to do it in an easy way. I needed +this for Github readme file so it also needed to be a GIF. + +The following is the [ffmpeg](https://ffmpeg.org/) version of it. + +```sh +ffmpeg -y \ + -i 01.webm \ + -i 02.webm \ + -i 03.webm \ + -i 04.webm \ + -filter_complex "\ + [0:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a0]; \ + [1:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a1]; \ + [2:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a2]; \ + [3:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a3]; \ + [a0][a1][a2][a3] xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0, scale=1000:-1 [v]" \ + -map "[v]" \ + -crf 23 \ + -preset veryfast \ + trigraphs.gif +``` + +- This will produce `trigraphs.gif` that is also scaled to max 1000px in width + (refer to `scale=1000:-1`). +- The important part for 4x1 stack is `xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0`. +- This will also cap frame rate to 6 (refer to `fps=6`) since that is enough and + this makes playback of GIFs smoother in a browser. + +![Result](./assets/notes/trigraphs.gif) diff --git a/content/notes/2023-11-05-add-lazy-loading-to-jekyll-posts.md b/content/notes/2023-11-05-add-lazy-loading-to-jekyll-posts.md new file mode 100644 index 0000000..5d6dae4 --- /dev/null +++ b/content/notes/2023-11-05-add-lazy-loading-to-jekyll-posts.md @@ -0,0 +1,33 @@ +--- +title: "Add lazy loading of images in Jekyll posts" +url: /add-lazy-loading-to-jekyll-posts.html +date: 2023-11-05T09:04:28+02:00 +type: note +draft: false +--- + +Normally you define images with `![]()` in markdown files. But jekyll also +provides a way to adding custom attributes to tags with `{:attr="value"}`. + +If you have lots of posts this command will append `` to all +images in all your markdown files. + +```md +![image-title](/path/to/your/image.jpg) +``` + +will become + +```md +![image-title](/path/to/your/image.jpg) +``` + +Shell line bellow. Go into the folder where your posts are (probably `_posts`). + +```sh +find . -type f -name "*.md" -exec sed -i -E 's/(\!\[.*\]\((.*?)\))$/\1/' {} \; +``` + +Under the hood this adds `loading="lazy"` to HTML `img` nodes. + +That is about it. diff --git a/content/notes/2023-11-07-personal-sane-vim-defaults.md b/content/notes/2023-11-07-personal-sane-vim-defaults.md new file mode 100644 index 0000000..a9157ad --- /dev/null +++ b/content/notes/2023-11-07-personal-sane-vim-defaults.md @@ -0,0 +1,59 @@ +--- +title: "Personal sane Vim defaults" +url: /apersonal-sane-vim-defaults.html +date: 2023-11-07T01:04:28+02:00 +type: note +draft: false +--- + +I have found many "sane" default configs on the net and this is my favorite +personal list. This is how my `.vimrc` file looks like. + +```vimrc +" General sane defaults. +syntax enable +colorscheme sorbet +nnoremap q: +set nocompatible +set relativenumber +set nohlsearch +set smartcase +set ignorecase +set incsearch +set autoindent +set nowrap +set nobackup +set noswapfile +set autoread +set wildmenu +set encoding=utf8 +set backspace=2 +set scrolloff=4 +set spelllang=en_us + +" Status Line enhancements. +set laststatus=2 +set statusline=%f%m%=%y\ %{strlen(&fenc)?&fenc:'none'}\ %l:%c\ %L\ %P +hi StatusLine cterm=NONE ctermbg=black ctermfg=brown +hi StatusLineNC cterm=NONE ctermbg=black ctermfg=darkgray + +" Commenting blocks of code. +augroup commenting_blocks_of_code + autocmd! + autocmd FileType c,cpp,go,scala let b:comment_leader = '// ' + autocmd FileType sh,ruby,python let b:comment_leader = '# ' + autocmd FileType conf,fstab let b:comment_leader = '# ' + autocmd FileType lua let b:comment_leader = '-- ' + autocmd FileType vim let b:comment_leader = '" ' +augroup END +noremap ,cc :silent s/^/=escape(b:comment_leader,'\/')/:nohlsearch +noremap ,cu :silent s/^\V=escape(b:comment_leader,'\/')//e:nohlsearch + +" Language specific indentation. +filetype plugin indent on +autocmd Filetype make,go,c,cpp setlocal noexpandtab tabstop=4 shiftwidth=4 +autocmd Filetype html,js,css setlocal expandtab tabstop=2 shiftwidth=2 +``` + +I keep it pretty vanilla so this is about everything I have in the file. + diff --git a/content/notes/2024-02-15-extract-lines-from-file.md b/content/notes/2024-02-15-extract-lines-from-file.md new file mode 100644 index 0000000..09d3937 --- /dev/null +++ b/content/notes/2024-02-15-extract-lines-from-file.md @@ -0,0 +1,19 @@ +--- +title: "Extract lines from a file with sed" +url: /extract-lines-from-file-with-sed.html +date: 2024-02-15T10:04:28+02:00 +type: note +draft: false +--- + +Easy way to extract line ranges (from line 200 to line 210) with sed. + +```sh +sed -n '200,210p' data/Homo_sapiens.GRCh38.dna.chromosome.18.fa + +# then pipe it to a new file with + +sed -n '200,210p' data/Homo_sapiens.GRCh38.dna.chromosome.18.fa > new.fa +``` + +`head` or `tail` could be used to extract from begining of the end of the file. diff --git a/content/notes/2024-02-21-dcss-online-rc-defaults.md b/content/notes/2024-02-21-dcss-online-rc-defaults.md new file mode 100644 index 0000000..5085b1c --- /dev/null +++ b/content/notes/2024-02-21-dcss-online-rc-defaults.md @@ -0,0 +1,33 @@ +--- +title: "Sane default for Dungeon Crawl Stone Soup Online edition" +url: /dcss-online-rc-defaults.html +date: 2024-02-21T06:35:11+02:00 +type: note +draft: false +--- + +I mostly play Dungeon Crawl Stone Soup online on Ohio, USA: cbro.berotato.org server and +when you start playing you can select the version you want to play. Each instance also +has `rc` file that can customize the way the game behave. + +This is my sane defaults config. It zooms in the game without needing to zoom in the +browser and it also adds a bit of delays in exploring and it stops at fight. + +```ini +autofight_stop = 80 +explore_auto_rest = true +explore_delay = 20 + +tile_cell_pixels = 48 +tile_font_crt_size = 24 +tile_font_stat_size = 24 +tile_font_msg_size = 24 +tile_font_tip_size = 24 +tile_font_lbl_size = 24 +tile_map_pixels = 0 +tile_filter_scaling = false +``` + +All the possible options are documented in the [Dungeon Crawl Stone Soup Options +Guide](https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt) +file. diff --git a/content/notes/2024-02-23-uninstall-ollama-from-a-linux-box.md b/content/notes/2024-02-23-uninstall-ollama-from-a-linux-box.md new file mode 100644 index 0000000..a597c54 --- /dev/null +++ b/content/notes/2024-02-23-uninstall-ollama-from-a-linux-box.md @@ -0,0 +1,25 @@ +--- +title: Uninstall Ollama from a Linux box +url: /uninstall-ollama-from-a-linux-box.html +type: note +date: 2024-02-23 +draft: false +--- +I have had some issues with Ollama not being up-to-date. If Ollama is installed with a curl command, it adds a systemd service. + +```sh +sudo systemctl stop ollama +sudo systemctl disable ollama +sudo rm /etc/systemd/system/ollama.service +sudo systemctl daemon-reload + +sudo rm /usr/local/bin/ollama + +sudo userdel ollama +sudo groupdel ollama + +rm -r ~/.ollama +sudo rm -rf /usr/share/ollama +``` + +That is about it. -- cgit v1.2.3