aboutsummaryrefslogtreecommitdiff
path: root/content/notes
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-03-10 14:59:14 +0100
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-03-10 14:59:14 +0100
commit1100562e29f6476448b656dbddd4cf22505523f6 (patch)
tree442eec492199104bd49dfd74474ce89ade8fcac9 /content/notes
parenta40d80be378e46a6c490e1b99b0d8f4acd968503 (diff)
downloadmitjafelicijan.com-1100562e29f6476448b656dbddd4cf22505523f6.tar.gz
Move back to JBMAFP
Diffstat (limited to 'content/notes')
-rw-r--r--content/notes/2022-08-13-algae-spotted-on-river-sava.md30
-rw-r--r--content/notes/2023-05-01-cachebusting-in-hugo.md16
-rw-r--r--content/notes/2023-05-05-run-9front-in-qemu.md27
-rw-r--r--content/notes/2023-05-06-git-push-multiple-origins.md16
-rw-r--r--content/notes/2023-05-07-mount-plan9-over-network.md22
-rw-r--r--content/notes/2023-05-08-write-iso-usb.md14
-rw-r--r--content/notes/2023-05-09-catv-weechat-config.md20
-rw-r--r--content/notes/2023-05-10-plan9-screenshot.md21
-rw-r--r--content/notes/2023-05-11-fix-plan9-bootloader.md19
-rw-r--r--content/notes/2023-05-12-install-plan9port-linux.md20
-rw-r--r--content/notes/2023-05-13-download-youtube-videos.md24
-rw-r--r--content/notes/2023-05-14-convert-mkv.md21
-rw-r--r--content/notes/2023-05-15-preview-troff-man-pages.md19
-rw-r--r--content/notes/2023-05-16-mass-set-permission.md15
-rw-r--r--content/notes/2023-05-22-non-blocking-shell-exec-csharp.md43
-rw-r--r--content/notes/2023-05-23-extend-lua-with-custom-c.md53
-rw-r--r--content/notes/2023-05-23-parse-rss-with-lua.md39
-rw-r--r--content/notes/2023-05-24-fresh-9front-desktop.md13
-rw-r--r--content/notes/2023-05-25-dcss-new-player-guide.md97
-rw-r--r--content/notes/2023-05-25-show-xterm-colors.md83
-rw-r--r--content/notes/2023-05-25-tmux-sane-defaults.md36
-rw-r--r--content/notes/2023-05-27-cronjobs-github-with-actions.md32
-rw-r--r--content/notes/2023-05-27-dcss-on-4k-displays.md29
-rw-r--r--content/notes/2023-05-27-drawing-pixels-in-plan9.md82
-rw-r--r--content/notes/2023-05-28-easy-time-took-in-bash.md24
-rw-r--r--content/notes/2023-05-29-grep-to-less-maintain-colors.md24
-rw-r--r--content/notes/2023-05-31-extending-dte-editor.md51
-rw-r--r--content/notes/2023-06-01-ewd-manuscripts-ebook.md21
-rw-r--r--content/notes/2023-06-04-bulk-make-thumbnails.md20
-rw-r--r--content/notes/2023-06-21-presentations-with-markdown.md77
-rw-r--r--content/notes/2023-06-24-making-cgit-look-nicer.md205
-rw-r--r--content/notes/2023-06-25-alacritty-open-links-with-modifier.md34
-rw-r--r--content/notes/2023-06-25-development-environments-with-nix.md67
-rw-r--r--content/notes/2023-06-29-10gui-10-finger-multitouch-user-interface.md24
-rw-r--r--content/notes/2023-06-29-60s-ibm-computers-commercial.md16
-rw-r--r--content/notes/2023-07-10-fix-screen-tearing-on-debian-12-xorg-and-i3.md22
-rw-r--r--content/notes/2023-07-10-online-radio-streaming-with-mpv-from-terminal.md14
-rw-r--r--content/notes/2023-07-14-set-color-temperature-of-displays-on-i3.md15
-rw-r--r--content/notes/2023-08-01-make-b-w-svg-charts-with-matplotlib.md70
-rw-r--r--content/notes/2023-09-18-aws-eb-pyyaml-fix.md35
-rw-r--r--content/notes/2023-09-25-compile-drawterm-on-fedora-38.md23
-rw-r--r--content/notes/2023-11-04-using-ffmpeg-to-combine-video-side-by-side.md40
-rw-r--r--content/notes/2023-11-05-add-lazy-loading-to-jekyll-posts.md33
-rw-r--r--content/notes/2023-11-07-personal-sane-vim-defaults.md59
-rw-r--r--content/notes/2024-02-15-extract-lines-from-file.md19
-rw-r--r--content/notes/2024-02-21-dcss-online-rc-defaults.md33
-rw-r--r--content/notes/2024-02-23-uninstall-ollama-from-a-linux-box.md25
47 files changed, 1742 insertions, 0 deletions
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 @@
1---
2title: Aerial photography of algae spotted on river Sava
3url: /aerial-photography-of-algae-spotted-on-river-sava.html
4date: 2022-08-13T12:00:00+02:00
5type: note
6draft: false
7---
8
9This is a bit of a different post than I usually write, but quite interesting
10one to me. River Sava has plenty of hydropower plants located down the stream.
11This makes regulating the strength of a current easier than normally. Because of
12lower stream strength and high temperatures, algae has formed on the river.
13This is the first time I've seen something like this in my whole life.
14
15Below are some photographs taken from a DJI drone capturing the event.
16
17![Algae on Sava](/assets/posts/algae-sava/dji-algae-0.jpg)
18
19![Algae on Sava](/assets/posts/algae-sava/dji-algae-1.jpg)
20
21![Algae on Sava](/assets/posts/algae-sava/dji-algae-2.jpg)
22
23![Algae on Sava](/assets/posts/algae-sava/dji-algae-3.jpg)
24
25![Algae on Sava](/assets/posts/algae-sava/dji-algae-4.jpg)
26
27![Algae on Sava](/assets/posts/algae-sava/dji-algae-5.jpg)
28
29I will try to get more photos of this in the future days and if something
30intriguing 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 @@
1---
2title: Cache busting in Hugo
3url: /cachebusting-in-hugo.html
4date: 2023-05-01T12:00:00+02:00
5type: note
6draft: false
7---
8
9```html
10\{\{ $cachebuster := delimit (shuffle (split (md5 "6fab11c6669976d759d2992eff1dd5be") "" )) "" \}\}
11
12<link rel="stylesheet" href="/style.css?v=\{\{ $cachebuster \}\}">
13```
14
15This `6fab11c6669976d759d2992eff1dd5be` can be random string you generate use.
16You 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 @@
1---
2title: Run 9front in Qemu
3url: /run-9front-in-qemu.html
4date: 2023-05-05T12:00:00+02:00
5type: note
6draft: false
7---
8
9Run 9front in Qemu. This applies to [Plan9](https://9p.io/plan9/) and
10[9front](https://9front.org/).
11
12Download from here http://9front.org/iso/.
13
14```sh
15# Create a qcow2 image.
16qemu-img create -f qcow2 $HOME/VM/9front.qcow2.img 30G
17
18# Run the VM.
19qemu-system-x86_64 -cpu host -enable-kvm -m 1024 \
20 -net nic,model=virtio,macaddr=52:54:00:00:EE:03 -net user \
21 -device virtio-scsi-pci,id=scsi \
22 -drive if=none,id=vd0,file=$HOME/VM/9front.qcow2.img \
23 -device scsi-hd,drive=vd0 \
24 -drive if=none,id=vd1,file=$HOME/VM/ISO/9front.386.iso \
25 -device scsi-cd,drive=vd1,bootindex=0
26```
27
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 @@
1---
2title: Push to multiple origins at once in Git
3url: /git-push-multiple-origins.html
4date: 2023-05-06T12:00:00+02:00
5type: note
6draft: false
7---
8
9Sometimes you want to push to multiple origins at once. This is useful if you
10have a mirror of your repository on another server. You can do this by adding
11multiple push urls to your git config. This is a shorthand for command above.
12
13```sh
14git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"'
15```
16
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 @@
1---
2title: Mount Plan9 over network
3url: /mount-plan9-over-network.html
4date: 2023-05-07T12:00:00+02:00
5type: note
6draft: false
7---
8
9- First install libfuse with sudo apt install libfuse-dev.
10- Then clone https://github.com/ftrvxmtrx/9pfs and compile it with make.
11- Copy 9pfs to your path.
12
13```sh
14# On Plan9 side
15ip/ipconfig # enables network
16aux/listen1 -tv tcp!*!9999 /bin/exportfs -r tmp # export tmp folder
17
18# On Linux side
199pfs 172.18.0.1 -p 9999 local_folder # mount
20umount local_folder # unmount
21```
22
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 @@
1---
2title: Write ISO to USB Key
3url: /write-iso-usb.html
4date: 2023-05-08T12:00:00+02:00
5type: note
6draft: false
7---
8
9Write ISO to USB key. Nothing fancy here.
10
11```sh
12sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync
13```
14
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 @@
1---
2title: "#cat-v on weechat configuration"
3url: /catv-weechat-config.html
4date: 2023-05-09T12:00:00+02:00
5type: note
6draft: false
7---
8
9Set up weechat to connect to #cat-v on oftc. This applies to
10[weechat](https://weechat.org/) but should be similar for other irc clients.
11
12```sh
13# Install weechat and launch it and execute the following commands.
14
15/server add oftc irc.oftc.net -tls
16/set irc.server.oftc.autoconnect on
17/set irc.server.oftc.autojoin "#cat-v"
18/set irc.server.oftc.nicks "nick1,nick2,nick3"
19```
20
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 @@
1---
2title: Take a screenshot in Plan9
3url: /plan9-screenshot.html
4date: 2023-05-10T12:00:00+02:00
5type: note
6draft: false
7---
8
9Take a screenshot in Plan9. This applies to [Plan9](https://9p.io/plan9/) and
10[9front](https://9front.org/). This will take a screenshot of the screen and
11output it to `/dev/screen`. You can then use `topng` to convert it to a png
12image.
13
14```sh
15# Instant screenshot.
16cat /dev/screen | topng > screen.png
17
18# Delayed screenshot (5 seconds).
19sleep 5; cat /dev/screen | topng > screen.png
20```
21
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 @@
1---
2title: Fix bootloader not being written in Plan9
3url: /fix-plan9-bootloader.html
4date: 2023-05-11T12:00:00+02:00
5type: note
6draft: false
7---
8
9If the bootloader is not being written to a disk when installing 9front on real
10harware try clearing first sector of the disk with the following command.
11
12```sh
13dd if=/dev/zero of=/dev/sdX bs=512 count=1
14
15# If command above doesn't work try this one, wait couple of seconds and
16# press delete key to stop the command.
17cat </dev/zero >/dev/sd*/data
18```
19
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 @@
1---
2title: Install Plan9port on Linux
3url: /install-plan9port-linux.html
4date: 2023-05-12T12:00:00+02:00
5type: note
6draft: false
7---
8
9Install Plan9port on Linux. This applies to
10[Plan9port](https://9fans.github.io/plan9port/). This is a port of many Plan 9
11programs to Unix-like operating systems. Useful for programs like `9term` and
12`rc`.
13
14```sh
15sudo apt-get install gcc libx11-dev libxt-dev libxext-dev libfontconfig1-dev
16git clone https://github.com/9fans/plan9port $HOME/plan9
17cd $HOME/plan9/plan9port
18./INSTALL -r $HOME/plan9
19```
20
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 @@
1---
2title: Download list of YouTube files
3url: /download-youtube-videos.html
4date: 2023-05-13T12:00:00+02:00
5type: note
6draft: false
7---
8
9If you need to download a list of YouTube videos and don't want to download the
10actual YouTube list (which `yt-dlp` supports), you can use the following method.
11
12```js
13// Used to get list of raw URL's from YouTube's video tab'.
14// Copy them into videos.txt.
15document.querySelectorAll('#contents a.ytd-thumbnail.style-scope.ytd-thumbnail').forEach(el => console.log(el.href))
16```
17
18Download and install https://github.com/yt-dlp/yt-dlp.
19
20```sh
21# This will download all videos in videos.txt.
22yt-dlp --batch-file videos.txt -N `nproc` -f webm
23```
24
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 @@
1---
2title: Convert all MKV files into other formats
3url: /convert-mkv.html
4date: 2023-05-14T12:00:00+02:00
5type: note
6draft: false
7---
8
9You will need `ffmpeg` installed on your system. This will convert all MKV files
10into WebM format.
11
12```sh
13# Convert all MKV files into WebM format.
14find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" -vcodec libvpx -acodec libvorbis -cpu-used 5 -threads 8 "${0%%.mp4}.webm"' {} \;
15```
16
17```sh
18# Convert all MKV files into MP4 format.
19find ./ -name '*.mkv' -exec bash -c 'ffmpeg -i "$0" c:a copy -c:v copy -cpu-used 5 -threads 8 "${0%%.mp4}.mp4"' {} \;
20```
21
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 @@
1---
2title: Previews how man page written in Troff will look like
3url: /preview-troff-man-pages.html
4date: 2023-05-15T12:00:00+02:00
5type: note
6draft: false
7---
8
9Troff is used to write man pages and it is difficult to read it so this will
10preview how it will look like when it is rendered.
11
12```sh
13# On Linux system.
14groff -man -Tascii filename
15
16# On Plan9 system.
17man 1 filename
18```
19
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 @@
1---
2title: Change permissions of matching files recursively
3url: /mass-set-permission.html
4date: 2023-05-16T12:00:00+02:00
5type: note
6draft: false
7---
8
9Replace `*.xml` with your pattern. This will remove executable bit from all
10files matching the pattern. Change `+` to `-` to add executable bit.
11
12```sh
13find . -type f -name "*.xml" -exec chmod -x {} +
14```
15
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 @@
1---
2title: Execute not blocking async shell command in C#
3url: /non-blocking-shell-exec-csharp.html
4date: 2023-05-22T12:00:00+02:00
5type: note
6draft: false
7---
8
9Execute a shell command in async in C# while not blocking the UI thread.
10
11```c#
12private async Task executeCopyCommand()
13{
14 await Task.Run(() =>
15 {
16 var processStartInfo = new ProcessStartInfo("cmd", "/c dir")
17 {
18 RedirectStandardOutput = true,
19 UseShellExecute = false,
20 CreateNoWindow = true
21 };
22
23 var process = new Process
24 {
25 StartInfo = processStartInfo
26 };
27
28 process.Start();
29 process.WaitForExit();
30 });
31}
32```
33
34Make sure that `async` is present in the function definition and `await` is used
35in the method that calls `executeCopyCommand()`.
36
37```c#
38private async void button_Click(object sender, EventArgs e)
39{
40 await executeCopyCommand();
41}
42```
43
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 @@
1---
2title: Extend Lua with custom C functions using Clang
3url: /extend-lua-with-custom-c.html
4date: 2023-05-23T12:00:00+02:00
5type: note
6draft: false
7---
8
9Here is a boilerplate for extending Lua with custom C functions. This requires
10Clang and Lua 5.1 to be installed. GCC can be used instead of Clang, but the
11Makefile will need to be modified.
12
13- nativefunc.c
14
15 ```c
16 #include <lua.h>
17 #include <lauxlib.h>
18
19 static int l_mult50(lua_State *L) {
20 double number = luaL_checknumber(L, 1);
21 lua_pushnumber(L, number * 50);
22 return 1;
23 }
24
25 int luaopen_nativefunc(lua_State *L) {
26 static const struct luaL_Reg nativeFuncLib[] = { {"mult50", l_mult50}, {NULL, NULL} };
27
28 luaL_register(L, "nativelib", nativeFuncLib);
29 return 1;
30 }
31 ```
32
33- main.lua
34
35 ```lua
36 require "nativefunc"
37 print(nativelib.mult50(50))
38 ```
39
40- Makefile
41
42 ```Makefile
43 CC = clang
44 CFLAGS =
45 INCLUDES = `pkg-config lua5.1 --cflags-only-I`
46
47 all:
48 $(CC) -shared -o nativefunc.so -fPIC nativefunc.c $(CFLAGS) $(INCLUDES)
49
50 clean:
51 rm *.so
52 ```
53
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 @@
1---
2title: Parse RSS feeds with Lua
3url: /parse-rss-with-lua.html
4date: 2023-05-23T12:00:00+02:00
5type: note
6draft: false
7---
8
9Example of parsing RSS feeds with Lua. Before running the script install:
10
11- feedparser with `luarocks install feedparser`
12- luasocket with `luarocks install luasocket`
13
14```lua
15local http = require("socket.http")
16local feedparser = require("feedparser")
17
18local feed_url = "https://mitjafelicijan.com/index.xml"
19
20local response, status, _ = http.request(feed_url)
21if status == 200 then
22 local parsed = feedparser.parse(response)
23
24 -- Print out feed details.
25 print("> Title ", parsed.feed.title)
26 print("> Author ", parsed.feed.author)
27 print("> ID ", parsed.feed.id)
28 print("> Entries ", #parsed.entries)
29
30 for _, item in ipairs(parsed.entries) do
31 print("GUID ", item.guid)
32 print("Title ", item.title)
33 print("Link ", item.link)
34 print("Summary ", item.summary)
35 end
36else
37 print("! Request failed. Status:", status)
38end
39```
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 @@
1---
2title: My brand new Plan9/9front desktop
3url: /fresh-9front-desktop.html
4date: 2023-05-24T12:00:00+02:00
5type: note
6draft: false
7---
8
9I have been experimenting with Plan9/9front for a week now. Noice! This is how
10my desktop looks like.
11
12![9front desktop](/assets/notes/9front-desktop.png)
13
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 @@
1---
2title: Dungeon Crawl Stone Soup - New player guide
3url: /dcss-new-player-guide.html
4date: 2023-05-25T22:00:00+02:00
5type: note
6draft: false
7---
8
9An amazing game deserves an amazing guide. All this material can be find in some
10form on another on [craw's](https://github.com/crawl/crawl) official repository.
11
12- [DCSS Quickstart](/assets/notes/dcss-quickstart.pdf) - Very short introduction to the
13 game
14- [DCSS Manual](/assets/notes/dcss_manual.pdf) - Extensive manual about the game
15
16![Dungeon Crawl Stone Soup](/assets/notes/dcss.jpg)
17
18**Movement and Exploration**
19
20- You can move around with the numpad (try numlock on and off), vi-keys, or
21 clicking with the mouse. Arrow keys work, though you can't move diagonally
22 with them. Pressing Shift and a direction will move until you see/hit
23 something.
24- Pressing `>` will take you down a staircase, and `<` to go up a staircase.
25- You can open doors by walking into them, and close them with `C`.
26- You can autoexplore by pressing `o`.
27- You can re-view recent messages with `Ctrl-p`.
28
29**Monsters and Combat**
30
31- You can pick up items with `,` or `g`.
32- Wield weapons with `w`. Weapons have different stats.
33 - (You may also engage in Unarmed Combat, though it isn't very effective when
34 untrained).
35- Attack monsters in melee by walking in their direction (or with
36 Ctrl-direction).
37- You can wait with `.` or `s`, passing your turn - such as to get monsters into
38 a corridor with you.
39- You can rest with `5`, waiting until you are fully healed, or something
40 noteworthy happens.
41- Either mouseover and rightclick, or use `x` then `v` on the monster to examine
42 monsters. Monsters with a red border are 'dangerous' relative to your current
43 XP level (XL).
44- Quiver (often ranged) actions for further use with `Q`.
45- You can fire ranged weapons manually with `f`, or auto-target your quiver with
46 `p` or `Shift-Tab`. Throwing weapons can be thrown immediately, while
47 launchers (like bows) need to be wielded first.
48
49**Items and Inventory**
50
51- View your inventory by pressing `i`. Most item related commands can also be
52 done with this menu.
53- You can wear amour with `W;` amour gives `AC`, while heavier body armour
54 reduces `EV`.
55- Autoexplore will automatically pick up useful items, such as potions and
56 scrolls, if you aren't in danger.
57- You can read scrolls with `r` and drink ("quaff") potions with `q`.
58- Equipment items may have brands, with special properties. Branded equipment is
59 blue when unidentified.
60- Equipment items may be artifacts, often with unique properties, and are
61 unmodifiable. They are written in white.
62- You can evoke wands with `V`.
63- You can put on jewelry with `P`, and remove it with `R`.
64- Gold is used in shops, which can be interacted with by either `>` or `<`.
65
66**Magic and Spellcasting**
67
68- Once you find a spellbook, you can memorize spells with `M`.
69- You need to be the same XL as the spell's spell level in order to learn it, in
70 addition to training magical skill (to lower failure rate).
71- Cast spells by pressing `z`, then the letter assigned to the spell. You may
72 also Quiver a spell and then use it like a ranged weapon (with Shift-Tab).
73- You can view your memorized spells by pressing `I` (capital-i) or `z`.
74- Like HP, you can recover MP by resting (with 5).
75- Many spells can be positioned more effectively, or combined with other spells,
76 in order to get (more effective) use out of them.
77- Heavier body amour and shields hamper spellcasting.
78
79**Gods and Divine Abilities**
80
81- You may look at a god's overview by praying at their altar (with `>` or `<`).
82 After praying, you can worship the god by pressing Enter afterwards.
83- Gods all have unique features about them. Trog, the god of the tutorial, is
84 also the god of rage and bloodshed, and so despises spellcasting.
85- Gods like and dislike different things. Most gods either like killing things
86 (like Trog) or exploring new areas (like Elyvilon), rewarding you piety
87 (divine favor) for doing so.
88- You should learn to use and even rely on divine abilities often, as they are
89 usually very strong. Trog's Berserk gives you 1.5x health, 1.5x speed (to all
90 valid actions), and a big damage boost. Note that Berserk prevents most
91 actions other than move and melee attack, and runs out very quickly if you
92 aren't attacking. And after berserk ends, you are slowed down and can't
93 berserk again for a short time.
94- In addition, the vast majority of abilities consume piety in the process.
95 Regardless, this ability is very cheap, and the benefits are incredible, so
96 don't hold back!
97- 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 @@
1---
2title: Display xterm color palette
3url: /xterm-color-palette.html
4date: 2023-05-25T12:00:00+02:00
5type: note
6draft: false
7---
8
9- `bash xterm-palette.sh` - will show you number of max colors available
10- `bash xterm-palette.sh -v` - will create a list of all colors with codes
11
12![xterm color palette](/assets/notes/xterm-palette.png)
13
14```sh
15#!/usr/bin/env bash
16# xterm-palette.sh
17
18trap 'tput sgr0' exit # Clean up even if user hits ^C
19
20function setfg () {
21 printf '\e[38;5;%dm' $1
22}
23
24function setbg () {
25 printf '\e[48;5;%dm' $1
26}
27
28function showcolors() {
29 # Given an integer, display that many colors
30 for ((i=0; i<$1; i++))
31 do
32 printf '%4d ' $i
33 setbg $i
34 tput el
35 tput sgr0
36 echo
37 done
38 tput sgr0 el
39}
40
41# First, test if terminal supports OSC 4 at all.
42printf '\e]4;%d;?\a' 0
43read -d $'\a' -s -t 0.1 </dev/tty
44if [ -z "$REPLY" ]
45then
46 # OSC 4 not supported, so we'll fall back to terminfo
47 max=$(tput colors)
48else
49 # OSC 4 is supported, so use it for a binary search
50 min=0
51 max=256
52 while [[ $((min+1)) -lt $max ]]
53 do
54 i=$(( (min+max)/2 ))
55 printf '\e]4;%d;?\a' $i
56 read -d $'\a' -s -t 0.1 </dev/tty
57 if [ -z "$REPLY" ]
58 then
59 max=$i
60 else
61 min=$i
62 fi
63 done
64fi
65
66
67# If -v is given, show all the colors
68case ${1-none} in
69 none)
70 echo $max
71 ;;
72 -v)
73 showcolors $max
74 ;;
75 *)
76 if [[ "$1" -gt 0 ]]; then
77 showcolors $1
78 else
79 echo $max
80 fi
81 ;;
82esac | less --raw-control-chars --QUIT-AT-EOF --no-init
83```
diff --git a/content/notes/2023-05-25-tmux-sane-defaults.md b/content/notes/2023-05-25-tmux-sane-defaults.md
new file mode 100644
index 0000000..2840af8
--- /dev/null
+++ b/content/notes/2023-05-25-tmux-sane-defaults.md
@@ -0,0 +1,36 @@
1---
2title: Sane defaults for tmux with more visible statusbar
3url: /tmux-sane-defaults.html
4date: 2023-05-25T12:00:00+02:00
5type: note
6draft: false
7---
8
9```conf
10# Remap prefix from 'C-b' to 'M-a'.
11unbind C-b
12set-option -g prefix M-a
13bind-key M-a send-prefix
14
15# Split panes using | and -.
16bind | split-window -h
17bind - split-window -v
18unbind '"'
19unbind %
20
21# Start counting windows with 1.
22set-option -g allow-rename on
23set -g base-index 1
24setw -g pane-base-index 1
25
26# Statusbar: purple bg and white fg.
27set -g status-bg '#480b8e'
28set -g status-fg '#ffffff'
29
30# Active window: black bg and white fg.
31set -g window-status-current-format "#[fg=#ffffff]#[bg=#111111]#[fg=#ffffff]#[bg=#111111] #I:#W #[fg=#ffffff]#[bg=#111111]"
32
33# Disable mouse mode (tmux 2.1 and above).
34set -g mouse off
35```
36
diff --git a/content/notes/2023-05-27-cronjobs-github-with-actions.md b/content/notes/2023-05-27-cronjobs-github-with-actions.md
new file mode 100644
index 0000000..8d44761
--- /dev/null
+++ b/content/notes/2023-05-27-cronjobs-github-with-actions.md
@@ -0,0 +1,32 @@
1---
2title: "Cronjobs on Github with Github Actions"
3url: /cronjobs-github-with-actions.html
4date: 2023-05-27T00:35:36+02:00
5type: note
6draft: false
7---
8
9In the root of your repository create a folder `.github/workflows` and in that
10folder create a file a file `cron.yaml`. This file can be named whatever you
11wish. But it has to be a `yaml` file.
12
13File below (`.github/workflows/cron.yaml`) describes an action that will trigger
14every six hours and it will curl example.com.
15
16However. Be sure that you have enough credits. Free account is not that generous
17with the minutes they give you for free. Check more about GitHub Actions usage
18on their website https://docs.github.com/en/actions.
19
20```yaml
21# .github/workflows/cron.yaml
22name: Do a curl every 6 hours
23on:
24 schedule:
25 - cron: '0 */6 * * *'
26jobs:
27 cron:
28 runs-on: ubuntu-latest
29 steps:
30 - name: Call some url
31 run: curl 'https://example.com'
32```
diff --git a/content/notes/2023-05-27-dcss-on-4k-displays.md b/content/notes/2023-05-27-dcss-on-4k-displays.md
new file mode 100644
index 0000000..3298c5c
--- /dev/null
+++ b/content/notes/2023-05-27-dcss-on-4k-displays.md
@@ -0,0 +1,29 @@
1---
2title: "Make DCSS playable on 4k displays"
3url: /dcss-on-4k-display.html
4date: 2023-05-27T19:35:11+02:00
5type: note
6draft: false
7---
8
9Dungeon Crawl Stone Soup has a a very small font by default. On a 4k display, it
10is barely readable. This is how I made it playable.
11
12Make a file `~/.crawlrc` with the following content:
13
14```ini
15# Adjust the sizes to your liking.
16
17tile_font_crt_size = 32
18tile_font_stat_size = 32
19tile_font_msg_size = 32
20tile_font_tip_size = 32
21tile_font_lbl_size = 32
22tile_sidebar_pixels = 64
23```
24
25To zoom in and out in viewport, press `Ctrl+` and `Ctrl-` respectively.
26
27All the possible options are documented in the [Dungeon Crawl Stone Soup Options
28Guide](https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt)
29file.
diff --git a/content/notes/2023-05-27-drawing-pixels-in-plan9.md b/content/notes/2023-05-27-drawing-pixels-in-plan9.md
new file mode 100644
index 0000000..5b5115d
--- /dev/null
+++ b/content/notes/2023-05-27-drawing-pixels-in-plan9.md
@@ -0,0 +1,82 @@
1---
2title: "Drawing Pixels in Plan9"
3url: /drawing-pixels-in-plan9.html
4date: 2023-05-27T17:41:33+02:00
5type: note
6draft: false
7---
8
9I have started exploring Plan9's graphics capabilities. This is a hello world
10alternative for drawing that draws a yellow square on a blue background.
11
12More information:
13
14- [draw.h header file](https://github.com/0intro/plan9/blob/main/sys/include/draw.h)
15 contains all the drawing functions
16- [draw man page](https://9fans.github.io/plan9port/man/man3/draw.html)
17 has a bit more digestable descriptions of the draw functions
18- [graphics man page](https://9fans.github.io/plan9port/man/man3/graphics.html)
19 has a bit more digestable descriptions of the graphics functions
20- [all man pages](https://9fans.github.io/plan9port/man/man3/)
21 can be a valuable resource for learning about the system
22
23![Plan9 Howdy World!](/assets/notes/plan9-pixels.png)
24
25```c
26// main.c
27#include <u.h>
28#include <libc.h>
29#include <draw.h>
30#include <cursor.h>
31
32void
33main()
34{
35 ulong co;
36 Image *im, *bg;
37 co = 0x0000FFFF;
38
39 if (initdraw(nil, nil, argv0) < 0)
40 {
41 sysfatal("%s: %r", argv0);
42 }
43
44 im = allocimage(display, Rect(0, 0, 300, 300), RGB24, 0, DYellow);
45 bg = allocimage(display, Rect(0, 0, 1, 1), RGB24, 1, co);
46
47 if (im == nil || bg == nil)
48 {
49 sysfatal("not enough memory");
50 }
51
52 draw(screen, screen->r, bg, nil, ZP);
53 draw(screen, screen->r, im, nil, Pt(-40, -40));
54
55 flushimage(display, Refnone);
56
57 // Wait 10 seconds before exiting.
58 sleep(10000);
59
60 exits(nil);
61}
62```
63
64And then compile with `mk` (mkfile below):
65
66```makefile
67# mkfile
68</$objtype/mkfile
69
70RC=/rc/bin
71BIN=/$objtype/bin
72MAN=/sys/man
73
74main:
75 $CC $CFLAGS main.c
76 $LD $LDFLAGS -o main main.$O
77```
78
79And run with `./main`. To exit the program, press `Delete key` (strange but this
80is the alternative for Ctrl+C).
81
82*This is **very cool** indeed!*
diff --git a/content/notes/2023-05-28-easy-time-took-in-bash.md b/content/notes/2023-05-28-easy-time-took-in-bash.md
new file mode 100644
index 0000000..42f2091
--- /dev/null
+++ b/content/notes/2023-05-28-easy-time-took-in-bash.md
@@ -0,0 +1,24 @@
1---
2title: "Easy measure time took in a bash script"
3url: /easy-time-took-in-bash.html
4date: 2023-05-28T17:53:20+02:00
5type: note
6draft: false
7---
8
9In Bash, the `$SECONDS` variable is a special variable that automatically keeps
10track of the number of seconds since the current shell or script started
11executing. It starts counting from the moment the script begins running.
12
13```bash
14#!/bin/bash
15
16# Reset the timer to zero.
17SECONDS=0
18
19# Do something.
20sleep 5
21
22# Print the time elapsed.
23echo "Time taken: $SECONDS seconds"
24```
diff --git a/content/notes/2023-05-29-grep-to-less-maintain-colors.md b/content/notes/2023-05-29-grep-to-less-maintain-colors.md
new file mode 100644
index 0000000..718dda8
--- /dev/null
+++ b/content/notes/2023-05-29-grep-to-less-maintain-colors.md
@@ -0,0 +1,24 @@
1---
2title: "Grep to Less that maintain colors"
3url: /grep-to-less-maintain-colors.html
4date: 2023-05-29T21:27:07+02:00
5type: note
6draft: false
7---
8
9I often use `grep` to search for todo's in my code and other people's code and
10then pipe them in `less` and I missed having colors that grep outputs in `less`.
11
12- Grep's `--color=always` use markers to highlight the matching strings.
13- Less's `-R` option outputs "raw" control characters.
14
15You could use `alias grep='grep --color=always'` and `alias less='less -R'` or
16create todo function in your `.bashrc` that accepts first argument as search
17string.
18
19```sh
20# This is where the magic happens.
21grep --color=always -rni "TODO:" | less -R
22```
23
24![Less and grep](/assets/notes/grep-less.png)
diff --git a/content/notes/2023-05-31-extending-dte-editor.md b/content/notes/2023-05-31-extending-dte-editor.md
new file mode 100644
index 0000000..8135bdc
--- /dev/null
+++ b/content/notes/2023-05-31-extending-dte-editor.md
@@ -0,0 +1,51 @@
1---
2title: "Extending dte editor"
3url: /extending-dte-editor.html
4date: 2023-05-31T08:12:45+02:00
5type: note
6draft: false
7---
8
9[`dte`](https://craigbarnes.gitlab.io/dte/) is an interesting editor I started
10using lately more and more. Since it is using
11[`execvp()`](https://linux.die.net/man/3/execvp) it can be easily extended. I
12needed comment/uncomment feature so I created a small utility that does this for
13me. Code lives on repository [dte
14extensions](https://git.mitjafelicijan.com/dte-extensions.git/about/) but this
15utilities can be used for whatever you want. Make sure you have version 1.11 or
16above.
17
18Next one will be invoking formatter based on the type of a file.
19
20My config that works for me.
21
22```sh
23set show-line-numbers true;
24set tab-width 4;
25set case-sensitive-search false;
26
27# Special aliases
28alias m_comment 'exec -s -i line -o buffer -e errmsg ~/.dte/bin/comment'
29alias m_format 'save; exec go fmt .; reload'
30alias m_duplicate 'copy;paste';
31
32# Useful aliases.
33alias m_force_close 'quit -f';
34alias m_reload 'close; open $FILE'
35
36# Key bindings.
37bind M-s save;
38bind M-q m_force_close;
39bind M-z refresh;
40bind C-down blkdown;
41bind C-up blkup;
42bind C-_ m_comment;
43bind M-. m_format;
44bind C-d m_duplicate;
45
46# Syntax highlighting.
47hi preproc magenta;
48hi keyword red;
49hi linenumber blue;
50hi comment cyan;
51```
diff --git a/content/notes/2023-06-01-ewd-manuscripts-ebook.md b/content/notes/2023-06-01-ewd-manuscripts-ebook.md
new file mode 100644
index 0000000..ac58fe0
--- /dev/null
+++ b/content/notes/2023-06-01-ewd-manuscripts-ebook.md
@@ -0,0 +1,21 @@
1---
2title: "Edsger W. Dijkstra Manuscripts ebook"
3url: /ewd-manuscripts-ebook.html
4date: 2023-06-01T22:47:56+02:00
5type: note
6draft: false
7---
8
9I love reading the original manuscripts of Edsger W. Dijkstra. They are
10available online at the University of Texas at Austin website, but I also found
11MOBI version. I converted it into ePub as well.
12
13Downloads:
14
15- [MOBI version of all Manuscripts](https://mitjafelicijan.fra1.digitaloceanspaces.com/haphazard/ewd-manuscripts.mobi)
16- [ePub version of all Manuscripts](https://mitjafelicijan.fra1.digitaloceanspaces.com/haphazard/ewd-manuscripts.epub)
17
18Sources and credits:
19
20- [Original manuscripts from University of Texas at Austin](https://www.cs.utexas.edu/users/EWD/index00xx.html)
21- [Original repository of MOBI version](https://github.com/evmn/The-Manuscripts-of-Edsger-W.-Dijkstra)
diff --git a/content/notes/2023-06-04-bulk-make-thumbnails.md b/content/notes/2023-06-04-bulk-make-thumbnails.md
new file mode 100644
index 0000000..d3a7d62
--- /dev/null
+++ b/content/notes/2023-06-04-bulk-make-thumbnails.md
@@ -0,0 +1,20 @@
1---
2title: "Bulk thumbnails"
3url: /bulk-make-thumbnails.html
4date: 2023-06-04T20:46:56+02:00
5type: note
6draft: false
7---
8
9Make bulk thumbnails of JPGs with ImageMagick.
10
11```sh
12#!/bin/bash
13
14directory="./images/"
15dimensions="360x360"
16
17for file in "$directory"*.jpg; do
18 convert "$file" -resize $dimensions "$file" "${file%.*}-thumbnail.jpg"
19done
20```
diff --git a/content/notes/2023-06-21-presentations-with-markdown.md b/content/notes/2023-06-21-presentations-with-markdown.md
new file mode 100644
index 0000000..a264eec
--- /dev/null
+++ b/content/notes/2023-06-21-presentations-with-markdown.md
@@ -0,0 +1,77 @@
1---
2title: "Simple presentations with Markdown"
3url: /presentations-with-markdown.html
4date: 2023-06-21T08:54:48+02:00
5type: note
6draft: false
7---
8
9A simple way to make presentations without using desktop apps or using online
10services is https://github.com/remarkjs/remark.
11
12First create `index.html` and be sure you make changes to `config` variable.
13
14```html
15<!DOCTYPE html>
16<html>
17
18<head>
19 <title></title>
20 <meta charset="utf-8">
21 <style>
22 body {
23 font-family: 'SF Pro Display';
24 }
25
26 .remark-code,
27 .remark-inline-code {
28 font-family: 'SF Mono';
29 font-size: medium;
30 background-color: gainsboro;
31 border-radius: 5px;
32 padding: 0 5px;
33 }
34 </style>
35</head>
36
37<body>
38 <textarea id="source"></textarea>
39 <script src="https://remarkjs.com/downloads/remark-latest.min.js"></script>
40 <script>
41 const config = {
42 title: 'My presentation',
43 file: 'presentation.md',
44 };
45
46 document.title = config.title;
47 remark.create({ sourceUrl: config.file });
48 </script>
49</body>
50
51</html>
52```
53
54Now the markdown file `presentation.md` with presenetation. `---` is used to
55separate slides. Other stuff is just pure markdown.
56
57```md
58class: center, middle
59
60# Main title of the presentation
61
62---
63
64# Fist slide
65
66Eveniet mollitia nemo architecto rerum aut iure iste. Sit nihil nobis libero iusto fugit nam laudantium ut. Dignissimos corrupti laudantium nisi.
67
68- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
69- Integer aliquet mauris a felis fringilla, ut congue massa finibus.
70
71---
72
73# Slide two
74
75- Lorem ipsum dolor sit amet, consectetur adipiscing elit.
76- Vestibulum eget leo ac dolor venenatis pulvinar.
77```
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 @@
1---
2title: "Making cgit look nicer"
3url: /making-cgit-look-nicer.html
4date: 2023-06-24T13:33:58+02:00
5type: note
6draft: false
7---
8
9For personal use I have a [private Git server](https://git.mitjafelicijan.com)
10set up and I use GitHub just as a mirror. By default the cgit theme looks a bit
11dated so I made the flowing theme.
12
13- `/etc/cgitrc`
14
15```ini
16css=/cgit.css
17logo=/startrek.gif
18favicon=/favicon.png
19source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh
20about-filter=/usr/lib/cgit/filters/about-formatting.sh
21
22local-time=1
23snapshots=tar.gz
24repository-sort=age
25cache-size=1000
26branch-sort=age
27summary-log=200
28max-atom-items=50
29max-repo-count=100
30
31enable-index-owner=0
32enable-follow-links=1
33enable-log-filecount=1
34enable-log-linecount=1
35
36root-title=Place for code, experiments and other bullshit!
37root-desc=
38clone-url=git@git.mitjafelicijan.com:/home/git/$CGIT_REPO_URL
39
40mimetype.gif=image/gif
41mimetype.html=text/html
42mimetype.jpg=image/jpeg
43mimetype.jpeg=image/jpeg
44mimetype.pdf=application/pdf
45mimetype.png=image/png
46mimetype.svg=image/svg+xml
47
48readme=:README.md
49readme=:readme.md
50
51# Must be at the end!
52virtual-root=/
53scan-path=/home/git/
54```
55
56For `syntax-highlighting-edited.sh` follow instructions on
57[https://wiki.archlinux.org/title/Cgit](https://wiki.archlinux.org/title/Cgit#Using_highlight).
58
59- `/usr/share/cgit/cgit.css`
60
61```css
62* {
63 font-size: 11pt;
64}
65
66body {
67 font-family: monospace;
68 background: white;
69 padding: 1em;
70}
71
72th, td {
73 text-align: left;
74}
75
76/* HEADER */
77
78#header {
79 margin-bottom: 1em;
80}
81
82#header .logo img {
83 display: block;
84 height: 3em;
85 margin-right: 10px;
86}
87
88#header .sub.right {
89 display: none;
90}
91
92/* FOOTER */
93
94.footer {
95 margin-top: 2em;
96 font-style: italic;
97}
98
99.footer, .footer a {
100 color: gray;
101}
102
103/* TABS */
104
105.tabs a {
106 margin-bottom: 2em;
107 display: inline-block;
108 margin-right: 1em;
109}
110
111.tabs td a:only-child {
112 display: none;
113}
114
115/* HIDING ELEMENTS */
116
117.cgit-panel, .form {
118 display: none;
119}
120
121/* LISTS */
122
123.list td, .list th {
124 padding-right: 2em;
125}
126
127.list .nohover a {
128 color: black;
129}
130
131.list .button {
132 padding-right: 0.5em;
133}
134
135/* COMMIT */
136
137.commit-subject {
138 padding: 1em 0;
139}
140
141.decoration a {
142 padding-left: 0.5em;
143}
144
145.commit-info th {
146 padding-right: 1em;
147}
148
149.commit-subject {
150 padding: 2em 0;
151}
152
153table.diff div.head {
154 padding-top: 2em;
155}
156
157table.diffstat td {
158 padding-right: 1em;
159}
160
161/* CONTENT */
162
163.linenumbers {
164 padding-right: 0.5em;
165}
166
167.linenumbers a {
168 color: gray;
169}
170
171.pager {
172 display: flex;
173 list-style-type: none;
174 padding: 0;
175 gap: 0.5em;
176}
177
178/* DIFF COLORS */
179
180table.diff {
181 width: 100%;
182}
183
184table.diff td {
185 white-space: pre;
186}
187
188table.diff td div.head {
189 font-weight: bold;
190 margin-top: 1em;
191 color: black;
192}
193
194table.diff td div.hunk {
195 color: #009;
196}
197
198table.diff td div.add {
199 color: green;
200}
201
202table.diff td div.del {
203 color: red;
204}
205```
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 @@
1---
2title: "Alacritty open links with modifier"
3url: /alacritty-open-links-with-modifier.html
4date: 2023-06-25T17:17:16+02:00
5type: note
6draft: false
7---
8
9Alacritty by default makes all links in the terminal output clickable and this
10gets annoying rather quickly. I liked the default behavior of Gnome terminal
11where you needed to hold Control key and then you could click and open links.
12
13To achieve this in Alacritty you need to provide a `hint` in the configuration
14file. Config file is located at `~/.config/alacritty/alacritty.yml`.
15
16```yaml
17hints:
18 enabled:
19 - regex: "(mailto:|gemini:|gopher:|https:|http:|news:|file:|git:|ssh:|ftp:)\
20 [^\u0000-\u001F\u007F-\u009F<>\"\\s{-}\\^⟨⟩`]+"
21 command: xdg-open
22 post_processing: true
23 mouse:
24 enabled: true
25 mods: Control
26```
27
28The following should work under any Linux system. For macOS, you will need to
29change `command: xdg-open` to something else.
30
31Now the links will be visible and clickable only when Control key is being
32pressed.
33
34Source: 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 @@
1---
2title: "Development environments with Nix"
3url: /development-environments-with-nix.html
4date: 2023-06-25T16:38:10+02:00
5type: note
6draft: false
7---
8
9Nix is amazing for making reproducible cross OS development environment.
10
11First you need to [install Nix package
12manager](https://nixos.org/download.html).
13
14- Create a file `shell.nix` in your project folder.
15- In the section that has `python3` etc add programs you want to use. These can
16 be CLI or GUI applications. It doesn't matter to Nix.
17
18```nix
19{ pkgs ? import <nixpkgs> {} }:
20 pkgs.mkShell {
21 nativeBuildInputs = with pkgs.buildPackages; [
22 python3
23 tinycc
24 ];
25}
26```
27
28And then run it `nix-shell`. By default it will look for `shell.nix` file. If
29you want to specify a different file use `nix-shell file.nix`. That is about it.
30
31When the shell is spawned it could happen that your `PS1` prompt will be
32overwritten and your prompt will look differently. In that case you need to
33either do `NIX_SHELL_PRESERVE_PROMPT=1 nix shell` or add
34`NIX_SHELL_PRESERVE_PROMPT` variable to your `bashrc` or `zshrc` file and set it
35to `1`.
36
37I also have a modified `PS1` prompt for Bash that I use and it also catches the
38usage of Nix shell.
39
40```sh
41NIX_SHELL_PRESERVE_PROMPT=1
42
43parse_git_branch() {
44 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
45}
46
47is_inside_nix_shell() {
48 nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)"
49 if [[ -n "$nix_shell_name" ]]; then
50 echo " \e[0;36m(nix-shell)\e[0m"
51 fi
52}
53
54export PS1="[\033[38;5;9m\]\u@\h\[$(tput sgr0)\]]$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ "
55```
56
57And this is what it looks like when you are in a Nix shell. Otherwise that part
58of prompt is omitted
59
60![PS1 Prompt](/assets/notes/ps1-prompt.png)
61
62More resources:
63
64- https://nixos.wiki/wiki/Development_environment_with_nix-shell
65- https://nixos.wiki/wiki/Main_Page
66- https://itsfoss.com/why-use-nixos/
67- 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 @@
1---
2title: "10/GUI 10 Finger Multitouch User Interface"
3url: /10gui-10-finger-multitouch-user-interface.html
4date: 2023-06-29T14:51:39+02:00
5type: note
6draft: false
7---
8
9Message from 10/GUI team (page 10gui.com does not exist anymore):
10
11*Over a quarter-century ago, Xerox introduced the modern graphical user
12interface paradigm we today take for granted.*
13
14*That it has endured is a testament to the genius of its design. But the
15industry is now at a crossroads: New technologies promise higher-bandwidth
16interaction, but have yet to find a truly viable implementation.*
17
18*10/GUI aims to bridge this gap by rethinking the desktop to leverage technology
19in an intuitive and powerful way.*
20
21<video
22 poster="/assets/notes/10gui-10-finger-multitouch-user-interface.jpg"
23 src="/assets/notes/10gui-10-finger-multitouch-user-interface.mp4"
24 controls></video>
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 @@
1---
2title: "60's IBM Computers Commercial"
3url: /60s-ibm-computers-commercial.html
4date: 2023-06-29T22:13:45+02:00
5type: note
6draft: false
7---
8
9Likely aired during an hour-long program during the 1960s, long commercials such
10as this typically aired during hour-long programs. They would *not* have aired
11during a half-hour program.
12
13<video
14 poster="/assets/notes/60s-ibm-computers-commercial.jpg"
15 src="/assets/notes/60s-ibm-computers-commercial.mp4"
16 controls></video>
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 @@
1---
2title: "Fix screen tearing on Debian 12 Xorg and i3"
3url: /fix-screen-tearing-on-debian-12-xorg-and-i3.html
4date: 2023-07-10T04:21:48+02:00
5type: note
6draft: false
7---
8
9I have been experiencing some issues with Intel® Integrated HD Graphics 3000
10under Debian 12 with Xorg and i3. Using `picom` compositor didn't help. To fix
11this issue create new file `/etc/X11/xorg.conf.d/20-intel.conf` as root and put
12the following in the file.
13
14```txt
15Section "Device"
16 Identifier "Intel Graphics"
17 Driver "intel"
18 Option "TearFree" "true"
19EndSection
20```
21
22Reboot 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 @@
1---
2title: "Online radio streaming with MPV from terminal"
3url: /online-radio-streaming-with-mpv-from-terminal.html
4date: 2023-07-10T03:34:45+02:00
5type: note
6draft: false
7---
8
9Recently I have been using my Thinkpad x220 more and there are some constraints
10I have faced with it. CPU is not as powerful as on my main machine and I really
11want to listen to some music while using the machine. Browsers really are bloat.
12
13Check out this site https://streamurl.link/ and copy the stream url and then do
14`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 @@
1---
2title: "Set color temperature of displays on i3"
3url: /set-color-temperature-of-displays-on-i3.html
4date: 2023-07-14T09:19:31+02:00
5type: note
6draft: false
7---
8
9I have been using Gnome's night shift for a while now and I have been missing
10this feature under i3wm. This can be done with
11[redshift](https://linux.die.net/man/1/redshift).
12
13- On Debian install with `sudo apt install redshift`
14- And then manually set it with `redshift -O 3000`
15- 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 @@
1---
2title: "Make B/W SVG charts with matplotlib"
3url: /make-b-w-svg-charts-with-matplotlib.html
4date: 2023-08-01T17:04:10+02:00
5type: note
6draft: false
7---
8
9Install pip requirements.
10
11```sh
12pip install matplotlib
13pip install pandas
14```
15
16Example of data being used.
17
18```text
19Epoch,Connect (NLB),Processing (NLB),Waiting (NLB),Total (NLB),Connect (ALB),Processing (ALB),Waiting (ALB),Total (ALB)
201,57.7,315.7,309.4,321.6,9,104.4,98.3,105.7
212,121.9,114.4,100.3,176.9,5.8,99.1,97.1,101.1
223,5.3,229.4,231.2,231.4,14.2,83,69.4,87.9
234,4.2,134.5,112.2,135.3,5.3,132.4,105.5,134.1
245,5.8,247.4,246.8,248.1,6,74.3,70.2,75.5
256,9.9,122.9,100.6,122.7,7.5,241.1,79.3,242.3
267,6.1,170.2,106.4,170.5,7.2,382.4,375.1,383.8
278,6.6,194.3,201.4,195.5,7.1,130.9,104.8,132.6
289,6.4,146.1,122.3,147.7,9.4,95.6,74,96.4
29```
30
31In the code you can use `df` as dataframes and use the headers like `df["Epoch"]`.
32This is how you get a column data with pandas.
33
34The Python code responsible for generating a chart:
35
36```python
37import csv
38import sys
39
40import matplotlib.pyplot as plt
41import pandas as pd
42
43# Read the data
44df = pd.read_csv("data.csv")
45
46# Settings
47plt.title("Connect median NLB vs ALB")
48plt.tight_layout(pad=2)
49fig = plt.gcf()
50fig.set_size_inches(10, 4)
51
52# Plotting
53plt.plot(df["Epoch"], df["Connect (ALB)"], label = "ALB", color="black", linestyle="-")
54plt.plot(df["Epoch"], df["Connect (NLB)"], label = "NLB", color="black", linestyle="--")
55
56# Adding x and y axis labels
57plt.xlabel("Epoch", fontstyle="italic")
58plt.ylabel("Median value (ms)", fontstyle="italic")
59
60# Legend
61legend = plt.legend()
62legend.get_frame().set_linewidth(0)
63
64# Export as SVG
65plt.savefig("plot.svg", format="svg")
66```
67
68![SVG Chart](/assets/notes/plot.svg)
69
70The 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 @@
1---
2title: "AWS EB PyYAML fix"
3url: /aws-eb-pyyaml-fix.html
4date: 2023-09-18T07:27:29+02:00
5type: note
6draft: false
7---
8
9Recent update of my system completely borked [EB CLI](https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install-advanced.html)
10on my machine.
11
12I tried installing it with `pip install awsebcli --upgrade --user` and it failed.
13
14The error was the following.
15
16```text
17Collecting PyYAML<6.1,>=5.3.1 (from awsebcli)
18 Using cached PyYAML-5.4.1.tar.gz (175 kB)
19 Installing build dependencies ... done
20 Getting requirements to build wheel ... error
21 error: subprocess-exited-with-error
22
23 × Getting requirements to build wheel did not run successfully.
24 │ exit code: 1
25 ╰─> [68 lines of output]
26```
27
28To fix this issue with PyYAML you must install PyYAML separately.
29
30Do the following and try installing `eb` again after.
31
32```sh
33echo 'Cython < 3.0' > /tmp/constraint.txt
34PIP_CONSTRAINT=/tmp/constraint.txt pip install 'PyYAML==5.4.1'
35```
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 @@
1---
2title: "Compile drawterm on Fedora 38"
3url: /compile-drawterm-on-fedora-38.html
4date: 2023-09-25T09:04:28+02:00
5type: note
6draft: false
7---
8
9First install two dependencies:
10
11```sh
12sudo dnf install libX11-devel libXt-devel
13```
14
15Clone the repo and compile it:
16
17```sh
18git clone git://git.9front.org/plan9front/drawterm
19cd drawterm
20CONF=unix make
21```
22
23That 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 @@
1---
2title: "Using ffmpeg to combine videos side by side"
3url: /using-ffmpeg-to-combine-video-side-by-side.html
4date: 2023-11-04T09:04:28+02:00
5type: note
6draft: false
7---
8
9I had a 4 webm videos (each 492x451) that I wanted to combine to be played side
10by side and I tried [iMovie](https://support.apple.com/imovie) and
11[Kdenlive](https://kdenlive.org/) and failed to do it in an easy way. I needed
12this for Github readme file so it also needed to be a GIF.
13
14The following is the [ffmpeg](https://ffmpeg.org/) version of it.
15
16```sh
17ffmpeg -y \
18 -i 01.webm \
19 -i 02.webm \
20 -i 03.webm \
21 -i 04.webm \
22 -filter_complex "\
23 [0:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a0]; \
24 [1:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a1]; \
25 [2:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a2]; \
26 [3:v] trim=duration=8, setpts=PTS-STARTPTS, scale=492x451, fps=6 [a3]; \
27 [a0][a1][a2][a3] xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0, scale=1000:-1 [v]" \
28 -map "[v]" \
29 -crf 23 \
30 -preset veryfast \
31 trigraphs.gif
32```
33
34- This will produce `trigraphs.gif` that is also scaled to max 1000px in width
35 (refer to `scale=1000:-1`).
36- The important part for 4x1 stack is `xstack=inputs=4:layout=0_0|w0_0|w0+w1_0|w0+w1+w2_0`.
37- This will also cap frame rate to 6 (refer to `fps=6`) since that is enough and
38 this makes playback of GIFs smoother in a browser.
39
40![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 @@
1---
2title: "Add lazy loading of images in Jekyll posts"
3url: /add-lazy-loading-to-jekyll-posts.html
4date: 2023-11-05T09:04:28+02:00
5type: note
6draft: false
7---
8
9Normally you define images with `![]()` in markdown files. But jekyll also
10provides a way to adding custom attributes to tags with `{:attr="value"}`.
11
12If you have lots of posts this command will append `` to all
13images in all your markdown files.
14
15```md
16![image-title](/path/to/your/image.jpg)
17```
18
19will become
20
21```md
22![image-title](/path/to/your/image.jpg)
23```
24
25Shell line bellow. Go into the folder where your posts are (probably `_posts`).
26
27```sh
28find . -type f -name "*.md" -exec sed -i -E 's/(\!\[.*\]\((.*?)\))$/\1/' {} \;
29```
30
31Under the hood this adds `loading="lazy"` to HTML `img` nodes.
32
33That 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 @@
1---
2title: "Personal sane Vim defaults"
3url: /apersonal-sane-vim-defaults.html
4date: 2023-11-07T01:04:28+02:00
5type: note
6draft: false
7---
8
9I have found many "sane" default configs on the net and this is my favorite
10personal list. This is how my `.vimrc` file looks like.
11
12```vimrc
13" General sane defaults.
14syntax enable
15colorscheme sorbet
16nnoremap q: <nop>
17set nocompatible
18set relativenumber
19set nohlsearch
20set smartcase
21set ignorecase
22set incsearch
23set autoindent
24set nowrap
25set nobackup
26set noswapfile
27set autoread
28set wildmenu
29set encoding=utf8
30set backspace=2
31set scrolloff=4
32set spelllang=en_us
33
34" Status Line enhancements.
35set laststatus=2
36set statusline=%f%m%=%y\ %{strlen(&fenc)?&fenc:'none'}\ %l:%c\ %L\ %P
37hi StatusLine cterm=NONE ctermbg=black ctermfg=brown
38hi StatusLineNC cterm=NONE ctermbg=black ctermfg=darkgray
39
40" Commenting blocks of code.
41augroup commenting_blocks_of_code
42 autocmd!
43 autocmd FileType c,cpp,go,scala let b:comment_leader = '// '
44 autocmd FileType sh,ruby,python let b:comment_leader = '# '
45 autocmd FileType conf,fstab let b:comment_leader = '# '
46 autocmd FileType lua let b:comment_leader = '-- '
47 autocmd FileType vim let b:comment_leader = '" '
48augroup END
49noremap <silent> ,cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
50noremap <silent> ,cu :<C-B>silent <C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
51
52" Language specific indentation.
53filetype plugin indent on
54autocmd Filetype make,go,c,cpp setlocal noexpandtab tabstop=4 shiftwidth=4
55autocmd Filetype html,js,css setlocal expandtab tabstop=2 shiftwidth=2
56```
57
58I keep it pretty vanilla so this is about everything I have in the file.
59
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 @@
1---
2title: "Extract lines from a file with sed"
3url: /extract-lines-from-file-with-sed.html
4date: 2024-02-15T10:04:28+02:00
5type: note
6draft: false
7---
8
9Easy way to extract line ranges (from line 200 to line 210) with sed.
10
11```sh
12sed -n '200,210p' data/Homo_sapiens.GRCh38.dna.chromosome.18.fa
13
14# then pipe it to a new file with
15
16sed -n '200,210p' data/Homo_sapiens.GRCh38.dna.chromosome.18.fa > new.fa
17```
18
19`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 @@
1---
2title: "Sane default for Dungeon Crawl Stone Soup Online edition"
3url: /dcss-online-rc-defaults.html
4date: 2024-02-21T06:35:11+02:00
5type: note
6draft: false
7---
8
9I mostly play Dungeon Crawl Stone Soup online on Ohio, USA: cbro.berotato.org server and
10when you start playing you can select the version you want to play. Each instance also
11has `rc` file that can customize the way the game behave.
12
13This is my sane defaults config. It zooms in the game without needing to zoom in the
14browser and it also adds a bit of delays in exploring and it stops at fight.
15
16```ini
17autofight_stop = 80
18explore_auto_rest = true
19explore_delay = 20
20
21tile_cell_pixels = 48
22tile_font_crt_size = 24
23tile_font_stat_size = 24
24tile_font_msg_size = 24
25tile_font_tip_size = 24
26tile_font_lbl_size = 24
27tile_map_pixels = 0
28tile_filter_scaling = false
29```
30
31All the possible options are documented in the [Dungeon Crawl Stone Soup Options
32Guide](https://github.com/crawl/crawl/blob/master/crawl-ref/docs/options_guide.txt)
33file.
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 @@
1---
2title: Uninstall Ollama from a Linux box
3url: /uninstall-ollama-from-a-linux-box.html
4type: note
5date: 2024-02-23
6draft: false
7---
8I have had some issues with Ollama not being up-to-date. If Ollama is installed with a curl command, it adds a systemd service.
9
10```sh
11sudo systemctl stop ollama
12sudo systemctl disable ollama
13sudo rm /etc/systemd/system/ollama.service
14sudo systemctl daemon-reload
15
16sudo rm /usr/local/bin/ollama
17
18sudo userdel ollama
19sudo groupdel ollama
20
21rm -r ~/.ollama
22sudo rm -rf /usr/share/ollama
23```
24
25That is about it.