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