aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archetypes/notes.md11
-rw-r--r--archetypes/posts.md9
-rw-r--r--content/notes/cachebusting-in-hugo.md2
-rw-r--r--content/notes/catv-weechat-config.md2
-rw-r--r--content/notes/convert-mkv.md2
-rw-r--r--content/notes/dcss-materials.md69
-rw-r--r--content/notes/download-youtube-videos.md2
-rw-r--r--content/notes/extend-lua-with-custom-c.md2
-rw-r--r--content/notes/fix-plan9-bootloader.md2
-rw-r--r--content/notes/fresh-9front-desktop.md2
-rw-r--r--content/notes/git-push-multiple-origins.md2
-rw-r--r--content/notes/install-plan9port-linux.md2
-rw-r--r--content/notes/mass-set-permission.md2
-rw-r--r--content/notes/mount-plan9-over-network.md2
-rw-r--r--content/notes/non-blocking-shell-exec-csharp.md2
-rw-r--r--content/notes/parse-rss-with-lua.md2
-rw-r--r--content/notes/plan9-screenshot.md2
-rw-r--r--content/notes/preview-troff-man-pages.md2
-rw-r--r--content/notes/run-9front-in-qemu.md2
-rw-r--r--content/notes/show-xterm-colors.md2
-rw-r--r--content/notes/something.md11
-rw-r--r--content/notes/tmux-sane-defaults.md2
-rw-r--r--content/notes/write-iso-usb.md5
-rw-r--r--content/pages/books.md2
-rw-r--r--content/pages/curriculum-vitae.md2
-rw-r--r--content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md29
-rw-r--r--content/posts/2012-03-09-led-technology-not-so-eco.md24
-rw-r--r--content/posts/2013-10-24-wireless-sensor-networks.md50
-rw-r--r--content/posts/2015-11-10-software-development-pitfalls.md180
-rw-r--r--content/posts/2017-03-07-golang-profiling-simplified.md28
-rw-r--r--content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md114
-rw-r--r--content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md41
-rw-r--r--content/posts/2017-08-11-simple-iot-application.md223
-rw-r--r--content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md117
-rw-r--r--content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md133
-rw-r--r--content/posts/2019-10-14-simplifying-and-reducing-clutter.md63
-rw-r--r--content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md43
-rw-r--r--content/posts/2020-03-22-simple-sse-based-pubsub-server.md109
-rw-r--r--content/posts/2020-03-27-create-placeholder-images-with-sharp.md36
-rw-r--r--content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md61
-rw-r--r--content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md99
-rw-r--r--content/posts/2020-05-05-remote-work.md63
-rw-r--r--content/posts/2020-08-15-systemd-disable-wake-onmouse.md42
-rw-r--r--content/posts/2020-09-06-esp-and-micropython.md68
-rw-r--r--content/posts/2020-09-08-bind-warning-on-login.md28
-rw-r--r--content/posts/2020-09-09-digitalocean-sync.md92
-rw-r--r--content/posts/2021-01-24-replacing-dropbox-with-s3.md52
-rw-r--r--content/posts/2021-01-25-goaccess.md90
-rw-r--r--content/posts/2021-06-26-simple-world-clock.md34
-rw-r--r--content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md100
-rw-r--r--content/posts/2021-08-01-linux-cheatsheet.md3
-rw-r--r--content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md164
-rw-r--r--content/posts/2021-12-25-running-golang-application-as-pid1.md122
-rw-r--r--content/posts/2021-12-30-wap-mobile-web-before-the-web.md79
-rw-r--r--content/posts/2022-06-30-trying-out-helix-editor.md42
-rw-r--r--content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md134
-rw-r--r--content/posts/2022-08-13-algae-spotted-on-river-sava.md12
-rw-r--r--content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md317
-rw-r--r--content/posts/2022-10-10-sentiment-based-on-political-bias.md84
-rw-r--r--content/posts/2022-10-11-handling-massive-worlds-in-godot.md82
-rw-r--r--content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md40
-rw-r--r--content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md140
-rw-r--r--content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md15
-rw-r--r--content/posts/2023-05-16-rekindling-my-love-for-programming.md72
-rw-r--r--content/posts/2023-05-22-crafting-stories-in-zed-editor.md61
-rw-r--r--content/posts/2023-05-23-i-was-wrong-about-git-workflows.md68
-rw-r--r--static/general/index.css2
-rw-r--r--static/notes/dcss-quickstart.pdfbin0 -> 80328 bytes
-rw-r--r--static/notes/dcss.jpgbin0 -> 855457 bytes
-rw-r--r--static/notes/dcss_manual.pdfbin0 -> 203302 bytes
-rw-r--r--themes/simple/layouts/_default/single.html8
-rw-r--r--themes/simple/static/css/tailwind.css5
72 files changed, 2584 insertions, 930 deletions
diff --git a/archetypes/notes.md b/archetypes/notes.md
new file mode 100644
index 0000000..9f13d6d
--- /dev/null
+++ b/archetypes/notes.md
@@ -0,0 +1,11 @@
1---
2title: "{{ replace .Name "-" " " | title }}"
3url: {{ .Name }}.html
4date: {{ .Date }}
5type: notes
6draft: true
7tags: []
8---
9
10Start here ...
11
diff --git a/archetypes/posts.md b/archetypes/posts.md
new file mode 100644
index 0000000..b9dad61
--- /dev/null
+++ b/archetypes/posts.md
@@ -0,0 +1,9 @@
1---
2title: "{{ replace .Name "-" " " | title }}"
3url: new-post.html
4date: {{ .Date }}
5draft: true
6---
7
8Start here ...
9
diff --git a/content/notes/cachebusting-in-hugo.md b/content/notes/cachebusting-in-hugo.md
index 65d7769..34e1684 100644
--- a/content/notes/cachebusting-in-hugo.md
+++ b/content/notes/cachebusting-in-hugo.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Cache busting in Hugo 2title: Cache busting in Hugo
3url: cachebusting-in-hugo.html 3url: cachebusting-in-hugo.html
4date: 2023-05-01 4date: 2023-05-01T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [hugo, cachebusting] 7tags: [hugo, cachebusting]
diff --git a/content/notes/catv-weechat-config.md b/content/notes/catv-weechat-config.md
index 3e6e612..ea53120 100644
--- a/content/notes/catv-weechat-config.md
+++ b/content/notes/catv-weechat-config.md
@@ -1,7 +1,7 @@
1--- 1---
2title: "#cat-v on weechat configuration" 2title: "#cat-v on weechat configuration"
3url: catv-weechat-config.html 3url: catv-weechat-config.html
4date: 2023-05-09 4date: 2023-05-09T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [irc, weechat, cat-v] 7tags: [irc, weechat, cat-v]
diff --git a/content/notes/convert-mkv.md b/content/notes/convert-mkv.md
index bafdfb3..0e1987a 100644
--- a/content/notes/convert-mkv.md
+++ b/content/notes/convert-mkv.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Convert all MKV files into other formats 2title: Convert all MKV files into other formats
3url: convert-mkv.html 3url: convert-mkv.html
4date: 2023-05-14 4date: 2023-05-14T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [ffmpeg, mkv, webm, mp4] 7tags: [ffmpeg, mkv, webm, mp4]
diff --git a/content/notes/dcss-materials.md b/content/notes/dcss-materials.md
new file mode 100644
index 0000000..e446224
--- /dev/null
+++ b/content/notes/dcss-materials.md
@@ -0,0 +1,69 @@
1---
2title: Dungeon Crawl Stone Soup Materials
3url: dcss-materials.html
4date: 2023-05-25T22:00:00+02:00
5type: notes
6draft: false
7tags: [dcss]
8---
9
10An amazing game deserves an amazing guide. All this material can be find in
11some for on another on [craw's](https://github.com/crawl/crawl) official
12repository.
13
14- [DCSS Quickstart](/notes/dcss-quickstart.pdf) - Very short introduction to the game
15- [DCSS Manual](/notes/dcss_manual.pdf) - Extensive manual about the game
16
17![Dungeon Crawl Stone Soup](/notes/dcss.jpg)
18
19**Movement and Exploration**
20
21- You can move around with the numpad (try numlock on and off), vi-keys, or clicking with the mouse. Arrow keys work, though you can't move diagonally with them. Pressing Shift and a direction will move until you see/hit something.
22- Pressing `>` will take you down a staircase, and `<` to go up a staircase.
23- You can open doors by walking into them, and close them with `C`.
24- You can autoexplore by pressing `o`.
25- You can re-view recent messages with `Ctrl-p`.
26
27**Monsters and Combat**
28
29- You can pick up items with `,` or `g`.
30- Wield weapons with `w`. Weapons have different stats.
31 - (You may also engage in Unarmed Combat, though it isn't very effective when untrained).
32- Attack monsters in melee by walking in their direction (or with Ctrl-direction).
33- You can wait with `.` or `s`, passing your turn - such as to get monsters into a corridor with you.
34- You can rest with `5`, waiting until you are fully healed, or something noteworthy happens.
35- Either mouseover and rightclick, or use `x` then `v` on the monster to examine monsters. Monsters with a red border are 'dangerous' relative to your current XP level (XL).
36- Quiver (often ranged) actions for further use with `Q`.
37- You can fire ranged weapons manually with `f`, or auto-target your quiver with `p` or `Shift-Tab`. Throwing weapons can be thrown immediately, while launchers (like bows) need to be wielded first.
38
39**Items and Inventory**
40
41- View your inventory by pressing `i`. Most item related commands can also be done with this menu.
42- You can wear amour with `W;` amour gives `AC`, while heavier body armour reduces `EV`.
43- Autoexplore will automatically pick up useful items, such as potions and scrolls, if you aren't in danger.
44- You can read scrolls with `r` and drink ("quaff") potions with `q`.
45- Equipment items may have brands, with special properties. Branded equipment is blue when unidentified.
46- Equipment items may be artifacts, often with unique properties, and are unmodifiable. They are written in white.
47- You can evoke wands with `V`.
48- You can put on jewelry with `P`, and remove it with `R`.
49- Gold is used in shops, which can be interacted with by either `>` or `<`.
50
51**Magic and Spellcasting**
52
53- Once you find a spellbook, you can memorize spells with `M`.
54- You need to be the same XL as the spell's spell level in order to learn it, in addition to training magical skill (to lower failure rate).
55- Cast spells by pressing `z`, then the letter assigned to the spell. You may also Quiver a spell and then use it like a ranged weapon (with Shift-Tab).
56- You can view your memorized spells by pressing `I` (capital-i) or `z`.
57- Like HP, you can recover MP by resting (with 5).
58- Many spells can be positioned more effectively, or combined with other spells, in order to get (more effective) use out of them.
59- Heavier body amour and shields hamper spellcasting.
60
61**Gods and Divine Abilities**
62
63- You may look at a god's overview by praying at their altar (with `>` or `<`). After praying, you can worship the god by pressing Enter afterwards.
64- Gods all have unique features about them. Trog, the god of the tutorial, is also the god of rage and bloodshed, and so despises spellcasting.
65- Gods like and dislike different things. Most gods either like killing things (like Trog) or exploring new areas (like Elyvilon), rewarding you piety (divine favor) for doing so.
66- You should learn to use and even rely on divine abilities often, as they are usually very strong. Trog's Berserk gives you 1.5x health, 1.5x speed (to all valid actions), and a big damage boost. Note that Berserk prevents most actions other than move and melee attack, and runs out very quickly if you aren't attacking. And after berserk ends, you are slowed down and can't berserk again for a short time.
67- In addition, the vast majority of abilities consume piety in the process. Regardless, this ability is very cheap, and the benefits are incredible, so don't hold back!
68- Pressing `^` will let you view your current god, abilities, and piety.
69
diff --git a/content/notes/download-youtube-videos.md b/content/notes/download-youtube-videos.md
index 455c550..6d26d12 100644
--- a/content/notes/download-youtube-videos.md
+++ b/content/notes/download-youtube-videos.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Download list of YouTube files 2title: Download list of YouTube files
3url: download-youtube-videos.html 3url: download-youtube-videos.html
4date: 2023-05-13 4date: 2023-05-13T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [youtube, yt-dlp, ffmpeg, webm, mp4] 7tags: [youtube, yt-dlp, ffmpeg, webm, mp4]
diff --git a/content/notes/extend-lua-with-custom-c.md b/content/notes/extend-lua-with-custom-c.md
index 2151237..eaa55a1 100644
--- a/content/notes/extend-lua-with-custom-c.md
+++ b/content/notes/extend-lua-with-custom-c.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Extend Lua with custom C functions using Clang 2title: Extend Lua with custom C functions using Clang
3url: extend-lua-with-custom-c.html 3url: extend-lua-with-custom-c.html
4date: 2023-05-23 4date: 2023-05-23T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [lua, clang, c] 7tags: [lua, clang, c]
diff --git a/content/notes/fix-plan9-bootloader.md b/content/notes/fix-plan9-bootloader.md
index 675eabc..fdd9425 100644
--- a/content/notes/fix-plan9-bootloader.md
+++ b/content/notes/fix-plan9-bootloader.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Fix bootloader not being written in Plan9 2title: Fix bootloader not being written in Plan9
3url: fix-plan9-bootloader.html 3url: fix-plan9-bootloader.html
4date: 2023-05-11 4date: 2023-05-11T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, bootloader] 7tags: [plan9, bootloader]
diff --git a/content/notes/fresh-9front-desktop.md b/content/notes/fresh-9front-desktop.md
index 71edd04..840126a 100644
--- a/content/notes/fresh-9front-desktop.md
+++ b/content/notes/fresh-9front-desktop.md
@@ -1,7 +1,7 @@
1--- 1---
2title: My brand new Plan9/9front desktop 2title: My brand new Plan9/9front desktop
3url: fresh-9front-desktop.html 3url: fresh-9front-desktop.html
4date: 2023-05-24 4date: 2023-05-24T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, 9front] 7tags: [plan9, 9front]
diff --git a/content/notes/git-push-multiple-origins.md b/content/notes/git-push-multiple-origins.md
index 14b6ed0..929a5dc 100644
--- a/content/notes/git-push-multiple-origins.md
+++ b/content/notes/git-push-multiple-origins.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Push to multiple origins at once in Git 2title: Push to multiple origins at once in Git
3url: git-push-multiple-origins.html 3url: git-push-multiple-origins.html
4date: 2023-05-06 4date: 2023-05-06T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [git] 7tags: [git]
diff --git a/content/notes/install-plan9port-linux.md b/content/notes/install-plan9port-linux.md
index 7e8994d..b74d2c0 100644
--- a/content/notes/install-plan9port-linux.md
+++ b/content/notes/install-plan9port-linux.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Install Plan9port on Linux 2title: Install Plan9port on Linux
3url: install-plan9port-linux.html 3url: install-plan9port-linux.html
4date: 2023-05-12 4date: 2023-05-12T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, plan9port, linux] 7tags: [plan9, plan9port, linux]
diff --git a/content/notes/mass-set-permission.md b/content/notes/mass-set-permission.md
index 84ec97a..b57374c 100644
--- a/content/notes/mass-set-permission.md
+++ b/content/notes/mass-set-permission.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Change permissions of matching files recursively 2title: Change permissions of matching files recursively
3url: mass-set-permission.html 3url: mass-set-permission.html
4date: 2023-05-16 4date: 2023-05-16T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [linux, find, chmod] 7tags: [linux, find, chmod]
diff --git a/content/notes/mount-plan9-over-network.md b/content/notes/mount-plan9-over-network.md
index 9e9875e..f643395 100644
--- a/content/notes/mount-plan9-over-network.md
+++ b/content/notes/mount-plan9-over-network.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Mount Plan9 over network 2title: Mount Plan9 over network
3url: mount-plan9-over-network.html 3url: mount-plan9-over-network.html
4date: 2023-05-07 4date: 2023-05-07T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, linux, 9pfs] 7tags: [plan9, linux, 9pfs]
diff --git a/content/notes/non-blocking-shell-exec-csharp.md b/content/notes/non-blocking-shell-exec-csharp.md
index 6de081e..cf43716 100644
--- a/content/notes/non-blocking-shell-exec-csharp.md
+++ b/content/notes/non-blocking-shell-exec-csharp.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Execute not blocking async shell command in C# 2title: Execute not blocking async shell command in C#
3url: non-blocking-shell-exec-csharp.html 3url: non-blocking-shell-exec-csharp.html
4date: 2023-05-22 4date: 2023-05-22T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [csharp, async, shell] 7tags: [csharp, async, shell]
diff --git a/content/notes/parse-rss-with-lua.md b/content/notes/parse-rss-with-lua.md
index 1757d45..1efeae5 100644
--- a/content/notes/parse-rss-with-lua.md
+++ b/content/notes/parse-rss-with-lua.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Parse RSS feeds with Lua 2title: Parse RSS feeds with Lua
3url: parse-rss-with-lua.html 3url: parse-rss-with-lua.html
4date: 2023-05-23 4date: 2023-05-23T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [lua, rss] 7tags: [lua, rss]
diff --git a/content/notes/plan9-screenshot.md b/content/notes/plan9-screenshot.md
index fe21ee4..c8a8f23 100644
--- a/content/notes/plan9-screenshot.md
+++ b/content/notes/plan9-screenshot.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Take a screenshot in Plan9 2title: Take a screenshot in Plan9
3url: plan9-screenshot.html 3url: plan9-screenshot.html
4date: 2023-05-10 4date: 2023-05-10T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, screenshot] 7tags: [plan9, screenshot]
diff --git a/content/notes/preview-troff-man-pages.md b/content/notes/preview-troff-man-pages.md
index acda0d6..ad94256 100644
--- a/content/notes/preview-troff-man-pages.md
+++ b/content/notes/preview-troff-man-pages.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Previews how man page written in Troff will look like 2title: Previews how man page written in Troff will look like
3url: preview-troff-man-pages.html 3url: preview-troff-man-pages.html
4date: 2023-05-15 4date: 2023-05-15T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [troff, man] 7tags: [troff, man]
diff --git a/content/notes/run-9front-in-qemu.md b/content/notes/run-9front-in-qemu.md
index 0001162..3bf2ff5 100644
--- a/content/notes/run-9front-in-qemu.md
+++ b/content/notes/run-9front-in-qemu.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Run 9front in Qemu 2title: Run 9front in Qemu
3url: run-9front-in-qemu.html 3url: run-9front-in-qemu.html
4date: 2023-05-05 4date: 2023-05-05T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [plan9, qemu] 7tags: [plan9, qemu]
diff --git a/content/notes/show-xterm-colors.md b/content/notes/show-xterm-colors.md
index fc7280b..008966b 100644
--- a/content/notes/show-xterm-colors.md
+++ b/content/notes/show-xterm-colors.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Display xterm color palette 2title: Display xterm color palette
3url: write-iso-usb.html 3url: write-iso-usb.html
4date: 2023-05-25 4date: 2023-05-25T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [linux, xterm, palette] 7tags: [linux, xterm, palette]
diff --git a/content/notes/something.md b/content/notes/something.md
new file mode 100644
index 0000000..435ea8c
--- /dev/null
+++ b/content/notes/something.md
@@ -0,0 +1,11 @@
1---
2title: "Something"
3url: something.html
4date: 2023-05-26T00:37:57+02:00
5type: notes
6draft: true
7tags: []
8---
9
10Start here ...
11
diff --git a/content/notes/tmux-sane-defaults.md b/content/notes/tmux-sane-defaults.md
index f23e19d..bd76d28 100644
--- a/content/notes/tmux-sane-defaults.md
+++ b/content/notes/tmux-sane-defaults.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Sane defaults for tmux with more visible statusbar 2title: Sane defaults for tmux with more visible statusbar
3url: tmux-sane-defaults.html 3url: tmux-sane-defaults.html
4date: 2023-05-25 4date: 2023-05-25T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [tmux] 7tags: [tmux]
diff --git a/content/notes/write-iso-usb.md b/content/notes/write-iso-usb.md
index 860e6a7..9e379fd 100644
--- a/content/notes/write-iso-usb.md
+++ b/content/notes/write-iso-usb.md
@@ -1,7 +1,7 @@
1--- 1---
2title: Write ISO to USB Key 2title: Write ISO to USB Key
3url: write-iso-usb.html 3url: write-iso-usb.html
4date: 2023-05-08 4date: 2023-05-08T12:00:00+02:00
5type: notes 5type: notes
6draft: false 6draft: false
7tags: [linux, iso, usb] 7tags: [linux, iso, usb]
@@ -12,3 +12,6 @@ Write ISO to USB key. Nothing fancy here.
12```sh 12```sh
13sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync 13sudo dd if=iso_file.iso of=/dev/sdX bs=4M status=progress conv=fdatasync
14``` 14```
15
16
17
diff --git a/content/pages/books.md b/content/pages/books.md
index 473efab..9f58ec5 100644
--- a/content/pages/books.md
+++ b/content/pages/books.md
@@ -1,6 +1,6 @@
1--- 1---
2title: Books I've read so far 2title: Books I've read so far
3date: 2022-08-27 3date: 2022-08-27T12:00:00+02:00
4url: books.html 4url: books.html
5draft: false 5draft: false
6--- 6---
diff --git a/content/pages/curriculum-vitae.md b/content/pages/curriculum-vitae.md
index 762234e..4fee27c 100644
--- a/content/pages/curriculum-vitae.md
+++ b/content/pages/curriculum-vitae.md
@@ -1,6 +1,6 @@
1--- 1---
2title: Curriculum Vitae 2title: Curriculum Vitae
3date: 2022-08-27 3date: 2022-08-27T12:00:00+02:00
4url: curriculum-vitae.html 4url: curriculum-vitae.html
5draft: false 5draft: false
6--- 6---
diff --git a/content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md b/content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md
index fdd0075..bdf965a 100644
--- a/content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md
+++ b/content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md
@@ -1,19 +1,35 @@
1--- 1---
2title: Most likely to succeed in the year of 2011 2title: Most likely to succeed in the year of 2011
3url: most-likely-to-succeed-in-year-of-2011.html 3url: most-likely-to-succeed-in-year-of-2011.html
4date: 2011-01-13 4date: 2011-01-13T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8The year of 2010 was definitely the year of Geo-location. The market responded beautifully and lots of very cool services were launched. We all have to thank the mobile market for such extensive adoption. With new generations of mobile phones that are not only buffed with high-tech hardware but are also affordable. We can now manage tasks that were not so long time ago, almost Star Trek’ish. And all this had and has great influence on the destination to which we are going now. 8The year of 2010 was definitely the year of Geo-location. The market responded
9beautifully and lots of very cool services were launched. We all have to thank
10the mobile market for such extensive adoption. With new generations of mobile
11phones that are not only buffed with high-tech hardware but are also affordable.
12We can now manage tasks that were not so long time ago, almost Star Trek’ish.
13And all this had and has great influence on the destination to which we are
14going now.
9 15
10Reading all this articles about new innovation about new thriving technologies makes me wonder what’s the next step. The future is the mesh, like Lisa Gansky said in her book The Mesh. 16Reading all this articles about new innovation about new thriving technologies
17makes me wonder what’s the next step. The future is the mesh, like Lisa Gansky
18said in her book The Mesh.
11 19
12Many still have conservative views on distributed systems. The problems with security of information. Fear of not controlling every aspect of information flow. I am very opened to distributed systems and heterogeneous applications, and I think this is the correct and best way to proceed. 20Many still have conservative views on distributed systems. The problems with
21security of information. Fear of not controlling every aspect of information
22flow. I am very opened to distributed systems and heterogeneous applications,
23and I think this is the correct and best way to proceed.
13 24
14This year will definitely be about communication platforms. Mobile to mobile. Machine to mobile and vice versa. All the tech is available and ready to put into action. Wireless is today’s new mantra. And the concept of semantic web is now ready for industry. 25This year will definitely be about communication platforms. Mobile to mobile.
26Machine to mobile and vice versa. All the tech is available and ready to put
27into action. Wireless is today’s new mantra. And the concept of semantic web
28is now ready for industry.
15 29
16Applications and developers now can gain access to new layers of systems and can prepare and build solutions to meet the high quality needs of market. The speed is everything now. 30Applications and developers now can gain access to new layers of systems and
31can prepare and build solutions to meet the high quality needs of market. The
32speed is everything now.
17 33
18My vote goes to “Machine to Machine” and “Embedded Systems”! 34My vote goes to “Machine to Machine” and “Embedded Systems”!
19 35
@@ -22,3 +38,4 @@ My vote goes to “Machine to Machine” and “Embedded Systems”!
22- [COOS Project (connectivity initiative)](http://www.coosproject.org/maven-site/1.0.0/project-info.html) 38- [COOS Project (connectivity initiative)](http://www.coosproject.org/maven-site/1.0.0/project-info.html)
23- [Community for machine-to-machine](http://m2m.com/index.jspa) 39- [Community for machine-to-machine](http://m2m.com/index.jspa)
24- [Embedded system](http://en.wikipedia.org/wiki/Embedded_system) 40- [Embedded system](http://en.wikipedia.org/wiki/Embedded_system)
41
diff --git a/content/posts/2012-03-09-led-technology-not-so-eco.md b/content/posts/2012-03-09-led-technology-not-so-eco.md
index 514b1c3..6e5aab9 100644
--- a/content/posts/2012-03-09-led-technology-not-so-eco.md
+++ b/content/posts/2012-03-09-led-technology-not-so-eco.md
@@ -1,20 +1,32 @@
1--- 1---
2title: LED technology might not be as eco-friendly as you think 2title: LED technology might not be as eco-friendly as you think
3url: led-technology-not-so-eco.html 3url: led-technology-not-so-eco.html
4date: 2012-03-09 4date: 2012-03-09T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8There is a lot of talk about LED technology. It is beginning to infiltrate industry at a fast rate, and it’s a challenge for designers and also engineers. I wondered when a weakness will be revealed. Then I stomped on an article talking about harm in using LED technology. It looks like this magical technology is not so magical and eco-friendly. 8There is a lot of talk about LED technology. It is beginning to infiltrate
9industry at a fast rate, and it’s a challenge for designers and also engineers.
10I wondered when a weakness will be revealed. Then I stomped on an article
11talking about harm in using LED technology. It looks like this magical
12technology is not so magical and eco-friendly.
9 13
10A new study from the University of California indicates that LED lights contain toxic metals, and should be produced, used and disposed of carefully. Besides the lead and nickel, the bulbs and their associated parts were also found to contain arsenic, copper, and other metals that have been linked to different cancers, neurological damage, kidney disease, hypertension, skin rashes and other illnesses in humans, and to ecological damage in waterways. 14A new study from the University of California indicates that LED lights
15contain toxic metals, and should be produced, used and disposed of carefully.
16Besides the lead and nickel, the bulbs and their associated parts were also
17found to contain arsenic, copper, and other metals that have been linked to
18different cancers, neurological damage, kidney disease, hypertension, skin
19rashes and other illnesses in humans, and to ecological damage in waterways.
11 20
12Since then, I haven’t yet found any regulation for disposal of LED lights or any other regulation or standard. This might be a problem in the future. And it is a massive drawback. This might have quite an impact on consumer market. 21Since then, I haven’t yet found any regulation for disposal of LED lights or
13 22any other regulation or standard. This might be a problem in the future. And
14Nevertheless, there is a potential, and I am sure the market will adapt. I also hope I will be reading documents regarding solution for this concern soon. 23it is a massive drawback. This might have quite an impact on consumer market.
15 24
25Nevertheless, there is a potential, and I am sure the market will adapt. I
26also hope I will be reading documents regarding solution for this concern soon.
16 27
17**Additional resources:** 28**Additional resources:**
18 29
19- [Recycling and Disposal of Light Bulbs](http://ezinearticles.com/?Recycling-and-Disposal-of-Light-Bulbs&id=1091304) 30- [Recycling and Disposal of Light Bulbs](http://ezinearticles.com/?Recycling-and-Disposal-of-Light-Bulbs&id=1091304)
20- [How to Dispose of a Low-Energy Light Bulb](http://www.ehow.com/how_7483442_dispose-lowenergy-light-bulb.html) 31- [How to Dispose of a Low-Energy Light Bulb](http://www.ehow.com/how_7483442_dispose-lowenergy-light-bulb.html)
32
diff --git a/content/posts/2013-10-24-wireless-sensor-networks.md b/content/posts/2013-10-24-wireless-sensor-networks.md
index e8948fb..dabdebc 100644
--- a/content/posts/2013-10-24-wireless-sensor-networks.md
+++ b/content/posts/2013-10-24-wireless-sensor-networks.md
@@ -1,25 +1,55 @@
1--- 1---
2title: Wireless sensor networks 2title: Wireless sensor networks
3url: wireless-sensor-networks.html 3url: wireless-sensor-networks.html
4date: 2013-10-24 4date: 2013-10-24T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Zigbee networks have this wonderful capability to self-heal, which means they can reorder connections between them if one of them is inoperable. This works our of the box when you deploy them. But you have to have in mind that achieving this is not as easy as you would think. None of it is plug&play. So to make your life a bit easier, here are some pointers which, I hope, will help you. 8Zigbee networks have this wonderful capability to self-heal, which means they
9can reorder connections between them if one of them is inoperable. This works
10our of the box when you deploy them. But you have to have in mind that
11achieving this is not as easy as you would think. None of it is plug&play.
12So to make your life a bit easier, here are some pointers which, I hope,
13will help you.
9 14
10- Be careful when you are ordering your equipment abroad. There are many rules and regulations you need to comply before you get your Xbee radios. What they do is they wait until you prove that you won’t use the technology for some kind of evil take over control of the world project :). For this, they have EAR (Export Administration Regulations) which basically means “This product may require a license to export from the United States.”. 15- Be careful when you are ordering your equipment abroad. There are many rules
11- I don’t know if this applies for every country, but when we purchased our Xbee radios from Mouser, this was mandatory! What we needed to do was to print out a form and write information about our company and send them a copy via email. With this document, we proved that we are a legitimate company. 16 and regulations you need to comply before you get your Xbee radios. What they
12- When you complete your purchase and send all the documentation, you are not clear yet. Then customs will take it from there :). There will be some additional costs. Before purchasing, make sure you have as much information about costs as possible. Because it can get costly in the end. 17 do is they wait until you prove that you won’t use the technology for some
13- I suggest you use companies from your country. You can seriously cut your costs. Here in Slovenia, the best option so far as I know is Farnell. And based on my personal experience, they rock! All I need to say! 18 kind of evil take over control of the world project :). For this, they have
14- Make plans when ordering larger quantities. Do not, I say, do not make your orders in December! :) Believe me! You will have problems with stock they can provide for you. So, we were forced to buy some things from Mouser, which was extremely painful because of all the regulations you need to obey when importing goods from the USA. 19 EAR (Export Administration Regulations) which basically means “This product
15- Make sure that firmware version on your Xbee radios is exactly the same! Do not get creative!!! I propose using templates. You can get template by exporting settings/profile in X-CTU application. Make sure you have enabled “Upgrade firmware” so you can be sure each radio has the same firmware. 20 may require a license to export from the United States.”.
16- And again: make plans! Plan everything! In months advanced! You will thank me later :) 21- I don’t know if this applies for every country, but when we purchased our
22 Xbee radios from Mouser, this was mandatory! What we needed to do was to
23 print out a form and write information about our company and send them a
24 copy via email. With this document, we proved that we are a legitimate
25 company.
26- When you complete your purchase and send all the documentation, you are not
27 clear yet. Then customs will take it from there :). There will be some
28 additional costs. Before purchasing, make sure you have as much information
29 about costs as possible. Because it can get costly in the end.
30- I suggest you use companies from your country. You can seriously cut your
31 costs. Here in Slovenia, the best option so far as I know is Farnell. And
32 based on my personal experience, they rock! All I need to say!
33- Make plans when ordering larger quantities. Do not, I say, do not make your
34 orders in December! :) Believe me! You will have problems with stock they
35 can provide for you. So, we were forced to buy some things from Mouser,
36 which was extremely painful because of all the regulations you need to obey
37 when importing goods from the USA.
38- Make sure that firmware version on your Xbee radios is exactly the same! Do
39 not get creative!!! I propose using templates. You can get template by
40 exporting settings/profile in X-CTU application. Make sure you have enabled
41 “Upgrade firmware” so you can be sure each radio has the same firmware.
42- And again: make plans! Plan everything! In months advanced! You will thank
43 me later :)
17- Test, test, test. Wireless networks can be tricky. 44- Test, test, test. Wireless networks can be tricky.
18 45
19If you are serious, I suggest you buy this book, Building Wireless Sensor Networks. You will get a glimpse of how networks work in lumens terms. It is a good starting point for everybody who wants to build wireless networks. 46If you are serious, I suggest you buy this book, Building Wireless Sensor
47Networks. You will get a glimpse of how networks work in lumens terms. It is
48a good starting point for everybody who wants to build wireless networks.
20 49
21**Additional resources:** 50**Additional resources:**
22 51
23- http://www.digi.com/aboutus/export/generalexportinfo 52- http://www.digi.com/aboutus/export/generalexportinfo
24- http://doresearch.stanford.edu/research-scholarship/export-controls/export-controlled-or-embargoed-countries-entities-and-persons 53- http://doresearch.stanford.edu/research-scholarship/export-controls/export-controlled-or-embargoed-countries-entities-and-persons
25- http://www.bis.doc.gov/licensing/exportingbasics.htm 54- http://www.bis.doc.gov/licensing/exportingbasics.htm
55
diff --git a/content/posts/2015-11-10-software-development-pitfalls.md b/content/posts/2015-11-10-software-development-pitfalls.md
index ec7fcb8..57e9736 100644
--- a/content/posts/2015-11-10-software-development-pitfalls.md
+++ b/content/posts/2015-11-10-software-development-pitfalls.md
@@ -1,72 +1,182 @@
1--- 1---
2title: Software development and my favorite pitfalls 2title: Software development and my favorite pitfalls
3url: software-development-pitfalls.html 3url: software-development-pitfalls.html
4date: 2015-11-10 4date: 2015-11-10T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Over the years I had the privilege to work on some very excited projects both in software development field and also in electronics field and every experience taught me some invaluable lessons about how NOT TO approach development. And through this post I will try to point out some absurd, outdated techniques I find the most annoying and damaging during a development cycle. There will be swearing because this topic really gets on my nerves and I never coherently tried to explain them in writing. So if I get heated up, please bear with me. 8Over the years I had the privilege to work on some very excited projects both
9 9in software development field and also in electronics field and every experience
10As new methods of project management are emerging, underlying processes still stay old and outdated. This is mainly because we as people are unable to completely shift away from these approaches. 10taught me some invaluable lessons about how NOT TO approach development. And
11 11through this post I will try to point out some absurd, outdated techniques I
12I was always struggling with communication, and many times that cost me a relationship or two because I was not on the ball all the time. Through every experience, I became more convinced that I am the problem and never ever doubted that the problem may be that communication never evolved a single step from emails. And if you think for a second, not many things have changed around this topic. We just have different representations of email (message boards, chats, project management tools). And I believe this is the real issue we are facing now. 12find the most annoying and damaging during a development cycle. There will be
13 13swearing because this topic really gets on my nerves and I never coherently
14There are many articles written about hyper connectivity and the effects that are a direct result of it. But mainstream does nothing towards it. We are just putting out fires, and we do nothing to prevent it. I am certain this will be a major source of grief in coming years. And what we all can do to avoid this is to change our mindset and experiment on our communication skills, development approaches. We need to maximize possible output that a person can give. And to achieve this we need to listen to them, encourage them. I know that not everybody is a naturally born leader, but with enough practice and encouragement they also can become active participants in leadership. 14tried to explain them in writing. So if I get heated up, please bear with me.
15 15
16There are many talks now about methodologies such as Scrum, Kanban, Cleanroom and they all fucking piss me of :). These are all boxes that imprison people and take away their freedom of thought. This is a straightforward mindfuck / amputation of creativity. 16As new methods of project management are emerging, underlying processes still
17 17stay old and outdated. This is mainly because we as people are unable to
18Let me list a couple of things that I find really destructive and bad for a project and in a long run company. 18completely shift away from these approaches.
19
20I was always struggling with communication, and many times that cost me a
21relationship or two because I was not on the ball all the time. Through every
22experience, I became more convinced that I am the problem and never ever
23doubted that the problem may be that communication never evolved a single step
24from emails. And if you think for a second, not many things have changed around
25this topic. We just have different representations of email (message boards,
26chats, project management tools). And I believe this is the real issue we are
27facing now.
28
29There are many articles written about hyper connectivity and the effects that
30are a direct result of it. But mainstream does nothing towards it. We are just
31putting out fires, and we do nothing to prevent it. I am certain this will be
32a major source of grief in coming years. And what we all can do to avoid this
33is to change our mindset and experiment on our communication skills,
34development approaches. We need to maximize possible output that a person can
35give. And to achieve this we need to listen to them, encourage them. I know
36that not everybody is a naturally born leader, but with enough practice and
37encouragement they also can become active participants in leadership.
38
39There are many talks now about methodologies such as Scrum, Kanban, Cleanroom
40and they all fucking piss me of :). These are all boxes that imprison people
41and take away their freedom of thought. This is a straightforward
42mindfuck / amputation of creativity.
43
44Let me list a couple of things that I find really destructive and bad for a
45project and in a long run company.
19 46
20## Ping emails 47## Ping emails
21 48
22Ping emails are emails you have to write as soon as you receive an email. Its sole purpose is to inform the sender that you received their email, and you are working on it. Its result is only to calm down the sender that their task is being dealt with. It’s intent basically is, I did my job by sending you this email, so I am on clear grounds. I categorize this email as fuck you email. This is one of the most irritating types of emails I need to write. This is the ultimate control freak show you can experience, and it gives the sender a false feeling of control. Newsflash: We do not live in 1982 where there was a possibility that email never reached the destination. I really hate this from the bottom of my heart. 49Ping emails are emails you have to write as soon as you receive an email. Its
23 50sole purpose is to inform the sender that you received their email, and you
24They should be like: “Yes, I am fucking alive, and I am at your service my leash!”. I guess if I would reply like this, I wouldn’t have to write any more of this kind of messages. 51are working on it. Its result is only to calm down the sender that their task
52is being dealt with. It’s intent basically is, I did my job by sending you
53this email, so I am on clear grounds. I categorize this email as fuck you email.
54This is one of the most irritating types of emails I need to write. This is
55the ultimate control freak show you can experience, and it gives the sender a
56false feeling of control. Newsflash: We do not live in 1982 where there was a
57possibility that email never reached the destination. I really hate this from
58the bottom of my heart.
59
60They should be like: “Yes, I am fucking alive, and I am at your service my
61leash!”. I guess if I would reply like this, I wouldn’t have to write any
62more of this kind of messages.
25 63
26## Everybody is a project manager 64## Everybody is a project manager
27 65
28Well, this is a tough one. I noticed that as soon as you let people to give their suggestions, you are basically screwed. There is a truth in the saying: “Give low expectations and deliver little more than you promised.”. 66Well, this is a tough one. I noticed that as soon as you let people to give
67their suggestions, you are basically screwed. There is a truth in the saying:
68“Give low expectations and deliver little more than you promised.”.
29 69
30People tend to take a role of a manager as soon as they are presented with an opportunity. And by getting angry at them, you only provoke yourself. They are not at fault. You just need to tell them they are only giving suggestions and not tasks at the beginning and everything will be alright. But if you give them a feeling that they are in control, you will have immense problems explaining why their features are not in current release. 70People tend to take a role of a manager as soon as they are presented with an
71opportunity. And by getting angry at them, you only provoke yourself. They are
72not at fault. You just need to tell them they are only giving suggestions and
73not tasks at the beginning and everything will be alright. But if you give
74them a feeling that they are in control, you will have immense problems
75explaining why their features are not in current release.
31 76
32Project mission must be always leading project requirements and any deviation from it will result in major project butchering. And by this, I mean that the project will get its own path, and you will be left with half done software that helps nobody. Clear mission goals and clean execution will allow you to develop software will clear intent. 77Project mission must be always leading project requirements and any deviation
78from it will result in major project butchering. And by this, I mean that the
79project will get its own path, and you will be left with half done software
80that helps nobody. Clear mission goals and clean execution will allow you to
81develop software will clear intent.
33 82
34## We are never wrong 83## We are never wrong
35 84
36I find this type of arrogance the worst. We must always conduct ourselves that we are infallible and cannot make mistakes. As soon as a procedure or process is established, there is no room for changes or improvements. This is the most idiotic thing someone can say of think. I think that processes need to involve and change over time. This is imperative and need to have in your organization if you want to improve and develop company. We all need to grow balls and change everything in order to adapt to current situations. Being a prisoner of predefined processes kills creativity. 85I find this type of arrogance the worst. We must always conduct ourselves that
37 86we are infallible and cannot make mistakes. As soon as a procedure or process
38I am constantly trying new software for project managing and communication. I believe every team has its own dynamic, and it needs to be discovered organically and naturally through many experiments. By putting the team in a box, you are amputating their creativity and therefore minimizing their potential. But if you talk to an executive, you will mainly find archetypical thinking and a strong need to compartmentalize everything from business processes to resource management. And this type of management that often displays micromanagement techniques only works for short periods (couple of years) and then employees either leave the company or become basically retarded drones on autopilot. 87is established, there is no room for changes or improvements. This is the most
88idiotic thing someone can say of think. I think that processes need to involve
89and change over time. This is imperative and need to have in your organization
90if you want to improve and develop company. We all need to grow balls and change
91everything in order to adapt to current situations. Being a prisoner of
92predefined processes kills creativity.
93
94I am constantly trying new software for project managing and communication.
95I believe every team has its own dynamic, and it needs to be discovered
96organically and naturally through many experiments. By putting the team in a
97box, you are amputating their creativity and therefore minimizing their
98potential. But if you talk to an executive, you will mainly find archetypical
99thinking and a strong need to compartmentalize everything from business
100processes to resource management. And this type of management that often
101displays micromanagement techniques only works for short periods (couple of
102years) and then employees either leave the company or become basically retarded
103drones on autopilot.
39 104
40## Micromanaging 105## Micromanaging
41 106
42This basically implies that everybody on the team is an idiot who needs to have a to-do list that they cannot write themselves. How about spoon-feeding the team at launch because besides the team leader, everybody must be a retarded idiot at best? 107This basically implies that everybody on the team is an idiot who needs to
108have a to-do list that they cannot write themselves. How about spoon-feeding
109the team at launch because besides the team leader, everybody must be a
110retarded idiot at best?
43 111
44I prefer milestones as they give developers much more freedom and creativity in developing and not waste their time checking some bizarre to-do list that was not even thought through. Projects constantly change throughout the development cycle, and all you are left at the end is a list of unchecked tasks and the wrath of management why they are not completed. Best WTF moment! 112I prefer milestones as they give developers much more freedom and creativity
113in developing and not waste their time checking some bizarre to-do list that
114was not even thought through. Projects constantly change throughout the
115development cycle, and all you are left at the end is a list of unchecked tasks
116and the wrath of management why they are not completed. Best WTF moment!
45 117
46## Human contact — no need for it! 118## Human contact — no need for it!
47 119
48We are vigorously trying to eliminate physical contact by replacing short meetings with software, with no regards that we are not machines. Many times a simple 5-min meeting at morning can solve most of the problems. In rapid development, short bursts of man to man communication is possibly the best way to go. 120We are vigorously trying to eliminate physical contact by replacing short
121meetings with software, with no regards that we are not machines. Many times
122a simple 5-min meeting at morning can solve most of the problems. In rapid
123development, short bursts of man to man communication is possibly the best
124way to go.
49 125
50We now have all this software available, and all what we get out of it is a giant clusterfuck. An obstacle and not a solution. So, why we still use them? 126We now have all this software available, and all what we get out of it is a
127giant clusterfuck. An obstacle and not a solution. So, why we still use them?
51 128
52## MVP is killing innovation 129## MVP is killing innovation
53 130
54Many will disagree with me on this one, but I stand strong by this statement. What I noticed in my experience that all this buzz words around us only mislead and capture us in a circle of solving issues that already have a solution, but we are unable to see it without using some fancy word for it. 131Many will disagree with me on this one, but I stand strong by this statement.
132What I noticed in my experience that all this buzz words around us only
133mislead and capture us in a circle of solving issues that already have a
134solution, but we are unable to see it without using some fancy word for it.
55 135
56The toughest thing to do for a developer is to minimize requirements. Well, this is though only for bad developers. Yes, I said it. There are many types of developers out there. And those unable to minimize feature scope are the ones you don’t need on your team. Their only goal is to solve problems that exist only in their heads. And then you have to argue with them, and waste energy on them, instead of developing your awesome product. They are a cancer and I suggest you cut them off. 136The toughest thing to do for a developer is to minimize requirements. Well,
137this is though only for bad developers. Yes, I said it. There are many types
138of developers out there. And those unable to minimize feature scope are the
139ones you don’t need on your team. Their only goal is to solve problems that
140exist only in their heads. And then you have to argue with them, and waste
141energy on them, instead of developing your awesome product. They are a cancer
142and I suggest you cut them off.
57 143
58MVP as an idea is great, but sadly people don’t understand underlying philosophy, and they spent too much time focusing and fixating on something that every sane person with normal IQ will understand without some made up acronym. And the result is a lot of talking and barely no execution. 144MVP as an idea is great, but sadly people don’t understand underlying
145philosophy, and they spent too much time focusing and fixating on something
146that every sane person with normal IQ will understand without some made up
147acronym. And the result is a lot of talking and barely no execution.
59 148
60Well, MVP is not directly killing innovation, but stupid people do when they try to understand it. 149Well, MVP is not directly killing innovation, but stupid people do when they
150try to understand it.
61 151
62## Pressure wasteland 152## Pressure wasteland
63 153
64You must never allow to be pressured into confirming a deadline if you are not confident. We often feel a need that we are in service of others, which is true to some extent. But it is also true that others are in service to us to some extent. And we forget this all the time. We are all pressured all the time to make decisions just to calm other people down. And when they leave your office you experience WTF moment :) How the hell did they manage to fuck me up again? 154You must never allow to be pressured into confirming a deadline if you are not
65 155confident. We often feel a need that we are in service of others, which is
66People need to realize that the more pressure you put on somebody, the less they will be able to do. So 5-min update email requests will only resolve in mental breakdown and inability to work that day. Constant poking is probably the only thing I lose my mind instantly. For all you that are doing this: “Stop bothering us with your insecurities and let us do our job. We will do it quicker and better without you breathing down our necks.” 156true to some extent. But it is also true that others are in service to us to
67 157some extent. And we forget this all the time. We are all pressured all the
68If this happens to me, I end up with no energy at the end. Don’t you get it? You will get much more from and out of me if you ask me like a human person and not your personal butler. On a long run, you are destroying your relationships and nobody would want to work with you. Your schizophrenic approach will damage only you in a long run. Nobody is anybody’s property. 158time to make decisions just to calm other people down. And when they leave
159your office you experience WTF moment :) How the hell did they manage to
160fuck me up again?
161
162People need to realize that the more pressure you put on somebody, the less
163they will be able to do. So 5-min update email requests will only resolve in
164mental breakdown and inability to work that day. Constant poking is probably
165the only thing I lose my mind instantly. For all you that are doing this:
166“Stop bothering us with your insecurities and let us do our job. We will do
167it quicker and better without you breathing down our necks.”
168
169If this happens to me, I end up with no energy at the end. Don’t you get it?
170You will get much more from and out of me if you ask me like a human person
171and not your personal butler. On a long run, you are destroying your
172relationships and nobody would want to work with you. Your schizophrenic
173approach will damage only you in a long run. Nobody is anybody’s property.
69 174
70## Conclusion 175## Conclusion
71 176
72I am guilty of many things described in this post. And I find it hard sometimes to acknowledge this. And I lie to myself and try vigorously to find some explanation why I do these things. There is always space for growth. And maybe you will also find some of yourself in this post and realize what needs to change for you to evolve. 177I am guilty of many things described in this post. And I find it hard sometimes
178to acknowledge this. And I lie to myself and try vigorously to find some
179explanation why I do these things. There is always space for growth. And
180maybe you will also find some of yourself in this post and realize what needs
181to change for you to evolve.
182
diff --git a/content/posts/2017-03-07-golang-profiling-simplified.md b/content/posts/2017-03-07-golang-profiling-simplified.md
index 92ff881..7eee2dd 100644
--- a/content/posts/2017-03-07-golang-profiling-simplified.md
+++ b/content/posts/2017-03-07-golang-profiling-simplified.md
@@ -1,27 +1,40 @@
1--- 1---
2title: Golang profiling simplified 2title: Golang profiling simplified
3url: golang-profiling-simplified.html 3url: golang-profiling-simplified.html
4date: 2017-03-07 4date: 2017-03-07T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Many posts have been written regarding profiling in Golang and I haven’t found proper tutorial regarding this. Almost all of them are missing some part of important information and it gets pretty frustrating when you have a deadline and are not finding simple distilled solution. 8Many posts have been written regarding profiling in Golang and I haven’t found
9proper tutorial regarding this. Almost all of them are missing some part of
10important information and it gets pretty frustrating when you have a deadline
11and are not finding simple distilled solution.
9 12
10Nevertheless, after searching and experimenting I have found a solution that works for me and probably should also for you. 13Nevertheless, after searching and experimenting I have found a solution that
14works for me and probably should also for you.
11 15
12## Where are my pprof files? 16## Where are my pprof files?
13 17
14By default pprof files are generated in /tmp/ folder. You can override folder where this files are generated programmatically in your golang code as we will see below in example. 18By default pprof files are generated in /tmp/ folder. You can override folder
19where this files are generated programmatically in your golang code as we will
20see below in example.
15 21
16## Why is my CPU profile empty? 22## Why is my CPU profile empty?
17 23
18I have found out that sometimes CPU profile is empty because program was not executing long enough. Programs, that execute too quickly don’t produce pprof file in my cases. Well, file is generated but only contains 4KB of information. 24I have found out that sometimes CPU profile is empty because program was not
25executing long enough. Programs, that execute too quickly don’t produce pprof
26file in my cases. Well, file is generated but only contains 4KB of information.
19 27
20## Profiling 28## Profiling
21 29
22As you can see from examples we are executing dummy_benchmark functions to ensure some sort of execution. Memory profiling can be done without such a “complex” function. But CPU profiling needs it. 30As you can see from examples we are executing dummy_benchmark functions to
31ensure some sort of execution. Memory profiling can be done without such a
32“complex” function. But CPU profiling needs it.
23 33
24Both memory and CPU profiling examples are almost the same. Only parameters in main function when calling profile.Start are different. When we set profile.ProfilePath(“.”) we tell profiler to store pprof files in the same folder as our program. 34Both memory and CPU profiling examples are almost the same. Only parameters
35in main function when calling profile.Start are different. When we set
36profile.ProfilePath(“.”) we tell profiler to store pprof files in the same
37folder as our program.
25 38
26### Memory profiling 39### Memory profiling
27 40
@@ -109,3 +122,4 @@ This will generate PDF document with visualized profile.
109 122
110- [Memory PDF profile example](/assets/go-profiling/golang-profiling-mem.pdf) 123- [Memory PDF profile example](/assets/go-profiling/golang-profiling-mem.pdf)
111- [CPU PDF profile example](/assets/go-profiling/golang-profiling-cpu.pdf) 124- [CPU PDF profile example](/assets/go-profiling/golang-profiling-cpu.pdf)
125
diff --git a/content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md b/content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md
index 6fca4ce..1b9be06 100644
--- a/content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md
+++ b/content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md
@@ -1,11 +1,14 @@
1--- 1---
2title: What I've learned developing ad server 2title: What I've learned developing ad server
3url: what-i-ve-learned-developing-ad-server.html 3url: what-i-ve-learned-developing-ad-server.html
4date: 2017-04-17 4date: 2017-04-17T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8For the past year and half I have been developing native advertising server that contextually matches ads and displays them in different template forms on variety of websites. This project grew from serving thousands of ads per day to millions. 8For the past year and half I have been developing native advertising server
9that contextually matches ads and displays them in different template forms
10on variety of websites. This project grew from serving thousands of ads per
11day to millions.
9 12
10The system is made from couple of core components: 13The system is made from couple of core components:
11 14
@@ -13,29 +16,56 @@ The system is made from couple of core components:
13- Utils - cronjobs and queue management tools, 16- Utils - cronjobs and queue management tools,
14- Dashboard UI. 17- Dashboard UI.
15 18
16Initial release was using [MongoDB](https://www.mongodb.com/) for full-text search but was later replaced by [Elasticsearch](https://www.elastic.co/) for better CPU utilization and better search performance. This provided us with many amazing functionalities of [Elasticsearch](https://www.elastic.co/). You should check it out if you do any search related operations. 19Initial release was using [MongoDB](https://www.mongodb.com/) for full-text
20search but was later replaced by [Elasticsearch](https://www.elastic.co/)
21for better CPU utilization and better search performance. This provided us
22with many amazing functionalities of [Elasticsearch](https://www.elastic.co/).
23You should check it out if you do any search related operations.
17 24
18Because the premise of the server is to provide native ad experience, they are rendered on the client side via simple templating engine. This ensures that ads can be displayed number of different ways based on the visual style of the page. And this makes JavaScript client library quite complex. 25Because the premise of the server is to provide native ad experience, they
26are rendered on the client side via simple templating engine. This ensures
27that ads can be displayed number of different ways based on the visual style
28of the page. And this makes JavaScript client library quite complex.
19 29
20So now that you know basic information about the product lets get into the lessons we learned. 30So now that you know basic information about the product lets get into the
31lessons we learned.
21 32
22## Aggregate everything 33## Aggregate everything
23 34
24After beta version was released everything (impressions, clicks, etc) was written in nanosecond resolution in the database. At that time we were using [PostgreSQL](https://www.postgresql.org/) and database quickly grew way above 200GB in disk space. And that was problematic. Statistics took disturbingly long time to aggregate. Also using indexes on stats table in database was no help after we reached 500 million datapoints. 35After beta version was released everything (impressions, clicks, etc) was
36written in nanosecond resolution in the database. At that time we were using
37[PostgreSQL](https://www.postgresql.org/) and database quickly grew way above
38200GB in disk space. And that was problematic. Statistics took disturbingly
39long time to aggregate. Also using indexes on stats table in database was no
40help after we reached 500 million datapoints.
25 41
26> There is a marketing product information and there is real life experience. And the tend to be quite the opposite. 42> There is a marketing product information and there is real life experience.
43And the tend to be quite the opposite.
27 44
28This was the reason that now everything is aggregated on daily basis and this data is then fed to Elastic in form of daily summary. With this we achieved we can now track many more dimensions such as zone, channel and platform information. And with this information we can now adapt occurrences of ads on specific places more precisely. 45This was the reason that now everything is aggregated on daily basis and this
46data is then fed to Elastic in form of daily summary. With this we achieved we
47can now track many more dimensions such as zone, channel and platform information.
48And with this information we can now adapt occurrences of ads on specific
49places more precisely.
29 50
30We have also adapted [Redis](https://redis.io/) as a full-time citizen in our stack. Because Redis also stores information on a local disk we have some sort of backup if server would accidentally suffer some failure. 51We have also adapted [Redis](https://redis.io/) as a full-time citizen in our
52stack. Because Redis also stores information on a local disk we have some sort
53of backup if server would accidentally suffer some failure.
31 54
32All the real-time statistics for ad serving and redirecting is presented as counters in Redis instance and daily extracted and pushed to Elastic. 55All the real-time statistics for ad serving and redirecting is presented as
56counters in Redis instance and daily extracted and pushed to Elastic.
33 57
34## Measure everything 58## Measure everything
35 59
36The thing about software is that we really don't know how well it is performing under load until such load is presented. When testing locally everything is fine but when on production things tend to fall apart. 60The thing about software is that we really don't know how well it is performing
61under load until such load is presented. When testing locally everything is
62fine but when on production things tend to fall apart.
37 63
38As a solution for this we are measuring everything we can. Function execution time (by encapsulating functions with timers), server performance (cpu, memory, disk, etc), Nginx and [uWSGI](https://uwsgi-docs.readthedocs.io/) performance. We sacrifice a bit of performance for the sake of this information. And we store all this information for later analysis. 64As a solution for this we are measuring everything we can. Function execution
65time (by encapsulating functions with timers), server performance (cpu, memory,
66disk, etc), Nginx and [uWSGI](https://uwsgi-docs.readthedocs.io/) performance.
67We sacrifice a bit of performance for the sake of this information. And we
68store all this information for later analysis.
39 69
40**Example of function execution time** 70**Example of function execution time**
41 71
@@ -69,17 +99,28 @@ As a solution for this we are measuring everything we can. Function execution ti
69} 99}
70``` 100```
71 101
72We have also started profiling with [cProfile](https://pymotw.com/2/profile/) and then visualizing with [KCachegrind](http://kcachegrind.sourceforge.net/). This provides much more detailed look into code execution. 102We have also started profiling with [cProfile](https://pymotw.com/2/profile/)
103and then visualizing with [KCachegrind](http://kcachegrind.sourceforge.net/).
104This provides much more detailed look into code execution.
73 105
74## Cache control is your friend 106## Cache control is your friend
75 107
76Because we use Javascript library for rendering ads we rely on this script extensively and when in need we need to be able to change behavior of the script quickly. 108Because we use Javascript library for rendering ads we rely on this script
109extensively and when in need we need to be able to change behavior of the
110script quickly.
77 111
78In our case we can not simply replace javascript url in html code. It usually takes a day or two for the guys who maintain sites to change code or add ?ver=xxx attribute. And this makes rapid deployment and testing very difficult and time consuming. There is a limitation of how much you can test locally. 112In our case we can not simply replace javascript url in html code. It usually
113takes a day or two for the guys who maintain sites to change code or add
114?ver=xxx attribute. And this makes rapid deployment and testing very difficult
115and time consuming. There is a limitation of how much you can test locally.
79 116
80We are now in the process of integrating [Google Tag Manager](https://www.google.com/analytics/tag-manager/) but couple of websites are developed on ASP.net platform that have some problems with tag manager. With a solution below we are certain that we are serving latest version of the script. 117We are now in the process of integrating [Google Tag Manager](https://www.google.com/analytics/tag-manager/)
118but couple of websites are developed on ASP.net platform that have some
119problems with tag manager. With a solution below we are certain that we are
120serving latest version of the script.
81 121
82And it only takes one mistake and users have the script cached and in case of caching it for 1 year you probably know where the problem is. 122And it only takes one mistake and users have the script cached and in case of
123caching it for 1 year you probably know where the problem is.
83 124
84```nginx 125```nginx
85# nginx ➜ /etc/nginx/sites-available/default 126# nginx ➜ /etc/nginx/sites-available/default
@@ -102,7 +143,10 @@ location /static/ {
102} 143}
103``` 144```
104 145
105Also be careful when redirecting to url in your python code. We noticed that if we didn't precisely setup cache control and expire headers in response we didn't get the request on the server and therefore couldn't measure clicks. So when redirecting do as follows and there will be no problems. 146Also be careful when redirecting to url in your python code. We noticed that
147if we didn't precisely setup cache control and expire headers in response we
148didn't get the request on the server and therefore couldn't measure clicks.
149So when redirecting do as follows and there will be no problems.
106 150
107```python 151```python
108# python ➜ bottlepy web micro-framework 152# python ➜ bottlepy web micro-framework
@@ -113,22 +157,42 @@ response.set_header("Location", url)
113return response 157return response
114``` 158```
115 159
116> Cache control in browsers is quite aggressive and you need to be precise to avoid future problems. We learned that lesson the hard way. 160> Cache control in browsers is quite aggressive and you need to be precise
161to avoid future problems. We learned that lesson the hard way.
117 162
118## Learn NGINX 163## Learn NGINX
119 164
120When deciding on a web server we went with Nginx as a reverse proxy for our applications. We adapted micro-service oriented architecture early in the project to ensure when we scale we can easily add additional servers to our cluster. And Nginx was crucial to perform load balancing and static content delivery. 165When deciding on a web server we went with Nginx as a reverse proxy for our
166applications. We adapted micro-service oriented architecture early in the
167project to ensure when we scale we can easily add additional servers to our
168cluster. And Nginx was crucial to perform load balancing and static content
169delivery.
121 170
122At first our config file was quite simple and later grew larger. After patching and adding new settings I sat down and learned more about the guts of Nginx. This proved to be very useful and we were able to squeeze much more out of our setup. So I advise you to take your time and read through the [documentation](https://nginx.org/en/docs/). This saved us a lot of headache. Googling for solutions only goes so far. 171At first our config file was quite simple and later grew larger. After patching
172and adding new settings I sat down and learned more about the guts of Nginx.
173This proved to be very useful and we were able to squeeze much more out of our
174setup. So I advise you to take your time and read through the
175[documentation](https://nginx.org/en/docs/). This saved us a lot of headache.
176Googling for solutions only goes so far.
123 177
124## Use Redis/Memcached 178## Use Redis/Memcached
125 179
126As explained above we are using caching basically for everything. It is the corner stone of our services. At first we were very careful about the quantity of things we stored in [Redis](https://redis.io/). But we later found out that the memory footprint is very low even when storing large amount of data in it. 180As explained above we are using caching basically for everything. It is the
181corner stone of our services. At first we were very careful about the quantity
182of things we stored in [Redis](https://redis.io/). But we later found out that
183the memory footprint is very low even when storing large amount of data in it.
127 184
128So we gradually increased our usage to caching whole HTML outputs of dashboard. This improved our performance in order of magnitude. And by using native TTL support this goes hand in hand with our needs. 185So we gradually increased our usage to caching whole HTML outputs of dashboard.
186This improved our performance in order of magnitude. And by using native TTL
187support this goes hand in hand with our needs.
129 188
130The reason why we choose [Redis](https://redis.io/) over [Memcached](https://memcached.org/) was the nature of scalability of Redis out of the box. But all this can be achieved with Memcached. 189The reason why we choose [Redis](https://redis.io/) over [Memcached](https://memcached.org/)
190was the nature of scalability of Redis out of the box. But all this can be
191achieved with Memcached.
131 192
132## Conclusion 193## Conclusion
133 194
134There are a lot more details that could have been written and every single topic in here deserves it's own post but you probably got the idea about the problems we faced. 195There are a lot more details that could have been written and every single
196topic in here deserves it's own post but you probably got the idea about
197the problems we faced.
198
diff --git a/content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md b/content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md
index 466d838..911e6e0 100644
--- a/content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md
+++ b/content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md
@@ -1,11 +1,14 @@
1--- 1---
2title: Profiling Python web applications with visual tools 2title: Profiling Python web applications with visual tools
3url: profiling-python-web-applications-with-visual-tools.html 3url: profiling-python-web-applications-with-visual-tools.html
4date: 2017-04-21 4date: 2017-04-21T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I have been profiling my software with KCachegrind for a long time now and I was missing this option when I am developing API's or other web services. I always knew that this is possible but never really took the time and dive into it. 8I have been profiling my software with KCachegrind for a long time now and I
9was missing this option when I am developing API's or other web services. I
10always knew that this is possible but never really took the time and dive
11into it.
9 12
10Before we begin there are some requirements. We will need to: 13Before we begin there are some requirements. We will need to:
11 14
@@ -25,7 +28,8 @@ We will be dividing this post into two main categories:
25 28
26## Simple web-service 29## Simple web-service
27 30
28Let's use virtualenv so we won't pollute our base system. If you don't have virtualenv installed on your system you can install it with pip command. 31Let's use virtualenv so we won't pollute our base system. If you don't have
32virtualenv installed on your system you can install it with pip command.
29 33
30```bash 34```bash
31# let's install virtualenv globally 35# let's install virtualenv globally
@@ -69,7 +73,8 @@ $ pip install bottle
69$ deactivate 73$ deactivate
70``` 74```
71 75
72We are now ready to write simple web service. Let's create file app.py and paste code bellow in this newly created file. 76We are now ready to write simple web service. Let's create file app.py and
77paste code bellow in this newly created file.
73 78
74```python 79```python
75# -*- coding: utf-8 -*- 80# -*- coding: utf-8 -*-
@@ -121,7 +126,8 @@ if __name__ == '__main__':
121# open browser 'http://0.0.0.0:4000' 126# open browser 'http://0.0.0.0:4000'
122``` 127```
123 128
124When browser hits awesome\_random\_number() function profile is created in prof/ subfolder. 129When browser hits awesome\_random\_number() function profile is created in
130prof/ subfolder.
125 131
126## Visualize profile 132## Visualize profile
127 133
@@ -133,17 +139,27 @@ $ pyprof2calltree -i awesome_random_number.prof
133# this creates 'awesome_random_number.prof.log' file in the same folder 139# this creates 'awesome_random_number.prof.log' file in the same folder
134``` 140```
135 141
136This file can be opened with visualizing tools listed above. In this case we will be using Profilling Viewer under MacOS. You can open image in new tab. As you can see from this example there is hierarchy of execution order of your code. 142This file can be opened with visualizing tools listed above. In this case we
143will be using Profilling Viewer under MacOS. You can open image in new tab.
144As you can see from this example there is hierarchy of execution order of
145your code.
137 146
138![Profilling Viewer](/assets/python-profiling/profiling-viewer.png) 147![Profilling Viewer](/assets/python-profiling/profiling-viewer.png)
139 148
140> Make sure you convert output of the cProfile output every time you want to refresh and take a look at your possible optimizations because cProfile updates .prof file every time browser hits the function. 149> Make sure you convert output of the cProfile output every time you want to
150refresh and take a look at your possible optimizations because cProfile
151updates .prof file every time browser hits the function.
141 152
142This is just a simple example but when you are developing real-life applications this can be very illuminating, especially to see which parts of your code are bottlenecks and need to be optimized. 153This is just a simple example but when you are developing real-life applications
154this can be very illuminating, especially to see which parts of your code are
155bottlenecks and need to be optimized.
143 156
144## Update 2017-04-22 157## Update 2017-04-22
145 158
146Reddit user [mvt](https://www.reddit.com/user/mvt) also recommended this awesome web based profile visualizer [SnakeViz](https://jiffyclub.github.io/snakeviz/) that directly takes output from [cProfile](https://docs.python.org/2/library/profile.html#module-cProfile) module. 159Reddit user [mvt](https://www.reddit.com/user/mvt) also recommended this
160awesome web based profile visualizer [SnakeViz](https://jiffyclub.github.io/snakeviz/)
161that directly takes output from [cProfile](https://docs.python.org/2/library/profile.html#module-cProfile)
162module.
147 163
148<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="583880c1-002e-41ed-a373-020a0ef2cff9" data-embed-created="2017-04-22T19:46:54.810Z"><a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/dgljhsb/">Comment</a> from discussion <a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/">Profiling Python web applications with visual tools</a>.</div><script async src="https://www.redditstatic.com/comment-embed.js"></script> 164<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="583880c1-002e-41ed-a373-020a0ef2cff9" data-embed-created="2017-04-22T19:46:54.810Z"><a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/dgljhsb/">Comment</a> from discussion <a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/">Profiling Python web applications with visual tools</a>.</div><script async src="https://www.redditstatic.com/comment-embed.js"></script>
149 165
@@ -160,7 +176,8 @@ $ snakeviz awesome_random_number.prof
160 176
161![SnakeViz](/assets/python-profiling/snakeviz.png) 177![SnakeViz](/assets/python-profiling/snakeviz.png)
162 178
163Reddit user [ccharles](https://www.reddit.com/user/ccharles) suggested a better way for installing pip software by targeting user level instead of using sudo. 179Reddit user [ccharles](https://www.reddit.com/user/ccharles) suggested a better
180way for installing pip software by targeting user level instead of using sudo.
164 181
165<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="f4f0459e-684d-441e-bebe-eb49b2f0a31d" data-embed-created="2017-04-22T19:46:10.874Z"><a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/dglpzkx/">Comment</a> from discussion <a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/">Profiling Python web applications with visual tools</a>.</div><script async src="https://www.redditstatic.com/comment-embed.js"></script> 182<div class="reddit-embed" data-embed-media="www.redditmedia.com" data-embed-parent="false" data-embed-live="false" data-embed-uuid="f4f0459e-684d-441e-bebe-eb49b2f0a31d" data-embed-created="2017-04-22T19:46:10.874Z"><a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/dglpzkx/">Comment</a> from discussion <a href="https://www.reddit.com/r/Python/comments/66v373/profiling_python_web_applications_with_visual/">Profiling Python web applications with visual tools</a>.</div><script async src="https://www.redditstatic.com/comment-embed.js"></script>
166 183
@@ -182,4 +199,6 @@ $ echo $PATH
182$ pip install snakeviz --user 199$ pip install snakeviz --user
183``` 200```
184 201
185Or as suggested by [mvt](https://www.reddit.com/user/mvt) you can use [pipsi](https://github.com/mitsuhiko/pipsi). 202Or as suggested by [mvt](https://www.reddit.com/user/mvt) you can
203use [pipsi](https://github.com/mitsuhiko/pipsi).
204
diff --git a/content/posts/2017-08-11-simple-iot-application.md b/content/posts/2017-08-11-simple-iot-application.md
index b34fe6b..a0ac4be 100644
--- a/content/posts/2017-08-11-simple-iot-application.md
+++ b/content/posts/2017-08-11-simple-iot-application.md
@@ -1,21 +1,40 @@
1--- 1---
2title: Simple IOT application supported by real-time monitoring and data history 2title: Simple IOT application supported by real-time monitoring and data history
3url: simple-iot-application.html 3url: simple-iot-application.html
4date: 2017-08-11 4date: 2017-08-11T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Initial thoughts 8## Initial thoughts
9 9
10I have been developing these kind of application for the better part of my last 5 years and people keep asking me how to approach developing such application and I will give a try explaining it here. 10I have been developing these kind of application for the better part of my last
11 115 years and people keep asking me how to approach developing such application
12IOT applications are really no different than any other kind of applications. We have data that needs to be collected and visualized in some form of tables or charts. The main difference here is that most of the times these data is collected by some kind of device foreign to developer that mainly operates in web domain. But fear not, it's not that different than writing some JavaScript. 12and I will give a try explaining it here.
13 13
14There are many devices able to transmit data via wireless or wired network by default but for the sake of example we will be using commonly known Arduino with wireless module already on the board → [Arduino MKR1000](https://store.arduino.cc/arduino-mkr1000). 14IOT applications are really no different than any other kind of applications.
15 15We have data that needs to be collected and visualized in some form of tables
16In order to make this little project as accessible to others as possible I will try to make it as inexpensive as possible. And by this I mean that I will avoid using hosted virtual servers and will be using my own laptop as a server. But you must buy Arduino MKR1000 to follow steps below. But if you would want to deploy this software I would suggest using [DigitalOcean](https://www.digitalocean.com) → smallest VPS is only per month making this one of the most affordable option out there. Please notice that this software will not run on stock web hosting that only supports LAMP (Linux, Apache, MySQL, and PHP). 16or charts. The main difference here is that most of the times these data is
17 17collected by some kind of device foreign to developer that mainly operates in
18_But before we begin please take notice that this is strictly experimental code and not well optimized and there are much better ways in handling some aspects of the application but that requires much deeper knowledge of technology that is not needed for an example like this._ 18web domain. But fear not, it's not that different than writing some JavaScript.
19
20There are many devices able to transmit data via wireless or wired network by
21default but for the sake of example we will be using commonly known Arduino
22with wireless module already on the board → [Arduino MKR1000](https://store.arduino.cc/arduino-mkr1000).
23
24In order to make this little project as accessible to others as possible I will
25try to make it as inexpensive as possible. And by this I mean that I will avoid
26using hosted virtual servers and will be using my own laptop as a server. But
27you must buy Arduino MKR1000 to follow steps below. But if you would want to
28deploy this software I would suggest using
29[DigitalOcean](https://www.digitalocean.com) → smallest VPS is only per month
30making this one of the most affordable option out there. Please notice that
31this software will not run on stock web hosting that only supports LAMP
32(Linux, Apache, MySQL, and PHP).
33
34But before we begin please take notice that this is strictly experimental code
35and not well optimized and there are much better ways in handling some aspects
36of the application but that requires much deeper knowledge of technology that
37is not needed for an example like this.
19 38
20**Development steps** 39**Development steps**
21 40
@@ -23,23 +42,33 @@ _But before we begin please take notice that this is strictly experimental code
232. Prototype C++ code that will read "sensor data" and transmit it to API. 422. Prototype C++ code that will read "sensor data" and transmit it to API.
243. Data visualization with charts → extends Python web application. 433. Data visualization with charts → extends Python web application.
25 44
26Step 1. and 3. will share the same web application. One route will be dedicated to API and another to serving HTML with chart. 45Step 1. and 3. will share the same web application. One route will be dedicated
46to API and another to serving HTML with chart.
27 47
28Schema below represents what we will try to achieve and how different parts correlates to each other. 48Schema below represents what we will try to achieve and how different parts
49correlates to each other.
29 50
30![Overview](/assets/iot-application/simple-iot-application-overview.svg) 51![Overview](/assets/iot-application/simple-iot-application-overview.svg)
31 52
32## Simple Python API 53## Simple Python API
33 54
34I have always been a fan of simplicity so we will be using [Bottle: Python Web Framework](https://bottlepy.org/docs/dev/). It is a single file web framework that seriously simplifies working with routes, templating and has built-in web server that satisfies our need in this case. 55I have always been a fan of simplicity so we will be using [Bottle: Python Web Framework](https://bottlepy.org/docs/dev/).
56It is a single file web framework that seriously simplifies working with routes,
57templating and has built-in web server that satisfies our need in this case.
35 58
36First we need to install bottle package. This can be done by downloading ```bottle.py``` and placing it in the root of your application or by using pip software ```pip install bottle --user```. 59First we need to install bottle package. This can be done by downloading
60```bottle.py``` and placing it in the root of your application or by using
61pip software ```pip install bottle --user```.
37 62
38If you are using Linux or MacOS then Python is already installed. If you will try to test this on Windows please install [Python for Windows](https://www.python.org/downloads/windows/). There may be some problems with path when you will try to launch ```python webapp.py``` so please take care of this before you continue. 63If you are using Linux or MacOS then Python is already installed. If you will
64try to test this on Windows please install [Python for Windows](https://www.python.org/downloads/windows/).
65There may be some problems with path when you will try to launch
66```python webapp.py``` so please take care of this before you continue.
39 67
40### Basic web application 68### Basic web application
41 69
42Most basic bottle application is quite simple. Paste code below in ```webapp.py``` file and save. 70Most basic bottle application is quite simple. Paste code below in
71```webapp.py``` file and save.
43 72
44```python 73```python
45# -*- coding: utf-8 -*- 74# -*- coding: utf-8 -*-
@@ -67,29 +96,60 @@ if __name__ == "__main__":
67 ) 96 )
68``` 97```
69 98
70To run this simple application you should open command prompt or terminal on your machine and go to the folder containing your file and type ```python webapp.py```. If everything goes ok then open your web browser and point it to ```http://0.0.0.0:5000```. 99To run this simple application you should open command prompt or terminal on
100your machine and go to the folder containing your file and type
101```python webapp.py```. If everything goes ok then open your web browser and
102point it to ```http://0.0.0.0:5000```.
71 103
72If you would like change the port of your application (like port 80) and not use root to run your app this will present a problem. The TCP/IP port numbers below 1024 are privileged ports → this is a security feature. So in order of simplicity and security use a port number above 1024 like I have used port 5000. 104If you would like change the port of your application (like port 80) and not
105use root to run your app this will present a problem. The TCP/IP port numbers
106below 1024 are privileged ports → this is a security feature. So in order of
107simplicity and security use a port number above 1024 like I have used port
1085000.
73 109
74If this fails at any time please fix it before you continue, because nothing below will work otherwise. 110If this fails at any time please fix it before you continue, because nothing
111below will work otherwise.
75 112
76We use 0.0.0.0 as default host so that this app is available over your local network. If you find your local ip ```ifconfig``` and try accessing this site with your phone (if on same network/router as your machine) this should work as well (example of such ip ```http://192.168.1.15:5000```). This is a must have because Arduino will be accessing this application to send it's data. 113We use 0.0.0.0 as default host so that this app is available over your local
114network. If you find your local ip ```ifconfig``` and try accessing this site
115with your phone (if on same network/router as your machine) this should work
116as well (example of such ip ```http://192.168.1.15:5000```). This is a must
117have because Arduino will be accessing this application to send it's data.
77 118
78### Web application security 119### Web application security
79 120
80There is a lot to be said about security and is a topic of many books. Of course all this can not be written here but to just establish some basic security → you should always use SSL with your application. Some fantastic free certificates are available by [Let's Encrypt - Free SSL/TLS Certificates](https://letsencrypt.org). With SSL certificate installed you should then make use of HTTP headers and send your "API key" via a header. If your key is send via header then this key is encrypted by SSL and send encrypted over the network. Never send your api keys by GET parameter like ```http://example.com/?api_key=somekeyvalue```. The problem that this kind of sending presents is that this key is visible in logs and by network sniffers. 121There is a lot to be said about security and is a topic of many books. Of course
122all this can not be written here but to just establish some basic
123security → you should always use SSL with your application. Some fantastic free
124certificates are available by [Let's Encrypt - Free SSL/TLS Certificates](https://letsencrypt.org).
125With SSL certificate installed you should then make use of HTTP headers and
126send your "API key" via a header. If your key is send via header then this
127key is encrypted by SSL and send encrypted over the network. Never send your
128api keys by GET parameter like ```http://example.com/?api_key=somekeyvalue```.
129The problem that this kind of sending presents is that this key is visible in
130logs and by network sniffers.
81 131
82There is a fantastic article describing some aspects about security: [11 Web Application Security Best Practices](https://www.keycdn.com/blog/web-application-security-best-practices/). Please check it out. 132There is a fantastic article describing some aspects about security: [11 Web Application Security Best Practices](https://www.keycdn.com/blog/web-application-security-best-practices/). Please check it out.
83 133
84### Simple API for writing data-points 134### Simple API for writing data-points
85 135
86We will now be using boilerplate code from example above and extend it to be able to write data received by API to local storage. For example use I will use SQLite3 because it plays well with Python and can store quite large amount of data. I have been using it to collect gigabytes of data in a single database without any corruption or problems → your experience may vary. 136We will now be using boilerplate code from example above and extend it to be
137able to write data received by API to local storage. For example use I will
138use SQLite3 because it plays well with Python and can store quite large amount
139of data. I have been using it to collect gigabytes of data in a single database
140without any corruption or problems → your experience may vary.
87 141
88To avoid learning SQLite I will be using [Dataset: databases for lazy people](https://dataset.readthedocs.io/en/latest/index.html). This package abstracts SQL and simplifies writing and reading data from database. You should install this package with pip software ```pip install dataset --user```. 142To avoid learning SQLite I will be using [Dataset: databases for lazy people](https://dataset.readthedocs.io/en/latest/index.html).
143This package abstracts SQL and simplifies writing and reading data from
144database. You should install this package with pip software
145```pip install dataset --user```.
89 146
90Because API will use POST method I will be testing if code works correctly by using [Restlet Client for Google Chrome](https://chrome.google.com/webstore/detail/restlet-client-rest-api-t/aejoelaoggembcahagimdiliamlcdmfm). This software also allows you to set headers → for basic security with API_KEY. 147Because API will use POST method I will be testing if code works correctly by
148using [Restlet Client for Google Chrome](https://chrome.google.com/webstore/detail/restlet-client-rest-api-t/aejoelaoggembcahagimdiliamlcdmfm).
149This software also allows you to set headers → for basic security with API_KEY.
91 150
92To quickly generate passwords or API keys I usually use this nifty website [RandomKeygen](https://randomkeygen.com/). 151To quickly generate passwords or API keys I usually use this nifty website
152[RandomKeygen](https://randomkeygen.com/).
93 153
94Copy and paste code below over your previous code in file ```webapp.py```. 154Copy and paste code below over your previous code in file ```webapp.py```.
95 155
@@ -144,31 +204,53 @@ if __name__ == "__main__":
144 ) 204 )
145``` 205```
146 206
147To run this simply go to folder containing python file and run ```python webapp.py``` from terminal. If everything goes ok you should have simple API available via POST method on /api route. 207To run this simply go to folder containing python file and run
208```python webapp.py``` from terminal. If everything goes ok you should have
209simple API available via POST method on /api route.
148 210
149After testing the service with Restlet Client you should be able to view your data in a database file ```data.db```. 211After testing the service with Restlet Client you should be able to view
212your data in a database file ```data.db```.
150 213
151![REST settings example](/assets/iot-application/iot-rest-example.png) 214![REST settings example](/assets/iot-application/iot-rest-example.png)
152 215
153You can also check the contents of new database file by using desktop client for SQLite → [DB Browser for SQLite](http://sqlitebrowser.org/). 216You can also check the contents of new database file by using desktop client
217for SQLite → [DB Browser for SQLite](http://sqlitebrowser.org/).
154 218
155![SQLite database example](/assets/iot-application/iot-sqlite-db.png) 219![SQLite database example](/assets/iot-application/iot-sqlite-db.png)
156 220
157Table structure is as simple as it can be. We have ts (timestamp) and value (value from Arduino). As you can see timestamp is generated on API side. If you would happen to have atomic clock on Arduino it would be then better to generate and send timestamp with the value. This would be particularity useful if we would be collecting sensor data at a higher frequency and then sending this data in bulk to API. 221Table structure is as simple as it can be. We have ts (timestamp) and
222value (value from Arduino). As you can see timestamp is generated on API
223side. If you would happen to have atomic clock on Arduino it would be then
224better to generate and send timestamp with the value. This would be
225particularity useful if we would be collecting sensor data at a higher
226frequency and then sending this data in bulk to API.
158 227
159If you will deploy this app with uWSGI and multi-threaded, use DSN (Data Source Name) url with ```?check_same_thread=False```. 228If you will deploy this app with uWSGI and multi-threaded, use
229DSN (Data Source Name) url with ```?check_same_thread=False```.
160 230
161Ok, now that we have some sort of a working API with some basic security so unwanted people can not post data to your database can we proceed further and try to program Arduino to send data to API. 231Ok, now that we have some sort of a working API with some basic security
232so unwanted people can not post data to your database can we proceed further
233and try to program Arduino to send data to API.
162 234
163## Sending data to API with Arduino MKR1000 235## Sending data to API with Arduino MKR1000
164 236
165First of all you should have MKR1000 module and microUSB cable to proceed. If you have ever done any work with Arduino you should know that you also need [Arduino IDE](https://www.arduino.cc/en/Main/Software). On provided link you should be able to download and install IDE. Once that task is completed and you have successfully run blink example you should proceed to the next step. 237First of all you should have MKR1000 module and microUSB cable to proceed.
238If you have ever done any work with Arduino you should know that you also
239need [Arduino IDE](https://www.arduino.cc/en/Main/Software). On provided link
240you should be able to download and install IDE. Once that task is completed
241and you have successfully run blink example you should proceed to the next step.
166 242
167In order to use wireless capabilities of MKR1000 you need to first install [WiFi101 library](https://www.arduino.cc/en/Reference/WiFi101) in Arduino IDE. Please check before you install, you may already have it installed. 243In order to use wireless capabilities of MKR1000 you need to first install
244[WiFi101 library](https://www.arduino.cc/en/Reference/WiFi101) in Arduino IDE.
245Please check before you install, you may already have it installed.
168 246
169Code below is a working example that sends data to API. Before you try to test your code make sure you have run Python web application. Then change settings for wifi, api endpoint and api_key. If by some reason code bellow doesn't work for you please leave a comment and I'll try to help. 247Code below is a working example that sends data to API. Before you try to test
248your code make sure you have run Python web application. Then change settings
249for wifi, api endpoint and api_key. If by some reason code bellow doesn't work
250for you please leave a comment and I'll try to help.
170 251
171Once you have opened IDE and copied this code try to compile and upload it. Then open "Serial monitor" to see if any output is presented by Arduino. 252Once you have opened IDE and copied this code try to compile and upload it.
253Then open "Serial monitor" to see if any output is presented by Arduino.
172 254
173```c 255```c
174#include <WiFi101.h> 256#include <WiFi101.h>
@@ -225,7 +307,6 @@ void setup() {
225} 307}
226 308
227void loop() { 309void loop() {
228
229 WiFiClient client; 310 WiFiClient client;
230 311
231 if (client.connect(server, port)) { 312 if (client.connect(server, port)) {
@@ -251,32 +332,54 @@ void loop() {
251 332
252 // waits for x seconds and continue looping 333 // waits for x seconds and continue looping
253 delay(timeout); 334 delay(timeout);
254
255} 335}
256``` 336```
257 337
258As seen from example you can notice that Arduino is generating random integer between [ 0 .. 1000 ]. You can easily replace this with a temperature sensor or any other kind of sensor. 338As seen from example you can notice that Arduino is generating random integer
339between [ 0 .. 1000 ]. You can easily replace this with a temperature sensor
340or any other kind of sensor.
259 341
260Now that we have API under the hood and Arduino is sending demo data we can now focus on data visualization. 342Now that we have API under the hood and Arduino is sending demo data we can
343now focus on data visualization.
261 344
262## Data visualization 345## Data visualization
263 346
264Before we continue we should examine our project folder structure. Currently we only have two files in our project: 347Before we continue we should examine our project folder structure. Currently
348we only have two files in our project:
265 349
266_simple-iot-app/_ 350_simple-iot-app/_
267 351
268* _webapp.py_ 352* _webapp.py_
269* _data.db_ 353* _data.db_
270 354
271We will now add HTML template that will contain CSS and JavaScript code inline for the simplicity reason. And for the bottle framework to be able to scan root application folder for templates we will add ```bottle.TEMPLATE_PATH.insert(0, "./")``` in ```webapp.py```. By default bottle framework uses ```views/``` subfolder to store templates. This is not the ideal situation and if you will use bottle to develop web applications you should use native behavior and store templates in it's predefined folder. But for the sake of example we will over-ride this. Be careful to fully replace your code with new code that is provided below. Avoid partially replacing code in file :) Also new code for reading data-points is provided in Python example below. 355We will now add HTML template that will contain CSS and JavaScript code inline
272 356for the simplicity reason. And for the bottle framework to be able to scan root
273First we add new route to our web application. It should be trigger when browser hits root of application ```http://0.0.0.0:5000/```. This route will do nothing more than render ```frontend.html``` template. This is done by ```return bottle.template("frontend.html")```. Check code below to further examine how exactly this is done. 357application folder for templates we will add
274 358```bottle.TEMPLATE_PATH.insert(0, "./")``` in ```webapp.py```. By default bottle
275Now we will expand ```/api``` route and use different methods to write or read data-points. For writing data-point we will use POST method and for reading points we will use GET method. GET method will return JSON object with latest readings and historical data. 359framework uses ```views/``` subfolder to store templates. This is not the ideal
276 360situation and if you will use bottle to develop web applications you should use
277There is a fantastic JavaScript library for plotting time-series charts called [MetricsGraphics.js](https://www.metricsgraphicsjs.org) that is based on [D3.js](https://d3js.org/) library for visualizing data. 361native behavior and store templates in it's predefined folder. But for the sake
278 362of example we will over-ride this. Be careful to fully replace your code with
279Data schema required by MetricsGraphics.js → to achieve this we need to transform data from database into this format: 363new code that is provided below. Avoid partially replacing code in file :) Also
364new code for reading data-points is provided in Python example below.
365
366First we add new route to our web application. It should be trigger when browser
367hits root of application ```http://0.0.0.0:5000/```. This route will do nothing
368more than render ```frontend.html``` template. This is done by
369```return bottle.template("frontend.html")```. Check code below to further
370examine how exactly this is done.
371
372Now we will expand ```/api``` route and use different methods to write or
373read data-points. For writing data-point we will use POST method and for
374reading points we will use GET method. GET method will return JSON object
375with latest readings and historical data.
376
377There is a fantastic JavaScript library for plotting time-series charts
378called [MetricsGraphics.js](https://www.metricsgraphicsjs.org) that is
379based on [D3.js](https://d3js.org/) library for visualizing data.
380
381Data schema required by MetricsGraphics.js → to achieve this we need to
382transform data from database into this format:
280 383
281```json 384```json
282[ 385[
@@ -291,7 +394,9 @@ Data schema required by MetricsGraphics.js → to achieve this we need to transf
291] 394]
292``` 395```
293 396
294Web application is now complete and we only need ```frontend.html``` that we will develop now. If you would try to start web app now and go to root app this will return error because we don't have frontend.html yet. 397Web application is now complete and we only need ```frontend.html``` that we
398will develop now. If you would try to start web app now and go to root app
399this will return error because we don't have frontend.html yet.
295 400
296```python 401```python
297# -*- coding: utf-8 -*- 402# -*- coding: utf-8 -*-
@@ -372,7 +477,9 @@ if __name__ == "__main__":
372 ) 477 )
373``` 478```
374 479
375And now finally we can implement ```frontend.html```. Create file with this name and copy code below. When you are done you can start web application. Steps for this part are listed below the code. 480And now finally we can implement ```frontend.html```. Create file with this
481name and copy code below. When you are done you can start web application.
482Steps for this part are listed below the code.
376 483
377```html 484```html
378<!DOCTYPE html> 485<!DOCTYPE html>
@@ -465,9 +572,11 @@ Ok, lets now start application and start feeding it data.
4652. connect Arduino MKR1000 to power source 5722. connect Arduino MKR1000 to power source
4663. open browser and go to ```http://0.0.0.0:5000``` 5733. open browser and go to ```http://0.0.0.0:5000```
467 574
468If everything goes well you should be seeing new data-points rendered on chart every 5 seconds. 575If everything goes well you should be seeing new data-points rendered on
576chart every 5 seconds.
469 577
470If you navigate to ```http://0.0.0.0:5000``` you should see rendered chart as shown on picture below. 578If you navigate to ```http://0.0.0.0:5000``` you should see rendered chart
579as shown on picture below.
471 580
472![Application output](/assets/iot-application/iot-app-output.png) 581![Application output](/assets/iot-application/iot-app-output.png)
473 582
@@ -475,9 +584,12 @@ Complete application with all the code is available for [download](/assets/iot-a
475 584
476## Conclusion 585## Conclusion
477 586
478I hope this clarifies some aspects of IOT application development. Of course this is a minimal example and is far from what can be done in real life with some further dive into other technologies. 587I hope this clarifies some aspects of IOT application development. Of course
588this is a minimal example and is far from what can be done in real life with
589some further dive into other technologies.
479 590
480If you would like to continue exploring IOT world here are some interesting resources for you to examine: 591If you would like to continue exploring IOT world here are some interesting
592resources for you to examine:
481 593
482* [Reading Sensors with an Arduino](https://www.allaboutcircuits.com/projects/reading-sensors-with-an-arduino/) 594* [Reading Sensors with an Arduino](https://www.allaboutcircuits.com/projects/reading-sensors-with-an-arduino/)
483* [MQTT 101 – How to Get Started with the lightweight IoT Protocol](http://www.hivemq.com/blog/how-to-get-started-with-mqtt) 595* [MQTT 101 – How to Get Started with the lightweight IoT Protocol](http://www.hivemq.com/blog/how-to-get-started-with-mqtt)
@@ -485,3 +597,4 @@ If you would like to continue exploring IOT world here are some interesting reso
485* [Internet of Things (IoT) Tutorials](http://www.tutorialspoint.com/internet_of_things/) 597* [Internet of Things (IoT) Tutorials](http://www.tutorialspoint.com/internet_of_things/)
486 598
487Any comment or additional ideas are welcomed in comments below. 599Any comment or additional ideas are welcomed in comments below.
600
diff --git a/content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md b/content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md
index 75f7799..bfc77ee 100644
--- a/content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md
+++ b/content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md
@@ -1,36 +1,67 @@
1--- 1---
2title: Using DigitalOcean Spaces Object Storage with FUSE 2title: Using DigitalOcean Spaces Object Storage with FUSE
3url: using-digitalocean-spaces-object-storage-with-fuse.html 3url: using-digitalocean-spaces-object-storage-with-fuse.html
4date: 2018-01-16 4date: 2018-01-16T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Couple of months ago [DigitalOcean](https://www.digitalocean.com) introduced new product called [Spaces](https://blog.digitalocean.com/introducing-spaces-object-storage/) which is Object Storage very similar to Amazon's S3. This really peaked my interest, because this was something I was missing and even the thought of going over the internet for such functionality was in no interest to me. Also in fashion with their previous pricing this also is very cheap and pricing page is a no-brainer compared to AWS or GCE. [Prices are clearly and precisely defined and outlined](https://www.digitalocean.com/pricing/). You must love them for that :) 8Couple of months ago [DigitalOcean](https://www.digitalocean.com) introduced
9new product called [Spaces](https://blog.digitalocean.com/introducing-spaces-object-storage/)
10which is Object Storage very similar to Amazon's S3. This really peaked my
11interest, because this was something I was missing and even the thought of
12going over the internet for such functionality was in no interest to me. Also
13in fashion with their previous pricing this also is very cheap and pricing
14page is a no-brainer compared to AWS or GCE. [Prices are clearly and precisely defined and outlined](https://www.digitalocean.com/pricing/).
15You must love them for that :)
9 16
10## Initial requirements 17## Initial requirements
11 18
12* Is it possible to use them as a mounted drive with FUSE? (tl;dr YES) 19* Is it possible to use them as a mounted drive with FUSE? (tl;dr YES)
13* Will the performance degrade over time and over different sizes of objects? (tl;dr NO&YES) 20* Will the performance degrade over time and over different sizes of objects?
14* Can storage be mounted on multiple machines at the same time and be writable? (tl;dr YES) 21 (tl;dr NO&YES)
15 22* Can storage be mounted on multiple machines at the same time and be writable?
16> Let me be clear. This scripts I use are made just for benchmarking and are not intended to be used in real-life situations. Besides that, I am looking into using this approaches but adding caching service in front of it and then dumping everything as an object to storage. This could potentially be some interesting post of itself. But in case you would need real-time data without eventual consistency please take this scripts as they are: not usable in such situations. 23 (tl;dr YES)
24
25> Let me be clear. This scripts I use are made just for benchmarking and are
26> not intended to be used in real-life situations. Besides that, I am looking
27> into using this approaches but adding caching service in front of it and then
28> dumping everything as an object to storage. This could potentially be some
29> interesting post of itself. But in case you would need real-time data without
30> eventual consistency please take this scripts as they are: not usable in such
31> situations.
17 32
18## Is it possible to use them as a mounted drive with FUSE? 33## Is it possible to use them as a mounted drive with FUSE?
19 34
20Well, actually they can be used in such manor. Because they are similar to [AWS S3](https://aws.amazon.com/s3/) many tools are available and you can find many articles and [Stackoverflow items](https://stackoverflow.com/search?q=s3+fuse). 35Well, actually they can be used in such manor. Because they are similar to
36[AWS S3](https://aws.amazon.com/s3/) many tools are available and you can find
37many articles and [Stackoverflow items](https://stackoverflow.com/search?q=s3+fuse).
21 38
22To make this work you will need DigitalOcean account. If you don't have one you will not be able to test this code. But if you have an account then you go and [create new Droplet](https://cloud.digitalocean.com/droplets/new?size=s-1vcpu-1gb&region=ams3&distro=debian&distroImage=debian-9-x64&options=private_networking,install_agent). If you click on this link you will already have preselected Debian 9 with smallest VM option. 39To make this work you will need DigitalOcean account. If you don't have one you
40will not be able to test this code. But if you have an account then you go and
41[create new Droplet](https://cloud.digitalocean.com/droplets/new?size=s-1vcpu-1gb&region=ams3&distro=debian&distroImage=debian-9-x64&options=private_networking,install_agent).
42If you click on this link you will already have preselected Debian 9 with
43smallest VM option.
23 44
24* Please be sure to add you SSH key, because we will login to this machine remotely. 45* Please be sure to add you SSH key, because we will login to this machine
25* If you change your region please remember which one you choose because we will need this information when we try to mount space to our machine. 46 remotely.
47* If you change your region please remember which one you choose because we
48 will need this information when we try to mount space to our machine.
26 49
27Instuctions on how to use SSH keys and how to setup them are available in article [How To Use SSH Keys with DigitalOcean Droplets](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets). 50Instuctions on how to use SSH keys and how to setup them are available in article
51[How To Use SSH Keys with DigitalOcean Droplets](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets).
28 52
29![DigitalOcean Droplets](/assets/do-fuse/fuse-droplets.png) 53![DigitalOcean Droplets](/assets/do-fuse/fuse-droplets.png)
30 54
31After we created Droplet it's time to create new Space. This is done by clicking on a button [Create](https://cloud.digitalocean.com/spaces/new) (right top corner) and selecting Spaces. Choose pronounceable ```Unique name``` because we will use it in examples below. You can either choose Private or Public, it doesn't matter in our case. And you can always change that in the future. 55After we created Droplet it's time to create new Space. This is done by clicking
56on a button [Create](https://cloud.digitalocean.com/spaces/new) (right top
57corner) and selecting Spaces. Choose pronounceable ```Unique name``` because we
58will use it in examples below. You can either choose Private or Public, it
59doesn't matter in our case. And you can always change that in the future.
32 60
33When you have created new Space we should [generate Access key](https://cloud.digitalocean.com/settings/api/tokens). This link will guide to the page when you can generate this key. After you create new one, please save provided Key and Secret because Secret will not be shown again. 61When you have created new Space we should [generate Access key](https://cloud.digitalocean.com/settings/api/tokens).
62This link will guide to the page when you can generate this key. After you
63create new one, please save provided Key and Secret because Secret will not
64be shown again.
34 65
35![DigitalOcean Spaces](/assets/do-fuse/fuse-spaces.png) 66![DigitalOcean Spaces](/assets/do-fuse/fuse-spaces.png)
36 67
@@ -59,9 +90,14 @@ s3fs UNIQUE-NAME /mnt/ -ourl=https://ams3.digitaloceanspaces.com -ouse_cache=/tm
59echo "Hello cruel world" > /mnt/hello.txt 90echo "Hello cruel world" > /mnt/hello.txt
60``` 91```
61 92
62After all this you can return to your browser and go to [DigitalOcean Spaces](https://cloud.digitalocean.com/spaces) and click on your created space. If file hello.txt is present you have successfully mounted space to your machine and wrote data to it. 93After all this you can return to your browser and go to
94[DigitalOcean Spaces](https://cloud.digitalocean.com/spaces) and click on your
95created space. If file hello.txt is present you have successfully mounted
96space to your machine and wrote data to it.
63 97
64I choose the same region for my Droplet and my Space but you don't have to. You can have different regions. What this actually does to performance I don't know. 98I choose the same region for my Droplet and my Space but you don't have to.
99You can have different regions. What this actually does to performance I
100don't know.
65 101
66Additional information on FUSE: 102Additional information on FUSE:
67 103
@@ -70,7 +106,9 @@ Additional information on FUSE:
70 106
71## Will the performance degrade over time and over different sizes of objects? 107## Will the performance degrade over time and over different sizes of objects?
72 108
73For this task I didn't want to just read and write text files or uploading images. I actually wanted to figure out if using something like SQlite is viable in this case. 109For this task I didn't want to just read and write text files or uploading
110images. I actually wanted to figure out if using something like SQlite is
111viable in this case.
74 112
75### Measurement experiment 1: File copy 113### Measurement experiment 1: File copy
76 114
@@ -96,13 +134,17 @@ n=0; while (( n++ < 100 )); do (time cp 1MB.dat /mnt/1MB.$n.dat) |& tee -a 1MB.r
96n=0; while (( n++ < 100 )); do (time cp 10MB.dat /mnt/10MB.$n.dat) |& tee -a 10MB.results.txt; done 134n=0; while (( n++ < 100 )); do (time cp 10MB.dat /mnt/10MB.$n.dat) |& tee -a 10MB.results.txt; done
97``` 135```
98 136
99Files of size 100MB were not successfully transferred and ended up displaying error (cp: failed to close '/mnt/100MB.1.dat': Operation not permitted). 137Files of size 100MB were not successfully transferred and ended up displaying
138error (cp: failed to close '/mnt/100MB.1.dat': Operation not permitted).
100 139
101As I suspected, object size is not really that important. Sadly I don't have the time to test performance over periods of time. But if some of you would do it please send me your data. I would be interested in seeing results. 140As I suspected, object size is not really that important. Sadly I don't have
141the time to test performance over periods of time. But if some of you would do
142it please send me your data. I would be interested in seeing results.
102 143
103**Here are plotted results** 144**Here are plotted results**
104 145
105You can download [raw result here](/assets/do-fuse/copy-benchmarks.tsv). Measurements are in seconds. 146You can download [raw result here](/assets/do-fuse/copy-benchmarks.tsv).
147Measurements are in seconds.
106 148
107<script src="//cdn.plot.ly/plotly-latest.min.js"></script> 149<script src="//cdn.plot.ly/plotly-latest.min.js"></script>
108<div id="copy-benchmarks"></div> 150<div id="copy-benchmarks"></div>
@@ -135,11 +177,18 @@ You can download [raw result here](/assets/do-fuse/copy-benchmarks.tsv). Measure
135})(); 177})();
136</script> 178</script>
137 179
138As far as these tests show, performance is quite stable and can be predicted which is fantastic. But this is a small test and spans only over couple of hours. So you should not completely trust them. 180As far as these tests show, performance is quite stable and can be predicted
181which is fantastic. But this is a small test and spans only over couple of
182hours. So you should not completely trust them.
139 183
140### Measurement experiment 2: SQLite performanse 184### Measurement experiment 2: SQLite performanse
141 185
142I was unable to use database file directly from mounted drive so this is a no-go as I suspected. So I executed code below on a local disk just to get some benchmarks. I inserted 1000 records with DROPTABLE, CREATETABLE, INSERTMANY, FETCHALL, COMMIT for 1000 times to generate statistics. As you can see performance of SQLite is quite amazing. You could then potentially just copy file to mounted drive and be done with it. 186I was unable to use database file directly from mounted drive so this is a
187no-go as I suspected. So I executed code below on a local disk just to get
188some benchmarks. I inserted 1000 records with DROPTABLE, CREATETABLE,
189INSERTMANY, FETCHALL, COMMIT for 1000 times to generate statistics. As you can
190see performance of SQLite is quite amazing. You could then potentially just
191copy file to mounted drive and be done with it.
143 192
144```python 193```python
145import time 194import time
@@ -218,7 +267,11 @@ result_time = CLOSE = end_time - start_time
218print("CLOSE: %g seconds" % (result_time)) 267print("CLOSE: %g seconds" % (result_time))
219``` 268```
220 269
221You can download [raw result here](/assets/do-fuse/sqlite-benchmarks.tsv). And again, these results are done on a local block storage and do not represent capabilities of object storage. With my current approach and state of the test code these can not be done. I would need to make Python code much more robust and check locking etc. 270You can download [raw result here](/assets/do-fuse/sqlite-benchmarks.tsv). And
271again, these results are done on a local block storage and do not represent
272capabilities of object storage. With my current approach and state of the test
273code these can not be done. I would need to make Python code much more robust
274and check locking etc.
222 275
223<div id="sqlite-benchmarks"></div> 276<div id="sqlite-benchmarks"></div>
224<script> 277<script>
@@ -252,10 +305,24 @@ You can download [raw result here](/assets/do-fuse/sqlite-benchmarks.tsv). And a
252 305
253## Can storage be mounted on multiple machines at the same time and be writable? 306## Can storage be mounted on multiple machines at the same time and be writable?
254 307
255Well, this one didn't take long to test. And the answer is **YES**. I mounted space on both machines and measured same performance on both machines. But because file is downloaded before write and then uploaded on complete there could potentially be problems is another process is trying to access the same file. 308Well, this one didn't take long to test. And the answer is **YES**. I mounted
309space on both machines and measured same performance on both machines. But
310because file is downloaded before write and then uploaded on complete there
311could potentially be problems is another process is trying to access the same
312file.
256 313
257## Observations and conslusion 314## Observations and conslusion
258 315
259Using Spaces in this way makes it easier to access and manage files. But besides that you would need to write additional code to make this one play nice with you applications. 316Using Spaces in this way makes it easier to access and manage files. But
317besides that you would need to write additional code to make this one play
318nice with you applications.
319
320Nevertheless, this was extremely simple to setup and use and this is just
321another excellent product in DigitalOcean product line. I found this exercise
322very valuable and am thinking about implementing some sort of mechanism for
323SQLite, so data can be stored on Spaces and accessed by many VM's. For a
324project where data doesn't need to be accessible in real-time and can have
325couple of minutes old data this would be very interesting. If any of you find
326this proposal interesting please write in a comment box below or shoot me an
327email and I will keep you posted.
260 328
261Nevertheless, this was extremely simple to setup and use and this is just another excellent product in DigitalOcean product line. I found this exercise very valuable and am thinking about implementing some sort of mechanism for SQLite, so data can be stored on Spaces and accessed by many VM's. For a project where data doesn't need to be accessible in real-time and can have couple of minutes old data this would be very interesting. If any of you find this proposal interesting please write in a comment box below or shoot me an email and I will keep you posted.
diff --git a/content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md b/content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
index 577e241..a57201f 100644
--- a/content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
+++ b/content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md
@@ -1,47 +1,71 @@
1--- 1---
2title: Encoding binary data into DNA sequence 2title: Encoding binary data into DNA sequence
3url: encoding-binary-data-into-dna-sequence.html 3url: encoding-binary-data-into-dna-sequence.html
4date: 2019-01-03 4date: 2019-01-03T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Initial thoughts 8## Initial thoughts
9 9
10Imagine a world where you could go outside and take a leaf from a tree and put it through your personal DNA sequencer and get data like music, videos or computer programs from it. Well, this is all possible now. It was not done on a large scale because it is quite expensive to create DNA strands but it's possible. 10Imagine a world where you could go outside and take a leaf from a tree and put
11it through your personal DNA sequencer and get data like music, videos or
12computer programs from it. Well, this is all possible now. It was not done
13on a large scale because it is quite expensive to create DNA strands but it's
14possible.
11 15
12Encoding data into DNA sequence is relatively simple process once you understand the relationship between binary data and nucleotides and scientists have been making large leaps in this field in order to provide viable long-term storage solution for our data that would potentially survive our specie if case of global disaster. We could imprint all the world's knowledge into plants and ensure the survival of our knowledge. 16Encoding data into DNA sequence is relatively simple process once you understand
17the relationship between binary data and nucleotides and scientists have been
18making large leaps in this field in order to provide viable long-term storage
19solution for our data that would potentially survive our specie if case of
20global disaster. We could imprint all the world's knowledge into plants and
21ensure the survival of our knowledge.
13 22
14More optimistic usage for this technology would be easier storage of ever growing data we produce every day. Once machines for sequencing DNA become fast enough and cheaper this could mean the next evolution of storing data and abandoning classical hard and solid state drives in data warehouses. 23More optimistic usage for this technology would be easier storage of ever
24growing data we produce every day. Once machines for sequencing DNA become fast
25enough and cheaper this could mean the next evolution of storing data and
26abandoning classical hard and solid state drives in data warehouses.
15 27
16As we currently stand this is still not viable but it is quite an amazing and cool technology. 28As we currently stand this is still not viable but it is quite an amazing and
29cool technology.
17 30
18My interests in this field are purely in encoding processes and experimental testing mainly because I don't have the access to this expensive machines. My initial goal was to create a toolkit that can be used by everybody to encode their data into a proper DNA sequence. 31My interests in this field are purely in encoding processes and experimental
32testing mainly because I don't have the access to this expensive machines. My
33initial goal was to create a toolkit that can be used by everybody to encode
34their data into a proper DNA sequence.
19 35
20## Glossary 36## Glossary
21 37
22**deoxyribose** 38**deoxyribose**
23A five-carbon sugar molecule with a hydrogen atom rather than a hydroxyl group in the 2′ position; the sugar component of DNA nucleotides. 39A five-carbon sugar molecule with a hydrogen atom rather than a hydroxyl group
40in the 2′ position; the sugar component of DNA nucleotides.
24 41
25**double helix** 42**double helix**
26The molecular shape of DNA in which two strands of nucleotides wind around each other in a spiral shape. 43The molecular shape of DNA in which two strands of nucleotides wind around
44each other in a spiral shape.
27 45
28**nitrogenous base** 46**nitrogenous base**
29A nitrogen-containing molecule that acts as a base; often referring to one of the purine or pyrimidine components of nucleic acids. 47A nitrogen-containing molecule that acts as a base; often referring to one of
48the purine or pyrimidine components of nucleic acids.
30 49
31**phosphate group** 50**phosphate group**
32A molecular group consisting of a central phosphorus atom bound to four oxygen atoms. 51A molecular group consisting of a central phosphorus atom bound to four oxygen
52atoms.
33 53
34**RGB** 54**RGB**
35The RGB color model is an additive color model in which red, green and blue light are added together in various ways to reproduce a broad array of colors. 55The RGB color model is an additive color model in which red, green and blue
56light are added together in various ways to reproduce a broad array of colors.
36 57
37**GCC** 58**GCC**
38The GNU Compiler Collection is a compiler system produced by the GNU Project supporting various programming languages. 59The GNU Compiler Collection is a compiler system produced by the GNU Project
60supporting various programming languages.
39 61
40## Data encoding 62## Data encoding
41 63
42**TL;DR:** Encoding involves the use of a code to change original data into a form that can be used by an external process. 64**TL;DR:** Encoding involves the use of a code to change original data into a
65form that can be used by an external process.
43 66
44Encoding is the process of converting data into a format required for a number of information processing needs, including: 67Encoding is the process of converting data into a format required for a number
68of information processing needs, including:
45 69
46- Program compiling and execution 70- Program compiling and execution
47- Data transmission, storage and compression/decompression 71- Data transmission, storage and compression/decompression
@@ -49,7 +73,9 @@ Encoding is the process of converting data into a format required for a number o
49 73
50Encoding can have two meanings: 74Encoding can have two meanings:
51 75
52- In computer technology, encoding is the process of applying a specific code, such as letters, symbols and numbers, to data for conversion into an equivalent cipher. 76- In computer technology, encoding is the process of applying a specific code,
77 such as letters, symbols and numbers, to data for conversion into an
78 equivalent cipher.
53- In electronics, encoding refers to analog to digital conversion. 79- In electronics, encoding refers to analog to digital conversion.
54 80
55## Quick history of DNA 81## Quick history of DNA
@@ -73,13 +99,19 @@ Encoding can have two meanings:
73 99
74## What is DNA? 100## What is DNA?
75 101
76Deoxyribonucleic acid, a self-replicating material which is **present in nearly all living organisms** as the main constituent of chromosomes. It is the **carrier of genetic information**. 102Deoxyribonucleic acid, a self-replicating material which is
103**present in nearly all living organisms** as the main constituent of
104chromosomes. It is the **carrier of genetic information**.
77 105
78> The nitrogen in our DNA, the calcium in our teeth, the iron in our blood, the carbon in our apple pies were made in the interiors of collapsing stars. We are made of starstuff. 106> The nitrogen in our DNA, the calcium in our teeth, the iron in our blood,
79> 107> the carbon in our apple pies were made in the interiors of collapsing stars.
108> We are made of starstuff.
80> **-- Carl Sagan, Cosmos** 109> **-- Carl Sagan, Cosmos**
81 110
82The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases (cytosine (C), thymine (T), adenine (A), guanine (G)), and a phosphate. Cytosine and thymine are pyrimidine bases, while adenine and guanine are purine bases. The sugar and the base together are called a nucleoside. 111The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases
112(cytosine (C), thymine (T), adenine (A), guanine (G)), and a phosphate.
113Cytosine and thymine are pyrimidine bases, while adenine and guanine are purine
114bases. The sugar and the base together are called a nucleoside.
83 115
84![DNA](/assets/dna-sequence/dna-basics.jpg) 116![DNA](/assets/dna-sequence/dna-basics.jpg)
85 117
@@ -88,6 +120,7 @@ The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases (cyto
88## Encode binary data into DNA sequence 120## Encode binary data into DNA sequence
89 121
90As an input file you can use any file you want: 122As an input file you can use any file you want:
123
91- ASCII files, 124- ASCII files,
92- Compiled programs, 125- Compiled programs,
93- Multimedia files (MP3, MP4, MVK, etc), 126- Multimedia files (MP3, MP4, MVK, etc),
@@ -95,15 +128,19 @@ As an input file you can use any file you want:
95- Database files, 128- Database files,
96- etc. 129- etc.
97 130
98Note: If you would copy all the bytes from RAM to file or pipe data to file you could encode also this data as long as you provide file pointer to the encoder. 131Note: If you would copy all the bytes from RAM to file or pipe data to file you
132could encode also this data as long as you provide file pointer to the encoder.
99 133
100### Basic Encoding 134### Basic Encoding
101 135
102As already mentioned, the Basic Encoding is based on a simple mapping. Since DNA is composed of 4 nucleotides (Adenine, Cytosine, Guanine, Thymine; usually referred using the first letter). Using this technique we can encode 136As already mentioned, the Basic Encoding is based on a simple mapping. Since
137DNA is composed of 4 nucleotides (Adenine, Cytosine, Guanine, Thymine; usually
138referred using the first letter). Using this technique we can encode
103 139
104$$ log_2(4) = log_2(2^2) = 2 bits $$ 140$$ log_2(4) = log_2(2^2) = 2 bits $$
105 141
106using a single nucleotide. In this way, we are able to use the 4 bases that compose the DNA strand to encode each byte of data. 142using a single nucleotide. In this way, we are able to use the 4 bases that
143compose the DNA strand to encode each byte of data.
107 144
108| Two bits | Nucleotides | 145| Two bits | Nucleotides |
109| -------- | ---------------- | 146| -------- | ---------------- |
@@ -112,7 +149,8 @@ using a single nucleotide. In this way, we are able to use the 4 bases that comp
112| 01 | **C** (Cytosine) | 149| 01 | **C** (Cytosine) |
113| 11 | **T** (Thymine) | 150| 11 | **T** (Thymine) |
114 151
115With this in mind we can simply encode any data by using two-bit to Nucleotides conversion. 152With this in mind we can simply encode any data by using two-bit to
153Nucleotides conversion.
116 154
117```python 155```python
118{ Algorithm 1: Naive byte array to DNA encode } 156{ Algorithm 1: Naive byte array to DNA encode }
@@ -135,15 +173,29 @@ begin
135end 173end
136``` 174```
137 175
138Another encoding would be **Goldman encoding**. Using this encoding helps with Nonsense mutation (amino acids replaced by a stop codon) that occurs and is the most problematic during translation because it leads to truncated amino acid sequences, which in turn results in truncated proteins. 176Another encoding would be **Goldman encoding**. Using this encoding helps with
177Nonsense mutation (amino acids replaced by a stop codon) that occurs and is
178the most problematic during translation because it leads to truncated amino
179acid sequences, which in turn results in truncated proteins.
139 180
140[Where to store big data? In DNA: Nick Goldman at TEDxPrague](https://www.youtube.com/watch?v=a4PiGWNsIEU) 181[Where to store big data? In DNA: Nick Goldman at TEDxPrague](https://www.youtube.com/watch?v=a4PiGWNsIEU)
141 182
142### FASTA file format 183### FASTA file format
143 184
144In bioinformatics, FASTA format is a text-based format for representing either nucleotide sequences or peptide sequences, in which nucleotides or amino acids are represented using single-letter codes. The format also allows for sequence names and comments to precede the sequences. The format originates from the FASTA software package, but has now become a standard in the field of bioinformatics. 185In bioinformatics, FASTA format is a text-based format for representing either
145 186nucleotide sequences or peptide sequences, in which nucleotides or amino acids
146The first line in a FASTA file started either with a ">" (greater-than) symbol or, less frequently, a ";" (semicolon) was taken as a comment. Subsequent lines starting with a semicolon would be ignored by software. Since the only comment used was the first, it quickly became used to hold a summary description of the sequence, often starting with a unique library accession number, and with time it has become commonplace to always use ">" for the first line and to not use ";" comments (which would otherwise be ignored). 187are represented using single-letter codes. The format also allows for sequence
188names and comments to precede the sequences. The format originates from the
189FASTA software package, but has now become a standard in the field of
190bioinformatics.
191
192The first line in a FASTA file started either with a ">" (greater-than) symbol
193or, less frequently, a ";" (semicolon) was taken as a comment. Subsequent
194lines starting with a semicolon would be ignored by software. Since the only
195comment used was the first, it quickly became used to hold a summary
196description of the sequence, often starting with a unique library accession
197number, and with time it has become commonplace to always use ">" for the first
198line and to not use ";" comments (which would otherwise be ignored).
147 199
148``` 200```
149;LCBO - Prolactin precursor - Bovine 201;LCBO - Prolactin precursor - Bovine
@@ -166,7 +218,8 @@ GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
166IENY 218IENY
167``` 219```
168 220
169FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format) format from the [Sanger Centre](https://www.sanger.ac.uk/) in Cambridge. 221FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format)
222format from the [Sanger Centre](https://www.sanger.ac.uk/) in Cambridge.
170 223
171### PNG encoded DNA sequence 224### PNG encoded DNA sequence
172 225
@@ -177,7 +230,8 @@ FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format)
177| C ➞ Cytosine | (255,0,0) | Red | 230| C ➞ Cytosine | (255,0,0) | Red |
178| T ➞ Thymine | (255,255,0) | Yellow | 231| T ➞ Thymine | (255,255,0) | Yellow |
179 232
180With this in mind we can create a simple algorithm to create PNG representation of a DNA sequence. 233With this in mind we can create a simple algorithm to create PNG representation
234of a DNA sequence.
181 235
182```python 236```python
183{ Algorithm 2: Naive DNA to PNG encode from FASTA file } 237{ Algorithm 2: Naive DNA to PNG encode from FASTA file }
@@ -198,9 +252,11 @@ end
198 252
199## Encoding text file in practice 253## Encoding text file in practice
200 254
201In this example we will take a simple text file as our input stream for encoding. This file will have a quote from Niels Bohr and saved as txt file. 255In this example we will take a simple text file as our input stream for
256encoding. This file will have a quote from Niels Bohr and saved as txt file.
202 257
203> How wonderful that we have met with a paradox. Now we have some hope of making progress. 258> How wonderful that we have met with a paradox. Now we have some hope of
259> making progress.
204> ― Niels Bohr 260> ― Niels Bohr
205 261
206First we encode text file into FASTA file. 262First we encode text file into FASTA file.
@@ -250,7 +306,8 @@ After encoding into PNG format this file looks like this.
250 306
251The larger the input stream is the larger the PNG file would be. 307The larger the input stream is the larger the PNG file would be.
252 308
253Compiled basic Hello World C program with [GCC](https://www.gnu.org/software/gcc/) would [look like](/assets/dna-sequence/sample.png). 309Compiled basic Hello World C program with [GCC](https://www.gnu.org/software/gcc/)
310would [look like](/assets/dna-sequence/sample.png).
254 311
255```c 312```c
256// gcc -O3 -o sample sample.c 313// gcc -O3 -o sample sample.c
@@ -265,10 +322,12 @@ main() {
265## Toolkit for encoding data 322## Toolkit for encoding data
266 323
267I have created a toolkit with two main programs: 324I have created a toolkit with two main programs:
325
268- dnae-encode (encodes file into FASTA file) 326- dnae-encode (encodes file into FASTA file)
269- dnae-png (encodes FASTA file into PNG) 327- dnae-png (encodes FASTA file into PNG)
270 328
271Toolkit with full source code is available on [github.com/mitjafelicijan/dna-encoding](https://github.com/mitjafelicijan/dna-encoding). 329Toolkit with full source code is available on
330[github.com/mitjafelicijan/dna-encoding](https://github.com/mitjafelicijan/dna-encoding).
272 331
273### dnae-encode 332### dnae-encode
274 333
@@ -311,11 +370,13 @@ First we generate some binary sample data with dd.
311dd if=<(openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero) of=1KB.bin bs=1KB count=1 iflag=fullblock 370dd if=<(openssl enc -aes-256-ctr -pass pass:"$(dd if=/dev/urandom bs=128 count=1 2>/dev/null | base64)" -nosalt < /dev/zero) of=1KB.bin bs=1KB count=1 iflag=fullblock
312``` 371```
313 372
314Our freshly generated 1KB file looks something like this (its full of garbage data as intended). 373Our freshly generated 1KB file looks something like this (its full of garbage
374data as intended).
315 375
316![Sample binary file 1KB](/assets/dna-sequence/sample-binary-file.png) 376![Sample binary file 1KB](/assets/dna-sequence/sample-binary-file.png)
317 377
318We create following binary files: 378We create following binary files:
379
319- 1KB.bin 380- 1KB.bin
320- 10KB.bin 381- 10KB.bin
321- 100KB.bin 382- 100KB.bin
@@ -323,7 +384,8 @@ We create following binary files:
323- 10MB.bin 384- 10MB.bin
324- 100MB.bin 385- 100MB.bin
325 386
326After this we create FASTA files for all the binary files by encoding them into DNA sequence. 387After this we create FASTA files for all the binary files by encoding them
388into DNA sequence.
327 389
328```bash 390```bash
329./dnae-encode -i 100MB.bin -o 100MB.fa 391./dnae-encode -i 100MB.bin -o 100MB.fa
@@ -348,3 +410,4 @@ gzip -9 < 10MB.fa > 10MB.fa.gz
348- https://opentextbc.ca/biology/chapter/9-1-the-structure-of-dna/ 410- https://opentextbc.ca/biology/chapter/9-1-the-structure-of-dna/
349- https://arxiv.org/abs/1801.04774 411- https://arxiv.org/abs/1801.04774
350- https://en.wikipedia.org/wiki/FASTA_format 412- https://en.wikipedia.org/wiki/FASTA_format
413
diff --git a/content/posts/2019-10-14-simplifying-and-reducing-clutter.md b/content/posts/2019-10-14-simplifying-and-reducing-clutter.md
index deb0cb8..13f4f42 100644
--- a/content/posts/2019-10-14-simplifying-and-reducing-clutter.md
+++ b/content/posts/2019-10-14-simplifying-and-reducing-clutter.md
@@ -1,22 +1,57 @@
1--- 1---
2title: Simplifying and reducing clutter in my life and work 2title: Simplifying and reducing clutter in my life and work
3url: simplifying-and-reducing-clutter.html 3url: simplifying-and-reducing-clutter.html
4date: 2019-10-14 4date: 2019-10-14T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I recently moved my main working machine back from Hachintosh to Linux. Well the experiment was interesting and I have done some great work on macOS but it was time to move back. 8I recently moved my main working machine back from Hachintosh to Linux. Well
9 9the experiment was interesting and I have done some great work on macOS but it
10I actually really missed Linux. The simplicity of `apt-get` or just the amount of software that exists for Linux should be a no-brainer. I spent most of my time on macOS finding solutions to make things work. Using [Brew](https://brew.sh/) was just a horrible experience and far from package managers of Linux. At least they managed to get that `sudo` debacle sorted. 10was time to move back.
11 11
12Not all was bad. macOS in general was a perfectly good environment. Things like Docker and tooling like this worked without any hiccups. My normal tools like coding IDE worked flawlessly and the whole look and feel is just superb. I have been using MacBook Air for couple of years so I was used to the system but never as a daily driver. 12I actually really missed Linux. The simplicity of `apt-get` or just the amount
13 13of software that exists for Linux should be a no-brainer. I spent most of my
14One of the things I did after I installed Linux back on my machine was cleaning up my Dropbox folder. I have everything on Dropbox. Even projects folder. I write code for living so my whole life revolves around couple of megs of code (with assets). So it's not like I have huge files on my machine. I don't have movies or music or pictures on my PC. All of that stuff is in cloud. I use Google music and I have Netflix account which is more than enough for me. 14time on macOS finding solutions to make things work. Using [Brew](https://brew.sh/)
15 15was just a horrible experience and far from package managers of Linux. At least
16I also went and deleted some of the repositories on my Github account. I have deleted more code than deployed. People find this strange but for me deleting something feels so cathartic and also forces me to write better code next time around when I am faced with similar problem. That was a huge relief if I am being totally honest. 16they managed to get that `sudo` debacle sorted.
17 17
18Next step was to do something with my webpage. I have been using some scripts I wrote a while ago to generate static pages from markdown source posts. I kept on adding and adding stuff on top of it and it became a source of a frustration. And this is just a simple blog and I was using gulp and npm. Anyways after couple of hours of searching and testing static generators I found an interesting one [https://github.com/piranha/gostatic](https://github.com/piranha/gostatic) and I just decided to use this one. It was the only one that had a simple templating engine, not that I really need one. But others had this convoluted way of trying to solve everything and at the end just required quite bigger learning curve I was ready to go with. So I deleted couple of old posts, simplified HTML, trashed most of the CSS and went with [https://motherfuckingwebsite.com/](https://motherfuckingwebsite.com/) aesthetics. Yeah, the previous site was more visually stimulating but all I really care is the content at this point. And Times New Roman font is kind of awesome. 18Not all was bad. macOS in general was a perfectly good environment. Things like
19 19Docker and tooling like this worked without any hiccups. My normal tools like
20I stopped working on most of the projects in the past couple of months because the overhead was just too insane. There comes a point when you stretch yourself too much and then you stop progressing and with that comes dissatisfaction. 20coding IDE worked flawlessly and the whole look and feel is just superb. I have
21been using MacBook Air for couple of years so I was used to the system but
22never as a daily driver.
23
24One of the things I did after I installed Linux back on my machine was cleaning
25up my Dropbox folder. I have everything on Dropbox. Even projects folder. I
26write code for living so my whole life revolves around couple of megs of code
27(with assets). So it's not like I have huge files on my machine. I don't have
28movies or music or pictures on my PC. All of that stuff is in cloud. I use
29Google music and I have Netflix account which is more than enough for me.
30
31I also went and deleted some of the repositories on my Github account. I have
32deleted more code than deployed. People find this strange but for me deleting
33something feels so cathartic and also forces me to write better code next time
34around when I am faced with similar problem. That was a huge relief if I am
35being totally honest.
36
37Next step was to do something with my webpage. I have been using some scripts
38I wrote a while ago to generate static pages from markdown source posts. I kept
39on adding and adding stuff on top of it and it became a source of a
40frustration. And this is just a simple blog and I was using gulp and npm.
41Anyways after couple of hours of searching and testing static generators I
42found an interesting one [https://github.com/piranha/gostatic](https://github.com/piranha/gostatic)
43and I just decided to use this one. It was the only one that had a simple
44templating engine, not that I really need one. But others had this convoluted
45way of trying to solve everything and at the end just required quite bigger
46learning curve I was ready to go with. So I deleted couple of old posts,
47simplified HTML, trashed most of the CSS and went with
48[https://motherfuckingwebsite.com/](https://motherfuckingwebsite.com/) aesthetics.
49Yeah, the previous site was more visually stimulating but all I really care is
50the content at this point. And Times New Roman font is kind of awesome.
51
52I stopped working on most of the projects in the past couple of months because
53the overhead was just too insane. There comes a point when you stretch yourself
54too much and then you stop progressing and with that comes dissatisfaction.
21 55
22So that's about it. Moving forward minimal style. 56So that's about it. Moving forward minimal style.
57
diff --git a/content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md b/content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md
index 30b0fd4..995da25 100644
--- a/content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md
+++ b/content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md
@@ -1,21 +1,29 @@
1--- 1---
2title: Using sentiment analysis for clickbait detection in RSS feeds 2title: Using sentiment analysis for clickbait detection in RSS feeds
3url: using-sentiment-analysis-for-clickbait-detection-in-rss-feeds.html 3url: using-sentiment-analysis-for-clickbait-detection-in-rss-feeds.html
4date: 2019-10-19 4date: 2019-10-19T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Initial thoughts 8## Initial thoughts
9 9
10One of the things that interested me for a while now is if major well established news sites use click bait titles to drive additional traffic to their sites and generate additional impressions. 10One of the things that interested me for a while now is if major well
11established news sites use click bait titles to drive additional traffic
12to their sites and generate additional impressions.
11 13
12Goal is to see how article titles and actual content of article differ from each other and see if titles are clickbaited. 14Goal is to see how article titles and actual content of article differ from
15each other and see if titles are clickbaited.
13 16
14## Preparing and cleaning data 17## Preparing and cleaning data
15 18
16For this example I opted to just use RSS feed from a new website and decided to go with [The Guardian](https://www.theguardian.com) World news. While this gets us limited data (~40) articles and also description (actual content) is trimmed this really doesn't reflect the actual article contents. 19For this example I opted to just use RSS feed from a new website and decided
20to go with [The Guardian](https://www.theguardian.com) World news. While this
21gets us limited data (~40) articles and also description (actual content) is
22trimmed this really doesn't reflect the actual article contents.
17 23
18To get better content I could use web scraping and use RSS as link list and fetch contents directly from website, but for this simple example this will suffice. 24To get better content I could use web scraping and use RSS as link list and
25fetch contents directly from website, but for this simple example this will
26suffice.
19 27
20There are couple of requirements we need to install before we continue: 28There are couple of requirements we need to install before we continue:
21 29
@@ -39,9 +47,15 @@ for item in feed.entries:
39 47
40## Perform sentiment analysis 48## Perform sentiment analysis
41 49
42Since we now have cleaned up data in our `feed.entries` object we can start with performing sentiment analysis. 50Since we now have cleaned up data in our `feed.entries` object we can start with
51performing sentiment analysis.
43 52
44There are many sentiment analysis libraries available that range from rule-based sentiment analysis up to machine learning supported analysis. To keep things simple I decided to use rule-based analysis library [vaderSentiment](https://github.com/cjhutto/vaderSentiment) from [C.J. Hutto](https://github.com/cjhutto). Really nice library and quite easy to use. 53There are many sentiment analysis libraries available that range from rule-based
54sentiment analysis up to machine learning supported analysis. To keep things
55simple I decided to use rule-based analysis library
56[vaderSentiment](https://github.com/cjhutto/vaderSentiment) from
57[C.J. Hutto](https://github.com/cjhutto). Really nice library and quite
58easy to use.
45 59
46```python 60```python
47from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer 61from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
@@ -54,7 +68,9 @@ for item in feed.entries:
54 sentiment_results.append([sentiment_title['compound'], sentiment_description['compound']]) 68 sentiment_results.append([sentiment_title['compound'], sentiment_description['compound']])
55``` 69```
56 70
57Now that we have this data in a shape that is compatible with matplotlib we can plot results to see the difference between title and description sentiment of an article. 71Now that we have this data in a shape that is compatible with matplotlib we can
72plot results to see the difference between title and description sentiment of
73an article.
58 74
59```python 75```python
60import matplotlib.pyplot as plt 76import matplotlib.pyplot as plt
@@ -69,12 +85,16 @@ plt.show()
69## Results and assets 85## Results and assets
70 86
711. Because of the small sample size further conclusions are impossible to make. 871. Because of the small sample size further conclusions are impossible to make.
722. Rule-based approach may not be the best way of doing this. By using deep learning we would be able to get better insights. 882. Rule-based approach may not be the best way of doing this. By using deep
733. **Next step would be to** periodically fetch RSS items and store them over a longer period of time and then perform analysis again and use either machine learning or deep learning on top of it. 89 learning we would be able to get better insights.
903. **Next step would be to** periodically fetch RSS items and store them over
91 a longer period of time and then perform analysis again and use either
92 machine learning or deep learning on top of it.
74 93
75![Relationship between title and description](/assets/sentiment-analysis/guardian-sa-title-desc-relationship.png) 94![Relationship between title and description](/assets/sentiment-analysis/guardian-sa-title-desc-relationship.png)
76 95
77Figure above displays difference between title and description sentiment for specific RSS feed item. 1 means positive and -1 means negative sentiment. 96Figure above displays difference between title and description sentiment for
97specific RSS feed item. 1 means positive and -1 means negative sentiment.
78 98
79[» Download Jupyter Notebook](/assets/sentiment-analysis/sentiment-analysis.ipynb) 99[» Download Jupyter Notebook](/assets/sentiment-analysis/sentiment-analysis.ipynb)
80 100
@@ -84,3 +104,4 @@ Figure above displays difference between title and description sentiment for spe
84- [AFINN-based sentiment analysis for Node.js by Andrew Sliwinski](https://github.com/thisandagain/sentiment) 104- [AFINN-based sentiment analysis for Node.js by Andrew Sliwinski](https://github.com/thisandagain/sentiment)
85- [Sentiment Analysis with LSTMs in Tensorflow by Adit Deshpande](https://github.com/adeshpande3/LSTM-Sentiment-Analysis) 105- [Sentiment Analysis with LSTMs in Tensorflow by Adit Deshpande](https://github.com/adeshpande3/LSTM-Sentiment-Analysis)
86- [Sentiment analysis on tweets using Naive Bayes, SVM, CNN, LSTM, etc. by Abdul Fatir](https://github.com/abdulfatir/twitter-sentiment-analysis) 106- [Sentiment analysis on tweets using Naive Bayes, SVM, CNN, LSTM, etc. by Abdul Fatir](https://github.com/abdulfatir/twitter-sentiment-analysis)
107
diff --git a/content/posts/2020-03-22-simple-sse-based-pubsub-server.md b/content/posts/2020-03-22-simple-sse-based-pubsub-server.md
index 939a62d..77c42a9 100644
--- a/content/posts/2020-03-22-simple-sse-based-pubsub-server.md
+++ b/content/posts/2020-03-22-simple-sse-based-pubsub-server.md
@@ -1,25 +1,41 @@
1--- 1---
2title: Simple Server-Sent Events based PubSub Server 2title: Simple Server-Sent Events based PubSub Server
3url: simple-server-sent-events-based-pubsub-server.html 3url: simple-server-sent-events-based-pubsub-server.html
4date: 2020-03-22 4date: 2020-03-22T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Before we continue ... 8## Before we continue ...
9 9
10Publisher Subscriber model is nothing new and there are many amazing solutions out there, so writing a new one would be a waste of time if other solutions wouldn't have quite complex install procedures and weren't so hard to maintain. But to be fair, comparing this simple server with something like [Kafka](https://kafka.apache.org/) or [RabbitMQ](https://www.rabbitmq.com/) is laughable at the least. Those solutions are enterprise grade and have many mechanisms there to ensure messages aren't lost and much more. Regardless of these drawbacks, this method has been tested on a large website and worked until now without any problems. So now, that we got that cleared up, let's continue. 10Publisher Subscriber model is nothing new and there are many amazing solutions
11 11out there, so writing a new one would be a waste of time if other solutions
12***Wiki definition:** Publish/subscribe messaging, or pub/sub messaging, is a form of asynchronous service-to-service communication used in serverless and microservices architectures. In a pub/sub model, any message published to a topic is immediately received by all the subscribers to the topic.* 12wouldn't have quite complex install procedures and weren't so hard to maintain.
13But to be fair, comparing this simple server with something like
14[Kafka](https://kafka.apache.org/) or [RabbitMQ](https://www.rabbitmq.com/) is
15laughable at the least. Those solutions are enterprise grade and have many
16mechanisms there to ensure messages aren't lost and much more. Regardless of
17these drawbacks, this method has been tested on a large website and worked
18until now without any problems. So now, that we got that cleared up, let's
19continue.
20
21***Wiki definition:** Publish/subscribe messaging, or pub/sub messaging, is a
22form of asynchronous service-to-service communication used in serverless and
23microservices architectures. In a pub/sub model, any message published to a
24topic is immediately received by all the subscribers to the topic.*
13 25
14## General goals 26## General goals
15 27
16- provide a simple server that relays messages to all the connected clients, 28- provide a simple server that relays messages to all the connected clients,
17- messages can be posted on specific topics, 29- messages can be posted on specific topics,
18- messages get sent via [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) to all the subscribers. 30- messages get sent via [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
31 to all the subscribers.
19 32
20## How exactly does the pub/sub model work? 33## How exactly does the pub/sub model work?
21 34
22The easiest way to explain this is with diagram bellow. Basic function is simple. We have subscribers that receive messages, and we have publishers that create and post messages. Similar model is also well know pattern that works on a premise of consumers and producers, and they take similar roles. 35The easiest way to explain this is with diagram bellow. Basic function is
36simple. We have subscribers that receive messages, and we have publishers that
37create and post messages. Similar model is also well know pattern that works
38on a premise of consumers and producers, and they take similar roles.
23 39
24![How PubSub works](/assets/simple-pubsub-server/pubsub-overview.png) 40![How PubSub works](/assets/simple-pubsub-server/pubsub-overview.png)
25 41
@@ -29,16 +45,23 @@ The easiest way to explain this is with diagram bellow. Basic function is simple
29- consumer is receiving messages from subscribed topic, 45- consumer is receiving messages from subscribed topic,
30- servers is also known as Broker, 46- servers is also known as Broker,
31- broker does not store messages or tracks success, 47- broker does not store messages or tracks success,
32- broker uses [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)) method for delivering messages, 48- broker uses [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics))
33- if consumer wants to receive messages from a topic, producer and consumer topics must match, 49 method for delivering messages,
50- if consumer wants to receive messages from a topic, producer and consumer topics
51 must match,
34- consumer can subscribe to multiple topics, 52- consumer can subscribe to multiple topics,
35- producer can publish to multiple topics, 53- producer can publish to multiple topics,
36- each message has a messageId. 54- each message has a messageId.
37 55
38**Known drawbacks:** 56**Known drawbacks:**
39 57
40- messages will not be stored in a persistent queue or unreceived messages like [DeadLetterQueue](https://en.wikipedia.org/wiki/Dead_letter_queue) so old messages could be lost on server restart, 58- messages will not be stored in a persistent queue or unreceived messages like
41- [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) opens a long-running connection between the client and the server so make sure if your setup is load balanced that the load balancer in this case can have long opened connection, 59 [DeadLetterQueue](https://en.wikipedia.org/wiki/Dead_letter_queue) so old
60 messages could be lost on server restart,
61- [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
62 opens a long-running connection between the client and the server so make
63 sure if your setup is load balanced that the load balancer in this case can
64 have long opened connection,
42- no system moderation due to the dynamic nature of creating queues. 65- no system moderation due to the dynamic nature of creating queues.
43 66
44## Server-Sent Events 67## Server-Sent Events
@@ -49,13 +72,16 @@ Read more about it on [official specification page](https://html.spec.whatwg.org
49 72
50![Browser support](/assets/simple-pubsub-server/caniuse.png) 73![Browser support](/assets/simple-pubsub-server/caniuse.png)
51 74
52Check [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource) for latest information about browser support. 75Check [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource)
76for latest information about browser support.
53 77
54### Known issues 78### Known issues
55 79
56- Firefox 52 and below do not support EventSource in web/shared workers 80- Firefox 52 and below do not support EventSource in web/shared workers
57- In Firefox prior to version 36 server-sent events do not reconnect automatically in case of a connection interrupt (bug) 81- In Firefox prior to version 36 server-sent events do not reconnect
58- Reportedly, CORS in EventSource is currently supported in Firefox 10+, Opera 12+, Chrome 26+, Safari 7.0+. 82 automatically in case of a connection interrupt (bug)
83- Reportedly, CORS in EventSource is currently supported in Firefox 10+,
84 Opera 12+, Chrome 26+, Safari 7.0+.
59- Antivirus software may block the event streaming data chunks. 85- Antivirus software may block the event streaming data chunks.
60 86
61Source: [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource) 87Source: [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource)
@@ -78,7 +104,8 @@ data: this is line two
78<blank line> 104<blank line>
79``` 105```
80 106
81And you can specify your own event types (the above messages will all trigger the message event): 107And you can specify your own event types (the above messages will all trigger
108the message event):
82 109
83```bash 110```bash
84id: 36 111id: 36
@@ -89,7 +116,8 @@ data: 103.34
89 116
90### Server requirements 117### Server requirements
91 118
92The important thing is how you send headers and which headers are sent by the server that triggers browser to threat response as a EventStream. 119The important thing is how you send headers and which headers are sent by the
120server that triggers browser to threat response as a EventStream.
93 121
94Headers responsible for this are: 122Headers responsible for this are:
95 123
@@ -101,15 +129,23 @@ Connection: keep-alive
101 129
102### Debugging with Google Chrome 130### Debugging with Google Chrome
103 131
104Google Chrome provides build-in debugging and exploration tool for [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) which is quite nice and available from Developer Tools under Network tab. 132Google Chrome provides build-in debugging and exploration tool for
133[Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
134which is quite nice and available from Developer Tools under Network tab.
105 135
106> You can debug only client side events that get received and not the server ones. For debugging server events add `console.log` to `server.js` code and print out events. 136> You can debug only client side events that get received and not the server
137> ones. For debugging server events add `console.log` to `server.js` code and
138> print out events.
107 139
108![Google Chrome Developer Tools EventStream](/assets/simple-pubsub-server/chrome-debugging.png) 140![Google Chrome Developer Tools EventStream](/assets/simple-pubsub-server/chrome-debugging.png)
109 141
110## Server implementation 142## Server implementation
111 143
112For the sake of this example we will use [Node.js](https://nodejs.org/en/) with [Express](https://expressjs.com) as our router since this is the easiest way to get started and we will use already written SSE library for node [sse-pubsub](https://www.npmjs.com/package/sse-pubsub) so we don't reinvent the wheel. 144For the sake of this example we will use [Node.js](https://nodejs.org/en/)
145with [Express](https://expressjs.com) as our router since this is the easiest
146way to get started and we will use already written SSE library for node
147[sse-pubsub](https://www.npmjs.com/package/sse-pubsub) so we don't reinvent
148the wheel.
113 149
114```bash 150```bash
115npm init --yes 151npm init --yes
@@ -216,11 +252,17 @@ app.listen(port, () => {
216 252
217### Our custom message format 253### Our custom message format
218 254
219Each message posted on a server must be in a specific format that out server accepts. Having structure like this allows us to have multiple separated type of events on each topic. 255Each message posted on a server must be in a specific format that out server
256accepts. Having structure like this allows us to have multiple separated type
257of events on each topic.
220 258
221With this we can separate streams and only receive events that belong to the topic. 259With this we can separate streams and only receive events that belong to the
260topic.
222 261
223One example would be, that we have index page and we want to receive messages about new upvotes or new subscribers but we don't want to follow events for other pages. This reduces clutter and overall network. And structure is much nicer and maintanable. 262One example would be, that we have index page and we want to receive messages
263about new upvotes or new subscribers but we don't want to follow events for
264other pages. This reduces clutter and overall network. And structure is much
265nicer and maintanable.
224 266
225```json 267```json
226{ 268{
@@ -236,11 +278,15 @@ One example would be, that we have index page and we want to receive messages ab
236 278
237<video src="/assets/simple-pubsub-server/clients.m4v" controls></video> 279<video src="/assets/simple-pubsub-server/clients.m4v" controls></video>
238 280
239You can download [the code](../simple-pubsub-server/sse-pubsub-server.zip) and follow along. 281You can download [the code](../simple-pubsub-server/sse-pubsub-server.zip)
282and follow along.
240 283
241### Publisher 284### Publisher
242 285
243As talked about above publisher is the one that send messages to the broker/server. Message inside the payload can be whatever you want (string, object, array). I would however personally avoid send large chunks of data like blobs and such. 286As talked about above publisher is the one that send messages to the
287broker/server. Message inside the payload can be whatever you want (string,
288object, array). I would however personally avoid send large chunks of data
289like blobs and such.
244 290
245```html 291```html
246<!DOCTYPE html> 292<!DOCTYPE html>
@@ -309,16 +355,23 @@ As talked about above publisher is the one that send messages to the broker/serv
309 </body> 355 </body>
310 356
311</html> 357</html>
312
313``` 358```
314 359
315### Subscriber 360### Subscriber
316 361
317Subscriber is responsible for receiving new messages that come from server via publisher. The code bellow is very rudimentary but works and follows the implementation guidelines for EventSource. 362Subscriber is responsible for receiving new messages that come from server via
363publisher. The code bellow is very rudimentary but works and follows the
364implementation guidelines for EventSource.
318 365
319You can use either Developer Tools Console to see incoming messages or you can defer to Debugging with Google Chrome section above to see all EventStream messages. 366You can use either Developer Tools Console to see incoming messages or you can
367defer to Debugging with Google Chrome section above to see all EventStream
368messages.
320 369
321> Don't be alarmed if the subscriber gets disconnected from the server every so often. The code we have here resets connection every 15s but it automatically get reconnected and fetches all messages up to last received message id. This setting can be adjusted in `server.js` file; search for the `maxStreamDuration` variable. 370> Don't be alarmed if the subscriber gets disconnected from the server every
371> so often. The code we have here resets connection every 15s but it
372> automatically get reconnected and fetches all messages up to last received
373> message id. This setting can be adjusted in `server.js` file; search for
374> the `maxStreamDuration` variable.
322 375
323```html 376```html
324<!DOCTYPE html> 377<!DOCTYPE html>
@@ -383,7 +436,6 @@ You can use either Developer Tools Console to see incoming messages or you can d
383 </body> 436 </body>
384 437
385</html> 438</html>
386
387``` 439```
388 440
389## Reading further 441## Reading further
@@ -394,3 +446,4 @@ You can use either Developer Tools Console to see incoming messages or you can d
394- [An HTTP/2 extension for bidirectional messaging communication](https://tools.ietf.org/id/draft-xie-bidirectional-messaging-01.html) 446- [An HTTP/2 extension for bidirectional messaging communication](https://tools.ietf.org/id/draft-xie-bidirectional-messaging-01.html)
395- [Introduction to HTTP/2](https://developers.google.com/web/fundamentals/performance/http2) 447- [Introduction to HTTP/2](https://developers.google.com/web/fundamentals/performance/http2)
396- [The WebSocket API (WebSockets)](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) 448- [The WebSocket API (WebSockets)](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API)
449
diff --git a/content/posts/2020-03-27-create-placeholder-images-with-sharp.md b/content/posts/2020-03-27-create-placeholder-images-with-sharp.md
index fc8eb0c..f7dd362 100644
--- a/content/posts/2020-03-27-create-placeholder-images-with-sharp.md
+++ b/content/posts/2020-03-27-create-placeholder-images-with-sharp.md
@@ -1,13 +1,18 @@
1--- 1---
2title: Create placeholder images with sharp Node.js image processing library 2title: Create placeholder images with sharp Node.js image processing library
3url: create-placeholder-images-with-sharp.html 3url: create-placeholder-images-with-sharp.html
4date: 2020-03-27 4date: 2020-03-27T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I have been searching for a solution to pre-generate some placeholder images for image server I needed to develop that resizes images on S3. I though this would be a 15min job and quickly found out how very mistaken I was. 8I have been searching for a solution to pre-generate some placeholder images
9for image server I needed to develop that resizes images on S3. I though this
10would be a 15min job and quickly found out how very mistaken I was.
9 11
10Even though Node.js is not really the best way to do this kind of things (surely something written in C or Rust or even Golang would be the correct way to do this but we didn't need the speed in our case) I found an excellent library [sharp - High performance Node.js image processing](https://github.com/lovell/sharp). 12Even though Node.js is not really the best way to do this kind of things
13(surely something written in C or Rust or even Golang would be the correct way
14to do this but we didn't need the speed in our case) I found an excellent
15library [sharp - High performance Node.js image processing](https://github.com/lovell/sharp).
11 16
12Getting things running was a breeze. 17Getting things running was a breeze.
13 18
@@ -45,15 +50,23 @@ s3.putObject({
45}).promise(); 50}).promise();
46``` 51```
47 52
48All this code was wrapped inside a web service with some additional security checks and defensive coding to detect if key is missing on S3. 53All this code was wrapped inside a web service with some additional security
54checks and defensive coding to detect if key is missing on S3.
49 55
50And at that point I needed to return placeholder images as a response in case key is missing or x,y are not allowed by the server etc. I could have created PNG in Gimp and just serve them but I wanted to respect aspect ratio and I didn't want to return some mangled images. 56And at that point I needed to return placeholder images as a response in case
57key is missing or x,y are not allowed by the server etc. I could have created
58PNG in Gimp and just serve them but I wanted to respect aspect ratio and I
59didn't want to return some mangled images.
51 60
52> Main problem with finding a clean solution I could copy and paste and change a bit was a task. API is changing constantly and there weren't clear examples or I was unable to find them. 61> Main problem with finding a clean solution I could copy and paste and change
62a bit was a task. API is changing constantly and there weren't clear examples
63or I was unable to find them.
53 64
54## Generating placeholder images using SVG 65## Generating placeholder images using SVG
55 66
56What I ended up was using SVG to generate text and created image with sharp and used composition to combine both layers. Response returned by this function is a buffer you can use to either upload to S3 or save to local file. 67What I ended up was using SVG to generate text and created image with sharp and
68used composition to combine both layers. Response returned by this function is
69a buffer you can use to either upload to S3 or save to local file.
57 70
58```js 71```js
59const generatePlaceholderImageWithText = async (width, height, message) => { 72const generatePlaceholderImageWithText = async (width, height, message) => {
@@ -78,6 +91,11 @@ const generatePlaceholderImageWithText = async (width, height, message) => {
78} 91}
79``` 92```
80 93
81That is about it. Nothing more to it. You can change the color of the image by changing `background` and if you want to change text styling you can adapt SVG to your needs. 94That is about it. Nothing more to it. You can change the color of the image by
95changing `background` and if you want to change text styling you can adapt
96SVG to your needs.
97
98> Also be careful about the length of the text. This function positions text
99> at the center and adds `20px` padding on all sides. If text is longer than
100> the image it will get cut.
82 101
83> Also be careful about the length of the text. This function positions text at the center and adds `20px` padding on all sides. If text is longer than the image it will get cut.
diff --git a/content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md b/content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md
index a976a7e..d0f4bac 100644
--- a/content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md
+++ b/content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md
@@ -1,19 +1,37 @@
1--- 1---
2title: The strange case of Elasticsearch allocation failure 2title: The strange case of Elasticsearch allocation failure
3url: the-strange-case-of-elasticsearch-allocation-failure.html 3url: the-strange-case-of-elasticsearch-allocation-failure.html
4date: 2020-03-29 4date: 2020-03-29T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I've been using Elasticsearch in production for 5 years now and never had a single problem with it. Hell, never even known there could be a problem. Just worked. All this time. The first node that I deployed is still being used in production, never updated, upgraded, touched in anyway. 8I've been using Elasticsearch in production for 5 years now and never had a
9 9single problem with it. Hell, never even known there could be a problem. Just
10All this bliss came to an abrupt end this Friday when I got notification that Elasticsearch cluster went warm. Well, warm is not that bad right? Wrong! Quickly after that I got another email which sent chills down my spine. Cluster is now red. RED! Now, shit really hit the fan! 10worked. All this time. The first node that I deployed is still being used in
11 11production, never updated, upgraded, touched in anyway.
12I tried googling what could be the problem and after executing allocation function noticed that some shards were unassigned and 5 attempts were already made (which is BTW to my luck the maximum) and that meant I am basically fucked. They also applied that one should wait for cluster to re-balance itself. So, I waited. One hour, two hours, several hours. Nothing, still RED. 12
13 13All this bliss came to an abrupt end this Friday when I got notification that
14The strangest thing about it all was, that queries were still being fulfilled. Data was coming out. On the outside it looked like nothing was wrong but everybody that would look at the cluster would know immediately that something was very very wrong and we were living on borrowed time here. 14Elasticsearch cluster went warm. Well, warm is not that bad right? Wrong!
15 15Quickly after that I got another email which sent chills down my spine.
16> **Please, DO NOT do what I did.** Seriously! Please ask someone on official forums or if you know an expert please consult him. There could be million of reasons and these solution fit my problem. Maybe in your case it would disastrous. I had all the data backed up and even if I would fail spectacularly I would be able to restore the data. It would be a huge pain and I would loose couple of days but I had a plan B. 16Cluster is now red. RED! Now, shit really hit the fan!
17
18I tried googling what could be the problem and after executing allocation
19function noticed that some shards were unassigned and 5 attempts were already
20made (which is BTW to my luck the maximum) and that meant I am basically fucked.
21They also applied that one should wait for cluster to re-balance itself. So,
22I waited. One hour, two hours, several hours. Nothing, still RED.
23
24The strangest thing about it all was, that queries were still being fulfilled.
25Data was coming out. On the outside it looked like nothing was wrong but
26everybody that would look at the cluster would know immediately that something
27was very very wrong and we were living on borrowed time here.
28
29> **Please, DO NOT do what I did.** Seriously! Please ask someone on official
30forums or if you know an expert please consult him. There could be million of
31reasons and these solution fit my problem. Maybe in your case it would
32disastrous. I had all the data backed up and even if I would fail spectacularly
33I would be able to restore the data. It would be a huge pain and I would
34loose couple of days but I had a plan B.
17 35
18Executing allocation and told me what the problem was but no clear solution yet. 36Executing allocation and told me what the problem was but no clear solution yet.
19 37
@@ -21,9 +39,14 @@ Executing allocation and told me what the problem was but no clear solution yet.
21GET /_cat/allocation?format=json 39GET /_cat/allocation?format=json
22``` 40```
23 41
24I got a message that `ALLOCATION_FAILED` with additional info `failed to create shard, failure ioexception[failed to obtain in-memory shard lock]`. Well splendid! I must also say that our cluster is capable more than enough to handle the traffic. Also JVM memory pressure never was an issue. So what happened really then? 42I got a message that `ALLOCATION_FAILED` with additional info
43`failed to create shard, failure ioexception[failed to obtain in-memory shard lock]`.
44Well splendid! I must also say that our cluster is capable more than enough
45to handle the traffic. Also JVM memory pressure never was an issue. So what
46happened really then?
25 47
26I tried also re-routing failed ones with no success due to AWS restrictions on having managed Elasticsearch cluster (they lock some of the functions). 48I tried also re-routing failed ones with no success due to AWS restrictions
49on having managed Elasticsearch cluster (they lock some of the functions).
27 50
28```yaml 51```yaml
29POST /_cluster/reroute?retry_failed=true 52POST /_cluster/reroute?retry_failed=true
@@ -37,7 +60,10 @@ I got a message that significantly reduced my options.
37} 60}
38``` 61```
39 62
40After that I went on a hunt again. I won't bother you with all the details because hours/days went by until I was finally able to re-index the problematic index and hoped for the best. Until that moment even re-indexing was giving me errors. 63After that I went on a hunt again. I won't bother you with all the details
64because hours/days went by until I was finally able to re-index the problematic
65index and hoped for the best. Until that moment even re-indexing was giving
66me errors.
41 67
42```yaml 68```yaml
43POST _reindex 69POST _reindex
@@ -51,7 +77,8 @@ POST _reindex
51} 77}
52``` 78```
53 79
54I needed to do this multiple times to get all the documents re-indexed. Then I dropped the original one with the following command. 80I needed to do this multiple times to get all the documents re-indexed. Then
81I dropped the original one with the following command.
55 82
56```yaml 83```yaml
57DELETE /myindex 84DELETE /myindex
@@ -71,6 +98,10 @@ POST _reindex
71} 98}
72``` 99```
73 100
74On the surface it looks like all is working but I have a long road in front of me to get all the things working again. Cluster now shows that it is in Green mode but I am also getting a notification that the cluster has processing status which could mean million of things. 101On the surface it looks like all is working but I have a long road in front
102of me to get all the things working again. Cluster now shows that it is in
103Green mode but I am also getting a notification that the cluster has
104processing status which could mean million of things.
75 105
76Godspeed! 106Godspeed!
107
diff --git a/content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md b/content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md
index 2b8b35b..47b95d5 100644
--- a/content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md
+++ b/content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md
@@ -1,41 +1,112 @@
1--- 1---
2title: My love and hate relationship with Node.js 2title: My love and hate relationship with Node.js
3url: my-love-and-hate-relationship-with-nodejs.html 3url: my-love-and-hate-relationship-with-nodejs.html
4date: 2020-03-30 4date: 2020-03-30T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Previous project I was working on was being coded in [Golang](https://golang.org/). Also was my first project using it. And damn, that was an awesome experience. The whole thing is just superb. From how errors are handled. The C-like way you handle compiling. The way the language is structured making it incredibly versatile and easy to learn. 8Previous project I was working on was being coded in [Golang](https://golang.org/).
9Also was my first project using it. And damn, that was an awesome experience.
10The whole thing is just superb. From how errors are handled. The C-like way
11you handle compiling. The way the language is structured making it incredibly
12versatile and easy to learn.
9 13
10It may cause some pain for somebody that is not used of using interfaces to map JSON and doing the recompilation all the time. But we have tools like [entr](http://eradman.com/entrproject/) and [make](https://www.gnu.org/software/make/) to fix that. 14It may cause some pain for somebody that is not used of using interfaces to map
15JSON and doing the recompilation all the time. But we have tools like
16[entr](http://eradman.com/entrproject/) and [make](https://www.gnu.org/software/make/)
17to fix that.
11 18
12But we are not here to talk about my undying love for **Golang**. Only in some way we probably should. It is an excellent example of how modern language should be designed. And because I have used it extensively in the last couple of years this probably taints my views of other languages. And is doing me a great disservice. Nevertheless, here we are. 19But we are not here to talk about my undying love for **Golang**. Only in some
20way we probably should. It is an excellent example of how modern language
21should be designed. And because I have used it extensively in the last couple
22of years this probably taints my views of other languages. And is doing me a
23great disservice. Nevertheless, here we are.
13 24
14About two years ago I started flirting with [Node.js](https://nodejs.org/en/) for a project I started working on. What I wanted was to have things written in a language that is widely used, and we could get additional developers for. As much as **Golang** is amazing it's really hard to get developers for it. Even now. And after playing around with it for a week I felt in love with the speed of iteration and massive package ecosystem. Do you want SSO? You got it! Do you want some esoteric library for something? There is a strong chance somebody wrote it. It is so extensive that you find yourself evaluating packages based on **GitHub stars** and number of contributors. You get swallowed by the vanity metrics and that potentially will become the downfall of Node.js. 25About two years ago I started flirting with [Node.js](https://nodejs.org/en/)
26for a project I started working on. What I wanted was to have things written
27in a language that is widely used, and we could get additional developers for.
28As much as **Golang** is amazing it's really hard to get developers for it.
29Even now. And after playing around with it for a week I felt in love with the
30speed of iteration and massive package ecosystem. Do you want SSO? You got it!
31Do you want some esoteric library for something? There is a strong chance
32somebody wrote it. It is so extensive that you find yourself evaluating
33packages based on **GitHub stars** and number of contributors. You get
34swallowed by the vanity metrics and that potentially will become the downfall
35of Node.js.
15 36
16Because of the sheer amount of choice I often got anxiety when choosing libraries. Will I choose the correct one? Is this library something that will be supported for a foreseeable future or not? I am used of using libraries that are being in development for 10 years plus (Python, C) and that gave me some sort of comfort. And it is probably unfair to Node.js and community to expect same dedication. 37Because of the sheer amount of choice I often got anxiety when choosing
38libraries. Will I choose the correct one? Is this library something that will
39be supported for a foreseeable future or not? I am used of using libraries that
40are being in development for 10 years plus (Python, C) and that gave me some
41sort of comfort. And it is probably unfair to Node.js and community to expect
42same dedication.
17 43
18Moving forward ... Work started and things were great. **Speed of iteration was insane**. For some feature that I would need a day in Golang only took me hour or two. I became lazy! Using packages all over the place. Falling into the same trap as others. Packages on top of packages. And [npm](https://www.npmjs.com/) didn't help at all. The way that the package manager works is just horrendous. And not allowing to have node_modules outside the project is also the stupidest idea ever. 44Moving forward ... Work started and things were great.
45**Speed of iteration was insane**. For some feature that I would need a day
46in Golang only took me hour or two. I became lazy! Using packages all over
47the place. Falling into the same trap as others. Packages on top of packages.
48And [npm](https://www.npmjs.com/) didn't help at all. The way that the package
49manager works is just horrendous. And not allowing to have node_modules outside
50the project is also the stupidest idea ever.
19 51
20So at that point I started feeling the technical debt that comes with Node.js and the whole ecosystem. What nobody tells you is that **structuring large Node.js apps** is more problematic than one would think. And going microservice for every single thing is also a bad idea. The amount of networking you introduce with that approach always ends up being a pain in the ass. And I don't even want to go into system administration here. The overhead is insane. Package-lock.json made many days feel like living hell for me. And I would eat the cost of all this if it meant for better development experience. Well, it didn't. 52So at that point I started feeling the technical debt that comes with Node.js
53and the whole ecosystem. What nobody tells you is that
54**structuring large Node.js apps** is more problematic than one would think.
55And going microservice for every single thing is also a bad idea. The amount
56of networking you introduce with that approach always ends up being a pain in
57the ass. And I don't even want to go into system administration here. The
58overhead is insane. Package-lock.json made many days feel like living hell
59for me. And I would eat the cost of all this if it meant for better development
60experience. Well, it didn't.
21 61
22The **lack of Typescript** support in the interpreter is still mind boggling to me. Why haven't they added native support yet for this is beyond me?! That would have solved so many problems. Lack of type safety became a problem somewhere in the middle of the project where the codebase was sufficiently large enough to present problems. We started adding arguments to functions and there was **no way to implicitly define argument types**. And because at that point there were a lot of functions, it became impossible to know what each one accepts, development became more and more trial and error based. 62The **lack of Typescript** support in the interpreter is still mind boggling
63to me. Why haven't they added native support yet for this is beyond me?! That
64would have solved so many problems. Lack of type safety became a problem
65somewhere in the middle of the project where the codebase was sufficiently
66large enough to present problems. We started adding arguments to functions
67and there was **no way to implicitly define argument types**. And because at
68that point there were a lot of functions, it became impossible to know what
69each one accepts, development became more and more trial and error based.
23 70
24I tried **implementing Typescript**, but that would present a large refactor that we were not willing to do at that point. The benefits were not enough. I also tried [Flow - static type checker](https://flow.org/) but implementation was also horrible. What Typescript and Flow forces you is to have src folder and then **transpile** your code into dist folder and run it with node. WTH is that all about. Why can't this be done in memory or some virtual file system? Why? I see no reason why this couldn't be done like this. But it is what it is. I abandoned all hope for static type checking. 71I tried **implementing Typescript**, but that would present a large refactor
72that we were not willing to do at that point. The benefits were not enough.
73I also tried [Flow - static type checker](https://flow.org/) but implementation
74was also horrible. What Typescript and Flow forces you is to have src folder
75and then **transpile** your code into dist folder and run it with node. WTH is
76that all about. Why can't this be done in memory or some virtual file system?
77Why? I see no reason why this couldn't be done like this. But it is what it is.
78I abandoned all hope for static type checking.
25 79
26One of the problems that resulted from not having interfaces or types was inability to model out our data from **Elasticsearch**. I could have done a **pedestrian implementation** of it, but there must be a better way of doing this without resorting to some hack basically. Or maybe I haven't found a solution, which is also a possibility. I have looked, though. No juice! 80One of the problems that resulted from not having interfaces or types was
81inability to model out our data from **Elasticsearch**. I could have done
82a **pedestrian implementation** of it, but there must be a better way of doing
83this without resorting to some hack basically. Or maybe I haven't found a
84solution, which is also a possibility. I have looked, though. No juice!
27 85
28**Error handling?** Is that a joke? 86**Error handling?** Is that a joke?
29 87
30Thank god for **await/async**. Without it, I would have probably just abandoned the whole thing and went with something else like Python. That's all I am going to say about this :) 88Thank god for **await/async**. Without it, I would have probably just abandoned
89the whole thing and went with something else like Python. That's all I am
90going to say about this :)
91
92I started asking myself a question if Node.js is actually ready to be used in
93a **large scale applications**? And this was a totally wrong question. What I
94should have been asking myself was, how to use Node.js in large scale
95application. And you don't get this in **marketing material** for Express or
96Koa etc. They never tell you this. Making Node.js scale on infrastructure or
97in codebase is really **more of an art than a science**. And just like with the
98whole JavaScript ecosystem:
31 99
32I started asking myself a question if Node.js is actually ready to be used in a **large scale applications**? And this was a totally wrong question. What I should have been asking myself was, how to use Node.js in large scale application. And you don't get this in **marketing material** for Express or Koa etc. They never tell you this. Making Node.js scale on infrastructure or in codebase is really **more of an art than a science**. And just like with the whole JavaScript ecosystem:
33- impossible to master, 100- impossible to master,
34- half of your time you work on your tooling, 101- half of your time you work on your tooling,
35- just accept transpilers that convert one code into another (holly smokes), 102- just accept transpilers that convert one code into another (holly smokes),
36- error handling is a joke, 103- error handling is a joke,
37- standards? What standards? 104- standards? What standards?
38 105
39But on the other hand. As I did, you will also learn to love it. Learn to use it quickly and do impossible things in crazy limited time. 106But on the other hand. As I did, you will also learn to love it. Learn to use
107it quickly and do impossible things in crazy limited time.
40 108
41I hate to admit it. But I love Node.js. Dammit, I love it :) 109I hate to admit it. But I love Node.js. Dammit, I love it :)
110
1112023 Update: I hate Node.js!
112
diff --git a/content/posts/2020-05-05-remote-work.md b/content/posts/2020-05-05-remote-work.md
index d4b5cbe..54a7d1b 100644
--- a/content/posts/2020-05-05-remote-work.md
+++ b/content/posts/2020-05-05-remote-work.md
@@ -1,37 +1,70 @@
1--- 1---
2title: Remote work and how it affects the daily lives of people 2title: Remote work and how it affects the daily lives of people
3url: remote-work.html 3url: remote-work.html
4date: 2020-05-05 4date: 2020-05-05T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I have been working remotely for the past 5 years. I love it. Love the freedom and make your schedule thingy. 8I have been working remotely for the past 5 years. I love it. Love the freedom
9and make your schedule thingy.
9 10
10## You work more not less 11## You work more not less
11 12
12I've heard from people things like: "Oh, you are so lucky, working from home, having all the free time you want". It was obvious they had no clue what means working remotely. They had this romantic idea of remote work. You can watch TV whenever you like, you can go outside for a picnic if you want and stuff like that. 13I've heard from people things like: "Oh, you are so lucky, working from home,
14having all the free time you want". It was obvious they had no clue what means
15working remotely. They had this romantic idea of remote work. You can watch TV
16whenever you like, you can go outside for a picnic if you want and stuff like
17that.
13 18
14This may be true if you work a day or two in a week from home. But if you go completely remote all these changes completely. I take some time to acclimate but then you start feeling the consequences of going fully remote. And it's not all rainbows and unicorns. Rather the opposite. 19This may be true if you work a day or two in a week from home. But if you go
20completely remote all these changes completely. I take some time to acclimate
21but then you start feeling the consequences of going fully remote. And it's not
22all rainbows and unicorns. Rather the opposite.
15 23
16## Feeling lost 24## Feeling lost
17 25
18At first, I remembered I felt lost. I was not used to this kind of environment. It felt disoriented and a part of you that is used to procrastinate turns on. You start thinking of a workday as a whole day. And soon this idea of "I can do this later" starts creeping in. Well, I have the whole day ahead of me. I can do this a bit later. 26At first, I remembered I felt lost. I was not used to this kind of environment.
27It felt disoriented and a part of you that is used to procrastinate turns on.
28You start thinking of a workday as a whole day. And soon this idea of "I can do
29this later" starts creeping in. Well, I have the whole day ahead of me. I can
30do this a bit later.
19 31
20## Hyper-performance 32## Hyper-performance
21 33
22As a direct result, you become more focused on your work since you don't have all the interruptions common in the workplace. And you can quickly get used to this hyper-performance. But this mode requires also a lot of peace and quiet. 34As a direct result, you become more focused on your work since you don't have
35all the interruptions common in the workplace. And you can quickly get used to
36this hyper-performance. But this mode requires also a lot of peace and quiet.
23 37
24And here we come to the ugly parts of all this. **People rarely have the self-control** to not waste other people's time. It is paralyzing when people start calling you, sending you chat messages, etc. The thing is, that when I achieve this hyper-performance mode I am completely embroiled in the problem I am solving and this kind of interruptions mess with your head. I need an hour at least to get back in the zone. Sometimes not achieving the same focus the whole day. 38And here we come to the ugly parts of all this. **People rarely have the self-control**
39to not waste other people's time. It is paralyzing when people start calling
40you, sending you chat messages, etc. The thing is, that when I achieve this
41hyper-performance mode I am completely embroiled in the problem I am solving
42and this kind of interruptions mess with your head. I need an hour at least to
43get back in the zone. Sometimes not achieving the same focus the whole day.
25 44
26I know that life is not how you want it to be and takes its route but from what I've learned this kind of interruptions can be avoided in 90% of the case easily just by closing any chat programs and putting your phone in a drawer. 45I know that life is not how you want it to be and takes its route but from what
46I've learned this kind of interruptions can be avoided in 90% of the case
47easily just by closing any chat programs and putting your phone in a drawer.
27 48
28## Suggestion to all the new remote workers 49## Suggestion to all the new remote workers
29 50
30- Stop wasting other people's time. You don't bother people at their desks in the office either. 51- Stop wasting other people's time. You don't bother people at their desks
31- Do not replace daily chats in the hallways with instant messaging software. It will only interrupt people. Nothing good will come of it. 52 in the office either.
32- Set your working hours and try to not allow it to bleed outside these boundaries and maintain your routine. 53- Do not replace daily chats in the hallways with instant messaging software.
33- Be prepared that hours will be longer regardless of your good intentions and your well thought of routine. 54 It will only interrupt people. Nothing good will come of it.
34- Try to be hyper-focused and do only one thing at the time. Multitasking is the enemy of progress. 55- Set your working hours and try to not allow it to bleed outside these
35- Avoid long meetings and if possible eliminate them. Rather take time to write them out and allow others to respond in their own time. Meetings are usually a large waste of time and most of the people attending them are there just because the manager said so. 56 boundaries and maintain your routine.
57- Be prepared that hours will be longer regardless of your good intentions
58 and your well thought of routine.
59- Try to be hyper-focused and do only one thing at the time. Multitasking is
60 the enemy of progress.
61- Avoid long meetings and if possible eliminate them. Rather take time to write
62 them out and allow others to respond in their own time. Meetings are usually a
63 large waste of time and most of the people attending them are there just
64 because the manager said so.
36- The software will not solve your problems. And throwing money at problems neither. 65- The software will not solve your problems. And throwing money at problems neither.
37- If you are in a managerial position don't supervise any single minute of workers. They are probably giving you more hours anyways. Track progress weekly not daily. You hired them and give them the benefit of the doubt that they will deliver what you agreed upon. 66- If you are in a managerial position don't supervise any single minute of
67 workers. They are probably giving you more hours anyways. Track progress
68 weekly not daily. You hired them and give them the benefit of the doubt that
69 they will deliver what you agreed upon.
70
diff --git a/content/posts/2020-08-15-systemd-disable-wake-onmouse.md b/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
index 09e5036..fabdc32 100644
--- a/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
+++ b/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
@@ -1,23 +1,43 @@
1--- 1---
2title: Disable mouse wake from suspend with systemd service 2title: Disable mouse wake from suspend with systemd service
3url: disable-mouse-wake-from-suspend-with-systemd-service.html 3url: disable-mouse-wake-from-suspend-with-systemd-service.html
4date: 2020-08-15 4date: 2020-08-15T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I recently bought [ThinkPad X220](https://www.laptopmag.com/reviews/laptops/lenovo-thinkpad-x220) just as a joke on eBay to test Linux distributions and play around with things and not destroy my main machine. Little to my knowledge I felt in love with it. Man, they really made awesome machines back then. 8I recently bought [ThinkPad X220](https://www.laptopmag.com/reviews/laptops/lenovo-thinkpad-x220)
9just as a joke on eBay to test Linux distributions and play around with things
10and not destroy my main machine. Little to my knowledge I felt in love with it.
11Man, they really made awesome machines back then.
9 12
10After changing disk that came with it to SSD and installing Ubuntu to test if everything works I noticed that even after a single touch of my external mouse the system would wake up from sleep even though the lid was shut down. 13After changing disk that came with it to SSD and installing Ubuntu to test if 
14everything works I noticed that even after a single touch of my external mouse
15the system would wake up from sleep even though the lid was shut down.
11 16
12I wouldn't even noticed it if laptop didn't have [LED sleep indicator](https://support.lenovo.com/lk/en/solutions/~/media/Images/ContentImages/p/pd025386_x1_status_03.ashx?w=426&h=262). I already had a bad experience with Linux and it's power management. I had a [Dell Inspiron 7537](https://www.pcmag.com/reviews/dell-inspiron-15-7537) laptop with a touchscreen and while traveling it decided to wake up and started cooking in my backpack to the point that the digitizer responsible for touch actually glue off and the whole screen got wrecked. So, I am a bit touchy about this. 17I wouldn't even noticed it if laptop didn't have
18[LED sleep indicator](https://support.lenovo.com/lk/en/solutions/~/media/Images/ContentImages/p/pd025386_x1_status_03.ashx?w=426&h=262).
19I already had a bad experience with Linux and it's power management. I had a
20[Dell Inspiron 7537](https://www.pcmag.com/reviews/dell-inspiron-15-7537) laptop
21with a touchscreen and while traveling it decided to wake up and started cooking
22in my backpack to the point that the digitizer responsible for touch actually
23glue off and the whole screen got wrecked. So, I am a bit touchy about this.
13 24
14I went on solution hunting and to my surprise there is no easy way to disable specific devices to perform wake up. Why is this not under the power management tab in setting is really strange. 25I went on solution hunting and to my surprise there is no easy way to disable
26specific devices to perform wake up. Why is this not under the power management 
27tab in setting is really strange.
15 28
16After googling for a solution I found [this nice article describing the solution](https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/) that worked for me. The only problem with this solution was that he added his solution to `.bashrc` and this triggers `sudo` that asks for a password each time new terminal is opened, which get annoying quickly since I open a lot of terminals all the time. 29After googling for a solution I found [this nice article describing the solution](https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/)
30that worked for me. The only problem with this solution was that he added his
31solution to `.bashrc` and this triggers `sudo` that asks for a password each
32time new terminal is opened, which get annoying quickly since I open a lot of
33terminals all the time.
17 34
18I followed his instructions and got to solution `sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.1/power/wakeup"`. 35I followed his instructions and got to solution
36`sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.1/power/wakeup"`.
19 37
20I created a system service file `sudo nano /etc/systemd/system/disable-mouse-wakeup.service` and removed `sudo` and replaced `sh` with `/usr/bin/sh` and pasted all that in `ExecStart`. 38I created a system service file `sudo nano /etc/systemd/system/disable-mouse-wakeup.service`
39and removed `sudo` and replaced `sh` with `/usr/bin/sh` and pasted all that
40in `ExecStart`.
21 41
22```ini 42```ini
23[Unit] 43[Unit]
@@ -44,4 +64,8 @@ sudo systemctl start disable-mouse-wakeup.service
44sudo systemctl status disable-mouse-wakeup.service 64sudo systemctl status disable-mouse-wakeup.service
45``` 65```
46 66
47This will permanently disable that device from wakeing up you computer on boot. If you have many devices you would like to surpress from waking up your machine I would create a shell script and call that instead of direclty doing it in service file. 67This will permanently disable that device from wakeing up you computer on boot.
68If you have many devices you would like to surpress from waking up your machine
69I would create a shell script and call that instead of direclty doing it in
70service file.
71
diff --git a/content/posts/2020-09-06-esp-and-micropython.md b/content/posts/2020-09-06-esp-and-micropython.md
index 481be0a..ac79a6d 100644
--- a/content/posts/2020-09-06-esp-and-micropython.md
+++ b/content/posts/2020-09-06-esp-and-micropython.md
@@ -1,34 +1,45 @@
1--- 1---
2title: Getting started with MicroPython and ESP8266 2title: Getting started with MicroPython and ESP8266
3url: esp8266-and-micropython-guide.html 3url: esp8266-and-micropython-guide.html
4date: 2020-09-06 4date: 2020-09-06T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Introduction 8## Introduction
9 9
10A while ago I bought some [ESP8266](https://www.espressif.com/en/products/socs/esp8266) and [ESP32](https://www.espressif.com/en/products/socs/esp32) dev boards to play around with and I finally found a project to try it out. 10A while ago I bought some [ESP8266](https://www.espressif.com/en/products/socs/esp8266)
11and [ESP32](https://www.espressif.com/en/products/socs/esp32) dev boards to
12play around with and I finally found a project to try it out.
11 13
12For my project, I used [ESP32](https://www.espressif.com/en/products/socs/esp32) but I could easily choose [ESP8266](https://www.espressif.com/en/products/socs/esp8266). This guide contains which tools I use and how I prepared my workspace to code for [ESP8266](https://www.espressif.com/en/products/socs/esp8266). 14For my project, I used [ESP32](https://www.espressif.com/en/products/socs/esp32)
15but I could easily choose [ESP8266](https://www.espressif.com/en/products/socs/esp8266).
16This guide contains which tools I use and how I prepared my workspace to code
17for [ESP8266](https://www.espressif.com/en/products/socs/esp8266).
13 18
14![ESP8266 and ESP32 boards](/assets/esp8366-micropython/boards.jpg) 19![ESP8266 and ESP32 boards](/assets/esp8366-micropython/boards.jpg)
15 20
16This guide covers: 21This guide covers:
22
17- flashing SOC 23- flashing SOC
18- install proper tooling 24- install proper tooling
19- deploying a simple script 25- deploying a simple script
20 26
21> Make sure that you are using **a good USB cable**. I had some problems with mine and once I replaced it everything started to work. 27> Make sure that you are using **a good USB cable**. I had some problems with
28mine and once I replaced it everything started to work.
22 29
23## Flashing the SOC 30## Flashing the SOC
24 31
25Plug your ESP8266 to USB port and check if the device was recognized with executing `dmesg | grep ch341-uart`. 32Plug your ESP8266 to USB port and check if the device was recognized with
33executing `dmesg | grep ch341-uart`.
26 34
27Then check if the device is available under `/dev/` by running `ls /dev/ttyUSB*`. 35Then check if the device is available under `/dev/` by running `ls /dev/ttyUSB*`.
28 36
29> **Linux users**: if a device is not available be sure you are in `dialout` group. You can check this by executing `groups $USER`. You can add a user to `dialout` group with `sudo adduser $USER dialout`. 37> **Linux users**: if a device is not available be sure you are in `dialout`
38> group. You can check this by executing `groups $USER`. You can add a user to
39> `dialout` group with `sudo adduser $USER dialout`.
30 40
31After these conditions are meet go to the navigate to [https://micropython.org/download/esp8266/](https://micropython.org/download/esp8266/) and download `esp8266-20200902-v1.13.bin`. 41After these conditions are meet go to the navigate to [https://micropython.org/download/esp8266/](https://micropython.org/download/esp8266/)
42and download `esp8266-20200902-v1.13.bin`.
32 43
33```sh 44```sh
34mkdir esp8266-test 45mkdir esp8266-test
@@ -37,7 +48,8 @@ cd esp8266-test
37wget https://micropython.org/resources/firmware/esp8266-20200902-v1.13.bin 48wget https://micropython.org/resources/firmware/esp8266-20200902-v1.13.bin
38``` 49```
39 50
40After obtaining firmware we will need some tooling to flash the firmware to the board. 51After obtaining firmware we will need some tooling to flash the firmware to
52the board.
41 53
42```sh 54```sh
43sudo pip3 install esptool 55sudo pip3 install esptool
@@ -45,7 +57,8 @@ sudo pip3 install esptool
45 57
46You can read more about `esptool` at [https://github.com/espressif/esptool/](https://github.com/espressif/esptool/). 58You can read more about `esptool` at [https://github.com/espressif/esptool/](https://github.com/espressif/esptool/).
47 59
48Before flashing the firmware we need to erase the flash on device. Substitute `USB0` with the device listed in output of `ls /dev/ttyUSB*`. 60Before flashing the firmware we need to erase the flash on device. Substitute
61`USB0` with the device listed in output of `ls /dev/ttyUSB*`.
49 62
50```sh 63```sh
51esptool.py --port /dev/ttyUSB0 erase_flash 64esptool.py --port /dev/ttyUSB0 erase_flash
@@ -57,9 +70,11 @@ If flash was successfully erased it is now time to flash the new firmware to it.
57esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20200902-v1.13.bin 70esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20200902-v1.13.bin
58``` 71```
59 72
60If everything went ok you can try accessing MicroPython REPL with `screen /dev/ttyUSB0 115200` or `picocom /dev/ttyUSB0 -b115200`. 73If everything went ok you can try accessing MicroPython REPL with `
74screen /dev/ttyUSB0 115200` or `picocom /dev/ttyUSB0 -b115200`.
61 75
62> Sometimes you will need to press `ENTER` in `screen` or `picocom` to access REPL. 76> Sometimes you will need to press `ENTER` in `screen` or `picocom` to access
77> REPL.
63 78
64When you are in REPL you can test if all is working properly following steps. 79When you are in REPL you can test if all is working properly following steps.
65 80
@@ -68,7 +83,8 @@ When you are in REPL you can test if all is working properly following steps.
68> machine.freq() 83> machine.freq()
69``` 84```
70 85
71This should output a number representing a frequency of the CPU (mine was `80000000`). 86This should output a number representing a frequency of the CPU (mine was
87`80000000`).
72 88
73When you are in `screen` or `picocom` these can help you a bit. 89When you are in `screen` or `picocom` these can help you a bit.
74 90
@@ -81,7 +97,8 @@ When you are in `screen` or `picocom` these can help you a bit.
81 97
82## Install better tooling 98## Install better tooling
83 99
84Now, to make our lives a little bit easier there are couple of additional tools that will make this whole experience a little more bearable. 100Now, to make our lives a little bit easier there are couple of additional tools
101that will make this whole experience a little more bearable.
85 102
86There are twq cool ways of uploading local files to SOC flash. 103There are twq cool ways of uploading local files to SOC flash.
87 104
@@ -113,7 +130,8 @@ ampy --delay 2 --port /dev/ttyUSB0 cat boot.py
113 130
114### rshell 131### rshell
115 132
116Even though `ampy` is a cool tool I opted with `rshell` in the end since it's much more polished and feature rich. 133Even though `ampy` is a cool tool I opted with `rshell` in the end since it's
134much more polished and feature rich.
117 135
118```bash 136```bash
119# installing ampy 137# installing ampy
@@ -126,7 +144,9 @@ Now that `rshell` is installed we can connect to the board.
126rshell --buffer-size=30 -p /dev/ttyUSB0 -a 144rshell --buffer-size=30 -p /dev/ttyUSB0 -a
127``` 145```
128 146
129This will open a shell inside bash and from here you can execute multiple commands. You can check what is supported with `help` once you are inside of a shell. 147This will open a shell inside bash and from here you can execute multiple
148commands. You can check what is supported with `help` once you are inside of
149a shell.
130 150
131```bash 151```bash
132m@turing ~/Junk/esp8266-test 152m@turing ~/Junk/esp8266-test
@@ -151,11 +171,14 @@ boards cd cp echo exit filetype ls repl rsync
151Use Control-D (or the exit command) to exit rshell. 171Use Control-D (or the exit command) to exit rshell.
152``` 172```
153 173
154> Inside a shell `ls` will display list of files on your machine. To get list of files on flash folder `/pyboard` is remapped inside the shell. To list files on flash you must perform `ls /pyboard`. 174> Inside a shell `ls` will display list of files on your machine. To get list
175> of files on flash folder `/pyboard` is remapped inside the shell. To list files
176> on flash you must perform `ls /pyboard`.
155 177
156#### Moving files to flash 178#### Moving files to flash
157 179
158To avoid copying files all the time I used `rsync` function from the inside of `rshell`. 180To avoid copying files all the time I used `rsync` function from the
181inside of `rshell`.
159 182
160```bash 183```bash
161rsync . /pyboard 184rsync . /pyboard
@@ -163,9 +186,11 @@ rsync . /pyboard
163 186
164#### Executing scripts 187#### Executing scripts
165 188
166It is a pain to continuously reboot the device to trigger `/pyboard/boot.py` and there is a better way of testing local scripts on remote device. 189It is a pain to continuously reboot the device to trigger `/pyboard/boot.py`
190and there is a better way of testing local scripts on remote device.
167 191
168Lets assume we have `src/freq.py` file that displays CPU frequency of a remote device. 192Lets assume we have `src/freq.py` file that displays CPU frequency of a
193remote device.
169 194
170```py 195```py
171# src/freq.py 196# src/freq.py
@@ -191,5 +216,6 @@ repl
191 216
192## Additional resources 217## Additional resources
193 218
194- [https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/](https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/) 219- https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/
195- [http://docs.micropython.org/en/latest/esp8266/quickref.html](http://docs.micropython.org/en/latest/esp8266/quickref.html) 220- http://docs.micropython.org/en/latest/esp8266/quickref.html
221
diff --git a/content/posts/2020-09-08-bind-warning-on-login.md b/content/posts/2020-09-08-bind-warning-on-login.md
index 62c421d..d5d725e 100644
--- a/content/posts/2020-09-08-bind-warning-on-login.md
+++ b/content/posts/2020-09-08-bind-warning-on-login.md
@@ -1,15 +1,23 @@
1--- 1---
2title: Fix bind warning in .profile on login in Ubuntu 2title: Fix bind warning in .profile on login in Ubuntu
3url: bind-warning-on-login-in-ubuntu.html 3url: bind-warning-on-login-in-ubuntu.html
4date: 2020-09-08 4date: 2020-09-08T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Recently I moved back to [bash](https://www.gnu.org/software/bash/) as my default shell. I was previously using [fish](https://fishshell.com/) and got used to the cool features it has. But, regardless of that, I wanted to move to a more standard shell because I was hopping back and forth with exporting variables and stuff like that which got pretty annoying. 8Recently I moved back to [bash](https://www.gnu.org/software/bash/) as my
9default shell. I was previously using [fish](https://fishshell.com/) and got
10used to the cool features it has. But, regardless of that, I wanted to move to
11a more standard shell because I was hopping back and forth with exporting
12variables and stuff like that which got pretty annoying.
9 13
10So I embarked on a mission to make [bash](https://www.gnu.org/software/bash/) more like [fish](https://fishshell.com/) and in the process found that I really missed autosuggest with TAB on changing directories. 14So I embarked on a mission to make [bash](https://www.gnu.org/software/bash/)
15more like [fish](https://fishshell.com/) and in the process found that I really
16missed autosuggest with TAB on changing directories.
11 17
12I found a nice alternative that emulates [zsh](http://zsh.sourceforge.net/) like autosuggestion and autocomplete so I added the following to my `.bashrc` file. 18I found a nice alternative that emulates [zsh](http://zsh.sourceforge.net/)
19like autosuggestion and autocomplete so I added the following to my `.bashrc`
20file.
13 21
14```bash 22```bash
15bind "TAB:menu-complete" 23bind "TAB:menu-complete"
@@ -19,13 +27,18 @@ bind "set menu-complete-display-prefix on"
19bind '"\e[Z":menu-complete-backward' 27bind '"\e[Z":menu-complete-backward'
20``` 28```
21 29
22I haven't noticed anything wrong with this and all was working fine until I restarted my machine and then I got this error. 30I haven't noticed anything wrong with this and all was working fine until I
31restarted my machine and then I got this error.
23 32
24![Profile bind error](/assets/profile-bind-error/error.jpg) 33![Profile bind error](/assets/profile-bind-error/error.jpg)
25 34
26When I pressed OK, I got into the [Gnome shell](https://wiki.gnome.org/Projects/GnomeShell) and all was working fine, but the error was still bugging me. I started looking for the reason why this is happening and found a solution to this error on [Remote SSH Commands - bash bind warning: line editing not enabled](https://superuser.com/a/892682). 35When I pressed OK, I got into the [Gnome shell](https://wiki.gnome.org/Projects/GnomeShell)
36and all was working fine, but the error was still bugging me. I started looking
37for the reason why this is happening and found a solution to this error on
38[Remote SSH Commands - bash bind warning: line editing not enabled](https://superuser.com/a/892682).
27 39
28So I added a simple `if [ -t 1 ]` around `bind` statements to avoid running commands that presume the session is interactive when it isn't. 40So I added a simple `if [ -t 1 ]` around `bind` statements to avoid running
41commands that presume the session is interactive when it isn't.
29 42
30```bash 43```bash
31if [ -t 1 ]; then 44if [ -t 1 ]; then
@@ -38,3 +51,4 @@ fi
38``` 51```
39 52
40After logging out and back in the problem was gone. 53After logging out and back in the problem was gone.
54
diff --git a/content/posts/2020-09-09-digitalocean-sync.md b/content/posts/2020-09-09-digitalocean-sync.md
index e7da657..2eeea2e 100644
--- a/content/posts/2020-09-09-digitalocean-sync.md
+++ b/content/posts/2020-09-09-digitalocean-sync.md
@@ -1,43 +1,80 @@
1--- 1---
2title: Using Digitalocean Spaces to sync between computers 2title: Using Digitalocean Spaces to sync between computers
3url: digitalocean-spaces-to-sync-between-computers.html 3url: digitalocean-spaces-to-sync-between-computers.html
4date: 2020-09-09 4date: 2020-09-09T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I've been using [Dropbox](https://www.dropbox.com/) for probably **10+ years** now and I-ve became so used to it that it runs in the background that I don't even imagine a world without it. But it's not without problems. 8I've been using [Dropbox](https://www.dropbox.com/) for probably **10+ years**
9 9now and I-ve became so used to it that it runs in the background that I don't
10At first I had problems with `.venv` environments for Python and the only solution for excluding synchronization for this folder was to manually exclude a specific folder which is not really scalable. FYI, my whole project folder is synced on [Dropbox](https://www.dropbox.com/). This of course introduced a lot of syncing of files and folders that are not needed or even break things on other machines. In the case of **Python**, I couldn't use that on my second machine. I needed to delete `.venv` folder and pip it again which synced files again to the main machine. This was very frustrating. **Nodejs** handles this much nicer and I can just run the scripts without deleting `node_modules` again and reinstalling. However, `node_modules` is a beast of its own. It creates so many files that OS has a problem counting them when you check the folder contents for size. 10even imagine a world without it. But it's not without problems.
11 11
12I wanted something similar to Dropbox. I could without the instant syncing but it would need to be fast and had the option for me to exclude folders like `node_modules, .venv, .git` and folders like that. 12At first I had problems with `.venv` environments for Python and the only
13 13solution for excluding synchronization for this folder was to manually exclude
14I went on a hunt for an alternative to [Dropbox](https://www.dropbox.com/) and found: 14a specific folder which is not really scalable. FYI, my whole project folder is
15synced on [Dropbox](https://www.dropbox.com/). This of course introduced a lot
16of syncing of files and folders that are not needed or even break things on
17other machines. In the case of **Python**, I couldn't use that on my second
18machine. I needed to delete `.venv` folder and pip it again which synced files
19again to the main machine. This was very frustrating. **Nodejs** handles this
20much nicer and I can just run the scripts without deleting `node_modules` again
21and reinstalling. However, `node_modules` is a beast of its own. It creates so
22many files that OS has a problem counting them when you check the folder
23contents for size.
24
25I wanted something similar to Dropbox. I could without the instant syncing
26but it would need to be fast and had the option for me to exclude folders like
27`node_modules, .venv, .git` and folders like that.
28
29I went on a hunt for an alternative to [Dropbox](https://www.dropbox.com/)
30and found:
15 31
16- [Tresorit](https://tresorit.com/) 32- [Tresorit](https://tresorit.com/)
17- [Sync.com](https://sync.com) 33- [Sync.com](https://sync.com)
18- [Box](https://www.box.com/) 34- [Box](https://www.box.com/)
19 35
20You know, the usual list of suspects. I didn't include [Google drive](https://drive.google.com) or [One drive](https://onedrive.live.com/) since they are even more draconian than Dropbox. 36You know, the usual list of suspects. I didn't include [Google drive](https://drive.google.com)
37or [One drive](https://onedrive.live.com/) since they are even more draconian
38than Dropbox.
21 39
22> All this does not stem from me being paranoid but recently these companies have became more and more aggressive and they keep violating our privacy when they share our data with 3rd party services. It is getting out of control. 40> All this does not stem from me being paranoid but recently these companies
41> have became more and more aggressive and they keep violating our privacy when
42> they share our data with 3rd party services. It is getting out of control.
23 43
24So, my main problem was still there. No way of excluding a specific folder from syncing. And before we go into "*But you have git, isn't that enough?*", I must say, that many of the files (PDFs, spreadsheets, etc) I have in a `git` repo don't get pushed upstream to Git and I still want to have them synced across my computers. 44So, my main problem was still there. No way of excluding a specific folder
45from syncing. And before we go into "*But you have git, isn't that enough?*",
46I must say, that many of the files (PDFs, spreadsheets, etc) I have in a `git`
47repo don't get pushed upstream to Git and I still want to have them synced
48across my computers.
25 49
26I initially wanted to use [rsync](https://linux.die.net/man/1/rsync) but I would need to then have a remote VPS or transfer between my computers directly. I wanted a solution where all my files could be accessible to me without my machine. 50I initially wanted to use [rsync](https://linux.die.net/man/1/rsync) but I
51would need to then have a remote VPS or transfer between my computers directly.
52I wanted a solution where all my files could be accessible to me without my
53machine.
27 54
28> **WARNING: This solution will cost you money!** DigitalOcean Spaces are $5 per month and there are some bandwidth limitations and if you go beyond that you get billed additionally. 55> **WARNING: This solution will cost you money!** DigitalOcean Spaces are $5
56per month and there are some bandwidth limitations and if you go beyond that
57you get billed additionally.
29 58
30Then I remembered that I could use something like [S3](https://en.wikipedia.org/wiki/Amazon_S3) since it has versioning and is fully managed. I didn't want to go down the AWS rabbit hole with this so I choose [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/). 59Then I remembered that I could use something like [S3](https://en.wikipedia.org/wiki/Amazon_S3)
60since it has versioning and is fully managed. I didn't want to go down the AWS
61rabbit hole with this so I choose [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/).
31 62
32Then I needed a command-line tool to sync between source and target. I found this nice tool [s3cmd](https://s3tools.org/s3cmd) and it is in the Ubuntu repositories. 63Then I needed a command-line tool to sync between source and target. I found
64this nice tool [s3cmd](https://s3tools.org/s3cmd) and it is in the Ubuntu
65repositories.
33 66
34```bash 67```bash
35sudo apt install s3cmd 68sudo apt install s3cmd
36``` 69```
37 70
38After installation will I create a new Space bucket on DigitalOcean. Remember the zone you will choose because you will need it when you will configure `s3cmd`. 71After installation will I create a new Space bucket on DigitalOcean. Remember
72the zone you will choose because you will need it when you will configure `s3cmd`.
39 73
40Then I visited [Digitalocean Applications & API](https://cloud.digitalocean.com/account/api/tokens) and generated **Spaces access keys**. Save both key and secret somewhere safe because when you will leave the page secret will not be available anymore to you and you will need to re-generate it. 74Then I visited [Digitalocean Applications & API](https://cloud.digitalocean.com/account/api/tokens)
75and generated **Spaces access keys**. Save both key and secret somewhere safe
76because when you will leave the page secret will not be available anymore to
77you and you will need to re-generate it.
41 78
42```bash 79```bash
43# enter your key and secret and correct endpoint 80# enter your key and secret and correct endpoint
@@ -45,7 +82,9 @@ Then I visited [Digitalocean Applications & API](https://cloud.digitalocean.com/
45# I created my bucket in Amsterdam regiin 82# I created my bucket in Amsterdam regiin
46s3cmd --configure 83s3cmd --configure
47``` 84```
48After that I played around with options for `s3cmd` and got to the following command. 85
86After that I played around with options for `s3cmd` and got to the following
87command.
49 88
50```bash 89```bash
51# I executed this command from my projects folder 90# I executed this command from my projects folder
@@ -53,12 +92,19 @@ cd projects
53s3cmd sync --delete-removed --exclude 'node_modules/*' --exclude '.git/*' --exclude '.venv/*' ./ s3://my-bucket-name/projects/ 92s3cmd sync --delete-removed --exclude 'node_modules/*' --exclude '.git/*' --exclude '.venv/*' ./ s3://my-bucket-name/projects/
54``` 93```
55 94
56When syncing int he other direction you will need to change the order of the `SOURCE` and `TARGET` to `s3://my-bucket-name/projects/` and `./`. 95When syncing int he other direction you will need to change the order of the
96`SOURCE` and `TARGET` to `s3://my-bucket-name/projects/` and `./`.
97
98> Be sure that all the paths have trailing slash so that sync knows that this
99> are directories.
57 100
58> Be sure that all the paths have trailing slash so that sync knows that this are directories. 101I am planning to implement some sort of a `.ignore` file that will enable me to
102have a project-specific exclude options.
59 103
60I am planning to implement some sort of a `.ignore` file that will enable me to have a project-specific exclude options. 104I am currently running this every hour as a cronjob which is perfectly fine
105for now when I am testing how this whole thing works and how it all will turn
106out.
61 107
62I am currently running this every hour as a cronjob which is perfectly fine for now when I am testing how this whole thing works and how it all will turn out. 108I have also created a small Gnome extension which is still very unstable, but
109when/if this whole experiment pays of I will share on Github.
63 110
64I have also created a small Gnome extension which is still very unstable, but when/if this whole experiment pays of I will share on Github.
diff --git a/content/posts/2021-01-24-replacing-dropbox-with-s3.md b/content/posts/2021-01-24-replacing-dropbox-with-s3.md
index f44aa63..0253368 100644
--- a/content/posts/2021-01-24-replacing-dropbox-with-s3.md
+++ b/content/posts/2021-01-24-replacing-dropbox-with-s3.md
@@ -1,25 +1,41 @@
1--- 1---
2title: Replacing Dropbox in favor of DigitalOcean spaces 2title: Replacing Dropbox in favor of DigitalOcean spaces
3url: replacing-dropbox-in-favor-of-digitalocean-spaces.html 3url: replacing-dropbox-in-favor-of-digitalocean-spaces.html
4date: 2021-01-24 4date: 2021-01-24T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8A few months ago I experimented with DigitalOcean spaces as my backup solution that could [replace Dropbox eventually](/digitalocean-spaces-to-sync-between-computers.html). That solution worked quite nicely, and I was amazed how smashing together a couple of existing solutions would work this fine. 8A few months ago I experimented with DigitalOcean spaces as my backup solution
9that could [replace Dropbox eventually](/digitalocean-spaces-to-sync-between-computers.html).
10That solution worked quite nicely, and I was amazed how smashing together a
11couple of existing solutions would work this fine.
9 12
10I have been running that solution in the background for a couple of months now and kind of forgot about it. But recent developments around deplatforming and having us people hostages of technology and big companies speed up my goals to become less dependent on [Google](https://edition.cnn.com/2020/12/17/tech/google-antitrust-lawsuit/index.html), [Dropbox](https://www.pcworld.com/article/2048680/dropbox-takes-a-peek-at-files.html) etc and take back some control. 13I have been running that solution in the background for a couple of months now
14and kind of forgot about it. But recent developments around deplatforming and
15having us people hostages of technology and big companies speed up my goals to
16become less dependent on [Google](https://edition.cnn.com/2020/12/17/tech/google-antitrust-lawsuit/index.html),
17[Dropbox](https://www.pcworld.com/article/2048680/dropbox-takes-a-peek-at-files.html)
18etc and take back some control.
11 19
12I am not a conspiracy theory nut, but to be honest, what these companies are doing lately is out of control. It is a matter of principle at this point. I have almost completely degoogled my life all the way from ditching Gmail, YouTube and most of the services surrounding Google. And I must tell you, I feel so good. I haven't felt this way for a long time. 20I am not a conspiracy theory nut, but to be honest, what these companies are
21doing lately is out of control. It is a matter of principle at this point. I
22have almost completely degoogled my life all the way from ditching Gmail,
23YouTube and most of the services surrounding Google. And I must tell you, I
24feel so good. I haven't felt this way for a long time.
13 25
14**Anyways. Let's get to the meat of things.** 26**Anyways. Let's get to the meat of things.**
15 27
16Before you continue you should read my post about [syncing to Dropbox](/digitalocean-spaces-to-sync-between-computers.html). 28Before you continue you should read my post about [syncing to Dropbox](/digitalocean-spaces-to-sync-between-computers.html).
17 29
18> Also to note, I am using Linux on my machine with Gnome desktop environment. This should work on MacOS too. To use this on Windows I suggest using [Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10) or [Cygwin](https://www.cygwin.com/). 30> Also to note, I am using Linux on my machine with Gnome desktop environment.
31This should work on MacOS too. To use this on Windows I suggest using
32[Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10)
33or [Cygwin](https://www.cygwin.com/).
19 34
20## Folder structure 35## Folder structure
21 36
22I liked structure from Dropbox. One folder where everything is located and synced. So, that's why adopted this also for my sync setup. 37I liked structure from Dropbox. One folder where everything is located and
38synced. So, that's why adopted this also for my sync setup.
23 39
24```go 40```go
25~/Vault 41~/Vault
@@ -29,7 +45,11 @@ I liked structure from Dropbox. One folder where everything is located and synce
29 ↳ projects 45 ↳ projects
30``` 46```
31 47
32All of my code is located in `~/Vault/projects` folder. And most of the projects are Git repositories. I do not use this sync method for backup per see but in case I reinstall my machine I can easily recreate all the important folder structure with one quick command. No external drives needed that can fail etc. 48All of my code is located in `~/Vault/projects` folder. And most of the
49projects are Git repositories. I do not use this sync method for backup per
50see but in case I reinstall my machine I can easily recreate all the important
51folder structure with one quick command. No external drives needed that can
52fail etc.
33 53
34## Sync script 54## Sync script
35 55
@@ -66,9 +86,12 @@ notify-send \
66 "Vault sync succeded at `date +"%D %T"`" 86 "Vault sync succeded at `date +"%D %T"`"
67``` 87```
68 88
69This script also backups some of the dotfiles I use and sends notification to Gnome notification center. It is a straightforward solution. Nothing special going on. 89This script also backups some of the dotfiles I use and sends notification to
90Gnome notification center. It is a straightforward solution. Nothing special
91going on.
70 92
71> One obvious benefit of this is that I can omit syncing Node's `node_modules` or Python's `.venv` and `.git` folders. 93> One obvious benefit of this is that I can omit syncing Node's `node_modules`
94> or Python's `.venv` and `.git` folders.
72 95
73You can use this script in a combination with [Cron](https://en.wikipedia.org/wiki/Cron). 96You can use this script in a combination with [Cron](https://en.wikipedia.org/wiki/Cron).
74 97
@@ -76,13 +99,14 @@ You can use this script in a combination with [Cron](https://en.wikipedia.org/wi
760 2 * * * sh ~/Vault/bin/vault-backup.sh 990 2 * * * sh ~/Vault/bin/vault-backup.sh
77``` 100```
78 101
79When you start syncing your local stuff with a remote server you can review your items on DigitalOcean. 102When you start syncing your local stuff with a remote server you can review
103your items on DigitalOcean.
80 104
81![Dropbox Spaces](/assets/dropbox-sync/dropbox-spaces.png) 105![Dropbox Spaces](/assets/dropbox-sync/dropbox-spaces.png)
82 106
83I have been using this script now for quite some time, and it's working flawlessly. I also uninstalled Dropbox and stopped using it completely. 107I have been using this script now for quite some time, and it's working
84 108flawlessly. I also uninstalled Dropbox and stopped using it completely.
85All I need to do is write a Bash script that does the reverse and downloads from remote server to local folder. This could be another post.
86
87 109
110All I need to do is write a Bash script that does the reverse and downloads
111from remote server to local folder. This could be another post.
88 112
diff --git a/content/posts/2021-01-25-goaccess.md b/content/posts/2021-01-25-goaccess.md
index e8fcee3..efbd175 100644
--- a/content/posts/2021-01-25-goaccess.md
+++ b/content/posts/2021-01-25-goaccess.md
@@ -1,28 +1,42 @@
1--- 1---
2title: Using GoAccess with Nginx to replace Google Analytics 2title: Using GoAccess with Nginx to replace Google Analytics
3url: using-goaccess-with-nginx-to-replace-google-analytics.html 3url: using-goaccess-with-nginx-to-replace-google-analytics.html
4date: 2021-01-25 4date: 2021-01-25T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Introduction 8## Introduction
9 9
10I know! You cannot simply replace Google Analytics with parsing access logs and displaying a couple of charts. But to be honest, I actually never used Google Analytics to the fullest extent and was usually interested in seeing page hits and which pages were visited most often. 10I know! You cannot simply replace Google Analytics with parsing access logs and
11displaying a couple of charts. But to be honest, I actually never used Google
12Analytics to the fullest extent and was usually interested in seeing page
13hits and which pages were visited most often.
11 14
12I recently moved my blog from Firebase to a VPS and also decided to remove Google Analytics tracking code from the site since its quite malicious and tracks users across other pages also and is creating a profile of a user, and I've had it. But I also need some insight of what is happening on a server and which content is being read the most etc. 15I recently moved my blog from Firebase to a VPS and also decided to remove
16Google Analytics tracking code from the site since its quite malicious and
17tracks users across other pages also and is creating a profile of a user, and
18I've had it. But I also need some insight of what is happening on a server
19and which content is being read the most etc.
13 20
14I have looked at many existing solutions like: 21I have looked at many existing solutions like:
22
15- [Umami](https://umami.is/) 23- [Umami](https://umami.is/)
16- [Freshlytics](https://github.com/sheshbabu/freshlytics) 24- [Freshlytics](https://github.com/sheshbabu/freshlytics)
17- [Matomo](https://matomo.org/) 25- [Matomo](https://matomo.org/)
18 26
19But the more I looked at them the more I noticed that I am replacing one evil with another one. Don't get me wrong. Some of these solutions are absolutely fantastic but would require installation of databases and something like PHP or Node. And I was not ready to put those things on my fresh server. Also having Docker installed is out of the question. 27But the more I looked at them the more I noticed that I am replacing one evil
28with another one. Don't get me wrong. Some of these solutions are absolutely
29fantastic but would require installation of databases and something like PHP
30or Node. And I was not ready to put those things on my fresh server. Also
31having Docker installed is out of the question.
20 32
21## Opting for log parsing 33## Opting for log parsing
22 34
23So, I defaulted to parsing already existing logs and generating HTML reports from this data. 35So, I defaulted to parsing already existing logs and generating HTML reports
36from this data.
24 37
25I found this amazing software [GoAccess](https://goaccess.io/) which provides all the functionalities I need, and it's a single binary. Written in Go. 38I found this amazing software [GoAccess](https://goaccess.io/) which provides
39all the functionalities I need, and it's a single binary. Written in Go.
26 40
27GoAccess can be used in two different modes. 41GoAccess can be used in two different modes.
28 42
@@ -32,11 +46,15 @@ GoAccess can be used in two different modes.
32![GoAccess HTML](/assets/goaccess/goaccess-dash-html.png) 46![GoAccess HTML](/assets/goaccess/goaccess-dash-html.png)
33<center><i>Running in a browser</i></center> 47<center><i>Running in a browser</i></center>
34 48
35I, however, need this to run in a browser. So, the second option is the way to go. The Idea is to periodically run cronjob and export this report into a folder that gets then server by Nginx behind a Basic authentication. 49I, however, need this to run in a browser. So, the second option is the way
50to go. The Idea is to periodically run cronjob and export this report into a
51folder that gets then server by Nginx behind a Basic authentication.
36 52
37## Getting Nginx ready 53## Getting Nginx ready
38 54
39I choose Ubuntu on [DigitalOcean](https://www.digitalocean.com/). First I installed [Nginx](https://nginx.org/en/), and [Letsencrypt](https://letsencrypt.org/getting-started/) certbot and all the necessary dependencies. 55I choose Ubuntu on [DigitalOcean](https://www.digitalocean.com/). First I
56installed [Nginx](https://nginx.org/en/), and [Letsencrypt](https://letsencrypt.org/getting-started/)
57certbot and all the necessary dependencies.
40 58
41```sh 59```sh
42# log in as root user 60# log in as root user
@@ -49,7 +67,8 @@ apt update && apt upgrade -y
49apt install nginx certbot python3-certbot-nginx apache2-utils 67apt install nginx certbot python3-certbot-nginx apache2-utils
50``` 68```
51 69
52After all this is installed we can create a new configuration for a statistics. Stats will be available at `stats.domain.com`. 70After all this is installed we can create a new configuration for a statistics.
71Stats will be available at `stats.domain.com`.
53 72
54```sh 73```sh
55# creates directory where html will be hosted 74# creates directory where html will be hosted
@@ -71,20 +90,27 @@ server {
71} 90}
72``` 91```
73 92
74Now we check if the configuration is ok. We can do this with `nginx -t`. If all is ok, we can restart Nginx with `service nginx restart`. 93Now we check if the configuration is ok. We can do this with `nginx -t`. If
94all is ok, we can restart Nginx with `service nginx restart`.
75 95
76After all that you should add A record for this domain that points to IP of a droplet. 96After all that you should add A record for this domain that points to IP of
97a droplet.
77 98
78Before enabling SSL you should test if DNS records have propagated with `curl stats.domain.com`. 99Before enabling SSL you should test if DNS records have propagated with
100`curl stats.domain.com`.
79 101
80Now, it's time to provision TLS certificate. To achieve this, you execute command `certbot --nginx`. Follow the wizard and when you are asked about redirection always choose 2 (always redirect to HTTPS). 102Now, it's time to provision TLS certificate. To achieve this, you execute command
103`certbot --nginx`. Follow the wizard and when you are asked about redirection
104always choose 2 (always redirect to HTTPS).
81 105
82When this is done you can visit https://stats.domain.com and you should get 404 not found error which is correct. 106When this is done you can visit https://stats.domain.com and you should get 404
107not found error which is correct.
83 108
84 109
85## Getting GoAccess ready 110## Getting GoAccess ready
86 111
87If you are using Debian like system GoAccess should be available in repository. Otherwise refer to the official website. 112If you are using Debian like system GoAccess should be available in repository.
113Otherwise refer to the official website.
88 114
89```sh 115```sh
90apt install goaccess 116apt install goaccess
@@ -122,11 +148,19 @@ goaccess \
122rm /var/log/nginx/access-all.log 148rm /var/log/nginx/access-all.log
123``` 149```
124 150
125Because after a while nginx creates multiple files with access logs we use [`zcat`](https://linux.die.net/man/1/zcat) to extract Gziped contents and create a file that has all the access logs. After this file is used we delete it. 151Because after a while nginx creates multiple files with access logs we use
152[`zcat`](https://linux.die.net/man/1/zcat) to extract Gziped contents and
153create a file that has all the access logs. After this file is used we
154delete it.
126 155
127If you want to exclude your home IP's result look at the `--exclude-ip` option in script and instead of `0.0.0.0` add your own home IP address. You can find your home IP by executing `curl ifconfig.me` from your local machine and NOT from the droplet. 156If you want to exclude your home IP's result look at the `--exclude-ip` option
157in script and instead of `0.0.0.0` add your own home IP address. You can find
158your home IP by executing `curl ifconfig.me` from your local machine and NOT
159from the droplet.
128 160
129Test the script by executing `sh /var/www/html/stats.domain.com/generate-stats.sh` and then checking `https://stats.domain.com`. If you can see stats instead of 404 than you are set. 161Test the script by executing `sh /var/www/html/stats.domain.com/generate-stats.sh`
162and then checking `https://stats.domain.com`. If you can see stats instead of
163404 than you are set.
130 164
131It's time to add this script to cron with `cron -e`. 165It's time to add this script to cron with `cron -e`.
132 166
@@ -136,13 +170,17 @@ It's time to add this script to cron with `cron -e`.
136 170
137## Securing with Basic authentication 171## Securing with Basic authentication
138 172
139You probably don't want stats to be publicly available, so we should create a user and a password for Basic authentication. 173You probably don't want stats to be publicly available, so we should create a
174user and a password for Basic authentication.
140 175
141First we create a password for a user `stats` with `htpasswd -c /etc/nginx/.htpasswd stats`. 176First we create a password for a user `stats` with `htpasswd -c /etc/nginx/.htpasswd stats`.
142 177
143Now we update config file with `nano /etc/nginx/sites-available/stats.domain.com`. You probably noticed that the file looks a bit different from before. This is because `certbot` added additional rules for SSL. 178Now we update config file with `nano /etc/nginx/sites-available/stats.domain.com`.
179You probably noticed that the file looks a bit different from before. This is
180because `certbot` added additional rules for SSL.
144 181
145Your location portion the config file should now look like. You should add `auth_basic` and `auth_basic_user_file` lines to the file. 182Your location portion the config file should now look like. You should add
183`auth_basic` and `auth_basic_user_file` lines to the file.
146 184
147```nginx 185```nginx
148location / { 186location / {
@@ -152,8 +190,12 @@ location / {
152} 190}
153``` 191```
154 192
155Test if config is still ok with `nginx -t` and if it is you can restart Nginx with `service nginx restart`. 193Test if config is still ok with `nginx -t` and if it is you can restart
194Nginx with `service nginx restart`.
195
196If you now visit `https://stats.domain.com` you should be prompted for username
197and password. If not, try reopening your browser.
156 198
157If you now visit `https://stats.domain.com` you should be prompted for username and password. If not, try reopening your browser. 199That is all. You now have analytics for your server that gets refreshed every
20010 minutes.
158 201
159That is all. You now have analytics for your server that gets refreshed every 10 minutes.
diff --git a/content/posts/2021-06-26-simple-world-clock.md b/content/posts/2021-06-26-simple-world-clock.md
index 80d1e32..f42af11 100644
--- a/content/posts/2021-06-26-simple-world-clock.md
+++ b/content/posts/2021-06-26-simple-world-clock.md
@@ -1,21 +1,31 @@
1--- 1---
2title: Simple world clock with eInk display and Raspberry Pi Zero 2title: Simple world clock with eInk display and Raspberry Pi Zero
3url: simple-world-clock-with-eiink-display-and-raspberry-pi-zero.html 3url: simple-world-clock-with-eiink-display-and-raspberry-pi-zero.html
4date: 2021-06-26 4date: 2021-06-26T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Our team is spread across the world, from the USA all the way to Australia, so having some sort of world clock makes sense. 8Our team is spread across the world, from the USA all the way to Australia,
9so having some sort of world clock makes sense.
9 10
10Currently, I am using an extension for Gnome called [Timezone extension](https://extensions.gnome.org/extension/2657/timezones-extension/), and it serves the purpose quite well. 11Currently, I am using an extension for Gnome called
12[Timezone extension](https://extensions.gnome.org/extension/2657/timezones-extension/),
13and it serves the purpose quite well.
11 14
12But I also have a bunch of electronics that I bought through the time, and I am not using any of them, and it's time to stop hording this stuff and use it in a project. 15But I also have a bunch of electronics that I bought through the time, and I
16am not using any of them, and it's time to stop hording this stuff and use it
17in a project.
13 18
14A while ago I bought a small eInk display [Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) and I have a bunch of [Raspberry Pi's Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/) lying around that I really need to use. 19A while ago I bought a small eInk display
20[Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811)
21and I have a bunch of [Raspberry Pi's Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/)
22lying around that I really need to use.
15 23
16![Inky pHAT, Raspberry Pi Zero](/assets/world-clock/hardware.jpg) 24![Inky pHAT, Raspberry Pi Zero](/assets/world-clock/hardware.jpg)
17 25
18Since the Inky [Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) is essentially a HAT, it can easily be added on top of the [Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/). 26Since the Inky [Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811)
27is essentially a HAT, it can easily be added on top of the
28[Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/).
19 29
20First, I installed the necessary software on Raspberry Pi with `pip3 install inky`. 30First, I installed the necessary software on Raspberry Pi with `pip3 install inky`.
21 31
@@ -66,7 +76,8 @@ board.set_image(img)
66board.show() 76board.show()
67``` 77```
68 78
69And because eInk displays are rather slow to refresh and the clock requires refreshing only once a minute, this can be done through cronjob. 79And because eInk displays are rather slow to refresh and the clock requires
80refreshing only once a minute, this can be done through cronjob.
70 81
71Before we add this job to cron we need to make `clock.py` executable with `chmod +x clock.py`. 82Before we add this job to cron we need to make `clock.py` executable with `chmod +x clock.py`.
72 83
@@ -80,8 +91,13 @@ So, we end up with a result like this.
80 91
81![World Clock](/assets/world-clock/world-clock.jpg) 92![World Clock](/assets/world-clock/world-clock.jpg)
82 93
83And for the enclosure that can be 3D printed, but I haven't yet something like this can be used. 94And for the enclosure that can be 3D printed, but I haven't yet something like
95this can be used.
84 96
85<iframe id="vs_iframe" src="https://www.viewstl.com/?embedded&url=https%3A%2F%2Fmitjafelicijan.com%2Fassets%2Fworld-clock%2Fenclosure.stl&color=gray&bgcolor=white&edges=no&orientation=front&noborder=no" style="border:0;margin:0;width:100%;height:400px;"></iframe> 97<iframe id="vs_iframe" src="https://www.viewstl.com/?embedded&url=https%3A%2F%2Fmitjafelicijan.com%2Fassets%2Fworld-clock%2Fenclosure.stl&color=gray&bgcolor=white&edges=no&orientation=front&noborder=no" style="border:0;margin:0;width:100%;height:400px;"></iframe>
86 98
87You can download my [STL file for the enclosure here](/assets/world-clock/enclosure.stl), but make sure that dimensions make sense and also opening for USB port should be added or just use a drill and some hot glue to make it stick in the enclosure. 99You can download my [STL file for the enclosure here](/assets/world-clock/enclosure.stl),
100but make sure that dimensions make sense and also opening for USB port should
101be added or just use a drill and some hot glue to make it stick in the
102enclosure.
103
diff --git a/content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md b/content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md
index 85b6c91..27e0905 100644
--- a/content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md
+++ b/content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md
@@ -1,34 +1,104 @@
1--- 1---
2title: My journey from being an internet über consumer to being a full hominum again 2title: My journey from being an internet über consumer to being a full hominum again
3url: from-internet-consumer-to-full-hominum-again.html 3url: from-internet-consumer-to-full-hominum-again.html
4date: 2021-07-30 4date: 2021-07-30T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8It's been almost a year since I started purging all my online accounts and going down this rabbit hole of being almost independent of the current internet machine. Even though I initially thought that I will have problems adapting, I was pleasantly surprised that the transition went so smoothly. Even better, it brought many benefits to my life. Such as increased focus, less stress about trivial things, etc. 8It's been almost a year since I started purging all my online accounts and
9going down this rabbit hole of being almost independent of the current internet
10machine. Even though I initially thought that I will have problems adapting,
11I was pleasantly surprised that the transition went so smoothly. Even better,
12it brought many benefits to my life. Such as increased focus, less stress
13about trivial things, etc.
9 14
10It all started with me doing small changes like unsubscribing from emails that I have either subscribed to by accepting terms and conditions. Or even some more malicious emails that I was getting because I was on a shared mailing list. And the later ones I hate the most of all. How the hell do they keep sharing my email and sending me unsolicited emails and get away with it? I have a suspicion that these marketing people share an Excel file between them and keep resubscribing me when they import lists into Mailchimp or similar software. 15It all started with me doing small changes like unsubscribing from emails that
16I have either subscribed to by accepting terms and conditions. Or even some
17more malicious emails that I was getting because I was on a shared mailing
18list. And the later ones I hate the most of all. How the hell do they keep
19sharing my email and sending me unsolicited emails and get away with it? I
20have a suspicion that these marketing people share an Excel file between them
21and keep resubscribing me when they import lists into Mailchimp or similar
22software.
11 23
12It's fascinating to see how much crap you get subscribed to when you are not paying attention. It got so bad that my primary Gmail address is a full of junk and need constant monitoring and cleaning up. And because I want to have Inbox Zero, this presents an additional problem for me. 24It's fascinating to see how much crap you get subscribed to when you are not
25paying attention. It got so bad that my primary Gmail address is a full of junk
26and need constant monitoring and cleaning up. And because I want to have Inbox
27Zero, this presents an additional problem for me.
13 28
14The stress that email presented for me didn't occur to me for a long time. I was noticing that I was unable to go through one single hour without hysterically refreshing email. And if somebody wrote me something, I needed to see it right then, even though I didn't immediately reply to it. I can only describe this with FOMO (fear of missing out). I have no other explanation than that. It was crippling, and I was constantly context switching, which I will address further down this post in more details. 29The stress that email presented for me didn't occur to me for a long time. I
30was noticing that I was unable to go through one single hour without
31hysterically refreshing email. And if somebody wrote me something, I needed
32to see it right then, even though I didn't immediately reply to it. I can
33only describe this with FOMO (fear of missing out). I have no other explanation
34than that. It was crippling, and I was constantly context switching, which I
35will address further down this post in more details.
15 36
16This was one of the reasons why I spawned up my personal email server, and I am using it now as my primary and person email. I still have Gmail as my “junk” email that I use for throw away stuff. I log in to Gmail once a week and check if there are any important emails that I got, but apart from that, it's sitting dormant and collecting dust. 37This was one of the reasons why I spawned up my personal email server, and I
38am using it now as my primary and person email. I still have Gmail as my “junk”
39email that I use for throw away stuff. I log in to Gmail once a week and check
40if there are any important emails that I got, but apart from that, it's
41sitting dormant and collecting dust.
17 42
18The more I was watching the world loose it's self with allowing anti freedom things to happen to it, the more I started to realize that something has to change. I don't have the power to change the world. And I also don't have a grandiose opinion of myself to even think to try it. But what I can do is to not subscribe to this consumer way of thinking. I will not be complicit in this. My moral and ethical stances won't allow it. So, this brings us to the second part of my journey. 43The more I was watching the world loose it's self with allowing anti freedom
44things to happen to it, the more I started to realize that something has to
45change. I don't have the power to change the world. And I also don't have a
46grandiose opinion of myself to even think to try it. But what I can do is to
47not subscribe to this consumer way of thinking. I will not be complicit in
48this. My moral and ethical stances won't allow it. So, this brings us to the
49second part of my journey.
19 50
20I was using all these 3rd party services because I was either lazy or OK with the drawbacks of them. I watched these services and companies became more and more evil. It is evil if you sell your user's data in this manner. Nobody reads privacy policies and everybody is OK with accepting them, and they pray on that flaw in human nature. I really hate the hypocrisy they manage to muster. These companies prey on our laziness, and we are at fault here. Nobody else. And I truly understand the reasons why we rather accept and move on, and not object and have our lives a little more difficult. They have perfected this through years of small changes that make us a little more dependent on them. You could not convince a person to give away all his rights and data in one day. This was gradual and slow. And it caught us all in surprise. When I really stopped and thought about it, I felt repulsed. By really stopping and thinking about it, I really mean stopping and thinking about it. Thoroughly and in depth. 51I was using all these 3rd party services because I was either lazy or OK with
52the drawbacks of them. I watched these services and companies became more and
53more evil. It is evil if you sell your user's data in this manner. Nobody reads
54privacy policies and everybody is OK with accepting them, and they pray on that
55flaw in human nature. I really hate the hypocrisy they manage to muster. These
56companies prey on our laziness, and we are at fault here. Nobody else. And I
57truly understand the reasons why we rather accept and move on, and not object
58and have our lives a little more difficult. They have perfected this through
59years of small changes that make us a little more dependent on them. You could
60not convince a person to give away all his rights and data in one day. This was
61gradual and slow. And it caught us all in surprise. When I really stopped and
62thought about it, I felt repulsed. By really stopping and thinking about it,
63I really mean stopping and thinking about it. Thoroughly and in depth.
21 64
22Each step I took depleted my character a bit more. Like I was trading myself bit by bit without understanding what it all meant. What it meant to be a full person, not divided by all this bought attention they want from me. They don't just get your data, but they also take your attention away from you. They scatter your and go with the divide and conquer tactic from there. And a person divided is a person not fully there. Not at the moment. Not alive fully. 65Each step I took depleted my character a bit more. Like I was trading myself
66bit by bit without understanding what it all meant. What it meant to be a full
67person, not divided by all this bought attention they want from me. They don't
68just get your data, but they also take your attention away from you. They
69scatter your and go with the divide and conquer tactic from there. And a person
70divided is a person not fully there. Not at the moment. Not alive fully.
23 71
24I was unable to form long thoughts. Well, I thought I was. But now that I see what being a full person is again, I can see that I was not at my 100% back then. 72I was unable to form long thoughts. Well, I thought I was. But now that I see
73what being a full person is again, I can see that I was not at my 100% back
74then.
25 75
26A revolt was inevitable. There was no other way of continuing my story without it. Without taking back my attention, my thoughts, my time, and my privacy, regardless of how too late it maybe is. 76A revolt was inevitable. There was no other way of continuing my story without
77it. Without taking back my attention, my thoughts, my time, and my privacy,
78regardless of how too late it maybe is.
27 79
28This has nothing to do with conspiracy theories. Even less with changing the world. All I wanted was to get my life back in order and not waste the energy that could be spent in other, better places. 80This has nothing to do with conspiracy theories. Even less with changing the
81world. All I wanted was to get my life back in order and not waste the energy
82that could be spent in other, better places.
29 83
30I started reading more. I can focus now fully on things I work on. Furthermore, I have the mental acuity that I never had before. My mind feels sharp. I don't get angry so much. I can cherish the finer things in life now without the need to interpret them intellectually. Not only that, but I have a feeling of belonging again. Sense of purpose has returned with a vengeance. And I can now help people without depleting myself. 84I started reading more. I can focus now fully on things I work on. Furthermore,
85I have the mental acuity that I never had before. My mind feels sharp. I don't
86get angry so much. I can cherish the finer things in life now without the need
87to interpret them intellectually. Not only that, but I have a feeling of
88belonging again. Sense of purpose has returned with a vengeance. And I can
89now help people without depleting myself.
31 90
32The last step so far was to finish closing all the remaining online accounts that I still had. And when I was thinking what value they bring me, I wasn't surprised that the answer was none. I wasn't logging in them and using them. I stopped being afraid of FOMO. If somebody wants to get in contact me, they will find a way. I am one search away. 91The last step so far was to finish closing all the remaining online accounts
92that I still had. And when I was thinking what value they bring me, I wasn't
93surprised that the answer was none. I wasn't logging in them and using them.
94I stopped being afraid of FOMO. If somebody wants to get in contact me, they
95will find a way. I am one search away.
96
97We are not beholden to anybody. Our lives are our own. So dare yourself to
98delete Facebook, LinkedIn. To unsubscribe. Dare yourself to take your time
99and attention back. Use that time and energy to go for a walk without thinking
100about work. Read a book instead of reading comment on social media that you
101will forget in an hour. Enrich your life instead of wasting it. It only
102requires a small step. And you will feel the benefits immediately. Lose the
103weight of the world that is crushing you without your consent.
33 104
34We are not beholden to anybody. Our lives are our own. So dare yourself to delete Facebook, LinkedIn. To unsubscribe. Dare yourself to take your time and attention back. Use that time and energy to go for a walk without thinking about work. Read a book instead of reading comment on social media that you will forget in an hour. Enrich your life instead of wasting it. It only requires a small step. And you will feel the benefits immediately. Lose the weight of the world that is crushing you without your consent.
diff --git a/content/posts/2021-08-01-linux-cheatsheet.md b/content/posts/2021-08-01-linux-cheatsheet.md
index 8c0d125..3747d43 100644
--- a/content/posts/2021-08-01-linux-cheatsheet.md
+++ b/content/posts/2021-08-01-linux-cheatsheet.md
@@ -1,7 +1,7 @@
1--- 1---
2title: List of essential Linux commands for server management 2title: List of essential Linux commands for server management
3url: linux-cheatsheet.html 3url: linux-cheatsheet.html
4date: 2021-08-01 4date: 2021-08-01T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
@@ -283,3 +283,4 @@ lsof -u <user>
283# -n 1 means every second 283# -n 1 means every second
284watch -n 1 df -h 284watch -n 1 df -h
285``` 285```
286
diff --git a/content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md b/content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md
index 56816a0..b8d93a6 100644
--- a/content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md
+++ b/content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md
@@ -1,21 +1,38 @@
1--- 1---
2title: Debian based riced up distribution for Developers and DevOps folks 2title: Debian based riced up distribution for Developers and DevOps folks
3url: debian-based-riced-up-distribution-for-developers-and-devops-folks.html 3url: debian-based-riced-up-distribution-for-developers-and-devops-folks.html
4date: 2021-12-03 4date: 2021-12-03T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Introduction 8## Introduction
9 9
10I have been using [Ubuntu](https://ubuntu.com/) for quite a longtime now. I have used [Debian](https://www.debian.org/) in the past and [Manjaro](https://manjaro.org/). Also had [Arch](https://archlinux.org/) for some time and even ran [Gentoo](https://www.gentoo.org/) way back. 10I have been using [Ubuntu](https://ubuntu.com/) for quite a longtime now. I
11 11have used [Debian](https://www.debian.org/) in the past and [Manjaro](https://manjaro.org/).
12What I learned from all this is that I prefer running a bit older versions and having them be stable than run bleeding edge rolling release. For that reason, I stuck with Ubuntu for a couple of years now. I am also at a point in my life where I just don't care what is cool or hip anymore. I just want a stable system that doesn't get in my way. 12Also had [Arch](https://archlinux.org/) for some time and even ran
13 13[Gentoo](https://www.gentoo.org/) way back.
14During all this, I noticed that these distributions were getting very bloated and a lot of software got included that I usually uninstall on fresh installation. Maybe this is my OCD speaking, but why do I have to give fresh installation min 1 GB of ram out of the box just to have a blank screen in front of me? I get it, there are many things included in the distro to make my life easier. I understand. But at this point I have a feeling that modern Linux distributions are becoming similar to [Node.js project with node_modules](https://devhumor.com/content/uploads/images/August2017/node-modules.jpg). Just a crazy number of packages serving very little or no purpose, just supporting other software. 14
15 15What I learned from all this is that I prefer running a bit older versions and
16I felt I needed a fresh start. To start over with something minimal and clean. Something that would put a little more joy into using a computer again. 16having them be stable than run bleeding edge rolling release. For that reason,
17 17I stuck with Ubuntu for a couple of years now. I am also at a point in my life
18For the first version, I wanted to target the following machines I have at home that I want this thing to work on. 18where I just don't care what is cool or hip anymore. I just want a stable
19system that doesn't get in my way.
20
21During all this, I noticed that these distributions were getting very bloated
22and a lot of software got included that I usually uninstall on fresh
23installation. Maybe this is my OCD speaking, but why do I have to give fresh
24installation min 1 GB of ram out of the box just to have a blank screen in
25front of me? I get it, there are many things included in the distro to make my
26life easier. I understand. But at this point I have a feeling that modern Linux
27distributions are becoming similar to [Node.js project with node_modules](https://devhumor.com/content/uploads/images/August2017/node-modules.jpg).
28Just a crazy number of packages serving very little or no purpose, just
29supporting other software.
30
31I felt I needed a fresh start. To start over with something minimal and clean.
32Something that would put a little more joy into using a computer again.
33
34For the first version, I wanted to target the following machines I have at
35home that I want this thing to work on.
19 36
20```yaml 37```yaml
21# My main stationary work machine 38# My main stationary work machine
@@ -35,61 +52,99 @@ Memory: 15891MiB
35 52
36## How should I approach this? 53## How should I approach this?
37 54
38I knew I wanted to use [minimal Debian netinst ](https://www.debian.org/CD/netinst/) for the base to give myself a head start. No reason to go through changing the installer and also testing all that behemoth of a thing. So, some sort of ricing was the only logical option to get this thing of the grounds somewhat quickly. 55I knew I wanted to use [minimal Debian netinst ](https://www.debian.org/CD/netinst/)
39 56for the base to give myself a head start. No reason to go through changing the
57installer and also testing all that behemoth of a thing. So, some sort of
58ricing was the only logical option to get this thing of the grounds somewhat
59quickly.
40 60
41> **What is ricing anyway?** 61> **What is ricing anyway?**
42> The term “RICE” stands for Race Inspired Cosmetic Enhancement. A group of people (could be one, idk) decided to see if they could tweak their own distros like they/others did their cars. This gave rise to a community of Linux/Unix enthusiasts trying to make their distros look cooler and better than others... For more information, read this article [What in the world is ricing!?](https://pesos.github.io/2020/07/14/what-is-ricing.html). 62> The term “RICE” stands for Race Inspired Cosmetic Enhancement. A group of
63> people (could be one, idk) decided to see if they could tweak their own
64> distros like they/others did their cars. This gave rise to a community of
65> Linux/Unix enthusiasts trying to make their distros look cooler and better
66> than others... For more information, read this article
67> [What in the world is ricing!?](https://pesos.github.io/2020/07/14/what-is-ricing.html).
43 68
44I didn't want this to just be a set of config files for theming purpose. I wanted this to include a set of pre-installed tools and services that are being used all the time by a modern developer. Theming is just a tiny part of it. Fonts being applied across the distro and things like that. 69I didn't want this to just be a set of config files for theming purpose. I
70wanted this to include a set of pre-installed tools and services that are being
71used all the time by a modern developer. Theming is just a tiny part of it.
72Fonts being applied across the distro and things like that.
45 73
46First, I choose terminal installer and left it to load additional components. Avoid using graphical installer in this case. 74First, I choose terminal installer and left it to load additional components.
75Avoid using graphical installer in this case.
47 76
48![](/assets/dfd-rice/install-00.png) 77![](/assets/dfd-rice/install-00.png)
49 78
50After that I selected hostname and created a normal user and set password for that user and root user and choose guided mode for disk partitioning. 79After that I selected hostname and created a normal user and set password for
80that user and root user and choose guided mode for disk partitioning.
51 81
52![](/assets/dfd-rice/install-01.png) 82![](/assets/dfd-rice/install-01.png)
53 83
54I left it run to install all the things required for the base system and opted out of scanning additional media for use by the package manager. Those will be downloaded from the internet during installation. 84I left it run to install all the things required for the base system and opted
85out of scanning additional media for use by the package manager. Those will be
86downloaded from the internet during installation.
55 87
56![](/assets/dfd-rice/install-02.png) 88![](/assets/dfd-rice/install-02.png)
57 89
58 90
59I opted out of the popularity contest, and **now comes the important part**. Uncheck all the boxes in Software selection and only leave 'standard system utilities'. I also left an SSH server, so I was able to log in to the machine from my main PC. 91I opted out of the popularity contest, and **now comes the important part**.
92Uncheck all the boxes in Software selection and only leave 'standard system
93utilities'. I also left an SSH server, so I was able to log in to the machine
94from my main PC.
60 95
61![](/assets/dfd-rice/install-03.png) 96![](/assets/dfd-rice/install-03.png)
62 97
63At this point, I installed GRUB bootloader on the disk where I installed the system. 98At this point, I installed GRUB bootloader on the disk where I installed the
99system.
64 100
65![](/assets/dfd-rice/install-04.png) 101![](/assets/dfd-rice/install-04.png)
66 102
67That concluded the installation of base Debian and after restarting the computer I was prompted with the login screen. 103That concluded the installation of base Debian and after restarting the
104computer I was prompted with the login screen.
68 105
69![](/assets/dfd-rice/install-05.png) 106![](/assets/dfd-rice/install-05.png)
70 107
71Now that I had the base installation, it was time to choose what software do I want to include in this so-called distribution. I wanted out of the box developer experience, so I had plenty to choose. 108Now that I had the base installation, it was time to choose what software do I
109want to include in this so-called distribution. I wanted out of the box
110developer experience, so I had plenty to choose.
72 111
73Let's not waste time and go through the list. 112Let's not waste time and go through the list.
74 113
75## Desktop environments 114## Desktop environments
76 115
77I have been using [Gnome](https://www.gnome.org/) for my whole Linux life. From version 2 forward. It's been quite a ride. I hated version 3 when it came out and replaced version 2. But I got used to it. And now with version 40+ they also made couple of changes which I found both frustrating and presently surprised. 116I have been using [Gnome](https://www.gnome.org/) for my whole Linux life.
117From version 2 forward. It's been quite a ride. I hated version 3 when it
118came out and replaced version 2. But I got used to it. And now with version
11940+ they also made couple of changes which I found both frustrating and
120presently surprised.
78 121
79The amount of vertical space you loose because of the beefy title bars on windows is ridiculous. And then in case of [Tilix](https://gnunn1.github.io/tilix-web/) you also have tabs, and you are 100px deep. Vertical space is one of the most important things for a developer. The more real estate you have, the more code you can have in a viewport. 122The amount of vertical space you loose because of the beefy title bars on
123windows is ridiculous. And then in case of [Tilix](https://gnunn1.github.io/tilix-web/)
124you also have tabs, and you are 100px deep. Vertical space is one of the most
125important things for a developer. The more real estate you have, the more
126code you can have in a viewport.
80 127
81But on the other hand, I still love how Gnome feels and looks. I gotta give them that. They really are trying to make Gnome feel unified and modern. 128But on the other hand, I still love how Gnome feels and looks. I gotta give
129them that. They really are trying to make Gnome feel unified and modern.
82 130
83Regardless of all the nice things Gnome has, I was looking at the tiling window managers for some time, but never had the nerve to actually go with it. But now was the ideal time to give it a go. No guts, no glory kind of a thing. 131Regardless of all the nice things Gnome has, I was looking at the tiling
132window managers for some time, but never had the nerve to actually go with
133it. But now was the ideal time to give it a go. No guts, no glory kind of
134a thing.
84 135
85One of the requirements for me was easy custom layouts because I use a really strange monitor with aspect ratio of 32:9. So relying on included layouts most of them have is a non-starter. 136One of the requirements for me was easy custom layouts because I use a really
137strange monitor with aspect ratio of 32:9. So relying on included layouts
138most of them have is a non-starter.
86 139
87What I was doing in Gnome was having windows in a layout like the diagram below. This is my common practice. And if you look at it you can clearly see I was replicating tiling window manager setup in Gnome. 140What I was doing in Gnome was having windows in a layout like the diagram
141below. This is my common practice. And if you look at it you can clearly see
142I was replicating tiling window manager setup in Gnome.
88 143
89![](/assets/dfd-rice/layout.png) 144![](/assets/dfd-rice/layout.png)
90 145
91 146That made me look into a bunch of tiling window managers and then tested them
92That made me look into a bunch of tiling window managers and then tested them out. Candidates I was looking at were: 147out. Candidates I was looking at were:
93 148
94- [i3](https://i3wm.org/) 149- [i3](https://i3wm.org/)
95- [bspwm](https://github.com/baskerville/bspwm) 150- [bspwm](https://github.com/baskerville/bspwm)
@@ -99,16 +154,21 @@ That made me look into a bunch of tiling window managers and then tested them ou
99- [Qtile](http://www.qtile.org/) 154- [Qtile](http://www.qtile.org/)
100- [dwm](https://dwm.suckless.org/) 155- [dwm](https://dwm.suckless.org/)
101 156
102You can also check article [13 Best Tiling Window Managers for Linux](https://www.tecmint.com/best-tiling-window-managers-for-linux/) I was referencing while testing them out. 157You can also check article [13 Best Tiling Window Managers for Linux](https://www.tecmint.com/best-tiling-window-managers-for-linux/)
103 158I was referencing while testing them out.
104While all of them provided what I needed, I liked i3 the most. What particular caught my eye was the ease to use and tree based layouts which allows flexible layouts. I know others can be set up also to have custom layouts other than spiral, dwindle etc. I think i3 is a good entry-level window manager for somebody like me.
105 159
160While all of them provided what I needed, I liked i3 the most. What particular
161caught my eye was the ease to use and tree based layouts which allows flexible
162layouts. I know others can be set up also to have custom layouts other than
163spiral, dwindle etc. I think i3 is a good entry-level window manager for
164somebody like me.
106 165
107## Batteries included 166## Batteries included
108 167
109The source for the whole thing is located on Github https://github.com/mitjafelicijan/dfd-rice. 168The source for the whole thing is located on Github https://github.com/mitjafelicijan/dfd-rice.
110 169
111Currenly included: 170Currenly included:
171
112- `non-free` (enables non-free packages in apt) 172- `non-free` (enables non-free packages in apt)
113- `sudo` (adds sudo and adds user to sudo group) 173- `sudo` (adds sudo and adds user to sudo group)
114- `essentials` (gcc, htop, zip, curl, etc...) 174- `essentials` (gcc, htop, zip, curl, etc...)
@@ -133,16 +193,19 @@ Currenly included:
133- `docker` (with docker-compose) 193- `docker` (with docker-compose)
134- `ansible` 194- `ansible`
135 195
136Install script also allows you to install only specific packages (example for: essentials ohmybash docker rust). 196Install script also allows you to install only specific packages (example for:
197essentials ohmybash docker rust).
137 198
138```sh 199```sh
139su - root \ 200su - root \
140 bash -c "$(wget -q https://raw.github.com/mitjafelicijan/dfd-rice/master/tools/install.sh -O -)" -- \ 201 bash -c "$(wget -q https://raw.github.com/mitjafelicijan/dfd-rice/master/tools/install.sh -O -)" -- \
141 essentials ohmybash docker rust 202 essentials ohmybash docker rust
142
143``` 203```
144 204
145Currently, most of these recipes use what Debian and this is totally fine with me since I never use bleeding edge features of a package. But if something major would come to light, I will replace it with a possible compilation script or something similar. 205Currently, most of these recipes use what Debian and this is totally fine with
206me since I never use bleeding edge features of a package. But if something
207major would come to light, I will replace it with a possible compilation
208script or something similar.
146 209
147This is some of the output from the installation script. 210This is some of the output from the installation script.
148 211
@@ -150,7 +213,6 @@ This is some of the output from the installation script.
150 213
151Let's take a look at some examples in the installation script. 214Let's take a look at some examples in the installation script.
152 215
153
154### Docker recipe 216### Docker recipe
155 217
156```sh 218```sh
@@ -170,7 +232,11 @@ systemctl status docker --no-pager
170 232
171### Making bash pretty 233### Making bash pretty
172 234
173I really like [Oh My Zsh](https://ohmyz.sh/), but I don't like zsh shell. When I used it, I constantly needed to be aware of it and running bash scripts was a pain. So, I was really delighted when I found out that a version for bash existed called [Oh My Bash](https://ohmybash.nntoan.com/). Let's take a look at the recipe for installing it. 235I really like [Oh My Zsh](https://ohmyz.sh/), but I don't like zsh shell.
236When I used it, I constantly needed to be aware of it and running bash scripts
237was a pain. So, I was really delighted when I found out that a version for
238bash existed called [Oh My Bash](https://ohmybash.nntoan.com/). Let's take a
239look at the recipe for installing it.
174 240
175```sh 241```sh
176# ohmybash 242# ohmybash
@@ -180,17 +246,29 @@ T1=${!}
180wait ${T1} 246wait ${T1}
181``` 247```
182 248
183Because OhMyBash does `exec bash` at the end, this traps our script inside another shell and our script cannot continue. For that reason, I executed this in background. But that presents a new problem. Because this is executed in background, we lose track of progress naturally. And that strange trick with `T1=${!}` and `wait ${T1}` waits for the background process to finish before continuing to another task in bash script. 249Because OhMyBash does `exec bash` at the end, this traps our script inside
184 250another shell and our script cannot continue. For that reason, I executed
185Check [Multi-Threaded Processing in Bash Scripts](https://www.cloudsavvyit.com/12277/how-to-use-multi-threaded-processing-in-bash-scripts/) for more details. 251this in background. But that presents a new problem. Because this is executed
252in background, we lose track of progress naturally. And that strange trick
253with `T1=${!}` and `wait ${T1}` waits for the background process to finish
254before continuing to another task in bash script.
186 255
256Check [Multi-Threaded Processing in Bash Scripts](https://www.cloudsavvyit.com/12277/how-to-use-multi-threaded-processing-in-bash-scripts/)
257for more details.
187 258
188## Conclusion 259## Conclusion
189 260
190Take a look at https://github.com/mitjafelicijan/dfd-rice/blob/develop/tools/install.sh script to get familiar with it. This is just a first iteration and I will continue to update it because I need this in my life. 261Take a look at https://github.com/mitjafelicijan/dfd-rice/blob/develop/tools/install.sh
262script to get familiar with it. This is just a first iteration and I will
263continue to update it because I need this in my life.
191 264
192The current version boots in 4s to the login prompt, and after you log in, the desktop environment loads in 2s. So, its fast, very fast. And on clean boot, I measured ~230 MB of RAM usage. 265The current version boots in 4s to the login prompt, and after you log in,
266the desktop environment loads in 2s. So, its fast, very fast. And on clean
267boot, I measured ~230 MB of RAM usage.
193 268
194And this is how it looks with two terminals side by side. I really like the simplicity and clean interface. I will polish the colors and stuff like that, but I really do like the results. 269And this is how it looks with two terminals side by side. I really like the
270simplicity and clean interface. I will polish the colors and stuff like that,
271but I really do like the results.
195 272
196![](/assets/dfd-rice/desktop.png) 273![](/assets/dfd-rice/desktop.png)
274
diff --git a/content/posts/2021-12-25-running-golang-application-as-pid1.md b/content/posts/2021-12-25-running-golang-application-as-pid1.md
index 3d1f266..e3b7fa2 100644
--- a/content/posts/2021-12-25-running-golang-application-as-pid1.md
+++ b/content/posts/2021-12-25-running-golang-application-as-pid1.md
@@ -1,43 +1,62 @@
1--- 1---
2title: Running Golang application as PID 1 with Linux kernel 2title: Running Golang application as PID 1 with Linux kernel
3url: running-golang-application-as-pid1.html 3url: running-golang-application-as-pid1.html
4date: 2021-12-25 4date: 2021-12-25T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Unikernels, kernels, and alike 8## Unikernels, kernels, and alike
9 9
10I have been reading a lot about [unikernernels](https://en.wikipedia.org/wiki/Unikernel) lately and found them very intriguing. When you push away all the marketing speak and look at the idea, it makes a lot of sense. 10I have been reading a lot about [unikernernels](https://en.wikipedia.org/wiki/Unikernel)
11lately and found them very intriguing. When you push away all the marketing
12speak and look at the idea, it makes a lot of sense.
11 13
12> A unikernel is a specialized, single address space machine image constructed by using library operating systems. ([Wikipedia](https://en.wikipedia.org/wiki/Unikernel)) 14> A unikernel is a specialized, single address space machine image constructed
15> by using library operating systems. ([Wikipedia](https://en.wikipedia.org/wiki/Unikernel))
13 16
14I really like the explanation from the article [Unikernels: Rise of the Virtual Library Operating System](https://queue.acm.org/detail.cfm?id=2566628). Really worth a read. 17I really like the explanation from the article
18[Unikernels: Rise of the Virtual Library Operating System](https://queue.acm.org/detail.cfm?id=2566628).
19Really worth a read.
15 20
16If we compare a normal operating system to a unikernel side by side, they would look something like this. 21If we compare a normal operating system to a unikernel side by side, they would
22look something like this.
17 23
18![Virtual machines vs Containers vs Unikernels](/assets/pid1/unikernels.png) 24![Virtual machines vs Containers vs Unikernels](/assets/pid1/unikernels.png)
19 25
20From this image, we can see how the complexity significantly decreases with the use of Unikernels. This comes with a price, of course. Unikernels are hard to get running and require a lot of work since you don't have an actual proper kernel running in the background providing network access and drivers etc. 26From this image, we can see how the complexity significantly decreases with
27the use of Unikernels. This comes with a price, of course. Unikernels are hard
28to get running and require a lot of work since you don't have an actual proper
29kernel running in the background providing network access and drivers etc.
21 30
22So as a half step to make the stack simpler, I started looking into using Linux kernel as a base and going from there. I came across this [Youtube video talking about Building the Simplest Possible Linux System](https://www.youtube.com/watch?v=Sk9TatW9ino) by [Rob Landley](https://landley.net) and apart from statically compiling the application to be run as PID1 there was really no other obstacles. 31So as a half step to make the stack simpler, I started looking into using
32Linux kernel as a base and going from there. I came across this
33[Youtube video talking about Building the Simplest Possible Linux System](https://www.youtube.com/watch?v=Sk9TatW9ino)
34by [Rob Landley](https://landley.net) and apart from statically compiling the
35application to be run as PID1 there was really no other obstacles.
23 36
24## What is PID 1? 37## What is PID 1?
25 38
26PID 1 is the first process that Linux kernel starts after the boot process. It also has a couple of unique properties that are unique to it. 39PID 1 is the first process that Linux kernel starts after the boot process.
40It also has a couple of unique properties that are unique to it.
27 41
28- When the process with PID 1 dies for any reason, all other processes are killed with KILL signal. 42- When the process with PID 1 dies for any reason, all other processes are
29- When any process having children dies for any reason, its children are re-parented to process with PID 1. 43 killed with KILL signal.
44- When any process having children dies for any reason, its children are
45 re-parented to process with PID 1.
30- Many signals which have default action of Term do not have one for PID 1. 46- Many signals which have default action of Term do not have one for PID 1.
31- When the process with PID 1 dies for any reason, kernel panics, which result in system crash. 47- When the process with PID 1 dies for any reason, kernel panics, which
48 result in system crash.
32 49
33PID 1 is considered as an Init application which takes care of running other and handling services like: 50PID 1 is considered as an Init application which takes care of running other
51and handling services like:
34 52
35- sshd, 53- sshd,
36- nginx, 54- nginx,
37- pulseaudio, 55- pulseaudio,
38- etc. 56- etc.
39 57
40If you are on a Linux machine, you can check what your process is with PID 1 by running the following. 58If you are on a Linux machine, you can check what your process is with PID 1
59by running the following.
41 60
42```sh 61```sh
43$ cat /proc/1/status 62$ cat /proc/1/status
@@ -51,23 +70,34 @@ PPid: 0
51... 70...
52``` 71```
53 72
54As we can see on my machine the process with id of 1 is [systemd](https://systemd.io/) which is a software suite that provides an array of system components for Linux operating systems. If you look closely you can also see that the `PPid` (process id of the parent process) is `0` which additionally confirms that this process doesn't have a parent. 73As we can see on my machine the process with id of 1 is [systemd](https://systemd.io/)
74which is a software suite that provides an array of system components for Linux
75operating systems. If you look closely you can also see that the `PPid`
76(process id of the parent process) is `0` which additionally confirms that
77this process doesn't have a parent.
55 78
56## So why even run application as PID 1 instead of just using a container? 79## So why even run application as PID 1 instead of just using a container?
57 80
58Containers are wonderful, but they come with a lot of baggage. And because they are in their nature layered, the images require quite a lot of space and also a lot of additional software to handle them. They are not as lightweight as they seem, and many popular images require 500 MB plus disk space. 81Containers are wonderful, but they come with a lot of baggage. And because they
82are in their nature layered, the images require quite a lot of space and also a
83lot of additional software to handle them. They are not as lightweight as they
84seem, and many popular images require 500 MB plus disk space.
59 85
60The idea of running this as PID 1 would result in a significantly smaller footprint, as we will see later in the post. 86The idea of running this as PID 1 would result in a significantly smaller footprint,
87as we will see later in the post.
61 88
62> You could run a simple init system inside Docker container described more in this article [Docker and the PID 1 zombie reaping problem](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/). 89> You could run a simple init system inside Docker container described more
90> in this article [Docker and the PID 1 zombie reaping problem](https://blog.phusion.nl/2015/01/20/docker-and-the-pid-1-zombie-reaping-problem/).
63 91
64## The master plan 92## The master plan
65 93
661. Compile Linux kernel with the default definitions. 941. Compile Linux kernel with the default definitions.
672. Prepare a Hello World application in Golang that is statically compiled. 952. Prepare a Hello World application in Golang that is statically compiled.
683. Run it with [QEMU](https://www.qemu.org/) and providing Golang application as init application / PID 1. 963. Run it with [QEMU](https://www.qemu.org/) and providing Golang application
97 as init application / PID 1.
69 98
70For the sake of simplicity we will not be cross-compiling any of it and just use the 64bit version. 99For the sake of simplicity we will not be cross-compiling any of it and just
100use the 64bit version.
71 101
72## Compiling Linux kernel 102## Compiling Linux kernel
73 103
@@ -87,12 +117,15 @@ $ time make -j `nproc`
87$ cd .. 117$ cd ..
88``` 118```
89 119
90At this point we have kernel image that is located in `arch/x86_64/boot/bzImage`. We will use this in QEMU later. 120At this point we have kernel image that is located in `arch/x86_64/boot/bzImage`.
121We will use this in QEMU later.
91 122
92To make our lives a bit easier lets move the kernel image to another place. Lets create a folder `bin/` in the root of our project with `mkdir -p bin`. 123To make our lives a bit easier lets move the kernel image to another place.
124Lets create a folder `bin/` in the root of our project with `mkdir -p bin`.
93 125
94 126
95At this point we can copy `bzImage` to `bin/` folder with `cp linux-5.15.7/arch/x86_64/boot/bzImage bin/bzImage`. 127At this point we can copy `bzImage` to `bin/` folder with
128`cp linux-5.15.7/arch/x86_64/boot/bzImage bin/bzImage`.
96 129
97The folder structure of this experiment should look like this. 130The folder structure of this experiment should look like this.
98 131
@@ -106,7 +139,8 @@ pid1/
106 139
107## Preparing PID 1 application in Golang 140## Preparing PID 1 application in Golang
108 141
109This step is relatively easy. The only thing we must have in mind that we will need to compile the binary as a static one. 142This step is relatively easy. The only thing we must have in mind that we will
143need to compile the binary as a static one.
110 144
111Let's create `init.go` file in the root of the project. 145Let's create `init.go` file in the root of the project.
112 146
@@ -126,7 +160,9 @@ func main() {
126} 160}
127``` 161```
128 162
129If you notice, we have a forever loop in the main, with a simple sleep of 1 second to not overwhelm the CPU. This is because PID 1 should never complete and/or exit. That would result in a kernel panic. Which is BAD! 163If you notice, we have a forever loop in the main, with a simple sleep of 1
164second to not overwhelm the CPU. This is because PID 1 should never complete
165and/or exit. That would result in a kernel panic. Which is BAD!
130 166
131There are two ways of compiling Golang application. Statically and dynamically. 167There are two ways of compiling Golang application. Statically and dynamically.
132 168
@@ -146,7 +182,10 @@ $ ldd init
146not a dynamic executable 182not a dynamic executable
147``` 183```
148 184
149At this point, we need to create [initramfs](https://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html) (abbreviated from "initial RAM file system", is the successor of initrd. It is a cpio archive of the initial file system that gets loaded into memory during the Linux startup process). 185At this point, we need to create [initramfs](https://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html)
186(abbreviated from "initial RAM file system", is the successor of initrd. It
187is a cpio archive of the initial file system that gets loaded into memory
188during the Linux startup process).
150 189
151```sh 190```sh
152$ echo init | cpio -o --format=newc > initramfs 191$ echo init | cpio -o --format=newc > initramfs
@@ -167,7 +206,10 @@ pid1/
167 206
168## Running all of it with QEMU 207## Running all of it with QEMU
169 208
170[QEMU](https://www.qemu.org/) is a free and open-source hypervisor. It emulates the machine's processor through dynamic binary translation and provides a set of different hardware and device models for the machine, enabling it to run a variety of guest operating systems. 209[QEMU](https://www.qemu.org/) is a free and open-source hypervisor. It emulates
210the machine's processor through dynamic binary translation and provides a set
211of different hardware and device models for the machine, enabling it to run a
212variety of guest operating systems.
171 213
172```sh 214```sh
173$ qemu-system-x86_64 -serial stdio -kernel bin/bzImage -initrd bin/initramfs -append "console=ttyS0" -m 128 215$ qemu-system-x86_64 -serial stdio -kernel bin/bzImage -initrd bin/initramfs -append "console=ttyS0" -m 128
@@ -212,7 +254,12 @@ The whole [log file here](/assets/pid1/qemu.log).
212 254
213## Size comparison 255## Size comparison
214 256
215The cool thing about this approach is that the Linux kernel and the application together only take around 12 MB, which is impressive as hell. And we need to also know that the size of bzImage (Linux kernel) could be greatly decreased by going into `make menuconfig` and removing a ton of features from the kernel, making the size even smaller. I managed to get kernel size down to 2 MB and still working properly. 257The cool thing about this approach is that the Linux kernel and the application
258together only take around 12 MB, which is impressive as hell. And we need to
259also know that the size of bzImage (Linux kernel) could be greatly decreased
260by going into `make menuconfig` and removing a ton of features from the kernel,
261making the size even smaller. I managed to get kernel size down to 2 MB and
262still working properly.
216 263
217```sh 264```sh
218total 12M 265total 12M
@@ -224,7 +271,8 @@ total 12M
224 271
225First we need to create proper folder structure with `mkdir -p iso/boot/grub`. 272First we need to create proper folder structure with `mkdir -p iso/boot/grub`.
226 273
227Then we need to download the [grub binary](https://github.com/littleosbook/littleosbook/raw/master/files/stage2_eltorito). You can read more about this program on https://github.com/littleosbook/littleosbook. 274Then we need to download the [grub binary](https://github.com/littleosbook/littleosbook/raw/master/files/stage2_eltorito).
275You can read more about this program on https://github.com/littleosbook/littleosbook.
228 276
229```sh 277```sh
230$ wget -O iso/boot/grub/stage2_eltorito https://github.com/littleosbook/littleosbook/raw/master/files/stage2_eltorito 278$ wget -O iso/boot/grub/stage2_eltorito https://github.com/littleosbook/littleosbook/raw/master/files/stage2_eltorito
@@ -275,12 +323,24 @@ genisoimage -R \
275 iso 323 iso
276``` 324```
277 325
278This will produce `GoAsPID1.iso` which you can use with [Virtualbox](https://www.virtualbox.org/) or [Gnome Boxes](https://apps.gnome.org/app/org.gnome.Boxes/). 326This will produce `GoAsPID1.iso` which you can use with [Virtualbox](https://www.virtualbox.org/)
327or [Gnome Boxes](https://apps.gnome.org/app/org.gnome.Boxes/).
279 328
280<video src="/assets/pid1/boxes.mp4" controls></video> 329<video src="/assets/pid1/boxes.mp4" controls></video>
281 330
282## Is running applications as PID 1 even worth it? 331## Is running applications as PID 1 even worth it?
283 332
284Well, the answer to this is not as simple as one would think. Sometimes it is and sometimes it's not. For embedded systems and very specialized applications it is worth for sure. But in normal uses, I don't think so. It was an interesting exercise in compiling kernels and looking at the guts of the Linux kernel, but sticking to containers for most of the things is a better option in my opinion. 333Well, the answer to this is not as simple as one would think. Sometimes it is
334and sometimes it's not. For embedded systems and very specialized applications
335it is worth for sure. But in normal uses, I don't think so. It was an interesting
336exercise in compiling kernels and looking at the guts of the Linux kernel,
337but sticking to containers for most of the things is a better option in my
338opinion.
339
340An interesting experiment would be creating an image that supports networking
341and could be deployed to AWS as an EC2 instance and observing how it fares.
342But in that case, we would need to write some sort of supervisor that would
343run on a separate EC2 that would check if other EC2 instances are running
344properly. Remember that if your application fails, kernel panics and the
345whole machine is inoperable in this case.
285 346
286An interesting experiment would be creating an image that supports networking and could be deployed to AWS as an EC2 instance and observing how it fares. But in that case, we would need to write some sort of supervisor that would run on a separate EC2 that would check if other EC2 instances are running properly. Remember that if your application fails, kernel panics and the whole machine is inoperable in this case.
diff --git a/content/posts/2021-12-30-wap-mobile-web-before-the-web.md b/content/posts/2021-12-30-wap-mobile-web-before-the-web.md
index 6664639..1ee82b5 100644
--- a/content/posts/2021-12-30-wap-mobile-web-before-the-web.md
+++ b/content/posts/2021-12-30-wap-mobile-web-before-the-web.md
@@ -1,15 +1,24 @@
1--- 1---
2title: Wireless Application Protocol and the mobile web before the web 2title: Wireless Application Protocol and the mobile web before the web
3url: wap-mobile-web-before-the-web.html 3url: wap-mobile-web-before-the-web.html
4date: 2021-12-30 4date: 2021-12-30T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## A little stroll down the history lane 8## A little stroll down the history lane
9 9
10About two weeks ago, I watched this outstanding documentary on YouTube [Springboard: the secret history of the first real smartphone](https://www.youtube.com/watch?v=b9_Vh9h3Ohw) about the history of smartphones and phones in general. It brought back so many memories. I never had an actual smartphone before the Android. The closest to smartphone was [Sony Ericsson P1](https://www.gsmarena.com/sony_ericsson_p1-1982.php). A fantastic phone and I broke it in Prague after a party and that was one of those rare occasions where I was actually mad at myself. But nevertheless, after that phone, the next one was an Android one. 10About two weeks ago, I watched this outstanding documentary on YouTube
11[Springboard: the secret history of the first real smartphone](https://www.youtube.com/watch?v=b9_Vh9h3Ohw)
12about the history of smartphones and phones in general. It brought back so many
13memories. I never had an actual smartphone before the Android. The closest to
14smartphone was [Sony Ericsson P1](https://www.gsmarena.com/sony_ericsson_p1-1982.php).
15A fantastic phone and I broke it in Prague after a party and that was one of
16those rare occasions where I was actually mad at myself. But nevertheless,
17after that phone, the next one was an Android one.
11 18
12Before that, I only owned normal phones from Nokia and Siemens etc. Nothing special, actually. These are the phones we are talking about. Before 2007. Apple and Android phones didn't exist yet. 19Before that, I only owned normal phones from Nokia and Siemens etc. Nothing
20special, actually. These are the phones we are talking about. Before 2007.
21Apple and Android phones didn't exist yet.
13 22
14These phones were rocking: 23These phones were rocking:
15 24
@@ -25,19 +34,43 @@ Let's take a look at these beauties.
25 34
26## WAP - Wireless Application Protocol 35## WAP - Wireless Application Protocol
27 36
28Not that one! We are talking about Wireless Application Protocol and not Cardi B's song 😃 37Not that one! We are talking about Wireless Application Protocol and not
38Cardi B's song 😃
29 39
30WAP stands for Wireless Application Protocol. It is a protocol designed for micro-browsers, and it enables the access of internet in the mobile devices. It uses the mark-up language WML (Wireless Markup Language and not HTML), WML is defined as XML 1.0 application. Furthermore, it enables creating web applications for mobile devices. In 1998, WAP Forum was founded by Ericson, Motorola, Nokia and Unwired Planet whose aim was to standardize the various wireless technologies via protocols. [(source)](https://www.geeksforgeeks.org/wireless-application-protocol/) 40WAP stands for Wireless Application Protocol. It is a protocol designed for
41micro-browsers, and it enables the access of internet in the mobile devices.
42It uses the mark-up language WML (Wireless Markup Language and not HTML), WML
43is defined as XML 1.0 application. Furthermore, it enables creating web
44applications for mobile devices. In 1998, WAP Forum was founded by Ericson,
45Motorola, Nokia and Unwired Planet whose aim was to standardize the various
46wireless technologies via protocols.
47[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
31 48
32WAP protocol was resulted by the joint efforts of the various members of WAP Forum. In 2002, WAP forum was merged with various other forums of the industry, resulting in the formation of Open Mobile Alliance (OMA). [(source)](https://www.geeksforgeeks.org/wireless-application-protocol/) 49WAP protocol was resulted by the joint efforts of the various members of WAP
50Forum. In 2002, WAP forum was merged with various other forums of the industry,
51resulting in the formation of Open Mobile Alliance (OMA).
52[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
33 53
34These were some wild times. Devices had tiny screens and data transmission rates were abominable. But they were capable of rendering WML (Wireless Markup Language). This was very similar to HTML, actually. It is a markup language, after all. 54These were some wild times. Devices had tiny screens and data transmission rates
55were abominable. But they were capable of rendering WML (Wireless Markup
56Language). This was very similar to HTML, actually. It is a markup language,
57after all.
35 58
36These pages could be served by [Apache](https://apache.org/) and could be generated by CGI scripts on the backend. The only difference was the limited markup language. 59These pages could be served by [Apache](https://apache.org/) and could be
60generated by CGI scripts on the backend. The only difference was the limited
61markup language.
37 62
38## WML - Wireless Markup Language 63## WML - Wireless Markup Language
39 64
40Just like web browsers use HTML for content structure, older mobile device browsers use WML - if you need to support really old mobile phones using WML browsers, you will need to know about it. WML is XML-based (an XML vocabulary just like XHTML and MathML, but not HTML) and does not use the same metaphor as HTML. HTML is a single document with some metadata packed away in the head, and a body encapsulating the visible page. With WML, the metaphor does not envisage a page, but rather a deck of cards. A WML file might have several pages or cards contained within it. [(source)](https://www.w3.org/wiki/Introduction_to_mobile_web) 65Just like web browsers use HTML for content structure, older mobile device
66browsers use WML - if you need to support really old mobile phones using WML
67browsers, you will need to know about it. WML is XML-based (an XML vocabulary
68just like XHTML and MathML, but not HTML) and does not use the same metaphor
69as HTML. HTML is a single document with some metadata packed away in the head,
70and a body encapsulating the visible page. With WML, the metaphor does not
71envisage a page, but rather a deck of cards. A WML file might have several
72pages or cards contained within it.
73[(source)](https://www.w3.org/wiki/Introduction_to_mobile_web)
41 74
42```html 75```html
43<?xml version="1.0"?> 76<?xml version="1.0"?>
@@ -53,7 +86,10 @@ There is an amazing tutorial on [Tutorialpoint about WML](https://www.tutorialsp
53 86
54## Converting Digg to WML 87## Converting Digg to WML
55 88
56This task is completely useless and not really feasible nowadays, but I had to give it a try for old-time sake. Since the data is already there in a form of RSS feed, I could take this feed and parse it and create a WML version of the homepage. 89This task is completely useless and not really feasible nowadays, but I had to
90give it a try for old-time sake. Since the data is already there in a form of
91RSS feed, I could take this feed and parse it and create a WML version of the
92homepage.
57 93
58We will need: 94We will need:
59 95
@@ -130,17 +166,25 @@ with open('www/index.wml', 'w+') as fp:
130 fp.write(html) 166 fp.write(html)
131``` 167```
132 168
133This script will create a folder `www` and in the folder `www/images` for storing resized images. 169This script will create a folder `www` and in the folder `www/images` for
170storing resized images.
134 171
135> Be sure you don't use SSL and use just normal HTTP for serving the content. These old phones will have problems with TLS 1.3 etc. 172> Be sure you don't use SSL and use just normal HTTP for serving the content.
173> These old phones will have problems with TLS 1.3 etc.
136 174
137If you look at the python file, I convert all the images into tiny B&W images. They should be WBMP (Wireless BitMaP) but I choose JPEGs for this, and it seems to work properly. 175If you look at the python file, I convert all the images into tiny B&W images.
176They should be WBMP (Wireless BitMaP) but I choose JPEGs for this, and it
177seems to work properly.
138 178
139Because I currently don't have a phone old enough to test it on, I used an emulator. And it was really hard to find one. I found [WAP Proof](http://wap-proof.sharewarejunction.com/) on shareware junction, and it did the job well enough. I will try to find and actual device to test it on. 179Because I currently don't have a phone old enough to test it on, I used an
180emulator. And it was really hard to find one. I found [WAP Proof](http://wap-proof.sharewarejunction.com/)
181on shareware junction, and it did the job well enough. I will try to find and
182actual device to test it on.
140 183
141<video src="/assets/wap/emulator.mp4" controls></video> 184<video src="/assets/wap/emulator.mp4" controls></video>
142 185
143If you are using Nginx to serve the contents, add a directive to the hosts file that will automatically server `index.wml` file. 186If you are using Nginx to serve the contents, add a directive to the hosts file
187that will automatically server `index.wml` file.
144 188
145```nginx 189```nginx
146server { 190server {
@@ -150,4 +194,7 @@ server {
150 194
151## Conclusion 195## Conclusion
152 196
153Well, this was pointless, but very fun! I hope you enjoyed it as much as I did. I will try to find an old phone to test it on. If you have any questions, feel free to ask in the comments. 197Well, this was pointless, but very fun! I hope you enjoyed it as much as I did.
198I will try to find an old phone to test it on. If you have any questions,
199feel free to ask in the comments.
200
diff --git a/content/posts/2022-06-30-trying-out-helix-editor.md b/content/posts/2022-06-30-trying-out-helix-editor.md
index 5e25980..c1da4a5 100644
--- a/content/posts/2022-06-30-trying-out-helix-editor.md
+++ b/content/posts/2022-06-30-trying-out-helix-editor.md
@@ -1,31 +1,53 @@
1--- 1---
2title: Trying out Helix code editor as my main editor 2title: Trying out Helix code editor as my main editor
3url: tying-out-helix-code-editor.html 3url: tying-out-helix-code-editor.html
4date: 2022-06-30 4date: 2022-06-30T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8I have been searching for a lightweight code editor for quite some time. One of the main reasons was that I wanted something that doesn't burn through CPU and RAM usage is not through the roof. I have been mostly using Visual Studio Code. It's been an outstanding editor. I have no quarrel with it at all. It's just time to spice life up with something new. 8I have been searching for a lightweight code editor for quite some time. One of
9the main reasons was that I wanted something that doesn't burn through CPU and
10RAM usage is not through the roof. I have been mostly using Visual Studio Code.
11It's been an outstanding editor. I have no quarrel with it at all. It's just
12time to spice life up with something new.
9 13
10I have been on this search for a couple of years. I have tried Vim, Neovim, Emacs, Doom Emacs, Micro and couple more. Among most of them, I liked Micro and Doom Emacs the most. Micro editor was a little too basic for me. And Doom Emacs was a bit too hardcore. This does not reflect on any of the editors. It's just my personal preference. 14I have been on this search for a couple of years. I have tried Vim, Neovim,
15Emacs, Doom Emacs, Micro and couple more. Among most of them, I liked Micro
16and Doom Emacs the most. Micro editor was a little too basic for me. And Doom
17Emacs was a bit too hardcore. This does not reflect on any of the editors. It's
18just my personal preference.
11 19
12> I tried Helix Editor about a year ago. But I didn't pay attention to it. Tried it and saw it's similar to Vi and just said no. I was premature to dismiss it. 20> I tried Helix Editor about a year ago. But I didn't pay attention to it.
21> Tried it and saw it's similar to Vi and just said no. I was premature to
22> dismiss it.
13 23
14One of the things I actually miss is line wrapping for certain files. When writing Markdown, line wrapping would be very helpful. Editing such a document is frustrating to say the least. Some of the Markdown to HTML converters don't take kindly of new lines between sentences. Not paragraphs, sentences. And I use Markdown to write this blog you are reading. 24One of the things I actually miss is line wrapping for certain files. When
25writing Markdown, line wrapping would be very helpful. Editing such a document
26is frustrating to say the least. Some of the Markdown to HTML converters don't
27take kindly of new lines between sentences. Not paragraphs, sentences. And I
28use Markdown to write this blog you are reading.
15 29
16But other than this, I have been extremely satisfied by it. It's been a pleasant surprise. There have been zero issues with the editor. 30But other than this, I have been extremely satisfied by it. It's been a pleasant
31surprise. There have been zero issues with the editor.
17 32
18One thing to do before you are able to use autocompletion and make use Language Server support is to install the language server with NPM. 33One thing to do before you are able to use autocompletion and make use Language
34Server support is to install the language server with NPM.
19 35
20```sh 36```sh
21npm install -g typescript typescript-language-server 37npm install -g typescript typescript-language-server
22``` 38```
23 39
24I am still getting used to the keyboard shortcuts and getting better. What Helix does really well is packing in sane defaults and even though because currently there is no plugin support I haven't found any need for them. It has all that you would need. It goes to extreme measures to show a user what is going on with popups that show you what the keyboard shortcuts are. 40I am still getting used to the keyboard shortcuts and getting better. What Helix
41does really well is packing in sane defaults and even though because currently
42there is no plugin support I haven't found any need for them. It has all that
43you would need. It goes to extreme measures to show a user what is going on
44with popups that show you what the keyboard shortcuts are.
25 45
26And it comes us packed with many [really good themes](https://github.com/helix-editor/helix/wiki/Themes). 46And it comes us packed with many
47[really good themes](https://github.com/helix-editor/helix/wiki/Themes).
27 48
28![Editor](/assets/helix-editor/editor.png) 49![Editor](/assets/helix-editor/editor.png)
29 50
30It's still young but has this mature feeling to it. It has sane defaults and mimics Vim (works a bit differently, but the overall idea is similar). 51It's still young but has this mature feeling to it. It has sane defaults and
52mimics Vim (works a bit differently, but the overall idea is similar).
31 53
diff --git a/content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md b/content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md
index 002eb5d..15bbf2b 100644
--- a/content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md
+++ b/content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md
@@ -1,23 +1,44 @@
1--- 1---
2title: What would DNA sound if synthesized to an audio file 2title: What would DNA sound if synthesized to an audio file
3url: what-would-dna-sound-if-synthesized.html 3url: what-would-dna-sound-if-synthesized.html
4date: 2022-07-05 4date: 2022-07-05T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Introduction 8## Introduction
9 9
10Lately, I have been thinking a lot about the nature of life, what are the foundation blocks of life and things like that. It's remarkable how complex and on the other hand simple the creation is when you look at it. The miracle of life keeps us grounded when our imagination goes wild. If the DNA are the blocks of life, you could consider them to be an API nature provided us to better understand all of this chaos masquerading as order. 10Lately, I have been thinking a lot about the nature of life, what are the
11 11foundation blocks of life and things like that. It's remarkable how complex
12I have been reading a lot about superintelligence and our somehow misguided path to create general artificial intelligence. What would the building blocks or our creation look like? Is the compression really the ultimate storage of information? Will our creation also ponder this questions when creating new worlds for themselves, or will we just disappear into the vastness of possibilities? It is a little offensive that we are playing God whilst being completely ignorant of our own reality. Who knows! Like many other breakthroughs, this one will also come at a cost not known to us when it finally happens. 12and on the other hand simple the creation is when you look at it. The miracle
13 13of life keeps us grounded when our imagination goes wild. If the DNA are the
14To keep things a bit lighter, I decided to convert some popular DNA sequences into an audio files for us to listen to. I am not the first one, nor I will be the last one to do this. But it is an interesting exercise in better understanding the relationship between art and science. Maybe listening to DNA instead of parsing it will find a way into better understanding, or at least enjoying the creation and cryptic nature of life. 14blocks of life, you could consider them to be an API nature provided us to
15better understand all of this chaos masquerading as order.
16
17I have been reading a lot about superintelligence and our somehow misguided
18path to create general artificial intelligence. What would the building blocks
19or our creation look like? Is the compression really the ultimate storage of
20information? Will our creation also ponder this questions when creating new
21worlds for themselves, or will we just disappear into the vastness of
22possibilities? It is a little offensive that we are playing God whilst being
23completely ignorant of our own reality. Who knows! Like many other
24breakthroughs, this one will also come at a cost not known to us when it
25finally happens.
26
27To keep things a bit lighter, I decided to convert some popular DNA sequences
28into an audio files for us to listen to. I am not the first one, nor I will be
29the last one to do this. But it is an interesting exercise in better
30understanding the relationship between art and science. Maybe listening to DNA
31instead of parsing it will find a way into better understanding, or at least
32enjoying the creation and cryptic nature of life.
15 33
16## DNA encoding and primer example 34## DNA encoding and primer example
17 35
18I have been exploring DNA in the past in my post from about 3 years ago in [Encoding binary data into DNA sequence](/encoding-binary-data-into-dna-sequence.html) where I have been converting all sorts of data into DNA sequences. 36I have been exploring DNA in the past in my post from about 3 years ago in
37[Encoding binary data into DNA sequence](/encoding-binary-data-into-dna-sequence.html)
38where I have been converting all sorts of data into DNA sequences.
19 39
20This will be a similar exercise but instead of converting to DNA, I will be generating tones from Nucleotides. 40This will be a similar exercise but instead of converting to DNA, I will be
41generating tones from Nucleotides.
21 42
22| Nucleotides | Note | Frequency | 43| Nucleotides | Note | Frequency |
23| ---------------- | ---- | --------- | 44| ---------------- | ---- | --------- |
@@ -28,11 +49,15 @@ This will be a similar exercise but instead of converting to DNA, I will be gene
28 49
29Since we do not have T in equal-tempered scale, I choose D to represent T note. 50Since we do not have T in equal-tempered scale, I choose D to represent T note.
30 51
31You can check [Frequencies for equal-tempered scale, A4 = 440 Hz](https://pages.mtu.edu/~suits/notefreqs.html). For this tuning, we also choose `Speed of Sound = 345 m/s = 1130 ft/s = 770 miles/hr`. 52You can check [Frequencies for equal-tempered scale, A4 = 440 Hz](https://pages.mtu.edu/~suits/notefreqs.html).
53For this tuning, we also choose `Speed of Sound = 345 m/s = 1130 ft/s = 770 miles/hr`.
32 54
33Now that we have this out of the way, we can also brush up on the DNA sequencing a bit. This is a famous quote I also used for the encoding tests, and it goes like this. 55Now that we have this out of the way, we can also brush up on the DNA
56sequencing a bit. This is a famous quote I also used for the encoding tests,
57and it goes like this.
34 58
35> How wonderful that we have met with a paradox. Now we have some hope of making progress. 59> How wonderful that we have met with a paradox. Now we have some hope of
60> making progress.
36> ― Niels Bohr 61> ― Niels Bohr
37 62
38```shell 63```shell
@@ -47,11 +72,16 @@ AACCTCACCAAACGGGACAAGATCGCCGGCGGGCTAGTATACAAGAACGCTTGCCAGTAC
47AACC 72AACC
48``` 73```
49 74
50This is what we gonna work with to get things rolling forward, when creating parser and waveform generator. 75This is what we gonna work with to get things rolling forward, when creating
76parser and waveform generator.
51 77
52## Parsing DNA data 78## Parsing DNA data
53 79
54This step is rather simple one. All we need to do is parse input DNA sequence in [FASTA format](https://en.wikipedia.org/wiki/FASTA_format) well known in [Bioinformatics](https://en.wikipedia.org/wiki/Bioinformatics) to extract single Nucleotides that will be converted into separate tones based on equal-tempered scale explained above. 80This step is rather simple one. All we need to do is parse input DNA sequence in
81[FASTA format](https://en.wikipedia.org/wiki/FASTA_format) well known
82in [Bioinformatics](https://en.wikipedia.org/wiki/Bioinformatics) to extract
83single Nucleotides that will be converted into separate tones based on
84equal-tempered scale explained above.
55 85
56```python 86```python
57nucleotide_tone_map = { 87nucleotide_tone_map = {
@@ -71,7 +101,8 @@ def generate_from_dna_sequence(sequence):
71 101
72## Generating sine wave 102## Generating sine wave
73 103
74Because we are essentially creating a long stream of notes we will be appending sine notes to a global array we will later use for creating a WAV file out of it. 104Because we are essentially creating a long stream of notes we will be appending
105sine notes to a global array we will later use for creating a WAV file out of it.
75 106
76```python 107```python
77import math 108import math
@@ -87,7 +118,8 @@ def append_sinewave(freq=440.0, duration_milliseconds=500, volume=1.0):
87 return 118 return
88``` 119```
89 120
90The sine wave generated here is the standard beep. If you want something more aggressive, you could try a square or saw tooth waveform. 121The sine wave generated here is the standard beep. If you want something more
122aggressive, you could try a square or saw tooth waveform.
91 123
92## Generating a WAV file from accumulated sine waves 124## Generating a WAV file from accumulated sine waves
93 125
@@ -112,15 +144,23 @@ def save_wav(file_name):
112 wav_file.close() 144 wav_file.close()
113``` 145```
114 146
11544100 is the industry standard sample rate - CD quality. If you need to save on file size, you can adjust it downwards. The standard for low quality is, 8000 or 8kHz. 14744100 is the industry standard sample rate - CD quality. If you need to save
148on file size, you can adjust it downwards. The standard for low quality is,
1498000 or 8kHz.
116 150
117WAV files here are using short, 16 bit, signed integers for the sample size. So, we multiply the floating-point data we have by 32767, the maximum value for a short integer. 151WAV files here are using short, 16 bit, signed integers for the sample size.
152So, we multiply the floating-point data we have by 32767, the maximum value
153for a short integer.
118 154
119> It is theoretically possible to use the floating point -1.0 to 1.0 data directly in a WAV file, but not obvious how to do that using the wave module in Python. 155> It is theoretically possible to use the floating point -1.0 to 1.0 data
156> directly in a WAV file, but not obvious how to do that using the wave module
157> in Python.
120 158
121## Generating Spectograms 159## Generating Spectograms
122 160
123I have tried two methods of doing this and both were just fine. I however opted out to use the [SoX - Sound eXchange, the Swiss Army knife of audio manipulation](https://linux.die.net/man/1/sox) one because it didn't require anything else. 161I have tried two methods of doing this and both were just fine. I however opted
162out to use the [SoX - Sound eXchange, the Swiss Army knife of audio manipulation](https://linux.die.net/man/1/sox)
163one because it didn't require anything else.
124 164
125```shell 165```shell
126sox output.wav -n spectrogram -o spectrogram.png 166sox output.wav -n spectrogram -o spectrogram.png
@@ -134,7 +174,8 @@ An example spectrogram of Ludwig van Beethoven Symphony No. 6 First movement.
134 174
135![Ludwig van Beethoven Symphony No. 6 First movement](/assets/dna-synthesized/symphony-no6-1st-movement.png) 175![Ludwig van Beethoven Symphony No. 6 First movement](/assets/dna-synthesized/symphony-no6-1st-movement.png)
136 176
137The other option could also be in combination with [gnuplot](http://www.gnuplot.info/). This would require an intermediary step, however. 177The other option could also be in combination with [gnuplot](http://www.gnuplot.info/).
178This would require an intermediary step, however.
138 179
139```shell 180```shell
140sox output.wav audio.dat 181sox output.wav audio.dat
@@ -173,7 +214,10 @@ plot "audio_only.dat" with lines lt rgb 'red'
173 214
174## Pre-generated sequences 215## Pre-generated sequences
175 216
176What I did was take interesting parts from an animal's genome and feed it to a tone generator script. This then generated a WAV file and I converted those to MP3, so they can be played in a browser. The last step was creating a spectrogram based on a WAV file. 217What I did was take interesting parts from an animal's genome and feed it to a
218tone generator script. This then generated a WAV file and I converted those to
219MP3, so they can be played in a browser. The last step was creating a
220spectrogram based on a WAV file.
177 221
178### Niels Bohr quote 222### Niels Bohr quote
179 223
@@ -185,7 +229,8 @@ What I did was take interesting parts from an animal's genome and feed it to a t
185 229
186### Mouse 230### Mouse
187 231
188This is part of a mouse genome `Mus_musculus.GRCm39.dna.nonchromosomal`. You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/mus_musculus/dna/). 232This is part of a mouse genome `Mus_musculus.GRCm39.dna.nonchromosomal`.
233You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/mus_musculus/dna/).
189 234
190<audio controls> 235<audio controls>
191 <source src="/assets/dna-synthesized/mouse/out.mp3" type="audio/mpeg"> 236 <source src="/assets/dna-synthesized/mouse/out.mp3" type="audio/mpeg">
@@ -195,7 +240,8 @@ This is part of a mouse genome `Mus_musculus.GRCm39.dna.nonchromosomal`. You can
195 240
196### Bison 241### Bison
197 242
198This is part of a bison genome `Bison_bison_bison.Bison_UMD1.0.cdna`. You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bison_bison_bison/cdna/). 243This is part of a bison genome `Bison_bison_bison.Bison_UMD1.0.cdna`.
244You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bison_bison_bison/cdna/).
199 245
200<audio controls> 246<audio controls>
201 <source src="/assets/dna-synthesized/bison/out.mp3" type="audio/mpeg"> 247 <source src="/assets/dna-synthesized/bison/out.mp3" type="audio/mpeg">
@@ -205,7 +251,8 @@ This is part of a bison genome `Bison_bison_bison.Bison_UMD1.0.cdna`. You can ge
205 251
206### Taurus 252### Taurus
207 253
208This is part of a taurus genome `Bos_taurus.ARS-UCD1.2.cdna`. You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bos_taurus/cdna/). 254This is part of a taurus genome `Bos_taurus.ARS-UCD1.2.cdna`.
255You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bos_taurus/cdna/).
209 256
210<audio controls> 257<audio controls>
211 <source src="/assets/dna-synthesized/taurus/out.mp3" type="audio/mpeg"> 258 <source src="/assets/dna-synthesized/taurus/out.mp3" type="audio/mpeg">
@@ -215,9 +262,14 @@ This is part of a taurus genome `Bos_taurus.ARS-UCD1.2.cdna`. You can get [genom
215 262
216## Making a drummer out of a DNA sequence 263## Making a drummer out of a DNA sequence
217 264
218To make things even more interesting, I decided to send this data via MIDI to my [Elektron Model:Samples](https://www.elektron.se/en/model-samples). This is a really cool piece of equipment that supports MIDI in via USB and 3.5 mm audio jack. 265To make things even more interesting, I decided to send this data via MIDI to
266my [Elektron Model:Samples](https://www.elektron.se/en/model-samples). This is
267a really cool piece of equipment that supports MIDI in via USB and 3.5 mm
268audio jack.
219 269
220Elektron is connected to my MacBook via USB cable and audio out is patched to a Sony Bluetooth speaker I have that supports 3.5 mm audio in. Elektron doesn't have internal speakers. 270Elektron is connected to my MacBook via USB cable and audio out is patched to
271a Sony Bluetooth speaker I have that supports 3.5 mm audio in. Elektron
272doesn't have internal speakers.
221 273
222![](/assets/dna-synthesized/elektron/IMG_0619.jpg) 274![](/assets/dna-synthesized/elektron/IMG_0619.jpg)
223 275
@@ -225,9 +277,12 @@ Elektron is connected to my MacBook via USB cable and audio out is patched to a
225 277
226![](/assets/dna-synthesized/elektron/IMG_0622.jpg) 278![](/assets/dna-synthesized/elektron/IMG_0622.jpg)
227 279
228For communicating with Elektron, I choose `pygame` Python module that has MIDI built in. With this, it was rather simple to send notes to the device. All I did was map MIDI notes to the actual Nucleotides. 280For communicating with Elektron, I choose `pygame` Python module that has MIDI
281built in. With this, it was rather simple to send notes to the device. All I
282did was map MIDI notes to the actual Nucleotides.
229 283
230Before all of this I also checked Audio MIDI Setup app under MacOS and checked MIDI Studio by pressing ⌘-2. 284Before all of this I also checked Audio MIDI Setup app under MacOS and checked
285MIDI Studio by pressing ⌘-2.
231 286
232![](/assets/dna-synthesized/elektron/midi-studio.jpg) 287![](/assets/dna-synthesized/elektron/midi-studio.jpg)
233 288
@@ -273,12 +328,27 @@ pygame.midi.quit()
273 328
274<video src="/assets/dna-synthesized/elektron/elektron.mp4" controls></video> 329<video src="/assets/dna-synthesized/elektron/elektron.mp4" controls></video>
275 330
276All of this could be made much more interesting if I choose different instruments for different Nucleotides, or doing more funky stuff with Elektron. But for now, this should be enough. It is just a proof of concept. Something to play around with. 331All of this could be made much more interesting if I choose different
332instruments for different Nucleotides, or doing more funky stuff with Elektron.
333But for now, this should be enough. It is just a proof of concept. Something
334to play around with.
277 335
278## Going even further 336## Going even further
279 337
280As you probably notice, the end results are quite similar to each other. This is to be expected because we are operating only with 4 notes essentially. What could make this more interesting is using something like [Supercollider](https://supercollider.github.io/) to create more interesting sounds. By transposing notes or using effects based on repeated data in a sequence. Possibilities are endless. 338As you probably notice, the end results are quite similar to each other. This
339is to be expected because we are operating only with 4 notes essentially. What
340could make this more interesting is using something like [Supercollider](https://supercollider.github.io/)
341to create more interesting sounds. By transposing notes or using effects based
342on repeated data in a sequence. Possibilities are endless.
343
344It is really astonishing what can be achieved with a little bit of code and an
345idea. I could see this becoming an interesting background soundscape instrument
346if done properly. It could replace random note generator with something more
347intriguing, biological, natural.
281 348
282It is really astonishing what can be achieved with a little bit of code and an idea. I could see this becoming an interesting background soundscape instrument if done properly. It could replace random note generator with something more intriguing, biological, natural. 349I actually find the results fascinating. I took some time and listened to this
350music of nature. Even though it's quite the same, it's also quite different.
351The subtle differences on repeat kind of creates music on its own. Makes you
352wonder. It kind of puts Occam’s Razor in its place. Nature for sure loves to
353make things as energy efficient as possible.
283 354
284I actually find the results fascinating. I took some time and listened to this music of nature. Even though it's quite the same, it's also quite different. The subtle differences on repeat kind of creates music on its own. Makes you wonder. It kind of puts Occam’s Razor in its place. Nature for sure loves to make things as energy efficient as possible.
diff --git a/content/posts/2022-08-13-algae-spotted-on-river-sava.md b/content/posts/2022-08-13-algae-spotted-on-river-sava.md
index 40b960f..faa2df1 100644
--- a/content/posts/2022-08-13-algae-spotted-on-river-sava.md
+++ b/content/posts/2022-08-13-algae-spotted-on-river-sava.md
@@ -1,11 +1,15 @@
1--- 1---
2title: Aerial photography of algae spotted on river Sava 2title: Aerial photography of algae spotted on river Sava
3url: aerial-photography-of-algae-spotted-on-river-sava.html 3url: aerial-photography-of-algae-spotted-on-river-sava.html
4date: 2022-08-13 4date: 2022-08-13T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8This is a bit of a different post than I usually write, but quite interesting one to me. River Sava has plenty of hydropower plants located down the stream. This makes regulating the strength of a current easier than normally. Because of lower stream strength and high temperatures, algae has formed on the river. This is the first time I've seen something like this in my whole life. 8This is a bit of a different post than I usually write, but quite interesting
9one to me. River Sava has plenty of hydropower plants located down the stream.
10This makes regulating the strength of a current easier than normally. Because
11of lower stream strength and high temperatures, algae has formed on the river.
12This is the first time I've seen something like this in my whole life.
9 13
10Below are some photographs taken from a DJI drone capturing the event. 14Below are some photographs taken from a DJI drone capturing the event.
11 15
@@ -21,4 +25,6 @@ Below are some photographs taken from a DJI drone capturing the event.
21 25
22![Algae on Sava](/assets/algae-sava/dji-algae-5.jpg) 26![Algae on Sava](/assets/algae-sava/dji-algae-5.jpg)
23 27
24I will try to get more photos of this in the future days and if something intriguing shows up will post it again on the blog. 28I will try to get more photos of this in the future days and if something
29intriguing shows up will post it again on the blog.
30
diff --git a/content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md b/content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md
index 6e5f938..120dcae 100644
--- a/content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md
+++ b/content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md
@@ -1,126 +1,303 @@
1--- 1---
2title: State of Web Technologies and Web development in year 2022 2title: State of Web Technologies and Web development in year 2022
3url: state-of-web-technologies-and-web-development-in-year-2022.html 3url: state-of-web-technologies-and-web-development-in-year-2022.html
4date: 2022-10-06 4date: 2022-10-06T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8## Initial thoughts 8## Initial thoughts
9 9
10*This post is a critique on the current state of web development. It is an opinionated post! I will learn more about this in the future, and probably slightly change my mind about some of the things I criticize.* 10*This post is a critique on the current state of web development. It is an
11opinionated post! I will learn more about this in the future, and probably
12slightly change my mind about some of the things I criticize.*
11 13
12I have started working on a hobby project about two weeks ago, and I wanted to use that situation as a learning one. Trying new things, new technologies, new tools. I always considered myself to be an adventurous person when it comes to technology. I never shy away from trying new languages, new operating systems etc. Likewise, I find the whole experience satisfying, and it tickles that part of my brain that finds discovery the highest of the mountains to climb. 14I have started working on a hobby project about two weeks ago, and I wanted to
15use that situation as a learning one. Trying new things, new technologies, new
16tools. I always considered myself to be an adventurous person when it comes to
17technology. I never shy away from trying new languages, new operating systems
18etc. Likewise, I find the whole experience satisfying, and it tickles that part
19of my brain that finds discovery the highest of the mountains to climb.
13 20
14What I always wanted to make was a coding game, that you would play in a browser (just to eliminate building binaries for each operating system) where you would level up your character and go into these scriptable battles. You know, RPG elements. 21What I always wanted to make was a coding game, that you would play in a
22browser (just to eliminate building binaries for each operating system) where
23you would level up your character and go into these scriptable battles. You
24know, RPG elements.
15 25
16So, the natural way to go would be some sort of SPA (single page application) with basic routing and some state management. Nothing crazy. 26So, the natural way to go would be some sort of SPA (single page application)
27with basic routing and some state management. Nothing crazy.
17 28
18> **Before we move on**, I have to be transparent. Take my views on this with a grain of salt. I have only scratched the surface with these technologies, and my knowledge is full of gaps. This is my experience using some of these products for the first time or in a limited capacity. 29> **Before we move on**, I have to be transparent. Take my views on this with
19> 30> a grain of salt. I have only scratched the surface with these technologies,
31> and my knowledge is full of gaps. This is my experience using some of these
32> products for the first time or in a limited capacity.
20 33
21Having this out of the way, I got myself a fresh pot of coffee and down the rabbit hole I went. 34Having this out of the way, I got myself a fresh pot of coffee and down the
35rabbit hole I went.
22 36
23## Giving React JS a spin 37## Giving React JS a spin
24 38
25I first tried [React JS](https://reactjs.org/). I kind of like it. Furthermore, I have worked with libraries like this in the past and also wrote a couple of them (nothing compared to that level), but I had the basic understanding of what was going on. I rolled up a project quickly and had basic things done in a matter of two hours, which was impressive. 39I first tried [React JS](https://reactjs.org/). I kind of like it. Furthermore,
26 40I have worked with libraries like this in the past and also wrote a couple of
27I prefer using [Tailwind CSS](https://tailwindcss.com/) for my styling pleasures, and integrating that was also a painless experience. It was actually nice to see that some things got better with time. In about 2 minutes I got Tailwind working, and I was able to use classes at my disposal. All that `postcss` stuff was taken care of by adding a couple of things in config files (all described really well in their documentation). 41them (nothing compared to that level), but I had the basic understanding of
28 42what was going on. I rolled up a project quickly and had basic things done in
29It is not that different from Vue which I have had more encounters with in the past People will probably call me a lunatic for saying this. But you know, it is the truth. Same same, but different. I still believe that using libraries like this is beneficial. I am not a JavaScript purist. They all have their quirks, but at the end of the day, I truly believe it’s worth it. 43a matter of two hours, which was impressive.
44
45I prefer using [Tailwind CSS](https://tailwindcss.com/) for my styling
46pleasures, and integrating that was also a painless experience. It was actually
47nice to see that some things got better with time. In about 2 minutes I got
48Tailwind working, and I was able to use classes at my disposal. All that
49`postcss` stuff was taken care of by adding a couple of things in config files
50(all described really well in their documentation).
51
52It is not that different from Vue which I have had more encounters with in the
53past People will probably call me a lunatic for saying this. But you know, it
54is the truth. Same same, but different. I still believe that using libraries
55like this is beneficial. I am not a JavaScript purist. They all have their
56quirks, but at the end of the day, I truly believe it’s worth it.
30 57
31## Bundlers and Transpilers 58## Bundlers and Transpilers
32 59
33I still reject calling [Typescript](https://www.typescriptlang.org/) to [JavaScript](https://www.javascript.com/) conversion a "compilation process". I call them [transpilers](https://devopedia.org/transpiler), and I don’t care! 😈 60I still reject calling [Typescript](https://www.typescriptlang.org/) to
61[JavaScript](https://www.javascript.com/) conversion a "compilation process".
62I call them [transpilers](https://devopedia.org/transpiler), and I don’t care! 😈
34 63
35And if you want to fight this, take a look at this little chart and be mad at it! 64And if you want to fight this, take a look at this little chart and be mad at it!
36 65
37![Compiling vs Transpiling](/assets/state-of-web/compiling-vs-transpiling.png) 66![Compiling vs Transpiling](/assets/state-of-web/compiling-vs-transpiling.png)
38 67
39The first one that I ever used was [webpack](https://webpack.js.org/), and it was an absolute horrific experience. Saying this, it is an absolutely fantastic tool. I felt more like a config editor than actually a programmer. To be fair, I am a huge fan of [make](https://www.gnu.org/software/make/), and you can do as you wish with this information. I like my build systems simple. 68The first one that I ever used was [webpack](https://webpack.js.org/), and it
40 69was an absolute horrific experience. Saying this, it is an absolutely
41Also, isn’t it interesting that we need something like [Babel](https://babeljs.io/) to make JavaScript code work in a browser that has only one client side scripting available, which is by no accident also JavaScript. Why? I know why it’s needed, but seriously, why. 70fantastic tool. I felt more like a config editor than actually a programmer.
42 71To be fair, I am a huge fan of [make](https://www.gnu.org/software/make/),
43I haven’t used Babel for years now. Or if I did, it was packaged together by some other bundler thingy. Which does not make things better, but at least I didn’t need to worry about it. 72and you can do as you wish with this information. I like my build systems
44 73simple.
45I really don’t like complicated build systems. I really don’t like abstracting code and making things appear magical. The older I get, the more I appreciate clear and clean, expressive code. No one-liners, if possible. 74
46 75Also, isn’t it interesting that we need something like [Babel](https://babeljs.io/)
47But I have to give props to [Vite](https://vitejs.dev/)! This was one of the best developer experiences I have ever had. Granted, it still has magical properties. And yes, it still is a bundler and abstracts things to the nth degree. But at least it didn’t force me to configure 700 lines of JSON. And I know that this makes me a hypocrite. You can’t have it all. Nonetheless, my reasoning here is, if using bundlers is inevitable, then at least they should provide an excellent developer experience. 76to make JavaScript code work in a browser that has only one client side
48 77scripting available, which is by no accident also JavaScript. Why? I know
49I also noticed that now the catch-all phrase is “blazingly fast” and “lightning fast” and “next generation” and stuff like that. I mean, yeah, tools should get faster with time. But saying that starting a project now takes 2 seconds instead of 20 seconds is something that is a break it or make it kind of a deal is ridiculous. I don’t mind waiting a couple of seconds every couple of days. I also don’t create 700 projects every day, and also who does? This argument has no bite. All I want is a decent reload time (~100ms is more than good enough for me) and that is it. 78why it’s needed, but seriously, why.
50 79
51You don’t need to sell me benefits if I only get them when I start a fresh project, and then try to convince me that this is somehow changing the fate of the universe. First of all, it is not. And second, if this is your only argument for your tool, I would advise you to maybe re-focus your efforts to something else. Vite says that startup times are really fast. And if that would be the only thing differentiating it from other tools, I would ignore it. But it has some really compelling features like [Hot Module Replacement](https://www.geeksforgeeks.org/reactjs-hot-module-replacement/) that really works well. It was a joy to use. 80I haven’t used Babel for years now. Or if I did, it was packaged together by
81some other bundler thingy. Which does not make things better, but at least
82I didn’t need to worry about it.
83
84I really don’t like complicated build systems. I really don’t like abstracting
85code and making things appear magical. The older I get, the more I appreciate
86clear and clean, expressive code. No one-liners, if possible.
87
88But I have to give props to [Vite](https://vitejs.dev/)! This was one of the
89best developer experiences I have ever had. Granted, it still has magical
90properties. And yes, it still is a bundler and abstracts things to the nth
91degree. But at least it didn’t force me to configure 700 lines of JSON. And
92I know that this makes me a hypocrite. You can’t have it all. Nonetheless,
93my reasoning here is, if using bundlers is inevitable, then at least they
94should provide an excellent developer experience.
95
96I also noticed that now the catch-all phrase is “blazingly fast” and
97“lightning fast” and “next generation” and stuff like that. I mean, yeah,
98tools should get faster with time. But saying that starting a project now takes
992 seconds instead of 20 seconds is something that is a break it or make it kind
100of a deal is ridiculous. I don’t mind waiting a couple of seconds every couple
101of days. I also don’t create 700 projects every day, and also who does? This
102argument has no bite. All I want is a decent reload time (~100ms is more than
103good enough for me) and that is it.
104
105You don’t need to sell me benefits if I only get them when I start a fresh
106project, and then try to convince me that this is somehow changing the fate
107of the universe. First of all, it is not. And second, if this is your only
108argument for your tool, I would advise you to maybe re-focus your efforts to
109something else. Vite says that startup times are really fast. And if that
110would be the only thing differentiating it from other tools, I would ignore
111it. But it has some really compelling features like
112[Hot Module Replacement](https://www.geeksforgeeks.org/reactjs-hot-module-replacement/)
113that really works well. It was a joy to use.
52 114
53So, I will be definitely using Vite in the future. 115So, I will be definitely using Vite in the future.
54 116
55## Jam Stack, Mach Stack no snack 117## Jam Stack, Mach Stack no snack
56 118
57Let's get a couple of the acronyms out of the way, so we all know what we are talking about: 119Let's get a couple of the acronyms out of the way, so we all know what we are
120talking about:
58 121
59- Jam Stack - JavaScript, API and Markup 122- Jam Stack - JavaScript, API and Markup
60- Mach Stack - Microservices, API-first, Cloud-Native SaaS, Headless 123- Mach Stack - Microservices, API-first, Cloud-Native SaaS, Headless
61 124
62It is so hard to follow all these new trendy things happening around you, that it makes you have a massive **FOMO** all the time. But on the other hand, you also don’t want to be that old fart that doesn’t move with the times and still writes his trusty jQuery code while listening to Blink 182 All the small things on full blast. It’s a good song, don’t get me wrong, but there are other songs out there. 125It is so hard to follow all these new trendy things happening around you, that
63 126it makes you have a massive **FOMO** all the time. But on the other hand, you
64I have to admit. [Vercel](https://vercel.com/) is really cool! Love the simplicity of the service. You could compare it to [Netlify](https://www.netlify.com/). I haven’t tried Netlify extensively, but from a couple of experimental deployments I still prefer Vercel. It is much more streamlined, but maybe this is bias in me. I really like Vercel’s Analytics, which give you a [Core Web Vitals report](https://web.dev/vitals/) in their admin console. Kind of cool, I’m not going to lie. 127also don’t want to be that old fart that doesn’t move with the times and still
65 128writes his trusty jQuery code while listening to Blink 182 All the small things
66This whole idea about frontend and backend merging into [SSR (server-side rendering)](https://www.debugbear.com/blog/server-side-rendering) looks so good on paper. It almost doesn’t come with any major flaws. 129on full blast. It’s a good song, don’t get me wrong, but there are other songs
67 130out there.
68But when it comes to the actual implementation, there is much to be desired. I’m going to lump [Next.js](https://nextjs.org/) and [Nuxt.js](https://nuxtjs.org/) together because they are essentially the same thing, just a different library. 131
69 132I have to admit. [Vercel](https://vercel.com/) is really cool! Love the
70Now comes the reality. Mixing backend and frontend in this manner creates this weird mental model where you kind of rely on magical properties of these libraries. You relinquish control over to them for better developer experience. But is that really true? Initially, I was so stoked about it. However, the more I used them, the more I felt uncomfortable. I felt dirty, actually. Maybe this is because I come from old ways of doing things where you control every step of request, and allowing something to hijack it feels like blasphemy. 133simplicity of the service. You could compare it to [Netlify](https://www.netlify.com/).
71 134I haven’t tried Netlify extensively, but from a couple of experimental
72More than that, some pretty significant technical issues arose from this. How do you do JWT token authentication? You put it in `api` folder and then do some fetching and storing into local state management. But doing this also requires some tinkering with await/async stuff on the React/Vue side of things. And then you need to write middleware for it. And the more I look at it, the more I see that this whole thing was not meant to be used like this, and it all feels and looks like a huge hack. 135deployments I still prefer Vercel. It is much more streamlined, but maybe this
73 136is bias in me. I really like Vercel’s Analytics, which give you a
74The issue I have with this is that they over-promise and under-deliver. They want to be an all-in-one replacement for everything, and they don’t deliver on this promise. And how could they?! We have to be fair. It is an impossible task. 137[Core Web Vitals report](https://web.dev/vitals/) in their admin console. Kind
75 138of cool, I’m not going to lie.
76They sell you [NoOps](https://www.geeksforgeeks.org/overview-of-noops/), but when you need to accomplish something a little bit more out of the scope of Hello World, you have to make hacky decisions to make it work. And having a deployment strategy that relies on many moving parts is never a good idea. Abstracting too much is usually a sign of bad architecture. 139
77 140This whole idea about frontend and backend merging into [SSR (server-side rendering)](https://www.debugbear.com/blog/server-side-rendering)
78Lately, this has become a huge trend that will for sure bite us in the future. And let’s not get it twisted. By doing this, PaaS providers like [AWS](https://aws.amazon.com/), [GCS](https://cloud.google.com/), etc. obscure their billing, and you end up paying more than you really should. And even if that is not an issue, it comes down to the principle of things. AWS is known for having multiple “currencies“ inside their projects like write operations, read operations, etc. which add up, and it creates this impossible to track billing scheme. It all behaves suspiciously like a pay-to-win game you could find on mobile phones that scams you out of your money. 141looks so good on paper. It almost doesn’t come with any major flaws.
79 142
80And as far as I am concerned, the most important thing was me not coding the functionalities for the game I want to make. I was battling libraries and cloud providers. How to deploy, what settings are relevant. Bad documentation or multiple versions of achieving the same thing. You are getting bombarded by all this information, and you don’t really have any control over it. Production-ready code becomes a joke, essentially. Especially if you tend to work on that project for a prolonged period of time. 143But when it comes to the actual implementation, there is much to be desired.
81 144I’m going to lump [Next.js](https://nextjs.org/) and [Nuxt.js](https://nuxtjs.org/)
82All of these options end up creating a fatigue. What to choose, what not to choose. Unnecessary worrying about if the stack will still be deemed worthy in six months. There is elegance in simplicity. 145together because they are essentially the same thing, just a different library.
83 146
84> JavaScript UI frameworks and libraries work in cycles. Every six months or so, a new one pops up, claiming that it has revolutionized UI development. Thousands of developers adopt it into their new projects, blog posts are written, Stack Overflow questions are asked and answered, and then a newer (and even more revolutionary) framework pops up to usurp the throne. — Ian Allen 147Now comes the reality. Mixing backend and frontend in this manner creates this
148weird mental model where you kind of rely on magical properties of these
149libraries. You relinquish control over to them for better developer experience.
150But is that really true? Initially, I was so stoked about it. However, the
151more I used them, the more I felt uncomfortable. I felt dirty, actually. Maybe
152this is because I come from old ways of doing things where you control every
153step of request, and allowing something to hijack it feels like blasphemy.
154
155More than that, some pretty significant technical issues arose from this. How
156do you do JWT token authentication? You put it in `api` folder and then do some
157fetching and storing into local state management. But doing this also requires
158some tinkering with await/async stuff on the React/Vue side of things. And then
159you need to write middleware for it. And the more I look at it, the more I see
160that this whole thing was not meant to be used like this, and it all feels and
161looks like a huge hack.
162
163The issue I have with this is that they over-promise and under-deliver. They
164want to be an all-in-one replacement for everything, and they don’t deliver
165on this promise. And how could they?! We have to be fair. It is an impossible
166task.
167
168They sell you [NoOps](https://www.geeksforgeeks.org/overview-of-noops/), but
169when you need to accomplish something a little bit more out of the scope of
170Hello World, you have to make hacky decisions to make it work. And having a
171deployment strategy that relies on many moving parts is never a good idea.
172Abstracting too much is usually a sign of bad architecture.
173
174Lately, this has become a huge trend that will for sure bite us in the future.
175And let’s not get it twisted. By doing this, PaaS providers like
176[AWS](https://aws.amazon.com/), [GCS](https://cloud.google.com/), etc. obscure
177their billing, and you end up paying more than you really should. And even if
178that is not an issue, it comes down to the principle of things. AWS is known
179for having multiple “currencies“ inside their projects like write operations,
180read operations, etc. which add up, and it creates this impossible to track
181billing scheme. It all behaves suspiciously like a pay-to-win game you could
182find on mobile phones that scams you out of your money.
183
184And as far as I am concerned, the most important thing was me not coding the
185functionalities for the game I want to make. I was battling libraries and
186cloud providers. How to deploy, what settings are relevant. Bad documentation
187or multiple versions of achieving the same thing. You are getting bombarded
188by all this information, and you don’t really have any control over it.
189Production-ready code becomes a joke, essentially. Especially if you tend to
190work on that project for a prolonged period of time.
191
192All of these options end up creating a fatigue. What to choose, what not to
193choose. Unnecessary worrying about if the stack will still be deemed worthy
194in six months. There is elegance in simplicity.
195
196> JavaScript UI frameworks and libraries work in cycles. Every six months or
197> so, a new one pops up, claiming that it has revolutionized UI development.
198> Thousands of developers adopt it into their new projects, blog posts are
199> written, Stack Overflow questions are asked and answered, and then a newer
200> (and even more revolutionary) framework pops up to usurp the throne.
201> — Ian Allen
85 202
86![To many options](/assets/state-of-web/2008-vs-2020.png) 203![To many options](/assets/state-of-web/2008-vs-2020.png)
87 204
88And this jab at these libraries and cloud providers is not done out of malice. It is a real concern that I have about them. In my life, I have seen technologies come and go, but the basics always stick around. So surrendering all the power you have to a library or a cloud provider is in my opinion a stupid move. 205And this jab at these libraries and cloud providers is not done out of malice.
206It is a real concern that I have about them. In my life, I have seen
207technologies come and go, but the basics always stick around. So surrendering
208all the power you have to a library or a cloud provider is in my opinion a
209stupid move.
89 210
90## Tailwind CSS still rocks! 211## Tailwind CSS still rocks!
91 212
92You know, many people say negative things about Tailwind. And after a lot of deliberation, I came to the conclusion that Tailwind is good for two types of developers. Tailwind is good for a complete noob or a senior developer. A complete noob doesn’t really care about inner workings of CSS, and a senior developer also doesn’t care about CSS. Well, at least, not anymore. And developers in between usually have the biggest issues with it. Not always of course, but in a lot of cases. 213You know, many people say negative things about Tailwind. And after a lot of
93 214deliberation, I came to the conclusion that Tailwind is good for two types of
94I like the creature comforts of Tailwind. Being utility first would make me argue that it is actually more similar to [Sass](https://sass-lang.com/) or [Less](https://lesscss.org/) than something like Bootstrap. Not technically, but ideologically. After I started using it, I never looked back. I use it every time I need to do something web related. 215developers. Tailwind is good for a complete noob or a senior developer. A
95 216complete noob doesn’t really care about inner workings of CSS, and a senior
96Writing CSS for general things feels like going several steps back. Instead of focusing on what you are actually trying to achieve, you focus on notations like [BEM](https://en.bem.info/methodology/css/), code structuring, optimizing HTML size. Just doing things that make 0.1% difference. You know that saying: Early optimization is the root of all evil. Exactly that. 217developer also doesn’t care about CSS. Well, at least, not anymore. And
97 218developers in between usually have the biggest issues with it. Not always of
98I am also not saying that Tailwind is the cure for everything. Sometimes custom CSS is necessary. But from what I found out in using it for almost two years in a production environment (on a site getting quite a lot of traffic and constantly being changed), I can say without any reservations that Tailwind saved our asses countless times. We would be rewriting CSS all the time without it. And I don’t really think writing CSS is the best way to spend my time. 219course, but in a lot of cases.
99 220
100I have also noticed that people who criticize Tailwind the most never actually used it in a real project that has a long lifetime with plenty of changes that will happen in the future. 221I like the creature comforts of Tailwind. Being utility first would make me
222argue that it is actually more similar to [Sass](https://sass-lang.com/) or
223[Less](https://lesscss.org/) than something like Bootstrap. Not technically,
224but ideologically. After I started using it, I never looked back. I use it
225every time I need to do something web related.
226
227Writing CSS for general things feels like going several steps back. Instead of
228focusing on what you are actually trying to achieve, you focus on notations
229like [BEM](https://en.bem.info/methodology/css/), code structuring, optimizing
230HTML size. Just doing things that make 0.1% difference. You know that saying:
231Early optimization is the root of all evil. Exactly that.
232
233I am also not saying that Tailwind is the cure for everything. Sometimes custom
234CSS is necessary. But from what I found out in using it for almost two years
235in a production environment (on a site getting quite a lot of traffic and
236constantly being changed), I can say without any reservations that Tailwind
237saved our asses countless times. We would be rewriting CSS all the time without
238it. And I don’t really think writing CSS is the best way to spend my time.
239
240I have also noticed that people who criticize Tailwind the most never actually
241used it in a real project that has a long lifetime with plenty of changes that
242will happen in the future.
101 243
102But you know, whatever floats your boat! 244But you know, whatever floats your boat!
103 245
104## Code maintainability 246## Code maintainability
105 247
106Somehow, people also stopped talking about maintenance. If you constantly try to catch the latest and greatest train, you are by that logic always trying new things. Which is a good thing if you want to learn about technologies and try them. But for the production environment, you have to have a stable stack that doesn’t change every 6 months. 248Somehow, people also stopped talking about maintenance. If you constantly try
249to catch the latest and greatest train, you are by that logic always trying
250new things. Which is a good thing if you want to learn about technologies and
251try them. But for the production environment, you have to have a stable stack
252that doesn’t change every 6 months.
107 253
108You can lock dependencies for sure. Nevertheless, the hype train moves along anyway. And the mindset this breeds goes against locking the code. This bleeding-edge rolling release cycle is not helping. That is why enterprise solutions usually look down on these popular stacks and only do bare minimum to appear hip and cool. 254You can lock dependencies for sure. Nevertheless, the hype train moves along
255anyway. And the mindset this breeds goes against locking the code. This
256bleeding-edge rolling release cycle is not helping. That is why enterprise
257solutions usually look down on these popular stacks and only do bare minimum to
258appear hip and cool.
109 259
110With that said, I still think that progress is good, but should be taken with a grain of salt. If your project is something that should be built once and then rarely updated, going with the latest stack is a possible way to go. But, if you are working on a project that lasts for years, you should probably approach it with some level of caution. Web development is often times too volatile. 260With that said, I still think that progress is good, but should be taken with a
261grain of salt. If your project is something that should be built once and then
262rarely updated, going with the latest stack is a possible way to go. But, if
263you are working on a project that lasts for years, you should probably approach
264it with some level of caution. Web development is often times too volatile.
111 265
112## Web development has a marketing issue 266## Web development has a marketing issue
113 267
114I noticed that almost every project now has this marketing spin put on it. Everything is blazingly fast now. I get it, they are competing for your attention, but what happened to just being truthful and not inflating reality. 268I noticed that almost every project now has this marketing spin put on it.
269Everything is blazingly fast now. I get it, they are competing for your
270attention, but what happened to just being truthful and not inflating reality.
115 271
116And in order to appeal to mass market, they leave things out of their marketing materials. These open-source projects are now behaving more and more like companies do. Which is a scary thought on its self. 272And in order to appeal to mass market, they leave things out of their marketing
273materials. These open-source projects are now behaving more and more like
274companies do. Which is a scary thought on its self.
117 275
118And we are also seeing a rise in a concept of building a company in the open, which is a good thing, don't get me wrong. But when it is using open-source to lure people and then lock them in their ecosystem, there is where I have issues with it. 276And we are also seeing a rise in a concept of building a company in the open,
277which is a good thing, don't get me wrong. But when it is using open-source to
278lure people and then lock them in their ecosystem, there is where I have issues
279with it.
119 280
120This might be because I have been using GNU/Linux for 20 years now and have been so beholden for my success to open-source that I see issues when open-source is being used to trick people into a false sense of security that these projects are built in the spirit of open-source. Because there is a difference. They are NOT! They have a really specific goal in mind. And the open-source is being used as a delivery system. Which is in my opinion disgusting! 281This might be because I have been using GNU/Linux for 20 years now and have
282been so beholden for my success to open-source that I see issues when
283open-source is being used to trick people into a false sense of security that
284these projects are built in the spirit of open-source. Because there is a
285difference. They are NOT! They have a really specific goal in mind. And the
286open-source is being used as a delivery system. Which is in my opinion
287disgusting!
121 288
122## Conclusion 289## Conclusion
123 290
124I will end my post with this. Web development is running now in circles. People are discovering [RPC](https://www.tutorialspoint.com/remote-procedure-call-rpc) now and this is the now the next big thing. [GraphQL](https://graphql.org/) is so passé. And I am so tired of it all. Of blazingly fast libraries, of all these new technologies that are actually just a remake of old ones. Of just the general spirit of the web. I will just use what I already know. Which worked 10 years ago and will work 10 years after this. I will adopt a couple of little tools like Vite. But I will not waste my time on this anymore. 291I will end my post with this. Web development is running now in circles. People
292are discovering [RPC](https://www.tutorialspoint.com/remote-procedure-call-rpc)
293now and this is the now the next big thing. [GraphQL](https://graphql.org/) is
294so passé. And I am so tired of it all. Of blazingly fast libraries, of all
295these new technologies that are actually just a remake of old ones. Of just
296the general spirit of the web. I will just use what I already know. Which worked
29710 years ago and will work 10 years after this. I will adopt a couple of
298little tools like Vite. But I will not waste my time on this anymore.
299
300It was a good exercise to get in touch with what’s new now. Nothing really
301changed that much. FOMO is now cured! Now I have to get my ass back to actually
302code and make the project that I wanted to make in the first place.
125 303
126It was a good exercise to get in touch with what’s new now. Nothing really changed that much. FOMO is now cured! Now I have to get my ass back to actually code and make the project that I wanted to make in the first place.
diff --git a/content/posts/2022-10-10-sentiment-based-on-political-bias.md b/content/posts/2022-10-10-sentiment-based-on-political-bias.md
deleted file mode 100644
index fc03a5e..0000000
--- a/content/posts/2022-10-10-sentiment-based-on-political-bias.md
+++ /dev/null
@@ -1,84 +0,0 @@
1---
2title: Sentiment distribution analysis based on political bias in online publications
3url: sentiment-based-on-political-bias.html
4date: 2022-10-10
5draft: true
6---
7
8I have been wondering for a long time what would sentiment differences look based on political leaning from popular publications. Is it the left that is more optimistic, center or the right.
9
10> **Before people loose their minds**, I don't care about political stuff in the context of this post and this is data we are talking about and not my personal feelings about it. So, before saying anything have this in mind and let data speak for itself.
11
12## Preparing the data
13
14The first step in getting stories from publications so we can start doing sentiment analysis on it. I have chosen to select 30 publications. 10 from left leaning publications, 10 from centre and 10 from right leaning ones.
15
16To find out leaning of a publication I will defer to AllSides website which provide a [Media Bias Ratings](https://www.allsides.com/media-bias/ratings).
17
18![AllSides Bias Chart](https://www.allsides.com/sites/default/files/AllSidesMediaBiasChart-Version6_0.jpg)
19
20The chart above is taken from AllSides and demonstrates political leaning of publications. This data changes over time and AllSides have made the revisions publicly available on their website.
21
22- [Learn more about Version 6](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-6-updated-ratings-npr-newsmax-and-more)
23- [Learn more about Version 5](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-42)
24- [Learn about Version 4](https://www.allsides.com/blog/new-allsides-media-bias-chart-announcing-version-4)
25- [Learn about Version 3](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-3)
26- [Learn about Version 2](https://www.allsides.com/blog/new-allsides-media-bias-chart-version-2-updated-media-bias-ratings)
27- [Learn about Version 1.1](https://www.allsides.com/blog/updated-allsides-media-bias-chart-version-11)
28- [Learn about Version 1](https://www.allsides.com/blog/introducing-allsides-media-bias-chart)
29
30
31They categorise political bias AllSides came up with is:
32
33TODO: CREATE A HORIZONTAL ARRAY STYLE OF CHART IMAGE
34
35- Left,
36- Lean Left,
37- Center,
38- Lean Right,
39- Right.
40
41I will group Left and Lean Left together. And the same goes for Lean Right and Right. So we end up with three groups [Left, Center, Right].
42
43The list I have ended up with contains these publications:
44
45- Left political bias:
46 - BuzzFeed News (https://www.buzzfeednews.com)
47 - CNN (https://cnn.com)
48 - Daily Beast (https://www.thedailybeast.com)
49 - HuffPost (https://www.huffpost.com)
50 - The Intercept (https://theintercept.com)
51 - Vox (https://www.vox.com)
52 - Slate (https://slate.com)
53 - The New Yorker (https://www.newyorker.com)
54 - MSNBC (https://www.msnbc.com)
55 - New York Times News (https://www.nytimes.com)
56- Center political "bias":
57 - Axios (https://www.axios.com)
58 - BBC (https://www.bbc.com)
59 - News Week (https://www.newsweek.com)
60 - Reuters (https://www.reuters.com)
61 - RealClear Politics (https://www.realclearpolitics.com)
62 - The Hill (https://thehill.com)
63 - The Wall Street Journal News(https://www.wsj.com)
64 - Associated Press News (https://apnews.com)
65 - CNET (https://www.cnet.com)
66 - Forbes (https://www.forbes.com)
67- Right political bias:
68 - The American Spectator (https://spectator.org)
69 - Breitbart News (http://www.breitbart.com)
70 - The Blaze (https://www.theblaze.com)
71 - Daily Caller (http://dailycaller.com)
72 - Daily Mail (https://www.dailymail.co.uk)
73 - The Daily Wire (https://www.dailywire.com)
74 - Fox News (https://www.foxnews.com)
75 - The Federalist (https://thefederalist.com)
76 - New York Post Opinion (https://nypost.com/opinion/)
77 - OANN (https://www.oann.com)
78
79
80
81
82
83
84
diff --git a/content/posts/2022-10-11-handling-massive-worlds-in-godot.md b/content/posts/2022-10-11-handling-massive-worlds-in-godot.md
deleted file mode 100644
index 0fa30e8..0000000
--- a/content/posts/2022-10-11-handling-massive-worlds-in-godot.md
+++ /dev/null
@@ -1,82 +0,0 @@
1---
2title: Handling big worlds in Godot by splitting and lazy loading chunks of it
3url: handling-big-worlds-in-godot.html
4date: 2022-10-11
5draft: true
6---
7
8Because these examples are exported from **Godot to WebAssembly** and the packaging produces **large files**, you will need to **click to lazy load them**
9
10I have seen a couple of examples on the net, but never really a comprehensive guide how this would be achieved. My solution is nowhere perfect, but it will get you started. This code is also not optimized, so buyer beware.
11
12For the sake of simplicity, I will keep the terrain plain. I have been working on a terrain generation tool in my spare time, but due to the other obligations, that project was put on the back burner. If you however interested in it you can check it out on my personal Git repository [https://git.mitjafelicijan.com/village-creator.git/](https://git.mitjafelicijan.com/village-creator.git/).
13
14![Village Creator](/assets/godot-dynamic-tile-loading/village-creator.png)
15
16It's using a node system to generate a terrain mesh, and it's utilizing cellular automata for special effects like sand erosion and wind erosion, etc. Example of using cellular automata rule in an image below.
17
18![Cellular automata](/assets/godot-dynamic-tile-loading/cellular-automata.png)
19
20As I mentioned previously, still far away from being useful. Always, enough about that. Let’s move on to the topic of this post.
21
22## Handling lazy loading in 2D world
23
24To simplify things, we will try doing in 2D world first. It makes for a simpler exercise and eliminates a lot of complexity that comes with additional axis.
25
26### Player movement
27
28First, we need to take care of player movement. I will not go into many details here, since there are plenty of good tutorials on this topic on the interwebs. Suffice it to say, I created a [KinematicBody2D](https://docs.godotengine.org/en/stable/classes/class_kinematicbody2d.html) node that gives us goodies like `move_and_slide` and added input maps for [move_up, move_down, move_right, move_left] movement.
29
30```gdscript
31# Player2D.gd
32
33extends KinematicBody2D
34
35# Exported variables.
36export var speed = 300
37
38# Utility variables for later use.
39# Can be ignored for now.
40export var player_scale = 1
41export var camera_zoom = 1
42
43# Internal variables.
44var velocity = Vector2.ZERO
45
46func _ready():
47 # Can be ignored for now.
48 $Model.scale = Vector2(player_scale, player_scale)
49 $Camera.zoom = Vector2(camera_zoom, camera_zoom)
50
51# Executes on every physics frame (60, 144, etc).
52# This game has vsync enabled.
53func _physics_process(delta):
54 handle_player_movement()
55
56# Handles player movement.
57func handle_player_movement():
58 velocity = Vector2.ZERO
59 if Input.is_action_pressed('move_right'):
60 velocity.x += 1
61 if Input.is_action_pressed('move_left'):
62 velocity.x -= 1
63 if Input.is_action_pressed('move_down'):
64 velocity.y += 1
65 if Input.is_action_pressed('move_up'):
66 velocity.y -= 1
67
68 # Make sure diagonal movement isn't faster.
69 # Therefore vector needs to be normalized.
70 velocity = velocity.normalized() * speed
71 velocity = move_and_slide(velocity)
72```
73
74[Read more about vector normalization.](https://www.fundza.com/vectors/normalize/)
75
76`$Model` is just a sprite loaded and positioned into the scene. For the background, I again loaded just a normal sprite and positioned it to center. This makes it easier to test if the movement is working properly. Background will be removed when we will start dynamically loading the world.
77
78<video src="/assets/godot-dynamic-tile-loading/2d-player-movement.webm" controls></video>
79
80Code for player movement can be [downloaded from my Git server](https://git.mitjafelicijan.com/big-worlds-godot.git/snapshot/big-worlds-godot-55bcad79c11bd67e8268925d7edbf571aa31e3bf.zip).
81
82<!--<div class="ll-iframe w-full h-80" data-src="/assets/godot-dynamic-tile-loading/example1/"></div>-->
diff --git a/content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md b/content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md
index dccf6b4..2739764 100644
--- a/content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md
+++ b/content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md
@@ -1,44 +1,64 @@
1--- 1---
2title: Microsoundtrack — That sound that machine makes when struggling 2title: Microsoundtrack — That sound that machine makes when struggling
3url: that-sound-that-machine-makes-when-struggling.html 3url: that-sound-that-machine-makes-when-struggling.html
4date: 2022-10-16 4date: 2022-10-16T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8A couple of months ago, I got an idea about micro soundtracks. In this concept, you are the observer, director, and audience in this tiny movies. 8A couple of months ago, I got an idea about micro soundtracks. In this concept,
9you are the observer, director, and audience in this tiny movies.
9 10
10What you do is to attempt to imagine what would be happening around you based on a title of the song and let the song help you fill the void in your story. 11What you do is to attempt to imagine what would be happening around you based
12on a title of the song and let the song help you fill the void in your story.
11 13
12I made these songs is Logic Pro X. Every year or so I do this kind of thing and make a couple of songs similar to this. But this is the first time I am posting about it. 14I made these songs is Logic Pro X. Every year or so I do this kind of thing
15and make a couple of songs similar to this. But this is the first time I am
16posting about it.
13 17
14You can listen to the whole set on [Youtube](https://www.youtube.com/watch?v=_5oXBhSmF3c) or scroll down the page and there are embedded players for each song. 18You can listen to the whole set on [Youtube](https://www.youtube.com/watch?v=_5oXBhSmF3c)
19or scroll down the page and there are embedded players for each song.
15 20
16## A bunch of inter-dimensional people with loud clocks 21## A bunch of inter-dimensional people with loud clocks
17 22
18A group of inter-dimensional people are going up and down the elevator with you while having loud clocks around their necks. Each clock ticks on a different frequency. A lot of other sounds are getting drawn into your dimension, resulting in a strange merging of dimensions. 23A group of inter-dimensional people are going up and down the elevator with
24you while having loud clocks around their necks. Each clock ticks on a different
25frequency. A lot of other sounds are getting drawn into your dimension,
26resulting in a strange merging of dimensions.
19 27
20<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1349272965/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe> 28<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1349272965/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe>
21 29
22## Two black holes conversing about the weather 30## Two black holes conversing about the weather
23 31
24You are a traveler in a spaceship flying very close to two colliding black holes having a discussion about the weather while tearing each other apart. During all this your ship is getting pulled into the event horizon of both black holes, putting a lot of strain on your spaceship. 32You are a traveler in a spaceship flying very close to two colliding black holes
33having a discussion about the weather while tearing each other apart. During
34all this your ship is getting pulled into the event horizon of both black
35holes, putting a lot of strain on your spaceship.
25 36
26<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1756714200/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe> 37<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1756714200/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe>
27 38
28## A planet where every organism is a plant 39## A planet where every organism is a plant
29 40
30You land on a planet where every living organism is a plant and among those plants some of them are highly intelligent, and you were asked to make first contact with the native species. Your visit takes place in a giant cave where you are meeting these plants, and they are talking to you. 41You land on a planet where every living organism is a plant and among those
42plants some of them are highly intelligent, and you were asked to make first
43contact with the native species. Your visit takes place in a giant cave where
44you are meeting these plants, and they are talking to you.
31 45
32<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=3710973979/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe> 46<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=3710973979/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe>
33 47
34## Bio implants having a fit and reprogramming your brain 48## Bio implants having a fit and reprogramming your brain
35 49
36In a distant future where everybody has bio implants, you have just received your first one, which happens to be a brain implant. Something goes wrong, and your implant is starting to misbehave, and you are experiencing brain malfunctions. You are on the streets at night a couple of hours after your procedure. You can feel your sanity breaking down. 50In a distant future where everybody has bio implants, you have just received
51your first one, which happens to be a brain implant. Something goes wrong,
52and your implant is starting to misbehave, and you are experiencing brain
53malfunctions. You are on the streets at night a couple of hours after your
54procedure. You can feel your sanity breaking down.
37 55
38<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1157430581/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe> 56<iframe style="border: 0; width: 100%; height: 42px;" src="https://bandcamp.com/EmbeddedPlayer/album=3913808801/size=small/bgcol=ffffff/linkcol=0687f5/track=1157430581/transparent=true/" seamless title="Bandcamp"><a href="https://mitjafelicijan.bandcamp.com/album/that-sound-that-machine-makes-when-struggling">That sound that machine makes when struggling by Mitja Felicijan</a></iframe>
39 57
40## Cow animation 58## Cow animation
41 59
42I also made this little cow animation. Go into full screen to see the effects in more details. 60I also made this little cow animation. Go into full screen to see the effects
61in more details.
43 62
44<video src="/assets/microsoundtrack/cow.m4v" controls loop></video> 63<video src="/assets/microsoundtrack/cow.m4v" controls loop></video>
64
diff --git a/content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md b/content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md
index 03fcc59..4ec307f 100644
--- a/content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md
+++ b/content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md
@@ -1,15 +1,36 @@
1--- 1---
2title: Trying to build a New kind of terminal emulator for the modern age 2title: Trying to build a New kind of terminal emulator for the modern age
3url: trying-to-build-a-new-kind-of-terminal-emulator.html 3url: trying-to-build-a-new-kind-of-terminal-emulator.html
4date: 2023-01-26 4date: 2023-01-26T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Over the past few weeks, I have been really thinking about terminal emulators, how we interact with computers, the separation of text-based programs and GUI ones. To be perfectly honest, I got pissed off one evening when I was cleaning up files on my computer. Normally, I go into console and do `ncdu` and check where the junk is. Then I start deleting stuff. Without any discrimination, usually. But when it comes to screenshots, I have learned that it's good to keep them somewhere near if I need to refer to something that I was doing. I am an avid screenshot taker. So at that point I checked Pictures folder and also did a basic search `find . -type f -name "*.jpg"` for all the JPEG files in my home directory and immediately got pissed off. Why can’t I see thumbnails in my terminal? I know why, but why in the year of 2022 this is still a problem. I am used to traversing my disk via terminal. I am faster, and I am more comfortable this way. But when it comes to visualization, I then need to revert to GUI applications and again find the same file to see it. I know that programs like `feh` and `sxiv` are available, but I would just like to see the preview. Like [Jupyter notebook](https://jupyter.org/) or something similar. Just having it inline. Part of a result. 8Over the past few weeks, I have been really thinking about terminal emulators,
9 9how we interact with computers, the separation of text-based programs and GUI
10It also didn’t help that I was spending some time with the [Plan 9](https://plan9.io/plan9/) Operating system. More specifically [9FRONT](http://9front.org/). The way that [ACME editor](http://acme.cat-v.org/) handles text editing is just wonderful. Different and fresh somehow, even though it’s super old. 10ones. To be perfectly honest, I got pissed off one evening when I was cleaning
11 11up files on my computer. Normally, I go into console and do `ncdu` and check
12So, I went on a lookout for an interesting way of visualizing results of some query. I found these applications to be outstanding examples of how not to be a captive of a predetermined way of doing things. 12where the junk is. Then I start deleting stuff. Without any discrimination,
13usually. But when it comes to screenshots, I have learned that it's good to
14keep them somewhere near if I need to refer to something that I was doing. I
15am an avid screenshot taker. So at that point I checked Pictures folder and
16also did a basic search `find . -type f -name "*.jpg"` for all the JPEG files
17in my home directory and immediately got pissed off. Why can’t I see thumbnails
18in my terminal? I know why, but why in the year of 2022 this is still a
19problem. I am used to traversing my disk via terminal. I am faster, and I am
20more comfortable this way. But when it comes to visualization, I then need to
21revert to GUI applications and again find the same file to see it. I know that
22programs like `feh` and `sxiv` are available, but I would just like to see the
23preview. Like [Jupyter notebook](https://jupyter.org/) or something similar.
24Just having it inline. Part of a result.
25
26It also didn’t help that I was spending some time with the [Plan 9](https://plan9.io/plan9/)
27Operating system. More specifically [9FRONT](http://9front.org/). The way
28that [ACME editor](http://acme.cat-v.org/) handles text editing is just
29wonderful. Different and fresh somehow, even though it’s super old.
30
31So, I went on a lookout for an interesting way of visualizing results of some
32query. I found these applications to be outstanding examples of how not to be
33a captive of a predetermined way of doing things.
13 34
14- [Wolfram Mathematica](https://www.wolfram.com/mathematica/) 35- [Wolfram Mathematica](https://www.wolfram.com/mathematica/)
15- [Jupyter notebooks](https://jupyter.org/) 36- [Jupyter notebooks](https://jupyter.org/)
@@ -17,29 +38,57 @@ So, I went on a lookout for an interesting way of visualizing results of some qu
17- [Temple OS](https://templeos.org/) 38- [Temple OS](https://templeos.org/)
18- [Emacs](https://www.gnu.org/software/emacs/) 39- [Emacs](https://www.gnu.org/software/emacs/)
19 40
20My idea is not as out there as ACME is, but it is a spin on the terminal emulators. I like the modes that Vi/Vim provides you with. I like the way the Emacs does its own `M-x` `M-c`. Furthermore, I really like how Mathematica and Jupyter present the data in a free flowing form. And I love how Temple OS is basically a C interpreter on some level. 41My idea is not as out there as ACME is, but it is a spin on the terminal
42emulators. I like the modes that Vi/Vim provides you with. I like the way
43the Emacs does its own `M-x` `M-c`. Furthermore, I really like how Mathematica
44and Jupyter present the data in a free flowing form. And I love how Temple OS
45is basically a C interpreter on some level.
21 46
22> **Note:** This is part 1 of the journey. Nowhere finished yet. I am just tinkering with this at the moment. This whole thing can easily spectacularly fail. 47> **Note:** This is part 1 of the journey. Nowhere finished yet. I am just
23> 48> tinkering with this at the moment. This whole thing can easily spectacularly
49> fail.
24 50
25So I started. I knew that I wanted to have the couple of modes, but I didn’t like the repetition of keystrokes, so the only option was to have some sort of toggle and indicate to the user that they are in a special mode. Like Vi does for Normal and Visual mode. 51So I started. I knew that I wanted to have the couple of modes, but I didn’t
52like the repetition of keystrokes, so the only option was to have some sort of
53toggle and indicate to the user that they are in a special mode. Like Vi does
54for Normal and Visual mode.
26 55
27These modes would for the first version be: 56These modes would for the first version be:
28 57
29- *Preview mode* (toggle with Ctrl + P) 58- *Preview mode* (toggle with Ctrl + P)
30 - When this mode would be enabled, the `ls` command would try to find images from the results and display thumbnails from them in the terminal itself. No ASCII art. Proper images. In a grid! 59 - When this mode would be enabled, the `ls` command would try to find images
60 from the results and display thumbnails from them in the terminal itself.
61 No ASCII art. Proper images. In a grid!
31- *Detach mode* (toggle with Ctrl + D) 62- *Detach mode* (toggle with Ctrl + D)
32 - When this mode would be enabled, every command would open a new window and execute that command in it. This would be useful for starting `htop` in a separate window. 63 - When this mode would be enabled, every command would open a new window
33 64 and execute that command in it. This would be useful for starting `htop`
34The reason for having these modes togglable is to not ask for previews every time. You enable a mode and until you disable it, it behaves that way. Purely out of ergonomic reasons. 65 in a separate window.
35 66
36I would like to treat every terminal I open as a session mentally. When I start using the terminal, I start digging deeper into the issue I am trying to resolve. And while I am doing this, I would like to open detached windows etc. A lot of these things can be done easily with something like [i3](https://i3wm.org/), but also that pull you out of the context of what you were doing. I would like to orchestrate everything from one single point. 67The reason for having these modes togglable is to not ask for previews every
37 68time. You enable a mode and until you disable it, it behaves that way.
38In planning for this project, I knew that I would need to use a language like C and a library such as [SDL2](https://www.libsdl.org/) in order to achieve the desired results. I had considered other options, but ultimately determined that [SDL2](https://www.libsdl.org/) was the best fit based on its capabilities and reputation in the programming community. 69Purely out of ergonomic reasons.
39 70
40At first, I thought the idea of a hardware accelerated terminal was a bit of a joke. It seemed like such a niche and unnecessary feature, especially given the fact that terminal emulators have been around for decades and have always relied on software rendering. But to be fair, [Alacritty](https://alacritty.org/) is doing the same thing. Well, they are doing a remarkable job at it. 71I would like to treat every terminal I open as a session mentally. When I start
41 72using the terminal, I start digging deeper into the issue I am trying to resolve.
42So, I embarked on a journey. Everything has to start somewhere. For me, it started with creating a window! It has to start somewhere. 🙂 73And while I am doing this, I would like to open detached windows etc. A lot of
74these things can be done easily with something like [i3](https://i3wm.org/),
75but also that pull you out of the context of what you were doing. I would
76like to orchestrate everything from one single point.
77
78In planning for this project, I knew that I would need to use a language like
79C and a library such as [SDL2](https://www.libsdl.org/) in order to achieve
80the desired results. I had considered other options, but ultimately determined
81that [SDL2](https://www.libsdl.org/) was the best fit based on its capabilities
82and reputation in the programming community.
83
84At first, I thought the idea of a hardware accelerated terminal was a bit of
85a joke. It seemed like such a niche and unnecessary feature, especially given
86the fact that terminal emulators have been around for decades and have always
87relied on software rendering. But to be fair, [Alacritty](https://alacritty.org/)
88is doing the same thing. Well, they are doing a remarkable job at it.
89
90So, I embarked on a journey. Everything has to start somewhere. For me, it
91started with creating a window! It has to start somewhere. 🙂
43 92
44```c 93```c
45// Oh, Hi Mark! 94// Oh, Hi Mark!
@@ -52,13 +101,28 @@ SDL_Window *window = SDL_CreateWindow(
52 101
53I continued like this to get some text displayed on the screen. 102I continued like this to get some text displayed on the screen.
54 103
55I noted that [`TTF_RenderText_Solid`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_Solid) rendered text really poorly. There were no antialiasing at all. In my wisdom, I never checked the documentation. Well, that was a fail. To uneducated like me: `TTF_RenderText_Solid` renders Latin1 text at fast quality to a new 8-bit surface. So, that's why the texts looked like shit. No wonder. 104I noted that [`TTF_RenderText_Solid`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_Solid)
56 105rendered text really poorly. There were no antialiasing at all. In my wisdom,
57Remarks on `TTF_RenderText_Solid`: This function will allocate a new 8-bit, palettized surface. The surface's 0 pixel will be the colorkey, giving a transparent background. The 1 pixel will be set to the text color. 106I never checked the documentation. Well, that was a fail. To uneducated like
58 107me: `TTF_RenderText_Solid` renders Latin1 text at fast quality to a new 8-bit
59After I replaced it with [`TTF_RenderText_LCD`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_LCD) which renders Latin1 text at LCD subpixel quality to a new ARGB surface, the text started looking good. Really make sure you read the documentation. It’s actually good. As a side note, you can find all the documentation regarding [SDL2 on their Wiki](https://wiki.libsdl.org/). 108surface. So, that's why the texts looked like shit. No wonder.
60 109
61After that was done, I started working on displaying other things like `Preview` and `Detach` modes. This wasn’t really that hard. In SDL2 you can check all the available events with `while (SDL_PollEvent(&event) > 0)` and have a bunch of switch statements to determine which key is currently being pressed. More about keys, [SDLKey](https://documentation.help/SDL/sdlkey.html) and mroe about pooling the events on [SDL_PollEvent](https://documentation.help/SDL/sdlpollevent.html). 110Remarks on `TTF_RenderText_Solid`: This function will allocate a new 8-bit,
111palettized surface. The surface's 0 pixel will be the colorkey, giving a
112transparent background. The 1 pixel will be set to the text color.
113
114After I replaced it with [`TTF_RenderText_LCD`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_LCD)
115which renders Latin1 text at LCD subpixel quality to a new ARGB surface, the
116text started looking good. Really make sure you read the documentation. It’s
117actually good. As a side note, you can find all the documentation regarding
118[SDL2 on their Wiki](https://wiki.libsdl.org/).
119
120After that was done, I started working on displaying other things like
121`Preview` and `Detach` modes. This wasn’t really that hard. In SDL2 you can
122check all the available events with `while (SDL_PollEvent(&event) > 0)` and
123have a bunch of switch statements to determine which key is currently being
124pressed. More about keys, [SDLKey](https://documentation.help/SDL/sdlkey.html)
125and mroe about pooling the events on [SDL_PollEvent](https://documentation.help/SDL/sdlpollevent.html).
62 126
63```c 127```c
64while (SDL_PollEvent(&event) > 0) 128while (SDL_PollEvent(&event) > 0)
@@ -80,7 +144,9 @@ while (SDL_PollEvent(&event) > 0)
80} 144}
81``` 145```
82 146
83After that was somewhat working correctly, I started creating a struct that would hold all the commands and results and I call them Cells. Yes, I stole that naming idea from Jupyter. 147After that was somewhat working correctly, I started creating a struct that
148would hold all the commands and results and I call them Cells. Yes, I stole
149that naming idea from Jupyter.
84 150
85```c 151```c
86typedef struct 152typedef struct
@@ -93,9 +159,13 @@ typedef struct
93} Cell; 159} Cell;
94``` 160```
95 161
96I am at a place now where I am starting to implement scrolling. This will for sure be fun to code. Memory management in C is super easy. 😂 162I am at a place now where I am starting to implement scrolling. This will for
163sure be fun to code. Memory management in C is super easy. 😂
97 164
98I have also added a simple [INI file like configuration](https://en.wikipedia.org/wiki/INI_file) support. It is done in an [STB style of header](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) and maps to specific options supported by the terminal. It is not universal, and the code below demonstrates how I will use it in the future. 165I have also added a simple [INI file like configuration](https://en.wikipedia.org/wiki/INI_file)
166support. It is done in an [STB style of header](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt)
167and maps to specific options supported by the terminal. It is not universal,
168and the code below demonstrates how I will use it in the future.
99 169
100```c 170```c
101#ifndef CONFIG_H 171#ifndef CONFIG_H
@@ -169,4 +239,8 @@ extern Config read_config_file(const char *filename)
169#endif 239#endif
170``` 240```
171 241
172This is as far as I managed to get for now. I have a daily job and this prohibits me to work on these things full time. But I should probably get back and finish this. At least have a simple version working out, so I can start testing it on my machines. Fingers crossed. 🕵️‍♂️ \ No newline at end of file 242This is as far as I managed to get for now. I have a daily job and this
243prohibits me to work on these things full time. But I should probably get
244back and finish this. At least have a simple version working out, so I can
245start testing it on my machines. Fingers crossed. 🕵️‍♂️
246
diff --git a/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md b/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md
index 7d22950..3d07072 100644
--- a/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md
+++ b/content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md
@@ -1,18 +1,25 @@
1--- 1---
2title: Push to multiple origins at once in Git 2title: Push to multiple origins at once in Git
3url: push-to-multiple-origins-at-once-in-git.html 3url: push-to-multiple-origins-at-once-in-git.html
4date: 2023-05-10 4date: 2023-05-10T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8This is a quick one. I use my personal Git server as my main server, and I use GitHub only as a mirror. As a result, I constantly forget to push to GitHub. 8This is a quick one. I use my personal Git server as my main server, and I use
9GitHub only as a mirror. As a result, I constantly forget to push to GitHub.
9 10
10To push to multiple origins at once in Git, you can create a custom Git alias or use a script to automate the process. Here's an example of how you can achieve this using a Git alias: 11To push to multiple origins at once in Git, you can create a custom Git alias
12or use a script to automate the process. Here's an example of how you can
13achieve this using a Git alias:
11 14
12```sh 15```sh
13git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"' 16git config --global alias.pushall '!sh -c "git remote | xargs -L1 git push --all"'
14``` 17```
15 18
16This command creates a Git alias called `pushall` which, when executed, will push the changes to all the remote repositories associated with the current repository. To use it, simply run `git pushall` instead of `git push` when you want to push to all the remote repositories at once. 19This command creates a Git alias called `pushall` which, when executed, will
20push the changes to all the remote repositories associated with the current
21repository. To use it, simply run `git pushall` instead of `git push` when
22you want to push to all the remote repositories at once.
17 23
18That's all, folks. 24That's all, folks.
25
diff --git a/content/posts/2023-05-16-rekindling-my-love-for-programming.md b/content/posts/2023-05-16-rekindling-my-love-for-programming.md
index 1d1d08b..6b73bb1 100644
--- a/content/posts/2023-05-16-rekindling-my-love-for-programming.md
+++ b/content/posts/2023-05-16-rekindling-my-love-for-programming.md
@@ -1,32 +1,76 @@
1--- 1---
2title: Rekindling my love for programming and enjoying the act of creating 2title: Rekindling my love for programming and enjoying the act of creating
3url: rekindling-my-love-for-programming.html 3url: rekindling-my-love-for-programming.html
4date: 2023-05-16 4date: 2023-05-16T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Programming can be a challenging and rewarding experience, but sometimes it's easy to feel burnt out or disinterested. I have lost the passion for coding over the past couple of months and it looked like I will never enjoy the coding as much as I did. 8Programming can be a challenging and rewarding experience, but sometimes it's
9easy to feel burnt out or disinterested. I have lost the passion for coding
10over the past couple of months and it looked like I will never enjoy the
11coding as much as I did.
9 12
10I was feeling burnt out with programming. I thought taking a break from it and focusing on other activities that I enjoy might be helpful. This way, I could come back to programming with a fresh perspective and renewed energy. I also thought about learning a new programming language or technology to keep things interesting and challenging. 13I was feeling burnt out with programming. I thought taking a break from it
14and focusing on other activities that I enjoy might be helpful. This way, I
15could come back to programming with a fresh perspective and renewed energy.
16I also thought about learning a new programming language or technology to
17keep things interesting and challenging.
11 18
12However, what I didn't realize was that learning a new language or technology wasn't going to solve the underlying issue. I needed to take a step back and re-evaluate why I had lost my passion for programming in the first place. This involved taking a deep look into what I was doing that resulted in this rut. 19However, what I didn't realize was that learning a new language or technology
20wasn't going to solve the underlying issue. I needed to take a step back and
21re-evaluate why I had lost my passion for programming in the first place.
22This involved taking a deep look into what I was doing that resulted in
23this rut.
13 24
14Sometimes, it's easy to get caught up in the hype of new technologies or languages, and we can feel like we're missing out if we're not constantly learning and experimenting. However, it's important to remember that the latest and greatest isn't always the best fit for our projects or our interests. Instead of constantly chasing the next big thing, it can be helpful to focus on what truly interests us and what we're passionate about. This can help us stay motivated and engaged with our work, rather than feeling like we're just going through the motions. 25Sometimes, it's easy to get caught up in the hype of new technologies or
26languages, and we can feel like we're missing out if we're not constantly
27learning and experimenting. However, it's important to remember that the
28latest and greatest isn't always the best fit for our projects or our
29interests. Instead of constantly chasing the next big thing, it can be helpful
30to focus on what truly interests us and what we're passionate about. This
31can help us stay motivated and engaged with our work, rather than feeling
32like we're just going through the motions.
15 33
16I expressed that I had lost my passion for coding over the past couple of months, and I realized that the reason behind it was my tendency to spread myself too thin and not focus on completing interesting projects. In order to regain my passion for coding, I need to focus on projects that truly interest me and give me a sense of purpose and motivation. 34I expressed that I had lost my passion for coding over the past couple of
35months, and I realized that the reason behind it was my tendency to spread
36myself too thin and not focus on completing interesting projects. In order
37to regain my passion for coding, I need to focus on projects that truly
38interest me and give me a sense of purpose and motivation.
17 39
18Recently, I have been playing World of Warcraft more frequently and have become interested in developing addons for the game. 40Recently, I have been playing World of Warcraft more frequently and have
41become interested in developing addons for the game.
19 42
20This quickly resulted in me creating three addons that improve the quality of life, and I subsequently developed a more useful add-on that encapsulates all the others I made. 43This quickly resulted in me creating three addons that improve the quality
44of life, and I subsequently developed a more useful add-on that encapsulates
45all the others I made.
21 46
22I found it interesting that this action sparked a new interest in me. Additionally, I discovered the Lua language, which reminded me that coding should be fun rather than just a struggle with a language. It should be pure, unadulterated fun. 47I found it interesting that this action sparked a new interest in me.
48Additionally, I discovered the Lua language, which reminded me that coding
49should be fun rather than just a struggle with a language. It should be
50pure, unadulterated fun.
23 51
24I wasn't fighting the syntax, nor was I focused on finding the most optimal solution. I simply created things without the pressure of making them the best they could possibly be. 52I wasn't fighting the syntax, nor was I focused on finding the most optimal
53solution. I simply created things without the pressure of making them the
54best they could possibly be.
25 55
26This made me realize that I actually adore simple languages that get out of the way and let you express what you want to do. It forced me to rethink a lot about what I use and what I actually enjoy. 56This made me realize that I actually adore simple languages that get out of
57the way and let you express what you want to do. It forced me to rethink a
58lot about what I use and what I actually enjoy.
27 59
28I have decided to stick to the basics. For a scripting language, I will use Lua. For networking, I will use Golang. And for any special needs, I will rely on C. I do not require Rust, Nim, or Zig. This selection is more than sufficient for my needs. I have to stay true to this simplicity. There is something to the Occam's Razor. 60I have decided to stick to the basics. For a scripting language, I will use
61Lua. For networking, I will use Golang. And for any special needs, I will
62rely on C. I do not require Rust, Nim, or Zig. This selection is more than
63sufficient for my needs. I have to stay true to this simplicity. There is
64something to the Occam's Razor.
29 65
30I've been struggling with a lack of creativity lately, but now I'm experiencing a real change. I realized I needed to take a step back and stop actively trying to address the issue. I needed to stop worrying and overthinking it. I simply needed some time. Looking back, I don't think I've taken any significant time off in the last 10 years. 66I've been struggling with a lack of creativity lately, but now I'm experiencing
67a real change. I realized I needed to take a step back and stop actively trying
68to address the issue. I needed to stop worrying and overthinking it. I simply
69needed some time. Looking back, I don't think I've taken any significant time
70off in the last 10 years.
71
72Suddenly, I find myself with the energy and passion to complete multiple
73small projects. It doesn't feel like a chore at all. Who knew I needed WoW
74to kickstart everything. Inspiration really does come from the strangest
75places.
31 76
32Suddenly, I find myself with the energy and passion to complete multiple small projects. It doesn't feel like a chore at all. Who knew I needed WoW to kickstart everything. Inspiration really does come from the strangest places.
diff --git a/content/posts/2023-05-22-crafting-stories-in-zed-editor.md b/content/posts/2023-05-22-crafting-stories-in-zed-editor.md
index 9c04b1c..f5240da 100644
--- a/content/posts/2023-05-22-crafting-stories-in-zed-editor.md
+++ b/content/posts/2023-05-22-crafting-stories-in-zed-editor.md
@@ -1,25 +1,41 @@
1--- 1---
2title: From General Zod to Superman - Crafting Stories in Zed Editor 2title: From General Zod to Superman - Crafting Stories in Zed Editor
3url: crafting-stories-in-zed-editor.html 3url: crafting-stories-in-zed-editor.html
4date: 2023-05-22 4date: 2023-05-22T12:00:00+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Pretentious title! Good start! I have nothing to add to this discussion. I just like this editor and wanted to write something here that will remind me to use it again in a while when/if it becomes available for Linux. 8Pretentious title! Good start! I have nothing to add to this discussion. I just
9like this editor and wanted to write something here that will remind me to
10use it again in a while when/if it becomes available for Linux.
9 11
10**TLDR:** I think this code editor is very cool and has a massive potential. I hope they don’t mess up with adding a plugin ecosystem to it! 12**TLDR:** I think this code editor is very cool and has a massive potential.
13I hope they don’t mess up with adding a plugin ecosystem to it!
11 14
12Out of morbid curiosity, I started using the [Zed editor](https://zed.dev/) on my Mac. Zed is a high-performance, multiplayer code editor developed by the creators of Atom and Tree-sitter. Written in Rust so it has to be blazingly fast! 😊 It's a joke, calm down. 15Out of morbid curiosity, I started using the [Zed editor](https://zed.dev/)
16on my Mac. Zed is a high-performance, multiplayer code editor developed by
17the creators of Atom and Tree-sitter. Written in Rust so it has to be
18blazingly fast! 😊 It's a joke, calm down.
13 19
14Over the past year, I have switched between [Helix editor](https://helix-editor.com/) and [VS Code](https://code.visualstudio.com/), but for the last couple of months, I have been using Helix exclusively. 20Over the past year, I have switched between [Helix editor](https://helix-editor.com/)
21and [VS Code](https://code.visualstudio.com/), but for the last couple of
22months, I have been using Helix exclusively.
15 23
16I've been genuinely impressed by Zed. When you open a file, it automatically detects its type and downloads the corresponding [LSP (language server)](https://en.wikipedia.org/wiki/Language_Server_Protocol). The list of supported languages is not extensive, but it's still impressive. It's a great example of how to create a product that stays out of your way. 24I've been genuinely impressed by Zed. When you open a file, it automatically
25detects its type and downloads the corresponding [LSP (language server)](https://en.wikipedia.org/wiki/Language_Server_Protocol).
26The list of supported languages is not extensive, but it's still impressive.
27It's a great example of how to create a product that stays out of your way.
17 28
18![Zed 1](/assets/zed/zed-1.png?style=bigimg) 29![Zed 1](/assets/zed/zed-1.png?style=bigimg)
19 30
20For C development it downloaded [clangd](https://clangd.llvm.org/) and setting up missing dependencies in code was rather easy. For this project I use [SDL2](https://www.libsdl.org/) for rendering terminal emulator. It’s a hobby project, don’t worry about it. 31For C development it downloaded [clangd](https://clangd.llvm.org/) and setting
32up missing dependencies in code was rather easy. For this project I use
33[SDL2](https://www.libsdl.org/) for rendering terminal emulator. It’s a
34hobby project, don’t worry about it.
21 35
22If you are going to give this a try and you are using C, I suggest checking two files in the root of your project folder. If you don't have them, create them. 36If you are going to give this a try and you are using C, I suggest checking
37two files in the root of your project folder. If you don't have them,
38create them.
23 39
24**compile_flags.txt** 40**compile_flags.txt**
25 41
@@ -28,7 +44,10 @@ If you are going to give this a try and you are using C, I suggest checking two
28-I/opt/homebrew/include/SDL2 44-I/opt/homebrew/include/SDL2
29``` 45```
30 46
31Easy way of checking what the appropriate includes for a specific library is to use `pkg-config` and in my case `pkg-config SDL2 --cflags-only-I`. But this is nothing new to C/C++ devs. Just a noter for people who are using Visual Studio. 47Easy way of checking what the appropriate includes for a specific library is
48to use `pkg-config` and in my case `pkg-config SDL2 --cflags-only-I`. But this
49is nothing new to C/C++ devs. Just a noter for people who are using Visual
50Studio.
32 51
33**.clang-format** 52**.clang-format**
34 53
@@ -39,21 +58,31 @@ BasedOnStyle: Mozilla
39 58
40I prefer Mozilla coding style for C so you can set that up. 59I prefer Mozilla coding style for C so you can set that up.
41 60
42They really have something special here. Although there is no version available for Linux yet, I will stick to Helix. This impressive piece of engineering is, above all, an amazing example of craftsmanship. 61They really have something special here. Although there is no version available
62for Linux yet, I will stick to Helix. This impressive piece of engineering is,
63above all, an amazing example of craftsmanship.
43 64
44They have a bunch of amazing integrated functionalities like live desktop sharing, code sharing in a live coding session. There is a lot of pretentious marketing speak there but the product is still amazing! 65They have a bunch of amazing integrated functionalities like live desktop
66sharing, code sharing in a live coding session. There is a lot of pretentious
67marketing speak there but the product is still amazing!
45 68
46For me the speed and the simplicity of the product was the most impressive thing. You get that: it just works feeling. A rare thing in 2023. 69For me the speed and the simplicity of the product was the most impressive
70thing. You get that: it just works feeling. A rare thing in 2023.
47 71
48![Zed 2](/assets/zed/zed-2.png?style=bigimg) 72![Zed 2](/assets/zed/zed-2.png?style=bigimg)
49 73
50 74They also managed to add [Github Copilot](https://github.com/features/copilot)
51They also managed to add [Github Copilot](https://github.com/features/copilot) in a non obtrusive way. To me, everything feels very intentional and specifically selected. It's minimal yet maximally effective. 75in a non obtrusive way. To me, everything feels very intentional and
76specifically selected. It's minimal yet maximally effective.
52 77
53<video src="https://zed.dev/img/post/copilot/copilot-demo.webm" autoplay loop></video> 78<video src="https://zed.dev/img/post/copilot/copilot-demo.webm" autoplay loop></video>
54 79
55It is a perfect balance between VS Code, Jetbrains IDE’s and something like VIM or Helix. 80It is a perfect balance between VS Code, Jetbrains IDE’s and something like
81VIM or Helix.
56 82
57I just hope they **DON’T** add plugin support and keep it like it is. They as a vendor should add stuff to it with great deliberation and thought. And this way the product will stay fast and focused. That’s my two cents. 83I just hope they **DON’T** add plugin support and keep it like it is. They as a
84vendor should add stuff to it with great deliberation and thought. And this
85way the product will stay fast and focused. That’s my two cents.
58 86
59Amazing job! 87Amazing job!
88
diff --git a/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md b/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
index eae7025..e1e45e8 100644
--- a/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
+++ b/content/posts/2023-05-23-i-was-wrong-about-git-workflows.md
@@ -1,28 +1,72 @@
1--- 1---
2title: I think I was completely wrong about Git workflows 2title: I think I was completely wrong about Git workflows
3url: i-was-wrong-about-git-workflows.html 3url: i-was-wrong-about-git-workflows.html
4date: 2023-05-23 4date: 2023-05-23T12:00:00+02:00
5draft: false 5draft: false
6type: posts
7tags: []
6--- 8---
7 9
8I have been using some approximation of [Git Flow](https://jeffkreeftmeijer.com/git-flow/) for years now and never really questioned it to be honest. When I create a repo I create develop branch and set it as default one and then merge to master from there. Seems reasonable enough. 10I have been using some approximation of [Git Flow](https://jeffkreeftmeijer.com/git-flow/)
11for years now and never really questioned it to be honest. When I create a repo
12I create develop branch and set it as default one and then merge to master
13from there. Seems reasonable enough.
9 14
10One thing that I have learned is that long living branches are the devil. They always end up making a huge mess when they need to be merged eventually into master. So by that reason, what is the develop branch if not the longest living feature branch. And from my personal experience there was never a situation where I wasn’t sweating bullets when I had to merge develop back to master. 15One thing that I have learned is that long living branches are the devil.
16They always end up making a huge mess when they need to be merged eventually
17into master. So by that reason, what is the develop branch if not the longest
18living feature branch. And from my personal experience there was never a
19situation where I wasn’t sweating bullets when I had to merge develop back
20to master.
11 21
12This realisation started to give me pause. So why the hell am I doing this, and is there a better way. Well the solution was always there. And it comes in a form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). 22This realisation started to give me pause. So why the hell am I doing this,
23and is there a better way. Well the solution was always there. And it comes
24in a form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging).
13 25
14So what are git tags? Git tags are references to specific points in a Git repository's history. They are used to mark important milestones, such as releases or significant commits, making it easier to identify and access specific versions of a project. 26So what are git tags? Git tags are references to specific points in a Git
27repository's history. They are used to mark important milestones, such as
28releases or significant commits, making it easier to identify and access
29specific versions of a project.
15 30
16Somehow we have all hijacked the meaning of the master branch that it has to be the most releasable version of code. And this is also where the confusing about versioning the software kicks in. Because master branch implicitly says that we are dealing with the rolling release type of a software. And by having a develop branch we are hacking around this confusion. With a separation of develop and master we lock functionalities into place and forcing a stable vs development version of the software. 31Somehow we have all hijacked the meaning of the master branch that it has
32to be the most releasable version of code. And this is also where the confusing
33about versioning the software kicks in. Because master branch implicitly says
34that we are dealing with the rolling release type of a software. And by having
35a develop branch we are hacking around this confusion. With a separation of
36develop and master we lock functionalities into place and forcing a stable
37vs development version of the software.
17 38
18But if that is true and the long living branches are the devil then why have develop at all. I think that most of this comes to how continuous integration is being done. There usually is no granular access to tags and CD software deploys what is present on a specific branch, may that be master for production and develop for staging. This is a gross simplification and by having this in place we have completely removed tagging as a viable option to create a fix point in software cycle that says, this is the production ready code. 39But if that is true and the long living branches are the devil then why have
40develop at all. I think that most of this comes to how continuous integration
41is being done. There usually is no granular access to tags and CD software
42deploys what is present on a specific branch, may that be master for production
43and develop for staging. This is a gross simplification and by having this
44in place we have completely removed tagging as a viable option to create a
45fix point in software cycle that says, this is the production ready code.
19 46
20One cool thing about tags are that you can checkout a specific tag. So they behave very similarly as branches in that regard. And you don’t have the overhead of having two mainstream branches. 47One cool thing about tags are that you can checkout a specific tag. So they
48behave very similarly as branches in that regard. And you don’t have the
49overhead of having two mainstream branches.
21 50
22So what is the solution? One approach is to use development workflow, where all changes are made on the smaller branches and continuously merged into master. Where the software is ready to be pushed to production you tag the master branch. This approach eliminates the need for long-lived branches and simplifies the development process. It also encourages developers to make small, incremental changes that can be tested and deployed quickly. However, this approach may not be suitable for all projects or teams that heavily rely on automated deployment based on branch names only. 51So what is the solution? One approach is to use development workflow, where
52all changes are made on the smaller branches and continuously merged into
53master. Where the software is ready to be pushed to production you tag the
54master branch. This approach eliminates the need for long-lived branches and
55simplifies the development process. It also encourages developers to make
56small, incremental changes that can be tested and deployed quickly. However,
57this approach may not be suitable for all projects or teams that heavily rely
58on automated deployment based on branch names only.
23 59
24This also requires that developers always keep production in mind. No more living on an island of the develop branch. All your actions and code need to be ready to meet production standards on a much smaller timescale. 60This also requires that developers always keep production in mind. No more
61living on an island of the develop branch. All your actions and code need to
62be ready to meet production standards on a much smaller timescale.
25 63
26I think that we have complicated the workflow in an honest attempt to make things more streamlined but in the process of doing this, we have inadvertently made our lives much more complicated. 64I think that we have complicated the workflow in an honest attempt to make
65things more streamlined but in the process of doing this, we have inadvertently
66made our lives much more complicated.
67
68In conclusion, it's important to re-evaluate our workflows from time to time
69to see if they still make sense and if there are better alternatives available.
70Long-living branches can be problematic, and using tags to mark important
71milestones can simplify the development process.
27 72
28In conclusion, it's important to re-evaluate our workflows from time to time to see if they still make sense and if there are better alternatives available. Long-living branches can be problematic, and using tags to mark important milestones can simplify the development process.
diff --git a/static/general/index.css b/static/general/index.css
index 7af598d..834ed35 100644
--- a/static/general/index.css
+++ b/static/general/index.css
@@ -1 +1 @@
/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mx-auto{margin-left:auto;margin-right:auto}.my-12{margin-top:3rem;margin-bottom:3rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-6{margin-left:1.5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.contents{display:contents}.hidden{display:none}.h-full{height:100%}.w-full{width:100%}.flex-grow{flex-grow:1}.list-disc{list-style-type:disc}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.gap-1{gap:.25rem}.rounded{border-radius:.25rem}.border-0{border-width:0}.border-2{border-width:2px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-orange-600{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity))}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-16{padding-bottom:4rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.underline-offset-2{text-underline-offset:2px}*{cursor:url(/general/9front-cursor.png),auto}.container-blog{max-width:700px}::selection{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}::-moz-selection{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}a:hover{color:blue}article.single h2{margin-bottom:2rem}article.single h2,article.single.note h2{margin-top:2rem;font-size:1.5rem;line-height:2rem;font-weight:700;line-height:1.25}article.single.note h2{margin-bottom:.25rem}article.single h3{font-size:1.25rem}article.single h3,article.single h4{margin-bottom:1rem;margin-top:2rem;line-height:1.75rem;font-weight:700;line-height:1.25}article.single h4{font-size:1.125rem}article.single p{margin-bottom:1.25rem}article.single a{text-decoration-line:underline;text-underline-offset:2px}article.single a:hover{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity))}article.single .content blockquote{background-image:url(/general/alert-light.svg);background-size:30px 30px;background-repeat:no-repeat;background-position:0 5px;margin-top:2rem;margin-bottom:2rem;padding-left:3rem}article.single .content blockquote p{margin-bottom:.5rem}article.single img{margin-top:2rem;margin-bottom:2rem;image-rendering:crisp-edges;image-rendering:-webkit-optimize-contrast}article.single img,article.single video{width:100%;border-radius:.25rem;--tw-bg-opacity:1!important;background-color:rgb(249 250 251/var(--tw-bg-opacity))!important}article.single audio{margin-bottom:1.5rem;width:100%}article.single code{background-color:rgb(254 249 195/var(--tw-bg-opacity))}article.single code,article.single.note code{border-radius:.25rem;--tw-bg-opacity:1;padding:.25rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}article.single.note code{background-color:rgb(243 244 246/var(--tw-bg-opacity))}article.single pre{margin-bottom:1.5rem;overflow-x:auto;border-radius:.25rem;--tw-bg-opacity:1!important;background-color:rgb(249 250 251/var(--tw-bg-opacity))!important;padding:1rem;font-size:.75rem;line-height:1rem}article.single pre code,article.single.note pre code{background:unset;padding:unset;line-height:1.625}article.single table{margin-bottom:1rem;width:100%;border-collapse:collapse;border-width:1px;--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}article.single table td,article.single table th,article.single table tr{border-width:1px;padding:.5rem 1rem;text-align:left}article.single .content ul{margin-bottom:1.5rem;list-style-type:disc;padding-left:1.5rem}@media (min-width:768px){article.single .content ul{padding-left:2.5rem}}article.single .content ol{margin-bottom:1.5rem;list-style-type:decimal;padding-left:2rem}@media (min-width:768px){article.single .content ol{padding-left:2.5rem}}article.single #TableOfContents{margin-bottom:2.5rem;margin-left:1rem;line-height:1.625}article.single #TableOfContents ul{list-style-type:decimal;padding-left:1rem}@media (min-width:768px){article.single #TableOfContents ul{padding-left:1.5rem}}article.single .katex-display{margin-top:2.5rem;margin-bottom:2.5rem}article.single .ll-iframe{border-radius:.25rem;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}article.single .ll-iframe:before{display:flex;height:100%}@keyframes pulse{50%{opacity:.5}}article.single .ll-iframe:before{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity));font-size:.875rem;line-height:1.25rem;font-weight:500;content:"Click here to load resource…"}article.single .ll-iframe.empty:before{content:none}.hover\:bg-yellow-100:hover{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity))}.hover\:text-gray-800:hover{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}@media (min-width:768px){.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:inline-block{display:inline-block}.md\:w-auto{width:auto}.md\:flex-row{flex-direction:row}.md\:p-0{padding:0}} \ No newline at end of file /*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.mx-auto{margin-left:auto;margin-right:auto}.my-12{margin-top:3rem;margin-bottom:3rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-12{margin-bottom:3rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-6{margin-left:1.5rem}.mt-4{margin-top:1rem}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.contents{display:contents}.hidden{display:none}.h-full{height:100%}.w-full{width:100%}.flex-grow{flex-grow:1}.list-disc{list-style-type:disc}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.gap-1{gap:.25rem}.rounded{border-radius:.25rem}.border-0{border-width:0}.border-2{border-width:2px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}.bg-orange-600{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity))}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pb-16{padding-bottom:4rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.underline-offset-2{text-underline-offset:2px}*{cursor:url(/general/9front-cursor.png),auto}.container-blog{max-width:700px}::selection{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}::-moz-selection{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity));--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}a:hover{color:blue}article.single h2{margin-bottom:2rem}article.single h2,article.single.note h2{margin-top:2rem;font-size:1.5rem;line-height:2rem;font-weight:700;line-height:1.25}article.single.note h2{margin-bottom:.25rem}article.single h3{font-size:1.25rem}article.single h3,article.single h4{margin-bottom:1rem;margin-top:2rem;line-height:1.75rem;font-weight:700;line-height:1.25}article.single h4{font-size:1.125rem}article.single p{margin-bottom:1.25rem}article.single a{text-decoration-line:underline;text-underline-offset:2px}article.single a:hover{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity))}article.single .content blockquote{background-image:url(/general/alert-light.svg);background-size:30px 30px;background-repeat:no-repeat;background-position:0 5px;margin-top:2rem;margin-bottom:2rem;padding-left:3rem}article.single .content blockquote p{margin-bottom:.5rem}article.single img{margin-top:2rem;margin-bottom:2rem;image-rendering:crisp-edges;image-rendering:-webkit-optimize-contrast}article.single img,article.single video{width:100%;border-radius:.25rem;--tw-bg-opacity:1!important;background-color:rgb(249 250 251/var(--tw-bg-opacity))!important}article.single audio{margin-bottom:1.5rem;width:100%}article.single code{background-color:rgb(254 249 195/var(--tw-bg-opacity))}article.single code,article.single.note code{border-radius:.25rem;--tw-bg-opacity:1;padding:.25rem .5rem;font-size:.75rem;line-height:1rem;font-weight:500}article.single.note code{background-color:rgb(243 244 246/var(--tw-bg-opacity))}article.single pre{margin-bottom:1.5rem;overflow-x:auto;border-radius:.25rem;--tw-bg-opacity:1!important;background-color:rgb(249 250 251/var(--tw-bg-opacity))!important;padding:1rem;font-size:.75rem;line-height:1rem}article.single pre code,article.single.note pre code{background:unset;padding:unset;line-height:1.625}article.single table{margin-bottom:1rem;width:100%;border-collapse:collapse;border-width:1px;--tw-border-opacity:1;border-color:rgb(0 0 0/var(--tw-border-opacity))}article.single table td,article.single table th,article.single table tr{border-width:1px;padding:.5rem 1rem;text-align:left}article.single .content ul{margin-bottom:1.5rem;list-style-type:disc;padding-left:1.5rem}@media (min-width:768px){article.single .content ul{padding-left:2.5rem}}article.single .content ol{margin-bottom:1.5rem;list-style-type:decimal;padding-left:2rem}@media (min-width:768px){article.single .content ol{padding-left:2.5rem}}article.single #TableOfContents{margin-bottom:2.5rem;margin-left:1rem;line-height:1.625}article.single #TableOfContents ul{list-style-type:decimal;padding-left:1rem}@media (min-width:768px){article.single #TableOfContents ul{padding-left:1.5rem}}article.single .content ul ul{margin-bottom:auto}article.single .katex-display{margin-top:2.5rem;margin-bottom:2.5rem}article.single .ll-iframe{border-radius:.25rem;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity))}article.single .ll-iframe:before{display:flex;height:100%}@keyframes pulse{50%{opacity:.5}}article.single .ll-iframe:before{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:2px;--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity));font-size:.875rem;line-height:1.25rem;font-weight:500;content:"Click here to load resource…"}article.single .ll-iframe.empty:before{content:none}.hover\:bg-yellow-100:hover{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity))}.hover\:text-gray-800:hover{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity))}.hover\:underline:hover{text-decoration-line:underline}@media (min-width:768px){.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:inline-block{display:inline-block}.md\:w-auto{width:auto}.md\:flex-row{flex-direction:row}.md\:p-0{padding:0}} \ No newline at end of file
diff --git a/static/notes/dcss-quickstart.pdf b/static/notes/dcss-quickstart.pdf
new file mode 100644
index 0000000..1b70615
--- /dev/null
+++ b/static/notes/dcss-quickstart.pdf
Binary files differ
diff --git a/static/notes/dcss.jpg b/static/notes/dcss.jpg
new file mode 100644
index 0000000..ffe7c6a
--- /dev/null
+++ b/static/notes/dcss.jpg
Binary files differ
diff --git a/static/notes/dcss_manual.pdf b/static/notes/dcss_manual.pdf
new file mode 100644
index 0000000..03cafd2
--- /dev/null
+++ b/static/notes/dcss_manual.pdf
Binary files differ
diff --git a/themes/simple/layouts/_default/single.html b/themes/simple/layouts/_default/single.html
index ffa776f..4489601 100644
--- a/themes/simple/layouts/_default/single.html
+++ b/themes/simple/layouts/_default/single.html
@@ -6,7 +6,7 @@
6 <header class="mb-6"> 6 <header class="mb-6">
7 <h1 itemtype="headline" class="text-4xl font-bold mb-4 leading-1 md:leading-2">{{ .Title }}</h1> 7 <h1 itemtype="headline" class="text-4xl font-bold mb-4 leading-1 md:leading-2">{{ .Title }}</h1>
8 8
9 {{ if in .Type "posts" }} 9 {{ if not (eq .Type "pages") }}
10 <time class="text-gray-400 font-medium text-sm">Published on {{ .Date.Format "Monday Jan 2, 2006" }}</time> 10 <time class="text-gray-400 font-medium text-sm">Published on {{ .Date.Format "Monday Jan 2, 2006" }}</time>
11 {{ end }} 11 {{ end }}
12 </header> 12 </header>
@@ -23,7 +23,7 @@
23 </div> 23 </div>
24 </article> 24 </article>
25 25
26 {{ if in .Type "posts" }} 26 {{ if not (eq .Type "pages") }}
27 <hr class="border-2 border-gray-100 mb-10" /> 27 <hr class="border-2 border-gray-100 mb-10" />
28 {{ end }} 28 {{ end }}
29 29
@@ -39,7 +39,7 @@
39 {{ end }} 39 {{ end }}
40 40
41 <!-- Read more --> 41 <!-- Read more -->
42 {{ if in .Type "posts" }} 42 {{ if not (eq .Type "pages") }}
43 {{ partial "read-more.html" . }} 43 {{ partial "read-more.html" . }}
44 {{ end }} 44 {{ end }}
45 45
@@ -53,4 +53,4 @@
53 {{ end }} 53 {{ end }}
54 54
55</main> 55</main>
56{{ end }} \ No newline at end of file 56{{ end }}
diff --git a/themes/simple/static/css/tailwind.css b/themes/simple/static/css/tailwind.css
index 53d8798..36e45e8 100644
--- a/themes/simple/static/css/tailwind.css
+++ b/themes/simple/static/css/tailwind.css
@@ -127,6 +127,11 @@ article.single #TableOfContents ul {
127 @apply list-decimal pl-4 md:pl-6; 127 @apply list-decimal pl-4 md:pl-6;
128} 128}
129 129
130/* Lists */
131article.single .content ul ul {
132 margin-bottom: auto;
133}
134
130/* Katex */ 135/* Katex */
131article.single .katex-display { 136article.single .katex-display {
132 @apply my-10; 137 @apply my-10;