aboutsummaryrefslogtreecommitdiff
path: root/content/posts
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2023-06-27 14:50:20 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2023-06-27 14:50:20 +0200
commit8697555125c57ae64a0c9b78514b4aac4fd523de (patch)
treea699df53a7c35a4425f30bca86982c4341f6de40 /content/posts
parent33b2615a5038bc85036081e8b5e0da8584d88097 (diff)
downloadmitjafelicijan.com-8697555125c57ae64a0c9b78514b4aac4fd523de.tar.gz
Massive formatting and added figcaption
Diffstat (limited to 'content/posts')
-rw-r--r--content/posts/2011-01-13-most-likely-to-succeed-in-year-of-2011.md36
-rw-r--r--content/posts/2012-03-09-led-technology-not-so-eco.md30
-rw-r--r--content/posts/2013-10-24-wireless-sensor-networks.md64
-rw-r--r--content/posts/2015-11-10-software-development-pitfalls.md256
-rw-r--r--content/posts/2017-03-07-golang-profiling-simplified.md24
-rw-r--r--content/posts/2017-04-17-what-i-ve-learned-developing-ad-server.md154
-rw-r--r--content/posts/2017-04-21-profiling-python-web-applications-with-visual-tools.md47
-rw-r--r--content/posts/2017-08-11-simple-iot-application.md308
-rw-r--r--content/posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md152
-rw-r--r--content/posts/2019-01-03-encoding-binary-data-into-dna-sequence.md143
-rw-r--r--content/posts/2019-10-14-simplifying-and-reducing-clutter.md85
-rw-r--r--content/posts/2019-10-19-using-sentiment-analysis-for-clickbait-detection.md50
-rw-r--r--content/posts/2020-03-22-simple-sse-based-pubsub-server.md132
-rw-r--r--content/posts/2020-03-27-create-placeholder-images-with-sharp.md46
-rw-r--r--content/posts/2020-03-29-the-strange-case-of-elasticsearch-allocation-failure.md74
-rw-r--r--content/posts/2020-03-30-my-love-and-hate-relationship-with-nodejs.md170
-rw-r--r--content/posts/2020-05-05-remote-work.md59
-rw-r--r--content/posts/2020-08-15-systemd-disable-wake-onmouse.md43
-rw-r--r--content/posts/2020-09-06-esp-and-micropython.md58
-rw-r--r--content/posts/2020-09-08-bind-warning-on-login.md27
-rw-r--r--content/posts/2020-09-09-digitalocean-sync.md83
-rw-r--r--content/posts/2021-01-24-replacing-dropbox-with-s3.md61
-rw-r--r--content/posts/2021-01-25-goaccess.md109
-rw-r--r--content/posts/2021-06-26-simple-world-clock.md48
-rw-r--r--content/posts/2021-07-30-from-internet-consumer-to-full-hominum-again.md118
-rw-r--r--content/posts/2021-12-03-debian-based-riced-up-distribution-for-developers.md165
-rw-r--r--content/posts/2021-12-25-running-golang-application-as-pid1.md7
-rw-r--r--content/posts/2021-12-30-wap-mobile-web-before-the-web.md87
-rw-r--r--content/posts/2022-06-30-trying-out-helix-editor.md33
-rw-r--r--content/posts/2022-07-05-what-would-dna-sound-if-synthesized.md163
-rw-r--r--content/posts/2022-08-13-algae-spotted-on-river-sava.md8
-rw-r--r--content/posts/2022-10-06-state-of-web-technologies-in-year-2022.md334
-rw-r--r--content/posts/2022-10-16-that-sound-that-machine-makes-when-struggling.md49
-rw-r--r--content/posts/2023-01-26-trying-to-build-a-new-kind-of-terminal-emulator.md184
-rw-r--r--content/posts/2023-05-10-push-to-multiple-origins-at-once-in-git.md17
-rw-r--r--content/posts/2023-05-16-rekindling-my-love-for-programming.md109
-rw-r--r--content/posts/2023-05-22-crafting-stories-in-zed-editor.md81
-rw-r--r--content/posts/2023-05-23-i-was-wrong-about-git-workflows.md95
-rw-r--r--content/posts/2023-05-31-re-inventing-task-runner-that-i-actually-used-daily.md158
39 files changed, 1942 insertions, 1925 deletions
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 bdf965a..9fc484a 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
@@ -5,31 +5,31 @@ date: 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 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 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 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. 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. 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 13And all this had and has great influence on the destination to which we are
14going now. 14going now.
15 15
16Reading all this articles about new innovation about new thriving technologies 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 17makes me wonder what’s the next step. The future is the mesh, like Lisa Gansky
18said in her book The Mesh. 18said in her book The Mesh.
19 19
20Many still have conservative views on distributed systems. The problems with 20Many still have conservative views on distributed systems. The problems with
21security of information. Fear of not controlling every aspect of information 21security of information. Fear of not controlling every aspect of information
22flow. I am very opened to distributed systems and heterogeneous applications, 22flow. I am very opened to distributed systems and heterogeneous applications,
23and I think this is the correct and best way to proceed. 23and I think this is the correct and best way to proceed.
24 24
25This year will definitely be about communication platforms. Mobile to mobile. 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 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 27into action. Wireless is today’s new mantra. And the concept of semantic web is
28is now ready for industry. 28now ready for industry.
29 29
30Applications and developers now can gain access to new layers of systems and 30Applications and developers now can gain access to new layers of systems and can
31can prepare and build solutions to meet the high quality needs of market. The 31prepare and build solutions to meet the high quality needs of market. The speed
32speed is everything now. 32is everything now.
33 33
34My vote goes to “Machine to Machine” and “Embedded Systems”! 34My vote goes to “Machine to Machine” and “Embedded Systems”!
35 35
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 6e5aab9..a683aec 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
@@ -5,25 +5,25 @@ date: 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 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. 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 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 11talking about harm in using LED technology. It looks like this magical
12technology is not so magical and eco-friendly. 12technology is not so magical and eco-friendly.
13 13
14A new study from the University of California indicates that LED lights 14A new study from the University of California indicates that LED lights contain
15contain toxic metals, and should be produced, used and disposed of carefully. 15toxic metals, and should be produced, used and disposed of carefully. Besides
16Besides the lead and nickel, the bulbs and their associated parts were also 16the lead and nickel, the bulbs and their associated parts were also found to
17found to contain arsenic, copper, and other metals that have been linked to 17contain arsenic, copper, and other metals that have been linked to different
18different cancers, neurological damage, kidney disease, hypertension, skin 18cancers, neurological damage, kidney disease, hypertension, skin rashes and
19rashes and other illnesses in humans, and to ecological damage in waterways. 19other illnesses in humans, and to ecological damage in waterways.
20 20
21Since then, I haven’t yet found any regulation for disposal of LED lights or 21Since then, I haven’t yet found any regulation for disposal of LED lights or any
22any other regulation or standard. This might be a problem in the future. And 22other regulation or standard. This might be a problem in the future. And it is a
23it is a massive drawback. This might have quite an impact on consumer market. 23massive drawback. This might have quite an impact on consumer market.
24 24
25Nevertheless, there is a potential, and I am sure the market will adapt. I 25Nevertheless, there is a potential, and I am sure the market will adapt. I also
26also hope I will be reading documents regarding solution for this concern soon. 26hope I will be reading documents regarding solution for this concern soon.
27 27
28**Additional resources:** 28**Additional resources:**
29 29
diff --git a/content/posts/2013-10-24-wireless-sensor-networks.md b/content/posts/2013-10-24-wireless-sensor-networks.md
index dabdebc..fc5d372 100644
--- a/content/posts/2013-10-24-wireless-sensor-networks.md
+++ b/content/posts/2013-10-24-wireless-sensor-networks.md
@@ -5,47 +5,45 @@ date: 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 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 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 10our of the box when you deploy them. But you have to have in mind that achieving
11achieving this is not as easy as you would think. None of it is plug&play. 11this is not as easy as you would think. None of it is plug&play. So to make
12So to make your life a bit easier, here are some pointers which, I hope, 12your life a bit easier, here are some pointers which, I hope, will help you.
13will help you.
14 13
15- Be careful when you are ordering your equipment abroad. There are many rules 14- Be careful when you are ordering your equipment abroad. There are many rules
16 and regulations you need to comply before you get your Xbee radios. What they 15 and regulations you need to comply before you get your Xbee radios. What they
17 do is they wait until you prove that you won’t use the technology for some 16 do is they wait until you prove that you won’t use the technology for some
18 kind of evil take over control of the world project :). For this, they have 17 kind of evil take over control of the world project :). For this, they have
19 EAR (Export Administration Regulations) which basically means “This product 18 EAR (Export Administration Regulations) which basically means “This product
20 may require a license to export from the United States.”. 19 may require a license to export from the United States.”.
21- I don’t know if this applies for every country, but when we purchased our 20- I don’t know if this applies for every country, but when we purchased our Xbee
22 Xbee radios from Mouser, this was mandatory! What we needed to do was to 21 radios from Mouser, this was mandatory! What we needed to do was to print out
23 print out a form and write information about our company and send them a 22 a form and write information about our company and send them a copy via
24 copy via email. With this document, we proved that we are a legitimate 23 email. With this document, we proved that we are a legitimate company.
25 company. 24- When you complete your purchase and send all the documentation, you are not
26- When you complete your purchase and send all the documentation, you are not 25 clear yet. Then customs will take it from there :). There will be some
27 clear yet. Then customs will take it from there :). There will be some 26 additional costs. Before purchasing, make sure you have as much information
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. 27 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 28- 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 29 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! 30 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 31- 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 32 orders in December! :) Believe me! You will have problems with stock they can
35 can provide for you. So, we were forced to buy some things from Mouser, 33 provide for you. So, we were forced to buy some things from Mouser, which was
36 which was extremely painful because of all the regulations you need to obey 34 extremely painful because of all the regulations you need to obey when
37 when importing goods from the USA. 35 importing goods from the USA.
38- Make sure that firmware version on your Xbee radios is exactly the same! Do 36- 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 37 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 38 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. 39 “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 40- And again: make plans! Plan everything! In months advanced! You will thank me
43 me later :) 41 later :)
44- Test, test, test. Wireless networks can be tricky. 42- Test, test, test. Wireless networks can be tricky.
45 43
46If you are serious, I suggest you buy this book, Building Wireless Sensor 44If 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 45Networks. You will get a glimpse of how networks work in lumens terms. It is a
48a good starting point for everybody who wants to build wireless networks. 46good starting point for everybody who wants to build wireless networks.
49 47
50**Additional resources:** 48**Additional resources:**
51 49
diff --git a/content/posts/2015-11-10-software-development-pitfalls.md b/content/posts/2015-11-10-software-development-pitfalls.md
index 57e9736..b9edd19 100644
--- a/content/posts/2015-11-10-software-development-pitfalls.md
+++ b/content/posts/2015-11-10-software-development-pitfalls.md
@@ -5,178 +5,176 @@ date: 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 8Over the years I had the privilege to work on some very excited projects both in
9in software development field and also in electronics field and every experience 9software development field and also in electronics field and every experience
10taught me some invaluable lessons about how NOT TO approach development. And 10taught me some invaluable lessons about how NOT TO approach development. And
11through this post I will try to point out some absurd, outdated techniques I 11through this post I will try to point out some absurd, outdated techniques I
12find the most annoying and damaging during a development cycle. There will be 12find the most annoying and damaging during a development cycle. There will be
13swearing because this topic really gets on my nerves and I never coherently 13swearing because this topic really gets on my nerves and I never coherently
14tried to explain them in writing. So if I get heated up, please bear with me. 14tried to explain them in writing. So if I get heated up, please bear with me.
15 15
16As new methods of project management are emerging, underlying processes still 16As new methods of project management are emerging, underlying processes still
17stay old and outdated. This is mainly because we as people are unable to 17stay old and outdated. This is mainly because we as people are unable to
18completely shift away from these approaches. 18completely shift away from these approaches.
19 19
20I was always struggling with communication, and many times that cost me a 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 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 22experience, I became more convinced that I am the problem and never ever doubted
23doubted that the problem may be that communication never evolved a single step 23that the problem may be that communication never evolved a single step from
24from emails. And if you think for a second, not many things have changed around 24emails. And if you think for a second, not many things have changed around this
25this topic. We just have different representations of email (message boards, 25topic. We just have different representations of email (message boards, chats,
26chats, project management tools). And I believe this is the real issue we are 26project management tools). And I believe this is the real issue we are facing
27facing now. 27now.
28 28
29There are many articles written about hyper connectivity and the effects that 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 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 31putting out fires, and we do nothing to prevent it. I am certain this will be a
32a major source of grief in coming years. And what we all can do to avoid this 32major source of grief in coming years. And what we all can do to avoid this is
33is to change our mindset and experiment on our communication skills, 33to change our mindset and experiment on our communication skills, development
34development approaches. We need to maximize possible output that a person can 34approaches. We need to maximize possible output that a person can give. And to
35give. And to achieve this we need to listen to them, encourage them. I know 35achieve this we need to listen to them, encourage them. I know that not
36that not everybody is a naturally born leader, but with enough practice and 36everybody is a naturally born leader, but with enough practice and encouragement
37encouragement they also can become active participants in leadership. 37they also can become active participants in leadership.
38 38
39There are many talks now about methodologies such as Scrum, Kanban, Cleanroom 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 40and they all fucking piss me of :). These are all boxes that imprison people and
41and take away their freedom of thought. This is a straightforward 41take away their freedom of thought. This is a straightforward mindfuck /
42mindfuck / amputation of creativity. 42amputation of creativity.
43 43
44Let me list a couple of things that I find really destructive and bad for a 44Let me list a couple of things that I find really destructive and bad for a
45project and in a long run company. 45project and in a long run company.
46 46
47## Ping emails 47## Ping emails
48 48
49Ping emails are emails you have to write as soon as you receive an email. Its 49Ping emails are emails you have to write as soon as you receive an email. Its
50sole purpose is to inform the sender that you received their email, and you 50sole purpose is to inform the sender that you received their email, and you are
51are working on it. Its result is only to calm down the sender that their task 51working on it. Its result is only to calm down the sender that their task is
52is being dealt with. It’s intent basically is, I did my job by sending you 52being dealt with. It’s intent basically is, I did my job by sending you this
53this email, so I am on clear grounds. I categorize this email as fuck you email. 53email, 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 54This is one of the most irritating types of emails I need to write. This is the
55the ultimate control freak show you can experience, and it gives the sender a 55ultimate control freak show you can experience, and it gives the sender a false
56false feeling of control. Newsflash: We do not live in 1982 where there was a 56feeling 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 57possibility that email never reached the destination. I really hate this from
58the bottom of my heart. 58the bottom of my heart.
59 59
60They should be like: “Yes, I am fucking alive, and I am at your service my 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 61leash!”. I guess if I would reply like this, I wouldn’t have to write any more
62more of this kind of messages. 62of this kind of messages.
63 63
64## Everybody is a project manager 64## Everybody is a project manager
65 65
66Well, this is a tough one. I noticed that as soon as you let people to give 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: 67their suggestions, you are basically screwed. There is a truth in the saying:
68“Give low expectations and deliver little more than you promised.”. 68“Give low expectations and deliver little more than you promised.”.
69 69
70People tend to take a role of a manager as soon as they are presented with an 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 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 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 73not tasks at the beginning and everything will be alright. But if you give them
74them a feeling that they are in control, you will have immense problems 74a feeling that they are in control, you will have immense problems explaining
75explaining why their features are not in current release. 75why their features are not in current release.
76 76
77Project mission must be always leading project requirements and any deviation 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 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 79project will get its own path, and you will be left with half done software that
80that helps nobody. Clear mission goals and clean execution will allow you to 80helps nobody. Clear mission goals and clean execution will allow you to develop
81develop software will clear intent. 81software will clear intent.
82 82
83## We are never wrong 83## We are never wrong
84 84
85I find this type of arrogance the worst. We must always conduct ourselves that 85I find this type of arrogance the worst. We must always conduct ourselves that
86we are infallible and cannot make mistakes. As soon as a procedure or process 86we are infallible and cannot make mistakes. As soon as a procedure or process is
87is established, there is no room for changes or improvements. This is the most 87established, 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 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 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 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 91everything in order to adapt to current situations. Being a prisoner of
92predefined processes kills creativity. 92predefined processes kills creativity.
93 93
94I am constantly trying new software for project managing and communication. 94I am constantly trying new software for project managing and communication. I
95I believe every team has its own dynamic, and it needs to be discovered 95believe every team has its own dynamic, and it needs to be discovered
96organically and naturally through many experiments. By putting the team in a 96organically and naturally through many experiments. By putting the team in a
97box, you are amputating their creativity and therefore minimizing their 97box, you are amputating their creativity and therefore minimizing their
98potential. But if you talk to an executive, you will mainly find archetypical 98potential. But if you talk to an executive, you will mainly find archetypical
99thinking and a strong need to compartmentalize everything from business 99thinking and a strong need to compartmentalize everything from business
100processes to resource management. And this type of management that often 100processes to resource management. And this type of management that often
101displays micromanagement techniques only works for short periods (couple of 101displays micromanagement techniques only works for short periods (couple of
102years) and then employees either leave the company or become basically retarded 102years) and then employees either leave the company or become basically retarded
103drones on autopilot. 103drones on autopilot.
104 104
105## Micromanaging 105## Micromanaging
106 106
107This basically implies that everybody on the team is an idiot who needs to 107This basically implies that everybody on the team is an idiot who needs to have
108have a to-do list that they cannot write themselves. How about spoon-feeding 108a to-do list that they cannot write themselves. How about spoon-feeding the team
109the team at launch because besides the team leader, everybody must be a 109at launch because besides the team leader, everybody must be a retarded idiot at
110retarded idiot at best? 110best?
111 111
112I prefer milestones as they give developers much more freedom and creativity 112I prefer milestones as they give developers much more freedom and creativity in
113in developing and not waste their time checking some bizarre to-do list that 113developing and not waste their time checking some bizarre to-do list that was
114was not even thought through. Projects constantly change throughout the 114not even thought through. Projects constantly change throughout the development
115development cycle, and all you are left at the end is a list of unchecked tasks 115cycle, and all you are left at the end is a list of unchecked tasks and the
116and the wrath of management why they are not completed. Best WTF moment! 116wrath of management why they are not completed. Best WTF moment!
117 117
118## Human contact — no need for it! 118## Human contact — no need for it!
119 119
120We are vigorously trying to eliminate physical contact by replacing short 120We are vigorously trying to eliminate physical contact by replacing short
121meetings with software, with no regards that we are not machines. Many times 121meetings with software, with no regards that we are not machines. Many times a
122a simple 5-min meeting at morning can solve most of the problems. In rapid 122simple 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 123development, short bursts of man to man communication is possibly the best way
124way to go. 124to go.
125 125
126We now have all this software available, and all what we get out of it is a 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? 127giant clusterfuck. An obstacle and not a solution. So, why we still use them?
128 128
129## MVP is killing innovation 129## MVP is killing innovation
130 130
131Many will disagree with me on this one, but I stand strong by this statement. 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 132What I noticed in my experience that all this buzz words around us only mislead
133mislead and capture us in a circle of solving issues that already have a 133and capture us in a circle of solving issues that already have a solution, but
134solution, but we are unable to see it without using some fancy word for it. 134we are unable to see it without using some fancy word for it.
135 135
136The toughest thing to do for a developer is to minimize requirements. Well, 136The toughest thing to do for a developer is to minimize requirements. Well, this
137this is though only for bad developers. Yes, I said it. There are many types 137is though only for bad developers. Yes, I said it. There are many types of
138of developers out there. And those unable to minimize feature scope are the 138developers out there. And those unable to minimize feature scope are the ones
139ones you don’t need on your team. Their only goal is to solve problems that 139you don’t need on your team. Their only goal is to solve problems that exist
140exist only in their heads. And then you have to argue with them, and waste 140only in their heads. And then you have to argue with them, and waste energy on
141energy on them, instead of developing your awesome product. They are a cancer 141them, instead of developing your awesome product. They are a cancer and I
142and I suggest you cut them off. 142suggest you cut them off.
143 143
144MVP as an idea is great, but sadly people don’t understand underlying 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 145philosophy, and they spent too much time focusing and fixating on something that
146that every sane person with normal IQ will understand without some made up 146every sane person with normal IQ will understand without some made up
147acronym. And the result is a lot of talking and barely no execution. 147acronym. And the result is a lot of talking and barely no execution.
148 148
149Well, MVP is not directly killing innovation, but stupid people do when they 149Well, MVP is not directly killing innovation, but stupid people do when they try
150try to understand it. 150to understand it.
151 151
152## Pressure wasteland 152## Pressure wasteland
153 153
154You must never allow to be pressured into confirming a deadline if you are not 154You must never allow to be pressured into confirming a deadline if you are not
155confident. We often feel a need that we are in service of others, which is 155confident. We often feel a need that we are in service of others, which is true
156true to some extent. But it is also true that others are in service to us to 156to some extent. But it is also true that others are in service to us to some
157some extent. And we forget this all the time. We are all pressured all the 157extent. And we forget this all the time. We are all pressured all the time to
158time to make decisions just to calm other people down. And when they leave 158make decisions just to calm other people down. And when they leave your office
159your office you experience WTF moment :) How the hell did they manage to 159you experience WTF moment :) How the hell did they manage to fuck me up again?
160fuck me up again? 160
161 161People need to realize that the more pressure you put on somebody, the less they
162People need to realize that the more pressure you put on somebody, the less 162will be able to do. So 5-min update email requests will only resolve in mental
163they will be able to do. So 5-min update email requests will only resolve in 163breakdown and inability to work that day. Constant poking is probably the only
164mental breakdown and inability to work that day. Constant poking is probably 164thing I lose my mind instantly. For all you that are doing this: “Stop bothering
165the only thing I lose my mind instantly. For all you that are doing this: 165us with your insecurities and let us do our job. We will do it quicker and
166“Stop bothering us with your insecurities and let us do our job. We will do 166better without you breathing down our necks.”
167it quicker and better without you breathing down our necks.”
168 167
169If this happens to me, I end up with no energy at the end. Don’t you get it? 168If 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 169You will get much more from and out of me if you ask me like a human person and
171and not your personal butler. On a long run, you are destroying your 170not your personal butler. On a long run, you are destroying your relationships
172relationships and nobody would want to work with you. Your schizophrenic 171and nobody would want to work with you. Your schizophrenic approach will damage
173approach will damage only you in a long run. Nobody is anybody’s property. 172only you in a long run. Nobody is anybody’s property.
174 173
175## Conclusion 174## Conclusion
176 175
177I am guilty of many things described in this post. And I find it hard sometimes 176I 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 177to 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 178explanation why I do these things. There is always space for growth. And maybe
180maybe you will also find some of yourself in this post and realize what needs 179you will also find some of yourself in this post and realize what needs to
181to change for you to evolve. 180change 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 7eee2dd..4bd18b2 100644
--- a/content/posts/2017-03-07-golang-profiling-simplified.md
+++ b/content/posts/2017-03-07-golang-profiling-simplified.md
@@ -6,34 +6,34 @@ draft: false
6--- 6---
7 7
8Many posts have been written regarding profiling in Golang and I haven’t found 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 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 10important information and it gets pretty frustrating when you have a deadline
11and are not finding simple distilled solution. 11and are not finding simple distilled solution.
12 12
13Nevertheless, after searching and experimenting I have found a solution that 13Nevertheless, after searching and experimenting I have found a solution that
14works for me and probably should also for you. 14works for me and probably should also for you.
15 15
16## Where are my pprof files? 16## Where are my pprof files?
17 17
18By default pprof files are generated in /tmp/ folder. You can override folder 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 19where this files are generated programmatically in your golang code as we will
20see below in example. 20see below in example.
21 21
22## Why is my CPU profile empty? 22## Why is my CPU profile empty?
23 23
24I have found out that sometimes CPU profile is empty because program was not 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 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. 26file in my cases. Well, file is generated but only contains 4KB of information.
27 27
28## Profiling 28## Profiling
29 29
30As you can see from examples we are executing dummy_benchmark functions to 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 31ensure some sort of execution. Memory profiling can be done without such a
32“complex” function. But CPU profiling needs it. 32“complex” function. But CPU profiling needs it.
33 33
34Both memory and CPU profiling examples are almost the same. Only parameters 34Both memory and CPU profiling examples are almost the same. Only parameters in
35in main function when calling profile.Start are different. When we set 35main function when calling profile.Start are different. When we set
36profile.ProfilePath(“.”) we tell profiler to store pprof files in the same 36profile.ProfilePath(“.”) we tell profiler to store pprof files in the same
37folder as our program. 37folder as our program.
38 38
39### Memory profiling 39### Memory profiling
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 1b9be06..bb98efd 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
@@ -5,10 +5,10 @@ date: 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 8For the past year and half I have been developing native advertising server that
9that contextually matches ads and displays them in different template forms 9contextually matches ads and displays them in different template forms on
10on variety of websites. This project grew from serving thousands of ads per 10variety of websites. This project grew from serving thousands of ads per day to
11day to millions. 11millions.
12 12
13The system is made from couple of core components: 13The system is made from couple of core components:
14 14
@@ -16,56 +16,56 @@ The system is made from couple of core components:
16- Utils - cronjobs and queue management tools, 16- Utils - cronjobs and queue management tools,
17- Dashboard UI. 17- Dashboard UI.
18 18
19Initial release was using [MongoDB](https://www.mongodb.com/) for full-text 19Initial release was using [MongoDB](https://www.mongodb.com/) for full-text
20search but was later replaced by [Elasticsearch](https://www.elastic.co/) 20search but was later replaced by [Elasticsearch](https://www.elastic.co/) for
21for better CPU utilization and better search performance. This provided us 21better CPU utilization and better search performance. This provided us with many
22with many amazing functionalities of [Elasticsearch](https://www.elastic.co/). 22amazing functionalities of [Elasticsearch](https://www.elastic.co/). You should
23You should check it out if you do any search related operations. 23check it out if you do any search related operations.
24 24
25Because the premise of the server is to provide native ad experience, they 25Because the premise of the server is to provide native ad experience, they are
26are rendered on the client side via simple templating engine. This ensures 26rendered on the client side via simple templating engine. This ensures that ads
27that ads can be displayed number of different ways based on the visual style 27can be displayed number of different ways based on the visual style of the
28of the page. And this makes JavaScript client library quite complex. 28page. And this makes JavaScript client library quite complex.
29 29
30So now that you know basic information about the product lets get into the 30So now that you know basic information about the product lets get into the
31lessons we learned. 31lessons we learned.
32 32
33## Aggregate everything 33## Aggregate everything
34 34
35After beta version was released everything (impressions, clicks, etc) was 35After beta version was released everything (impressions, clicks, etc) was
36written in nanosecond resolution in the database. At that time we were using 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 37[PostgreSQL](https://www.postgresql.org/) and database quickly grew way above
38200GB in disk space. And that was problematic. Statistics took disturbingly 38200GB in disk space. And that was problematic. Statistics took disturbingly long
39long time to aggregate. Also using indexes on stats table in database was no 39time to aggregate. Also using indexes on stats table in database was no help
40help after we reached 500 million datapoints. 40after we reached 500 million datapoints.
41 41
42> There is a marketing product information and there is real life experience. 42> There is a marketing product information and there is real life experience.
43And the tend to be quite the opposite. 43And the tend to be quite the opposite.
44 44
45This was the reason that now everything is aggregated on daily basis and this 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 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. 47can now track many more dimensions such as zone, channel and platform
48And with this information we can now adapt occurrences of ads on specific 48information. And with this information we can now adapt occurrences of ads on
49places more precisely. 49specific places more precisely.
50 50
51We have also adapted [Redis](https://redis.io/) as a full-time citizen in our 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 52stack. Because Redis also stores information on a local disk we have some sort
53of backup if server would accidentally suffer some failure. 53of backup if server would accidentally suffer some failure.
54 54
55All the real-time statistics for ad serving and redirecting is presented as 55All the real-time statistics for ad serving and redirecting is presented as
56counters in Redis instance and daily extracted and pushed to Elastic. 56counters in Redis instance and daily extracted and pushed to Elastic.
57 57
58## Measure everything 58## Measure everything
59 59
60The thing about software is that we really don't know how well it is performing 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 61under load until such load is presented. When testing locally everything is fine
62fine but when on production things tend to fall apart. 62but when on production things tend to fall apart.
63 63
64As a solution for this we are measuring everything we can. Function execution 64As a solution for this we are measuring everything we can. Function execution
65time (by encapsulating functions with timers), server performance (cpu, memory, 65time (by encapsulating functions with timers), server performance (cpu, memory,
66disk, etc), Nginx and [uWSGI](https://uwsgi-docs.readthedocs.io/) performance. 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 67We sacrifice a bit of performance for the sake of this information. And we store
68store all this information for later analysis. 68all this information for later analysis.
69 69
70**Example of function execution time** 70**Example of function execution time**
71 71
@@ -99,27 +99,28 @@ store all this information for later analysis.
99} 99}
100``` 100```
101 101
102We have also started profiling with [cProfile](https://pymotw.com/2/profile/) 102We have also started profiling with [cProfile](https://pymotw.com/2/profile/)
103and then visualizing with [KCachegrind](http://kcachegrind.sourceforge.net/). 103and then visualizing with [KCachegrind](http://kcachegrind.sourceforge.net/).
104This provides much more detailed look into code execution. 104This provides much more detailed look into code execution.
105 105
106## Cache control is your friend 106## Cache control is your friend
107 107
108Because we use Javascript library for rendering ads we rely on this script 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 109extensively and when in need we need to be able to change behavior of the script
110script quickly. 110quickly.
111 111
112In our case we can not simply replace javascript url in html code. It usually 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 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 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. 115and time consuming. There is a limitation of how much you can test locally.
116 116
117We are now in the process of integrating [Google Tag Manager](https://www.google.com/analytics/tag-manager/) 117We are now in the process of integrating [Google Tag
118but couple of websites are developed on ASP.net platform that have some 118Manager](https://www.google.com/analytics/tag-manager/) but couple of websites
119problems with tag manager. With a solution below we are certain that we are 119are developed on ASP.net platform that have some problems with tag manager. With
120serving latest version of the script. 120a solution below we are certain that we are serving latest version of the
121script.
121 122
122And it only takes one mistake and users have the script cached and in case of 123And 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. 124caching it for 1 year you probably know where the problem is.
124 125
125```nginx 126```nginx
@@ -143,10 +144,10 @@ location /static/ {
143} 144}
144``` 145```
145 146
146Also be careful when redirecting to url in your python code. We noticed that 147Also be careful when redirecting to url in your python code. We noticed that if
147if we didn't precisely setup cache control and expire headers in response we 148we didn't precisely setup cache control and expire headers in response we didn't
148didn't get the request on the server and therefore couldn't measure clicks. 149get the request on the server and therefore couldn't measure clicks. So when
149So when redirecting do as follows and there will be no problems. 150redirecting do as follows and there will be no problems.
150 151
151```python 152```python
152# python ➜ bottlepy web micro-framework 153# python ➜ bottlepy web micro-framework
@@ -157,42 +158,41 @@ response.set_header("Location", url)
157return response 158return response
158``` 159```
159 160
160> Cache control in browsers is quite aggressive and you need to be precise 161> Cache control in browsers is quite aggressive and you need to be precise to
161to avoid future problems. We learned that lesson the hard way. 162avoid future problems. We learned that lesson the hard way.
162 163
163## Learn NGINX 164## Learn NGINX
164 165
165When deciding on a web server we went with Nginx as a reverse proxy for our 166When 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 167applications. We adapted micro-service oriented architecture early in the
167project to ensure when we scale we can easily add additional servers to our 168project 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 169cluster. And Nginx was crucial to perform load balancing and static content
169delivery. 170delivery.
170 171
171At first our config file was quite simple and later grew larger. After patching 172At 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. 173and 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 174This 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 175setup. 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. 176[documentation](https://nginx.org/en/docs/). This saved us a lot of headache.
176Googling for solutions only goes so far. 177Googling for solutions only goes so far.
177 178
178## Use Redis/Memcached 179## Use Redis/Memcached
179 180
180As explained above we are using caching basically for everything. It is the 181As 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 182corner 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 183of 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. 184the memory footprint is very low even when storing large amount of data in it.
184 185
185So we gradually increased our usage to caching whole HTML outputs of dashboard. 186So 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 187This improved our performance in order of magnitude. And by using native TTL
187support this goes hand in hand with our needs. 188support this goes hand in hand with our needs.
188 189
189The reason why we choose [Redis](https://redis.io/) over [Memcached](https://memcached.org/) 190The reason why we choose [Redis](https://redis.io/) over
190was the nature of scalability of Redis out of the box. But all this can be 191[Memcached](https://memcached.org/) was the nature of scalability of Redis out
191achieved with Memcached. 192of the box. But all this can be achieved with Memcached.
192 193
193## Conclusion 194## Conclusion
194 195
195There are a lot more details that could have been written and every single 196There are a lot more details that could have been written and every single topic
196topic in here deserves it's own post but you probably got the idea about 197in here deserves it's own post but you probably got the idea about the problems
197the problems we faced. 198we 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 911e6e0..2e36eaf 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
@@ -5,10 +5,9 @@ date: 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 8I have been profiling my software with KCachegrind for a long time now and I was
9was missing this option when I am developing API's or other web services. I 9missing this option when I am developing API's or other web services. I always
10always knew that this is possible but never really took the time and dive 10knew that this is possible but never really took the time and dive into it.
11into it.
12 11
13Before we begin there are some requirements. We will need to: 12Before we begin there are some requirements. We will need to:
14 13
@@ -17,7 +16,9 @@ Before we begin there are some requirements. We will need to:
17- visualize data with [KCachegrind](http://kcachegrind.sourceforge.net/html/Home.html) or [Profiling Viewer](http://www.profilingviewer.com/). 16- visualize data with [KCachegrind](http://kcachegrind.sourceforge.net/html/Home.html) or [Profiling Viewer](http://www.profilingviewer.com/).
18 17
19 18
20If you are using MacOS you should check out [Profiling Viewer](http://www.profilingviewer.com/) or [MacCallGrind](http://www.maccallgrind.com/). 19If you are using MacOS you should check out [Profiling
20Viewer](http://www.profilingviewer.com/) or
21[MacCallGrind](http://www.maccallgrind.com/).
21 22
22![KCachegrind](/assets/python-profiling/kcachegrind.png) 23![KCachegrind](/assets/python-profiling/kcachegrind.png)
23 24
@@ -28,7 +29,7 @@ We will be dividing this post into two main categories:
28 29
29## Simple web-service 30## Simple web-service
30 31
31Let's use virtualenv so we won't pollute our base system. If you don't have 32Let'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. 33virtualenv installed on your system you can install it with pip command.
33 34
34```bash 35```bash
@@ -73,8 +74,8 @@ $ pip install bottle
73$ deactivate 74$ deactivate
74``` 75```
75 76
76We are now ready to write simple web service. Let's create file app.py and 77We are now ready to write simple web service. Let's create file app.py and paste
77paste code bellow in this newly created file. 78code bellow in this newly created file.
78 79
79```python 80```python
80# -*- coding: utf-8 -*- 81# -*- coding: utf-8 -*-
@@ -126,8 +127,8 @@ if __name__ == '__main__':
126# open browser 'http://0.0.0.0:4000' 127# open browser 'http://0.0.0.0:4000'
127``` 128```
128 129
129When browser hits awesome\_random\_number() function profile is created in 130When browser hits awesome\_random\_number() function profile is created in prof/
130prof/ subfolder. 131subfolder.
131 132
132## Visualize profile 133## Visualize profile
133 134
@@ -139,26 +140,27 @@ $ pyprof2calltree -i awesome_random_number.prof
139# this creates 'awesome_random_number.prof.log' file in the same folder 140# this creates 'awesome_random_number.prof.log' file in the same folder
140``` 141```
141 142
142This file can be opened with visualizing tools listed above. In this case we 143This 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. 144will be using Profilling Viewer under MacOS. You can open image in new tab. As
144As you can see from this example there is hierarchy of execution order of 145you can see from this example there is hierarchy of execution order of your
145your code. 146code.
146 147
147![Profilling Viewer](/assets/python-profiling/profiling-viewer.png) 148![Profilling Viewer](/assets/python-profiling/profiling-viewer.png)
148 149
149> Make sure you convert output of the cProfile output every time you want to 150> 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 151refresh and take a look at your possible optimizations because cProfile updates
151updates .prof file every time browser hits the function. 152.prof file every time browser hits the function.
152 153
153This is just a simple example but when you are developing real-life applications 154This 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 155this can be very illuminating, especially to see which parts of your code are
155bottlenecks and need to be optimized. 156bottlenecks and need to be optimized.
156 157
157## Update 2017-04-22 158## Update 2017-04-22
158 159
159Reddit user [mvt](https://www.reddit.com/user/mvt) also recommended this 160Reddit user [mvt](https://www.reddit.com/user/mvt) also recommended this awesome
160awesome web based profile visualizer [SnakeViz](https://jiffyclub.github.io/snakeviz/) 161web 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) 162that directly takes output from
163[cProfile](https://docs.python.org/2/library/profile.html#module-cProfile)
162module. 164module.
163 165
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> 166<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>
@@ -201,4 +203,3 @@ $ pip install snakeviz --user
201 203
202Or as suggested by [mvt](https://www.reddit.com/user/mvt) you can 204Or as suggested by [mvt](https://www.reddit.com/user/mvt) you can
203use [pipsi](https://github.com/mitsuhiko/pipsi). 205use [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 a0ac4be..e7e086b 100644
--- a/content/posts/2017-08-11-simple-iot-application.md
+++ b/content/posts/2017-08-11-simple-iot-application.md
@@ -7,34 +7,35 @@ draft: false
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 10I have been developing these kind of application for the better part of my last
115 years and people keep asking me how to approach developing such application 115 years and people keep asking me how to approach developing such application
12and I will give a try explaining it here. 12and I will give a try explaining it here.
13 13
14IOT applications are really no different than any other kind of applications. 14IOT applications are really no different than any other kind of applications.
15We have data that needs to be collected and visualized in some form of tables 15We have data that needs to be collected and visualized in some form of tables or
16or charts. The main difference here is that most of the times these data is 16charts. The main difference here is that most of the times these data is
17collected by some kind of device foreign to developer that mainly operates in 17collected by some kind of device foreign to developer that mainly operates in
18web domain. But fear not, it's not that different than writing some JavaScript. 18web domain. But fear not, it's not that different than writing some JavaScript.
19 19
20There are many devices able to transmit data via wireless or wired network by 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 21default but for the sake of example we will be using commonly known Arduino with
22with wireless module already on the board → [Arduino MKR1000](https://store.arduino.cc/arduino-mkr1000). 22wireless module already on the board → [Arduino
23 23MKR1000](https://store.arduino.cc/arduino-mkr1000).
24In order to make this little project as accessible to others as possible I will 24
25try to make it as inexpensive as possible. And by this I mean that I will avoid 25In order to make this little project as accessible to others as possible I will
26using hosted virtual servers and will be using my own laptop as a server. But 26try to make it as inexpensive as possible. And by this I mean that I will avoid
27you must buy Arduino MKR1000 to follow steps below. But if you would want to 27using hosted virtual servers and will be using my own laptop as a server. But
28deploy this software I would suggest using 28you must buy Arduino MKR1000 to follow steps below. But if you would want to
29[DigitalOcean](https://www.digitalocean.com) → smallest VPS is only per month 29deploy this software I would suggest using
30making this one of the most affordable option out there. Please notice that 30[DigitalOcean](https://www.digitalocean.com) → smallest VPS is only per month
31this software will not run on stock web hosting that only supports LAMP 31making this one of the most affordable option out there. Please notice that this
32(Linux, Apache, MySQL, and PHP). 32software will not run on stock web hosting that only supports LAMP (Linux,
33 33Apache, MySQL, and PHP).
34But before we begin please take notice that this is strictly experimental code 34
35and not well optimized and there are much better ways in handling some aspects 35But before we begin please take notice that this is strictly experimental code
36of the application but that requires much deeper knowledge of technology that 36and not well optimized and there are much better ways in handling some aspects
37is not needed for an example like this. 37of the application but that requires much deeper knowledge of technology that is
38not needed for an example like this.
38 39
39**Development steps** 40**Development steps**
40 41
@@ -42,32 +43,34 @@ is not needed for an example like this.
422. Prototype C++ code that will read "sensor data" and transmit it to API. 432. Prototype C++ code that will read "sensor data" and transmit it to API.
433. Data visualization with charts → extends Python web application. 443. Data visualization with charts → extends Python web application.
44 45
45Step 1. and 3. will share the same web application. One route will be dedicated 46Step 1. and 3. will share the same web application. One route will be dedicated
46to API and another to serving HTML with chart. 47to API and another to serving HTML with chart.
47 48
48Schema below represents what we will try to achieve and how different parts 49Schema below represents what we will try to achieve and how different parts
49correlates to each other. 50correlates to each other.
50 51
51![Overview](/assets/iot-application/simple-iot-application-overview.svg) 52![Overview](/assets/iot-application/simple-iot-application-overview.svg)
52 53
53## Simple Python API 54## Simple Python API
54 55
55I have always been a fan of simplicity so we will be using [Bottle: Python Web Framework](https://bottlepy.org/docs/dev/). 56I have always been a fan of simplicity so we will be using [Bottle: Python Web
56It is a single file web framework that seriously simplifies working with routes, 57Framework](https://bottlepy.org/docs/dev/). It is a single file web framework
57templating and has built-in web server that satisfies our need in this case. 58that seriously simplifies working with routes, templating and has built-in web
59server that satisfies our need in this case.
58 60
59First we need to install bottle package. This can be done by downloading 61First 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 62```bottle.py``` and placing it in the root of your application or by using pip
61pip software ```pip install bottle --user```. 63software ```pip install bottle --user```.
62 64
63If you are using Linux or MacOS then Python is already installed. If you will 65If 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/). 66try to test this on Windows please install [Python for
65There may be some problems with path when you will try to launch 67Windows](https://www.python.org/downloads/windows/). There may be some problems
66```python webapp.py``` so please take care of this before you continue. 68with path when you will try to launch ```python webapp.py``` so please take care
69of this before you continue.
67 70
68### Basic web application 71### Basic web application
69 72
70Most basic bottle application is quite simple. Paste code below in 73Most basic bottle application is quite simple. Paste code below in
71```webapp.py``` file and save. 74```webapp.py``` file and save.
72 75
73```python 76```python
@@ -96,59 +99,62 @@ if __name__ == "__main__":
96 ) 99 )
97``` 100```
98 101
99To run this simple application you should open command prompt or terminal on 102To run this simple application you should open command prompt or terminal on
100your machine and go to the folder containing your file and type 103your machine and go to the folder containing your file and type ```python
101```python webapp.py```. If everything goes ok then open your web browser and 104webapp.py```. If everything goes ok then open your web browser and point it to
102point it to ```http://0.0.0.0:5000```. 105```http://0.0.0.0:5000```.
103 106
104If you would like change the port of your application (like port 80) and not 107If you would like change the port of your application (like port 80) and not use
105use root to run your app this will present a problem. The TCP/IP port numbers 108root to run your app this will present a problem. The TCP/IP port numbers below
106below 1024 are privileged ports → this is a security feature. So in order of 1091024 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 110simplicity and security use a port number above 1024 like I have used port 5000.
1085000.
109 111
110If this fails at any time please fix it before you continue, because nothing 112If this fails at any time please fix it before you continue, because nothing
111below will work otherwise. 113below will work otherwise.
112 114
113We use 0.0.0.0 as default host so that this app is available over your local 115We 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 116network. 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 117with your phone (if on same network/router as your machine) this should work as
116as well (example of such ip ```http://192.168.1.15:5000```). This is a must 118well (example of such ip ```http://192.168.1.15:5000```). This is a must have
117have because Arduino will be accessing this application to send it's data. 119because Arduino will be accessing this application to send it's data.
118 120
119### Web application security 121### Web application security
120 122
121There is a lot to be said about security and is a topic of many books. Of course 123There 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 124all this can not be written here but to just establish some basic security → you
123security → you should always use SSL with your application. Some fantastic free 125should always use SSL with your application. Some fantastic free certificates
124certificates are available by [Let's Encrypt - Free SSL/TLS Certificates](https://letsencrypt.org). 126are available by [Let's Encrypt - Free SSL/TLS
125With SSL certificate installed you should then make use of HTTP headers and 127Certificates](https://letsencrypt.org). With SSL certificate installed you
126send your "API key" via a header. If your key is send via header then this 128should then make use of HTTP headers and send your "API key" via a header. If
127key is encrypted by SSL and send encrypted over the network. Never send your 129your key is send via header then this key is encrypted by SSL and send encrypted
128api keys by GET parameter like ```http://example.com/?api_key=somekeyvalue```. 130over the network. Never send your api keys by GET parameter like
129The problem that this kind of sending presents is that this key is visible in 131```http://example.com/?api_key=somekeyvalue```. The problem that this kind of
130logs and by network sniffers. 132sending presents is that this key is visible in logs and by network sniffers.
131 133
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. 134There is a fantastic article describing some aspects about security: [11 Web
135Application Security Best
136Practices](https://www.keycdn.com/blog/web-application-security-best-practices/). Please
137check it out.
133 138
134### Simple API for writing data-points 139### Simple API for writing data-points
135 140
136We will now be using boilerplate code from example above and extend it to be 141We 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 142SQLite3 because it plays well with Python and can store quite large amount of
138use SQLite3 because it plays well with Python and can store quite large amount 143able to write data received by API to local storage. For example use I will use
139of data. I have been using it to collect gigabytes of data in a single database 144data. I have been using it to collect gigabytes of data in a single database
140without any corruption or problems → your experience may vary. 145without any corruption or problems → your experience may vary.
141 146
142To avoid learning SQLite I will be using [Dataset: databases for lazy people](https://dataset.readthedocs.io/en/latest/index.html). 147To avoid learning SQLite I will be using [Dataset: databases for lazy
143This package abstracts SQL and simplifies writing and reading data from 148people](https://dataset.readthedocs.io/en/latest/index.html). This package
144database. You should install this package with pip software 149abstracts SQL and simplifies writing and reading data from database. You should
145```pip install dataset --user```. 150install this package with pip software ```pip install dataset --user```.
146 151
147Because API will use POST method I will be testing if code works correctly by 152Because 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). 153using [Restlet Client for Google
154Chrome](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. 155This software also allows you to set headers → for basic security with API_KEY.
150 156
151To quickly generate passwords or API keys I usually use this nifty website 157To quickly generate passwords or API keys I usually use this nifty website
152[RandomKeygen](https://randomkeygen.com/). 158[RandomKeygen](https://randomkeygen.com/).
153 159
154Copy and paste code below over your previous code in file ```webapp.py```. 160Copy and paste code below over your previous code in file ```webapp.py```.
@@ -204,12 +210,12 @@ if __name__ == "__main__":
204 ) 210 )
205``` 211```
206 212
207To run this simply go to folder containing python file and run 213To run this simply go to folder containing python file and run ```python
208```python webapp.py``` from terminal. If everything goes ok you should have 214webapp.py``` from terminal. If everything goes ok you should have simple API
209simple API available via POST method on /api route. 215available via POST method on /api route.
210 216
211After testing the service with Restlet Client you should be able to view 217After testing the service with Restlet Client you should be able to view your
212your data in a database file ```data.db```. 218data in a database file ```data.db```.
213 219
214![REST settings example](/assets/iot-application/iot-rest-example.png) 220![REST settings example](/assets/iot-application/iot-rest-example.png)
215 221
@@ -218,38 +224,38 @@ for SQLite → [DB Browser for SQLite](http://sqlitebrowser.org/).
218 224
219![SQLite database example](/assets/iot-application/iot-sqlite-db.png) 225![SQLite database example](/assets/iot-application/iot-sqlite-db.png)
220 226
221Table structure is as simple as it can be. We have ts (timestamp) and 227Table structure is as simple as it can be. We have ts (timestamp) and value
222value (value from Arduino). As you can see timestamp is generated on API 228(value from Arduino). As you can see timestamp is generated on API side. If you
223side. If you would happen to have atomic clock on Arduino it would be then 229would happen to have atomic clock on Arduino it would be then better to generate
224better to generate and send timestamp with the value. This would be 230and send timestamp with the value. This would be particularity useful if we
225particularity useful if we would be collecting sensor data at a higher 231would be collecting sensor data at a higher frequency and then sending this data
226frequency and then sending this data in bulk to API. 232in bulk to API.
227 233
228If you will deploy this app with uWSGI and multi-threaded, use 234If you will deploy this app with uWSGI and multi-threaded, use DSN (Data Source
229DSN (Data Source Name) url with ```?check_same_thread=False```. 235Name) url with ```?check_same_thread=False```.
230 236
231Ok, now that we have some sort of a working API with some basic security 237Ok, now that we have some sort of a working API with some basic security so
232so unwanted people can not post data to your database can we proceed further 238unwanted people can not post data to your database can we proceed further and
233and try to program Arduino to send data to API. 239try to program Arduino to send data to API.
234 240
235## Sending data to API with Arduino MKR1000 241## Sending data to API with Arduino MKR1000
236 242
237First of all you should have MKR1000 module and microUSB cable to proceed. 243First of all you should have MKR1000 module and microUSB cable to proceed. If
238If you have ever done any work with Arduino you should know that you also 244you have ever done any work with Arduino you should know that you also need
239need [Arduino IDE](https://www.arduino.cc/en/Main/Software). On provided link 245[Arduino IDE](https://www.arduino.cc/en/Main/Software). On provided link you
240you should be able to download and install IDE. Once that task is completed 246should be able to download and install IDE. Once that task is completed and you
241and you have successfully run blink example you should proceed to the next step. 247have successfully run blink example you should proceed to the next step.
242 248
243In order to use wireless capabilities of MKR1000 you need to first install 249In 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. 250[WiFi101 library](https://www.arduino.cc/en/Reference/WiFi101) in Arduino IDE.
245Please check before you install, you may already have it installed. 251Please check before you install, you may already have it installed.
246 252
247Code below is a working example that sends data to API. Before you try to test 253Code 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 254your 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 255for 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. 256for you please leave a comment and I'll try to help.
251 257
252Once you have opened IDE and copied this code try to compile and upload it. 258Once 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. 259Then open "Serial monitor" to see if any output is presented by Arduino.
254 260
255```c 261```c
@@ -335,50 +341,50 @@ void loop() {
335} 341}
336``` 342```
337 343
338As seen from example you can notice that Arduino is generating random integer 344As seen from example you can notice that Arduino is generating random integer
339between [ 0 .. 1000 ]. You can easily replace this with a temperature sensor 345between [ 0 .. 1000 ]. You can easily replace this with a temperature sensor or
340or any other kind of sensor. 346any other kind of sensor.
341 347
342Now that we have API under the hood and Arduino is sending demo data we can 348Now that we have API under the hood and Arduino is sending demo data we can now
343now focus on data visualization. 349focus on data visualization.
344 350
345## Data visualization 351## Data visualization
346 352
347Before we continue we should examine our project folder structure. Currently 353Before we continue we should examine our project folder structure. Currently we
348we only have two files in our project: 354only have two files in our project:
349 355
350_simple-iot-app/_ 356_simple-iot-app/_
351 357
352* _webapp.py_ 358* _webapp.py_
353* _data.db_ 359* _data.db_
354 360
355We will now add HTML template that will contain CSS and JavaScript code inline 361We will now add HTML template that will contain CSS and JavaScript code inline
356for the simplicity reason. And for the bottle framework to be able to scan root 362for the simplicity reason. And for the bottle framework to be able to scan root
357application folder for templates we will add 363application folder for templates we will add ```bottle.TEMPLATE_PATH.insert(0,
358```bottle.TEMPLATE_PATH.insert(0, "./")``` in ```webapp.py```. By default bottle 364"./")``` in ```webapp.py```. By default bottle framework uses ```views/```
359framework uses ```views/``` subfolder to store templates. This is not the ideal 365subfolder to store templates. This is not the ideal situation and if you will
360situation and if you will use bottle to develop web applications you should use 366use bottle to develop web applications you should use native behavior and store
361native behavior and store templates in it's predefined folder. But for the sake 367templates in it's predefined folder. But for the sake of example we will
362of example we will over-ride this. Be careful to fully replace your code with 368over-ride this. Be careful to fully replace your code with new code that is
363new code that is provided below. Avoid partially replacing code in file :) Also 369provided below. Avoid partially replacing code in file :) Also new code for
364new code for reading data-points is provided in Python example below. 370reading data-points is provided in Python example below.
365 371
366First we add new route to our web application. It should be trigger when browser 372First 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 373hits root of application ```http://0.0.0.0:5000/```. This route will do nothing
368more than render ```frontend.html``` template. This is done by 374more than render ```frontend.html``` template. This is done by ```return
369```return bottle.template("frontend.html")```. Check code below to further 375bottle.template("frontend.html")```. Check code below to further examine how
370examine how exactly this is done. 376exactly this is done.
371 377
372Now we will expand ```/api``` route and use different methods to write or 378Now we will expand ```/api``` route and use different methods to write or read
373read data-points. For writing data-point we will use POST method and for 379data-points. For writing data-point we will use POST method and for reading
374reading points we will use GET method. GET method will return JSON object 380points we will use GET method. GET method will return JSON object with latest
375with latest readings and historical data. 381readings and historical data.
376 382
377There is a fantastic JavaScript library for plotting time-series charts 383There is a fantastic JavaScript library for plotting time-series charts called
378called [MetricsGraphics.js](https://www.metricsgraphicsjs.org) that is 384[MetricsGraphics.js](https://www.metricsgraphicsjs.org) that is based on
379based on [D3.js](https://d3js.org/) library for visualizing data. 385[D3.js](https://d3js.org/) library for visualizing data.
380 386
381Data schema required by MetricsGraphics.js → to achieve this we need to 387Data schema required by MetricsGraphics.js → to achieve this we need to
382transform data from database into this format: 388transform data from database into this format:
383 389
384```json 390```json
@@ -394,9 +400,9 @@ transform data from database into this format:
394] 400]
395``` 401```
396 402
397Web application is now complete and we only need ```frontend.html``` that we 403Web 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 404will develop now. If you would try to start web app now and go to root app this
399this will return error because we don't have frontend.html yet. 405will return error because we don't have frontend.html yet.
400 406
401```python 407```python
402# -*- coding: utf-8 -*- 408# -*- coding: utf-8 -*-
@@ -477,9 +483,9 @@ if __name__ == "__main__":
477 ) 483 )
478``` 484```
479 485
480And now finally we can implement ```frontend.html```. Create file with this 486And now finally we can implement ```frontend.html```. Create file with this name
481name and copy code below. When you are done you can start web application. 487and copy code below. When you are done you can start web application. Steps for
482Steps for this part are listed below the code. 488this part are listed below the code.
483 489
484```html 490```html
485<!DOCTYPE html> 491<!DOCTYPE html>
@@ -572,23 +578,24 @@ Ok, lets now start application and start feeding it data.
5722. connect Arduino MKR1000 to power source 5782. connect Arduino MKR1000 to power source
5733. open browser and go to ```http://0.0.0.0:5000``` 5793. open browser and go to ```http://0.0.0.0:5000```
574 580
575If everything goes well you should be seeing new data-points rendered on 581If everything goes well you should be seeing new data-points rendered on chart
576chart every 5 seconds. 582every 5 seconds.
577 583
578If you navigate to ```http://0.0.0.0:5000``` you should see rendered chart 584If you navigate to ```http://0.0.0.0:5000``` you should see rendered chart as
579as shown on picture below. 585shown on picture below.
580 586
581![Application output](/assets/iot-application/iot-app-output.png) 587![Application output](/assets/iot-application/iot-app-output.png)
582 588
583Complete application with all the code is available for [download](/assets/iot-application/simple-iot-application.zip). 589Complete application with all the code is available for
590[download](/assets/iot-application/simple-iot-application.zip).
584 591
585## Conclusion 592## Conclusion
586 593
587I hope this clarifies some aspects of IOT application development. Of course 594I 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 595this is a minimal example and is far from what can be done in real life with
589some further dive into other technologies. 596some further dive into other technologies.
590 597
591If you would like to continue exploring IOT world here are some interesting 598If you would like to continue exploring IOT world here are some interesting
592resources for you to examine: 599resources for you to examine:
593 600
594* [Reading Sensors with an Arduino](https://www.allaboutcircuits.com/projects/reading-sensors-with-an-arduino/) 601* [Reading Sensors with an Arduino](https://www.allaboutcircuits.com/projects/reading-sensors-with-an-arduino/)
@@ -597,4 +604,3 @@ resources for you to examine:
597* [Internet of Things (IoT) Tutorials](http://www.tutorialspoint.com/internet_of_things/) 604* [Internet of Things (IoT) Tutorials](http://www.tutorialspoint.com/internet_of_things/)
598 605
599Any comment or additional ideas are welcomed in comments below. 606Any 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 bfc77ee..3a62594 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
@@ -5,63 +5,67 @@ date: 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 8Couple of months ago [DigitalOcean](https://www.digitalocean.com) introduced new
9new product called [Spaces](https://blog.digitalocean.com/introducing-spaces-object-storage/) 9product called
10which is Object Storage very similar to Amazon's S3. This really peaked my 10[Spaces](https://blog.digitalocean.com/introducing-spaces-object-storage/) which
11interest, because this was something I was missing and even the thought of 11is Object Storage very similar to Amazon's S3. This really peaked my interest,
12going over the internet for such functionality was in no interest to me. Also 12because this was something I was missing and even the thought of going over the
13in fashion with their previous pricing this also is very cheap and pricing 13internet for such functionality was in no interest to me. Also in fashion with
14page is a no-brainer compared to AWS or GCE. [Prices are clearly and precisely defined and outlined](https://www.digitalocean.com/pricing/). 14their previous pricing this also is very cheap and pricing page is a no-brainer
15You must love them for that :) 15compared to AWS or GCE. [Prices are clearly and precisely defined and
16outlined](https://www.digitalocean.com/pricing/). You must love them for that
17:)
16 18
17## Initial requirements 19## Initial requirements
18 20
19* Is it possible to use them as a mounted drive with FUSE? (tl;dr YES) 21* Is it possible to use them as a mounted drive with FUSE? (tl;dr YES)
20* Will the performance degrade over time and over different sizes of objects? 22* Will the performance degrade over time and over different sizes of objects?
21 (tl;dr NO&YES) 23 (tl;dr NO&YES)
22* Can storage be mounted on multiple machines at the same time and be writable? 24* Can storage be mounted on multiple machines at the same time and be writable?
23 (tl;dr YES) 25 (tl;dr YES)
24 26
25> Let me be clear. This scripts I use are made just for benchmarking and are 27> Let me be clear. This scripts I use are made just for benchmarking and are not
26> not intended to be used in real-life situations. Besides that, I am looking 28> intended to be used in real-life situations. Besides that, I am looking into
27> into using this approaches but adding caching service in front of it and then 29> 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 30> 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 31> 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 32> eventual consistency please take this scripts as they are: not usable in such
31> situations. 33> situations.
32 34
33## Is it possible to use them as a mounted drive with FUSE? 35## Is it possible to use them as a mounted drive with FUSE?
34 36
35Well, actually they can be used in such manor. Because they are similar to 37Well, actually they can be used in such manor. Because they are similar to [AWS
36[AWS S3](https://aws.amazon.com/s3/) many tools are available and you can find 38S3](https://aws.amazon.com/s3/) many tools are available and you can find many
37many articles and [Stackoverflow items](https://stackoverflow.com/search?q=s3+fuse). 39articles and [Stackoverflow items](https://stackoverflow.com/search?q=s3+fuse).
38 40
39To make this work you will need DigitalOcean account. If you don't have one you 41To 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 42will 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). 43[create new
42If you click on this link you will already have preselected Debian 9 with 44Droplet](https://cloud.digitalocean.com/droplets/new?size=s-1vcpu-1gb&region=ams3&distro=debian&distroImage=debian-9-x64&options=private_networking,install_agent).
45If you click on this link you will already have preselected Debian 9 with
43smallest VM option. 46smallest VM option.
44 47
45* Please be sure to add you SSH key, because we will login to this machine 48* Please be sure to add you SSH key, because we will login to this machine
46 remotely. 49 remotely.
47* If you change your region please remember which one you choose because we 50* If you change your region please remember which one you choose because we will
48 will need this information when we try to mount space to our machine. 51 need this information when we try to mount space to our machine.
49 52
50Instuctions on how to use SSH keys and how to setup them are available in article 53Instuctions on how to use SSH keys and how to setup them are available in
51[How To Use SSH Keys with DigitalOcean Droplets](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets). 54article [How To Use SSH Keys with DigitalOcean
55Droplets](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets).
52 56
53![DigitalOcean Droplets](/assets/do-fuse/fuse-droplets.png) 57![DigitalOcean Droplets](/assets/do-fuse/fuse-droplets.png)
54 58
55After we created Droplet it's time to create new Space. This is done by clicking 59After 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 60on a button [Create](https://cloud.digitalocean.com/spaces/new) (right top
57corner) and selecting Spaces. Choose pronounceable ```Unique name``` because we 61corner) and selecting Spaces. Choose pronounceable ```Unique name``` because we
58will use it in examples below. You can either choose Private or Public, it 62will 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. 63doesn't matter in our case. And you can always change that in the future.
60 64
61When you have created new Space we should [generate Access key](https://cloud.digitalocean.com/settings/api/tokens). 65When you have created new Space we should [generate Access
62This link will guide to the page when you can generate this key. After you 66key](https://cloud.digitalocean.com/settings/api/tokens). This link will guide
63create new one, please save provided Key and Secret because Secret will not 67to the page when you can generate this key. After you create new one, please
64be shown again. 68save provided Key and Secret because Secret will not be shown again.
65 69
66![DigitalOcean Spaces](/assets/do-fuse/fuse-spaces.png) 70![DigitalOcean Spaces](/assets/do-fuse/fuse-spaces.png)
67 71
@@ -90,14 +94,13 @@ s3fs UNIQUE-NAME /mnt/ -ourl=https://ams3.digitaloceanspaces.com -ouse_cache=/tm
90echo "Hello cruel world" > /mnt/hello.txt 94echo "Hello cruel world" > /mnt/hello.txt
91``` 95```
92 96
93After all this you can return to your browser and go to 97After all this you can return to your browser and go to [DigitalOcean
94[DigitalOcean Spaces](https://cloud.digitalocean.com/spaces) and click on your 98Spaces](https://cloud.digitalocean.com/spaces) and click on your created
95created space. If file hello.txt is present you have successfully mounted 99space. If file hello.txt is present you have successfully mounted space to your
96space to your machine and wrote data to it. 100machine and wrote data to it.
97 101
98I choose the same region for my Droplet and my Space but you don't have to. 102I choose the same region for my Droplet and my Space but you don't have to. You
99You can have different regions. What this actually does to performance I 103can have different regions. What this actually does to performance I don't know.
100don't know.
101 104
102Additional information on FUSE: 105Additional information on FUSE:
103 106
@@ -106,9 +109,9 @@ Additional information on FUSE:
106 109
107## Will the performance degrade over time and over different sizes of objects? 110## Will the performance degrade over time and over different sizes of objects?
108 111
109For this task I didn't want to just read and write text files or uploading 112For 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 113images. I actually wanted to figure out if using something like SQlite is viable
111viable in this case. 114in this case.
112 115
113### Measurement experiment 1: File copy 116### Measurement experiment 1: File copy
114 117
@@ -134,12 +137,12 @@ n=0; while (( n++ < 100 )); do (time cp 1MB.dat /mnt/1MB.$n.dat) |& tee -a 1MB.r
134n=0; while (( n++ < 100 )); do (time cp 10MB.dat /mnt/10MB.$n.dat) |& tee -a 10MB.results.txt; done 137n=0; while (( n++ < 100 )); do (time cp 10MB.dat /mnt/10MB.$n.dat) |& tee -a 10MB.results.txt; done
135``` 138```
136 139
137Files of size 100MB were not successfully transferred and ended up displaying 140Files of size 100MB were not successfully transferred and ended up displaying
138error (cp: failed to close '/mnt/100MB.1.dat': Operation not permitted). 141error (cp: failed to close '/mnt/100MB.1.dat': Operation not permitted).
139 142
140As I suspected, object size is not really that important. Sadly I don't have 143As I suspected, object size is not really that important. Sadly I don't have the
141the time to test performance over periods of time. But if some of you would do 144time to test performance over periods of time. But if some of you would do it
142it please send me your data. I would be interested in seeing results. 145please send me your data. I would be interested in seeing results.
143 146
144**Here are plotted results** 147**Here are plotted results**
145 148
@@ -177,18 +180,18 @@ Measurements are in seconds.
177})(); 180})();
178</script> 181</script>
179 182
180As far as these tests show, performance is quite stable and can be predicted 183As 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 184which is fantastic. But this is a small test and spans only over couple of
182hours. So you should not completely trust them. 185hours. So you should not completely trust them.
183 186
184### Measurement experiment 2: SQLite performanse 187### Measurement experiment 2: SQLite performanse
185 188
186I was unable to use database file directly from mounted drive so this is a 189I was unable to use database file directly from mounted drive so this is a no-go
187no-go as I suspected. So I executed code below on a local disk just to get 190as I suspected. So I executed code below on a local disk just to get some
188some benchmarks. I inserted 1000 records with DROPTABLE, CREATETABLE, 191benchmarks. I inserted 1000 records with DROPTABLE, CREATETABLE, INSERTMANY,
189INSERTMANY, FETCHALL, COMMIT for 1000 times to generate statistics. As you can 192FETCHALL, COMMIT for 1000 times to generate statistics. As you can see
190see performance of SQLite is quite amazing. You could then potentially just 193performance of SQLite is quite amazing. You could then potentially just copy
191copy file to mounted drive and be done with it. 194file to mounted drive and be done with it.
192 195
193```python 196```python
194import time 197import time
@@ -305,24 +308,23 @@ and check locking etc.
305 308
306## Can storage be mounted on multiple machines at the same time and be writable? 309## Can storage be mounted on multiple machines at the same time and be writable?
307 310
308Well, this one didn't take long to test. And the answer is **YES**. I mounted 311Well, 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 312space on both machines and measured same performance on both machines. But
310because file is downloaded before write and then uploaded on complete there 313because file is downloaded before write and then uploaded on complete there
311could potentially be problems is another process is trying to access the same 314could potentially be problems is another process is trying to access the same
312file. 315file.
313 316
314## Observations and conslusion 317## Observations and conslusion
315 318
316Using Spaces in this way makes it easier to access and manage files. But 319Using Spaces in this way makes it easier to access and manage files. But besides
317besides that you would need to write additional code to make this one play 320that you would need to write additional code to make this one play nice with you
318nice with you applications. 321applications.
319 322
320Nevertheless, this was extremely simple to setup and use and this is just 323Nevertheless, this was extremely simple to setup and use and this is just
321another excellent product in DigitalOcean product line. I found this exercise 324another excellent product in DigitalOcean product line. I found this exercise
322very valuable and am thinking about implementing some sort of mechanism for 325very 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 326SQLite, so data can be stored on Spaces and accessed by many VM's. For a project
324project where data doesn't need to be accessible in real-time and can have 327where data doesn't need to be accessible in real-time and can have couple of
325couple of minutes old data this would be very interesting. If any of you find 328minutes old data this would be very interesting. If any of you find this
326this proposal interesting please write in a comment box below or shoot me an 329proposal interesting please write in a comment box below or shoot me an email
327email and I will keep you posted. 330and I will keep you posted.
328
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 a57201f..f0343ae 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
@@ -7,64 +7,59 @@ draft: false
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 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 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 12computer programs from it. Well, this is all possible now. It was not done on a
13on a large scale because it is quite expensive to create DNA strands but it's 13large scale because it is quite expensive to create DNA strands but it's
14possible. 14possible.
15 15
16Encoding data into DNA sequence is relatively simple process once you understand 16Encoding data into DNA sequence is relatively simple process once you understand
17the relationship between binary data and nucleotides and scientists have been 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 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 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 20global disaster. We could imprint all the world's knowledge into plants and
21ensure the survival of our knowledge. 21ensure the survival of our knowledge.
22 22
23More optimistic usage for this technology would be easier storage of ever 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 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 25enough and cheaper this could mean the next evolution of storing data and
26abandoning classical hard and solid state drives in data warehouses. 26abandoning classical hard and solid state drives in data warehouses.
27 27
28As we currently stand this is still not viable but it is quite an amazing and 28As we currently stand this is still not viable but it is quite an amazing and
29cool technology. 29cool technology.
30 30
31My interests in this field are purely in encoding processes and experimental 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 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 33initial goal was to create a toolkit that can be used by everybody to encode
34their data into a proper DNA sequence. 34their data into a proper DNA sequence.
35 35
36## Glossary 36## Glossary
37 37
38**deoxyribose** 38**deoxyribose** A five-carbon sugar molecule with a hydrogen atom rather than a
39A five-carbon sugar molecule with a hydrogen atom rather than a hydroxyl group 39hydroxyl group in the 2′ position; the sugar component of DNA nucleotides.
40in the 2′ position; the sugar component of DNA nucleotides.
41 40
42**double helix** 41**double helix** The molecular shape of DNA in which two strands of nucleotides
43The molecular shape of DNA in which two strands of nucleotides wind around 42wind around each other in a spiral shape.
44each other in a spiral shape.
45 43
46**nitrogenous base** 44**nitrogenous base** A nitrogen-containing molecule that acts as a base; often
47A nitrogen-containing molecule that acts as a base; often referring to one of 45referring to one of the purine or pyrimidine components of nucleic acids.
48the purine or pyrimidine components of nucleic acids.
49 46
50**phosphate group** 47**phosphate group** A molecular group consisting of a central phosphorus atom
51A molecular group consisting of a central phosphorus atom bound to four oxygen 48bound to four oxygen atoms.
52atoms.
53 49
54**RGB** 50**RGB** The RGB color model is an additive color model in which red, green and
55The RGB color model is an additive color model in which red, green and blue 51blue light are added together in various ways to reproduce a broad array of
56light are added together in various ways to reproduce a broad array of colors. 52colors.
57 53
58**GCC** 54**GCC** The GNU Compiler Collection is a compiler system produced by the GNU
59The GNU Compiler Collection is a compiler system produced by the GNU Project 55Project supporting various programming languages.
60supporting various programming languages.
61 56
62## Data encoding 57## Data encoding
63 58
64**TL;DR:** Encoding involves the use of a code to change original data into a 59**TL;DR:** Encoding involves the use of a code to change original data into a
65form that can be used by an external process. 60form that can be used by an external process.
66 61
67Encoding is the process of converting data into a format required for a number 62Encoding is the process of converting data into a format required for a number
68of information processing needs, including: 63of information processing needs, including:
69 64
70- Program compiling and execution 65- Program compiling and execution
@@ -74,7 +69,7 @@ of information processing needs, including:
74Encoding can have two meanings: 69Encoding can have two meanings:
75 70
76- In computer technology, encoding is the process of applying a specific code, 71- 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 72 such as letters, symbols and numbers, to data for conversion into an
78 equivalent cipher. 73 equivalent cipher.
79- In electronics, encoding refers to analog to digital conversion. 74- In electronics, encoding refers to analog to digital conversion.
80 75
@@ -99,23 +94,25 @@ Encoding can have two meanings:
99 94
100## What is DNA? 95## What is DNA?
101 96
102Deoxyribonucleic acid, a self-replicating material which is 97Deoxyribonucleic acid, a self-replicating material which is **present in nearly
103**present in nearly all living organisms** as the main constituent of 98all living organisms** as the main constituent of chromosomes. It is the
104chromosomes. It is the **carrier of genetic information**. 99**carrier of genetic information**.
105 100
106> The nitrogen in our DNA, the calcium in our teeth, the iron in our blood, 101> The nitrogen in our DNA, the calcium in our teeth, the iron in our blood,
107> the carbon in our apple pies were made in the interiors of collapsing stars. 102> the carbon in our apple pies were made in the interiors of collapsing stars.
108> We are made of starstuff. 103> We are made of starstuff.
109> **-- Carl Sagan, Cosmos** 104> **-- Carl Sagan, Cosmos**
110 105
111The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases 106The nucleotide in DNA consists of a sugar (deoxyribose), one of four bases
112(cytosine (C), thymine (T), adenine (A), guanine (G)), and a phosphate. 107(cytosine (C), thymine (T), adenine (A), guanine (G)), and a phosphate.
113Cytosine and thymine are pyrimidine bases, while adenine and guanine are purine 108Cytosine and thymine are pyrimidine bases, while adenine and guanine are purine
114bases. The sugar and the base together are called a nucleoside. 109bases. The sugar and the base together are called a nucleoside.
115 110
116![DNA](/assets/dna-sequence/dna-basics.jpg) 111![DNA](/assets/dna-sequence/dna-basics.jpg)
117 112
118*DNA (a) forms a double stranded helix, and (b) adenine pairs with thymine and cytosine pairs with guanine. (credit a: modification of work by Jerome Walker, Dennis Myts)* 113*DNA (a) forms a double stranded helix, and (b) adenine pairs with thymine and
114cytosine pairs with guanine. (credit a: modification of work by Jerome Walker,
115Dennis Myts)*
119 116
120## Encode binary data into DNA sequence 117## Encode binary data into DNA sequence
121 118
@@ -128,18 +125,18 @@ As an input file you can use any file you want:
128- Database files, 125- Database files,
129- etc. 126- etc.
130 127
131Note: If you would copy all the bytes from RAM to file or pipe data to file you 128Note: 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. 129could encode also this data as long as you provide file pointer to the encoder.
133 130
134### Basic Encoding 131### Basic Encoding
135 132
136As already mentioned, the Basic Encoding is based on a simple mapping. Since 133As already mentioned, the Basic Encoding is based on a simple mapping. Since DNA
137DNA is composed of 4 nucleotides (Adenine, Cytosine, Guanine, Thymine; usually 134is composed of 4 nucleotides (Adenine, Cytosine, Guanine, Thymine; usually
138referred using the first letter). Using this technique we can encode 135referred using the first letter). Using this technique we can encode
139 136
140$$ log_2(4) = log_2(2^2) = 2 bits $$ 137$$ log_2(4) = log_2(2^2) = 2 bits $$
141 138
142using a single nucleotide. In this way, we are able to use the 4 bases that 139using 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. 140compose the DNA strand to encode each byte of data.
144 141
145| Two bits | Nucleotides | 142| Two bits | Nucleotides |
@@ -149,8 +146,8 @@ compose the DNA strand to encode each byte of data.
149| 01 | **C** (Cytosine) | 146| 01 | **C** (Cytosine) |
150| 11 | **T** (Thymine) | 147| 11 | **T** (Thymine) |
151 148
152With this in mind we can simply encode any data by using two-bit to 149With this in mind we can simply encode any data by using two-bit to Nucleotides
153Nucleotides conversion. 150conversion.
154 151
155```python 152```python
156{ Algorithm 1: Naive byte array to DNA encode } 153{ Algorithm 1: Naive byte array to DNA encode }
@@ -173,29 +170,29 @@ begin
173end 170end
174``` 171```
175 172
176Another encoding would be **Goldman encoding**. Using this encoding helps with 173Another encoding would be **Goldman encoding**. Using this encoding helps with
177Nonsense mutation (amino acids replaced by a stop codon) that occurs and is 174Nonsense mutation (amino acids replaced by a stop codon) that occurs and is the
178the most problematic during translation because it leads to truncated amino 175most problematic during translation because it leads to truncated amino acid
179acid sequences, which in turn results in truncated proteins. 176sequences, which in turn results in truncated proteins.
180 177
181[Where to store big data? In DNA: Nick Goldman at TEDxPrague](https://www.youtube.com/watch?v=a4PiGWNsIEU) 178[Where to store big data? In DNA: Nick Goldman at TEDxPrague](https://www.youtube.com/watch?v=a4PiGWNsIEU)
182 179
183### FASTA file format 180### FASTA file format
184 181
185In bioinformatics, FASTA format is a text-based format for representing either 182In bioinformatics, FASTA format is a text-based format for representing either
186nucleotide sequences or peptide sequences, in which nucleotides or amino acids 183nucleotide sequences or peptide sequences, in which nucleotides or amino acids
187are represented using single-letter codes. The format also allows for sequence 184are represented using single-letter codes. The format also allows for sequence
188names and comments to precede the sequences. The format originates from the 185names and comments to precede the sequences. The format originates from the
189FASTA software package, but has now become a standard in the field of 186FASTA software package, but has now become a standard in the field of
190bioinformatics. 187bioinformatics.
191 188
192The first line in a FASTA file started either with a ">" (greater-than) symbol 189The first line in a FASTA file started either with a ">" (greater-than) symbol
193or, less frequently, a ";" (semicolon) was taken as a comment. Subsequent 190or, less frequently, a ";" (semicolon) was taken as a comment. Subsequent lines
194lines starting with a semicolon would be ignored by software. Since the only 191starting with a semicolon would be ignored by software. Since the only comment
195comment used was the first, it quickly became used to hold a summary 192used was the first, it quickly became used to hold a summary description of the
196description of the sequence, often starting with a unique library accession 193sequence, often starting with a unique library accession number, and with time
197number, and with time it has become commonplace to always use ">" for the first 194it has become commonplace to always use ">" for the first line and to not use
198line and to not use ";" comments (which would otherwise be ignored). 195";" comments (which would otherwise be ignored).
199 196
200``` 197```
201;LCBO - Prolactin precursor - Bovine 198;LCBO - Prolactin precursor - Bovine
@@ -218,7 +215,7 @@ GLMPFLHTSKHRSMMLRPLSQALFWTLTMDLLTLTWIGSQPVEYPYTIIGQMASILYFSIILAFLPIAGX
218IENY 215IENY
219``` 216```
220 217
221FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format) 218FASTA format was extended by [FASTQ](https://en.wikipedia.org/wiki/FASTQ_format)
222format from the [Sanger Centre](https://www.sanger.ac.uk/) in Cambridge. 219format from the [Sanger Centre](https://www.sanger.ac.uk/) in Cambridge.
223 220
224### PNG encoded DNA sequence 221### PNG encoded DNA sequence
@@ -230,7 +227,7 @@ format from the [Sanger Centre](https://www.sanger.ac.uk/) in Cambridge.
230| C ➞ Cytosine | (255,0,0) | Red | 227| C ➞ Cytosine | (255,0,0) | Red |
231| T ➞ Thymine | (255,255,0) | Yellow | 228| T ➞ Thymine | (255,255,0) | Yellow |
232 229
233With this in mind we can create a simple algorithm to create PNG representation 230With this in mind we can create a simple algorithm to create PNG representation
234of a DNA sequence. 231of a DNA sequence.
235 232
236```python 233```python
@@ -252,7 +249,7 @@ end
252 249
253## Encoding text file in practice 250## Encoding text file in practice
254 251
255In this example we will take a simple text file as our input stream for 252In 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. 253encoding. This file will have a quote from Niels Bohr and saved as txt file.
257 254
258> How wonderful that we have met with a paradox. Now we have some hope of 255> How wonderful that we have met with a paradox. Now we have some hope of
@@ -306,8 +303,9 @@ After encoding into PNG format this file looks like this.
306 303
307The larger the input stream is the larger the PNG file would be. 304The larger the input stream is the larger the PNG file would be.
308 305
309Compiled basic Hello World C program with [GCC](https://www.gnu.org/software/gcc/) 306Compiled basic Hello World C program with
310would [look like](/assets/dna-sequence/sample.png). 307[GCC](https://www.gnu.org/software/gcc/) would [look
308like](/assets/dna-sequence/sample.png).
311 309
312```c 310```c
313// gcc -O3 -o sample sample.c 311// gcc -O3 -o sample sample.c
@@ -370,7 +368,7 @@ First we generate some binary sample data with dd.
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 368dd 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
371``` 369```
372 370
373Our freshly generated 1KB file looks something like this (its full of garbage 371Our freshly generated 1KB file looks something like this (its full of garbage
374data as intended). 372data as intended).
375 373
376![Sample binary file 1KB](/assets/dna-sequence/sample-binary-file.png) 374![Sample binary file 1KB](/assets/dna-sequence/sample-binary-file.png)
@@ -410,4 +408,3 @@ gzip -9 < 10MB.fa > 10MB.fa.gz
410- https://opentextbc.ca/biology/chapter/9-1-the-structure-of-dna/ 408- https://opentextbc.ca/biology/chapter/9-1-the-structure-of-dna/
411- https://arxiv.org/abs/1801.04774 409- https://arxiv.org/abs/1801.04774
412- https://en.wikipedia.org/wiki/FASTA_format 410- 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 13f4f42..97ddb34 100644
--- a/content/posts/2019-10-14-simplifying-and-reducing-clutter.md
+++ b/content/posts/2019-10-14-simplifying-and-reducing-clutter.md
@@ -5,53 +5,54 @@ date: 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 8I recently moved my main working machine back from Hachintosh to Linux. Well the
9the experiment was interesting and I have done some great work on macOS but it 9experiment was interesting and I have done some great work on macOS but it was
10was time to move back. 10time to move back.
11 11
12I actually really missed Linux. The simplicity of `apt-get` or just the amount 12I actually really missed Linux. The simplicity of `apt-get` or just the amount
13of software that exists for Linux should be a no-brainer. I spent most of my 13of software that exists for Linux should be a no-brainer. I spent most of my
14time on macOS finding solutions to make things work. Using [Brew](https://brew.sh/) 14time on macOS finding solutions to make things work. Using
15was just a horrible experience and far from package managers of Linux. At least 15[Brew](https://brew.sh/) was just a horrible experience and far from package
16they managed to get that `sudo` debacle sorted. 16managers of Linux. At least they managed to get that `sudo` debacle sorted.
17 17
18Not all was bad. macOS in general was a perfectly good environment. Things like 18Not all was bad. macOS in general was a perfectly good environment. Things like
19Docker and tooling like this worked without any hiccups. My normal tools like 19Docker and tooling like this worked without any hiccups. My normal tools like
20coding IDE worked flawlessly and the whole look and feel is just superb. I have 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 21been using MacBook Air for couple of years so I was used to the system but never
22never as a daily driver. 22as a daily driver.
23 23
24One of the things I did after I installed Linux back on my machine was cleaning 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 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 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 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 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. 29Google music and I have Netflix account which is more than enough for me.
30 30
31I also went and deleted some of the repositories on my Github account. I have 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 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 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 34around when I am faced with similar problem. That was a huge relief if I am
35being totally honest. 35being totally honest.
36 36
37Next step was to do something with my webpage. I have been using some scripts 37Next step was to do something with my webpage. I have been using some scripts I
38I wrote a while ago to generate static pages from markdown source posts. I kept 38wrote a while ago to generate static pages from markdown source posts. I kept on
39on adding and adding stuff on top of it and it became a source of a 39adding 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. 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 41Anyways after couple of hours of searching and testing static generators I found
42found an interesting one [https://github.com/piranha/gostatic](https://github.com/piranha/gostatic) 42an interesting one
43and I just decided to use this one. It was the only one that had a simple 43[https://github.com/piranha/gostatic](https://github.com/piranha/gostatic) and I
44templating engine, not that I really need one. But others had this convoluted 44just decided to use this one. It was the only one that had a simple templating
45way of trying to solve everything and at the end just required quite bigger 45engine, not that I really need one. But others had this convoluted way of trying
46learning curve I was ready to go with. So I deleted couple of old posts, 46to solve everything and at the end just required quite bigger learning curve I
47simplified HTML, trashed most of the CSS and went with 47was ready to go with. So I deleted couple of old posts, simplified HTML, trashed
48[https://motherfuckingwebsite.com/](https://motherfuckingwebsite.com/) aesthetics. 48most of the CSS and went with
49Yeah, the previous site was more visually stimulating but all I really care is 49[https://motherfuckingwebsite.com/](https://motherfuckingwebsite.com/)
50the content at this point. And Times New Roman font is kind of awesome. 50aesthetics. Yeah, the previous site was more visually stimulating but all I
51 51really care is the content at this point. And Times New Roman font is kind of
52I stopped working on most of the projects in the past couple of months because 52awesome.
53the overhead was just too insane. There comes a point when you stretch yourself 53
54I stopped working on most of the projects in the past couple of months because
55the 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. 56too much and then you stop progressing and with that comes dissatisfaction.
55 57
56So that's about it. Moving forward minimal style. 58So 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 995da25..e7324bb 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
@@ -7,22 +7,22 @@ draft: false
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 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 11established news sites use click bait titles to drive additional traffic to
12to their sites and generate additional impressions. 12their sites and generate additional impressions.
13 13
14Goal is to see how article titles and actual content of article differ from 14Goal is to see how article titles and actual content of article differ from each
15each other and see if titles are clickbaited. 15other and see if titles are clickbaited.
16 16
17## Preparing and cleaning data 17## Preparing and cleaning data
18 18
19For this example I opted to just use RSS feed from a new website and decided 19For this example I opted to just use RSS feed from a new website and decided to
20to go with [The Guardian](https://www.theguardian.com) World news. While this 20go with [The Guardian](https://www.theguardian.com) World news. While this gets
21gets us limited data (~40) articles and also description (actual content) is 21us limited data (~40) articles and also description (actual content) is trimmed
22trimmed this really doesn't reflect the actual article contents. 22this really doesn't reflect the actual article contents.
23 23
24To get better content I could use web scraping and use RSS as link list and 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 25fetch contents directly from website, but for this simple example this will
26suffice. 26suffice.
27 27
28There are couple of requirements we need to install before we continue: 28There are couple of requirements we need to install before we continue:
@@ -50,12 +50,12 @@ for item in feed.entries:
50Since we now have cleaned up data in our `feed.entries` object we can start with 50Since we now have cleaned up data in our `feed.entries` object we can start with
51performing sentiment analysis. 51performing sentiment analysis.
52 52
53There are many sentiment analysis libraries available that range from rule-based 53There are many sentiment analysis libraries available that range from rule-based
54sentiment analysis up to machine learning supported analysis. To keep things 54sentiment analysis up to machine learning supported analysis. To keep things
55simple I decided to use rule-based analysis library 55simple I decided to use rule-based analysis library
56[vaderSentiment](https://github.com/cjhutto/vaderSentiment) from 56[vaderSentiment](https://github.com/cjhutto/vaderSentiment) from
57[C.J. Hutto](https://github.com/cjhutto). Really nice library and quite 57[C.J. Hutto](https://github.com/cjhutto). Really nice library and quite easy to
58easy to use. 58use.
59 59
60```python 60```python
61from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer 61from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
@@ -68,9 +68,9 @@ for item in feed.entries:
68 sentiment_results.append([sentiment_title['compound'], sentiment_description['compound']]) 68 sentiment_results.append([sentiment_title['compound'], sentiment_description['compound']])
69``` 69```
70 70
71Now that we have this data in a shape that is compatible with matplotlib we can 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 72plot results to see the difference between title and description sentiment of an
73an article. 73article.
74 74
75```python 75```python
76import matplotlib.pyplot as plt 76import matplotlib.pyplot as plt
@@ -85,15 +85,15 @@ plt.show()
85## Results and assets 85## Results and assets
86 86
871. 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.
882. Rule-based approach may not be the best way of doing this. By using deep 882. Rule-based approach may not be the best way of doing this. By using deep
89 learning we would be able to get better insights. 89 learning we would be able to get better insights.
903. **Next step would be to** periodically fetch RSS items and store them over 903. **Next step would be to** periodically fetch RSS items and store them over a
91 a longer period of time and then perform analysis again and use either 91 longer period of time and then perform analysis again and use either machine
92 machine learning or deep learning on top of it. 92 learning or deep learning on top of it.
93 93
94![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)
95 95
96Figure above displays difference between title and description sentiment for 96Figure above displays difference between title and description sentiment for
97specific RSS feed item. 1 means positive and -1 means negative sentiment. 97specific RSS feed item. 1 means positive and -1 means negative sentiment.
98 98
99[» Download Jupyter Notebook](/assets/sentiment-analysis/sentiment-analysis.ipynb) 99[» Download Jupyter Notebook](/assets/sentiment-analysis/sentiment-analysis.ipynb)
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 77c42a9..60745d0 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
@@ -7,35 +7,35 @@ draft: false
7 7
8## Before we continue ... 8## Before we continue ...
9 9
10Publisher Subscriber model is nothing new and there are many amazing solutions 10Publisher Subscriber model is nothing new and there are many amazing solutions
11out there, so writing a new one would be a waste of time if other solutions 11out there, so writing a new one would be a waste of time if other solutions
12wouldn't have quite complex install procedures and weren't so hard to maintain. 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 13But to be fair, comparing this simple server with something like
14[Kafka](https://kafka.apache.org/) or [RabbitMQ](https://www.rabbitmq.com/) is 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 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 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 17these drawbacks, this method has been tested on a large website and worked until
18until now without any problems. So now, that we got that cleared up, let's 18now without any problems. So now, that we got that cleared up, let's continue.
19continue. 19
20 20***Wiki definition:** Publish/subscribe messaging, or pub/sub messaging, is a
21***Wiki definition:** Publish/subscribe messaging, or pub/sub messaging, is a 21form of asynchronous service-to-service communication used in serverless and
22form of asynchronous service-to-service communication used in serverless and 22microservices architectures. In a pub/sub model, any message published to a
23microservices architectures. In a pub/sub model, any message published to a
24topic is immediately received by all the subscribers to the topic.* 23topic is immediately received by all the subscribers to the topic.*
25 24
26## General goals 25## General goals
27 26
28- provide a simple server that relays messages to all the connected clients, 27- provide a simple server that relays messages to all the connected clients,
29- messages can be posted on specific topics, 28- messages can be posted on specific topics,
30- messages get sent via [Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) 29- messages get sent via [Server-Sent
30 Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
31 to all the subscribers. 31 to all the subscribers.
32 32
33## How exactly does the pub/sub model work? 33## How exactly does the pub/sub model work?
34 34
35The easiest way to explain this is with diagram bellow. Basic function is 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 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 37create and post messages. Similar model is also well know pattern that works on
38on a premise of consumers and producers, and they take similar roles. 38a premise of consumers and producers, and they take similar roles.
39 39
40![How PubSub works](/assets/simple-pubsub-server/pubsub-overview.png) 40![How PubSub works](/assets/simple-pubsub-server/pubsub-overview.png)
41 41
@@ -45,43 +45,47 @@ on a premise of consumers and producers, and they take similar roles.
45- consumer is receiving messages from subscribed topic, 45- consumer is receiving messages from subscribed topic,
46- servers is also known as Broker, 46- servers is also known as Broker,
47- broker does not store messages or tracks success, 47- broker does not store messages or tracks success,
48- broker uses [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)) 48- broker uses
49 method for delivering messages, 49 [FIFO](https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)) method
50- if consumer wants to receive messages from a topic, producer and consumer topics 50 for delivering messages,
51 must match, 51- if consumer wants to receive messages from a topic, producer and consumer
52 topics must match,
52- consumer can subscribe to multiple topics, 53- consumer can subscribe to multiple topics,
53- producer can publish to multiple topics, 54- producer can publish to multiple topics,
54- each message has a messageId. 55- each message has a messageId.
55 56
56**Known drawbacks:** 57**Known drawbacks:**
57 58
58- messages will not be stored in a persistent queue or unreceived messages like 59- messages will not be stored in a persistent queue or unreceived messages like
59 [DeadLetterQueue](https://en.wikipedia.org/wiki/Dead_letter_queue) so old 60 [DeadLetterQueue](https://en.wikipedia.org/wiki/Dead_letter_queue) so old
60 messages could be lost on server restart, 61 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- [Server-Sent
62 opens a long-running connection between the client and the server so make 63 Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events)
63 sure if your setup is load balanced that the load balancer in this case can 64 opens a long-running connection between the client and the server so make sure
64 have long opened connection, 65 if your setup is load balanced that the load balancer in this case can have
66 long opened connection,
65- no system moderation due to the dynamic nature of creating queues. 67- no system moderation due to the dynamic nature of creating queues.
66 68
67## Server-Sent Events 69## Server-Sent Events
68 70
69Read more about it on [official specification page](https://html.spec.whatwg.org/multipage/server-sent-events.html). 71Read more about it on [official specification
72page](https://html.spec.whatwg.org/multipage/server-sent-events.html).
70 73
71### Current browser support 74### Current browser support
72 75
73![Browser support](/assets/simple-pubsub-server/caniuse.png) 76![Browser support](/assets/simple-pubsub-server/caniuse.png)
74 77
75Check [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource) 78Check
79[https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource)
76for latest information about browser support. 80for latest information about browser support.
77 81
78### Known issues 82### Known issues
79 83
80- Firefox 52 and below do not support EventSource in web/shared workers 84- Firefox 52 and below do not support EventSource in web/shared workers
81- In Firefox prior to version 36 server-sent events do not reconnect 85- In Firefox prior to version 36 server-sent events do not reconnect
82 automatically in case of a connection interrupt (bug) 86 automatically in case of a connection interrupt (bug)
83- Reportedly, CORS in EventSource is currently supported in Firefox 10+, 87- Reportedly, CORS in EventSource is currently supported in Firefox 10+, Opera
84 Opera 12+, Chrome 26+, Safari 7.0+. 88 12+, Chrome 26+, Safari 7.0+.
85- Antivirus software may block the event streaming data chunks. 89- Antivirus software may block the event streaming data chunks.
86 90
87Source: [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource) 91Source: [https://caniuse.com/#feat=eventsource](https://caniuse.com/#feat=eventsource)
@@ -104,7 +108,7 @@ data: this is line two
104<blank line> 108<blank line>
105``` 109```
106 110
107And you can specify your own event types (the above messages will all trigger 111And you can specify your own event types (the above messages will all trigger
108the message event): 112the message event):
109 113
110```bash 114```bash
@@ -116,7 +120,7 @@ data: 103.34
116 120
117### Server requirements 121### Server requirements
118 122
119The important thing is how you send headers and which headers are sent by the 123The important thing is how you send headers and which headers are sent by the
120server that triggers browser to threat response as a EventStream. 124server that triggers browser to threat response as a EventStream.
121 125
122Headers responsible for this are: 126Headers responsible for this are:
@@ -129,23 +133,23 @@ Connection: keep-alive
129 133
130### Debugging with Google Chrome 134### Debugging with Google Chrome
131 135
132Google Chrome provides build-in debugging and exploration tool for 136Google Chrome provides build-in debugging and exploration tool for [Server-Sent
133[Server-Sent Events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) 137Events](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. 138which is quite nice and available from Developer Tools under Network tab.
135 139
136> You can debug only client side events that get received and not the server 140> 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 141> ones. For debugging server events add `console.log` to `server.js` code and
138> print out events. 142> print out events.
139 143
140![Google Chrome Developer Tools EventStream](/assets/simple-pubsub-server/chrome-debugging.png) 144![Google Chrome Developer Tools EventStream](/assets/simple-pubsub-server/chrome-debugging.png)
141 145
142## Server implementation 146## Server implementation
143 147
144For the sake of this example we will use [Node.js](https://nodejs.org/en/) 148For the sake of this example we will use [Node.js](https://nodejs.org/en/) with
145with [Express](https://expressjs.com) as our router since this is the easiest 149[Express](https://expressjs.com) as our router since this is the easiest way to
146way to get started and we will use already written SSE library for node 150get 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 151[sse-pubsub](https://www.npmjs.com/package/sse-pubsub) so we don't reinvent the
148the wheel. 152wheel.
149 153
150```bash 154```bash
151npm init --yes 155npm init --yes
@@ -252,16 +256,16 @@ app.listen(port, () => {
252 256
253### Our custom message format 257### Our custom message format
254 258
255Each message posted on a server must be in a specific format that out server 259Each 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 260accepts. Having structure like this allows us to have multiple separated type of
257of events on each topic. 261events on each topic.
258 262
259With this we can separate streams and only receive events that belong to the 263With this we can separate streams and only receive events that belong to the
260topic. 264topic.
261 265
262One example would be, that we have index page and we want to receive messages 266One 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 267about 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 268other pages. This reduces clutter and overall network. And structure is much
265nicer and maintanable. 269nicer and maintanable.
266 270
267```json 271```json
@@ -278,15 +282,15 @@ nicer and maintanable.
278 282
279<video src="/assets/simple-pubsub-server/clients.m4v" controls></video> 283<video src="/assets/simple-pubsub-server/clients.m4v" controls></video>
280 284
281You can download [the code](../simple-pubsub-server/sse-pubsub-server.zip) 285You can download [the code](../simple-pubsub-server/sse-pubsub-server.zip) and
282and follow along. 286follow along.
283 287
284### Publisher 288### Publisher
285 289
286As talked about above publisher is the one that send messages to the 290As talked about above publisher is the one that send messages to the
287broker/server. Message inside the payload can be whatever you want (string, 291broker/server. Message inside the payload can be whatever you want (string,
288object, array). I would however personally avoid send large chunks of data 292object, array). I would however personally avoid send large chunks of data like
289like blobs and such. 293blobs and such.
290 294
291```html 295```html
292<!DOCTYPE html> 296<!DOCTYPE html>
@@ -359,19 +363,19 @@ like blobs and such.
359 363
360### Subscriber 364### Subscriber
361 365
362Subscriber is responsible for receiving new messages that come from server via 366Subscriber is responsible for receiving new messages that come from server via
363publisher. The code bellow is very rudimentary but works and follows the 367publisher. The code bellow is very rudimentary but works and follows the
364implementation guidelines for EventSource. 368implementation guidelines for EventSource.
365 369
366You can use either Developer Tools Console to see incoming messages or you can 370You 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 371defer to Debugging with Google Chrome section above to see all EventStream
368messages. 372messages.
369 373
370> Don't be alarmed if the subscriber gets disconnected from the server every 374> Don't be alarmed if the subscriber gets disconnected from the server every so
371> so often. The code we have here resets connection every 15s but it 375> often. The code we have here resets connection every 15s but it automatically
372> automatically get reconnected and fetches all messages up to last received 376> get reconnected and fetches all messages up to last received message id. This
373> message id. This setting can be adjusted in `server.js` file; search for 377> setting can be adjusted in `server.js` file; search for the
374> the `maxStreamDuration` variable. 378> `maxStreamDuration` variable.
375 379
376```html 380```html
377<!DOCTYPE html> 381<!DOCTYPE html>
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 f7dd362..ac4f053 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
@@ -5,14 +5,15 @@ date: 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 8I have been searching for a solution to pre-generate some placeholder images for
9for image server I needed to develop that resizes images on S3. I though this 9image server I needed to develop that resizes images on S3. I though this would
10would be a 15min job and quickly found out how very mistaken I was. 10be a 15min job and quickly found out how very mistaken I was.
11 11
12Even though Node.js is not really the best way to do this kind of things 12Even though Node.js is not really the best way to do this kind of things (surely
13(surely something written in C or Rust or even Golang would be the correct way 13something written in C or Rust or even Golang would be the correct way to do
14to do this but we didn't need the speed in our case) I found an excellent 14this but we didn't need the speed in our case) I found an excellent library
15library [sharp - High performance Node.js image processing](https://github.com/lovell/sharp). 15[sharp - High performance Node.js image
16processing](https://github.com/lovell/sharp).
16 17
17Getting things running was a breeze. 18Getting things running was a breeze.
18 19
@@ -53,20 +54,20 @@ s3.putObject({
53All this code was wrapped inside a web service with some additional security 54All this code was wrapped inside a web service with some additional security
54checks and defensive coding to detect if key is missing on S3. 55checks and defensive coding to detect if key is missing on S3.
55 56
56And at that point I needed to return placeholder images as a response in case 57And 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 58key 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 59PNG in Gimp and just serve them but I wanted to respect aspect ratio and I
59didn't want to return some mangled images. 60didn't want to return some mangled images.
60 61
61> Main problem with finding a clean solution I could copy and paste and change 62> Main problem with finding a clean solution I could copy and paste and change a
62a bit was a task. API is changing constantly and there weren't clear examples 63> bit was a task. API is changing constantly and there weren't clear examples or
63or I was unable to find them. 64> I was unable to find them.
64 65
65## Generating placeholder images using SVG 66## Generating placeholder images using SVG
66 67
67What I ended up was using SVG to generate text and created image with sharp and 68What 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 69used composition to combine both layers. Response returned by this function is a
69a buffer you can use to either upload to S3 or save to local file. 70buffer you can use to either upload to S3 or save to local file.
70 71
71```js 72```js
72const generatePlaceholderImageWithText = async (width, height, message) => { 73const generatePlaceholderImageWithText = async (width, height, message) => {
@@ -91,11 +92,10 @@ const generatePlaceholderImageWithText = async (width, height, message) => {
91} 92}
92``` 93```
93 94
94That is about it. Nothing more to it. You can change the color of the image by 95That 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 96changing `background` and if you want to change text styling you can adapt SVG
96SVG to your needs. 97to 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.
101 98
99> Also be careful about the length of the text. This function positions text at
100> the center and adds `20px` padding on all sides. If text is longer than the
101> 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 d0f4bac..bf1d710 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
@@ -5,33 +5,33 @@ date: 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 8I've been using Elasticsearch in production for 5 years now and never had a
9single problem with it. Hell, never even known there could be a problem. Just 9single problem with it. Hell, never even known there could be a problem. Just
10worked. All this time. The first node that I deployed is still being used in 10worked. All this time. The first node that I deployed is still being used in
11production, never updated, upgraded, touched in anyway. 11production, never updated, upgraded, touched in anyway.
12 12
13All this bliss came to an abrupt end this Friday when I got notification that 13All this bliss came to an abrupt end this Friday when I got notification that
14Elasticsearch cluster went warm. Well, warm is not that bad right? Wrong! 14Elasticsearch cluster went warm. Well, warm is not that bad right? Wrong!
15Quickly after that I got another email which sent chills down my spine. 15Quickly after that I got another email which sent chills down my spine. Cluster
16Cluster is now red. RED! Now, shit really hit the fan! 16is now red. RED! Now, shit really hit the fan!
17 17
18I tried googling what could be the problem and after executing allocation 18I tried googling what could be the problem and after executing allocation
19function noticed that some shards were unassigned and 5 attempts were already 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. 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, 21They also applied that one should wait for cluster to re-balance itself. So, I
22I waited. One hour, two hours, several hours. Nothing, still RED. 22waited. One hour, two hours, several hours. Nothing, still RED.
23 23
24The strangest thing about it all was, that queries were still being fulfilled. 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 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 26everybody that would look at the cluster would know immediately that something
27was very very wrong and we were living on borrowed time here. 27was very very wrong and we were living on borrowed time here.
28 28
29> **Please, DO NOT do what I did.** Seriously! Please ask someone on official 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 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 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 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 33I would be able to restore the data. It would be a huge pain and I would loose
34loose couple of days but I had a plan B. 34couple of days but I had a plan B.
35 35
36Executing 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.
37 37
@@ -39,14 +39,14 @@ Executing allocation and told me what the problem was but no clear solution yet.
39GET /_cat/allocation?format=json 39GET /_cat/allocation?format=json
40``` 40```
41 41
42I got a message that `ALLOCATION_FAILED` with additional info 42I got a message that `ALLOCATION_FAILED` with additional info `failed to create
43`failed to create shard, failure ioexception[failed to obtain in-memory shard lock]`. 43shard, failure ioexception[failed to obtain in-memory shard lock]`. Well
44Well splendid! I must also say that our cluster is capable more than enough 44splendid! I must also say that our cluster is capable more than enough to handle
45to handle the traffic. Also JVM memory pressure never was an issue. So what 45the traffic. Also JVM memory pressure never was an issue. So what happened
46happened really then? 46really then?
47 47
48I tried also re-routing failed ones with no success due to AWS restrictions 48I tried also re-routing failed ones with no success due to AWS restrictions on
49on having managed Elasticsearch cluster (they lock some of the functions). 49having managed Elasticsearch cluster (they lock some of the functions).
50 50
51```yaml 51```yaml
52POST /_cluster/reroute?retry_failed=true 52POST /_cluster/reroute?retry_failed=true
@@ -60,10 +60,10 @@ I got a message that significantly reduced my options.
60} 60}
61``` 61```
62 62
63After that I went on a hunt again. I won't bother you with all the details 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 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 65index and hoped for the best. Until that moment even re-indexing was giving me
66me errors. 66errors.
67 67
68```yaml 68```yaml
69POST _reindex 69POST _reindex
@@ -77,8 +77,8 @@ POST _reindex
77} 77}
78``` 78```
79 79
80I needed to do this multiple times to get all the documents re-indexed. Then 80I needed to do this multiple times to get all the documents re-indexed. Then I
81I dropped the original one with the following command. 81dropped the original one with the following command.
82 82
83```yaml 83```yaml
84DELETE /myindex 84DELETE /myindex
@@ -98,10 +98,10 @@ POST _reindex
98} 98}
99``` 99```
100 100
101On the surface it looks like all is working but I have a long road in front 101On the surface it looks like all is working but I have a long road in front of
102of me to get all the things working again. Cluster now shows that it is in 102me to get all the things working again. Cluster now shows that it is in Green
103Green mode but I am also getting a notification that the cluster has 103mode but I am also getting a notification that the cluster has processing status
104processing status which could mean million of things. 104which could mean million of things.
105 105
106Godspeed! 106Godspeed!
107 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 47b95d5..daebb4c 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
@@ -5,96 +5,95 @@ date: 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/). 8Previous project I was working on was being coded in
9Also was my first project using it. And damn, that was an awesome experience. 9[Golang](https://golang.org/). Also was my first project using it. And damn,
10The whole thing is just superb. From how errors are handled. The C-like way 10that was an awesome experience. The whole thing is just superb. From how errors
11you handle compiling. The way the language is structured making it incredibly 11are handled. The C-like way you handle compiling. The way the language is
12versatile and easy to learn. 12structured making it incredibly versatile and easy to learn.
13 13
14It may cause some pain for somebody that is not used of using interfaces to map 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 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/) 16[entr](http://eradman.com/entrproject/) and
17to fix that. 17[make](https://www.gnu.org/software/make/) to fix that.
18 18
19But we are not here to talk about my undying love for **Golang**. Only in some 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 20way we probably should. It is an excellent example of how modern language should
21should be designed. And because I have used it extensively in the last couple 21be designed. And because I have used it extensively in the last couple of years
22of years this probably taints my views of other languages. And is doing me a 22this probably taints my views of other languages. And is doing me a great
23great disservice. Nevertheless, here we are. 23disservice. Nevertheless, here we are.
24 24
25About two years ago I started flirting with [Node.js](https://nodejs.org/en/) 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 26for a project I started working on. What I wanted was to have things written in
27in a language that is widely used, and we could get additional developers for. 27a language that is widely used, and we could get additional developers for. As
28As much as **Golang** is amazing it's really hard to get developers for it. 28much as **Golang** is amazing it's really hard to get developers for it. Even
29Even now. And after playing around with it for a week I felt in love with the 29now. And after playing around with it for a week I felt in love with the speed
30speed of iteration and massive package ecosystem. Do you want SSO? You got it! 30of iteration and massive package ecosystem. Do you want SSO? You got it! Do you
31Do you want some esoteric library for something? There is a strong chance 31want some esoteric library for something? There is a strong chance somebody
32somebody wrote it. It is so extensive that you find yourself evaluating 32wrote it. It is so extensive that you find yourself evaluating packages based on
33packages based on **GitHub stars** and number of contributors. You get 33**GitHub stars** and number of contributors. You get swallowed by the vanity
34swallowed by the vanity metrics and that potentially will become the downfall 34metrics and that potentially will become the downfall of Node.js.
35of Node.js. 35
36 36Because of the sheer amount of choice I often got anxiety when choosing
37Because of the sheer amount of choice I often got anxiety when choosing 37libraries. Will I choose the correct one? Is this library something that will be
38libraries. Will I choose the correct one? Is this library something that will 38supported for a foreseeable future or not? I am used of using libraries that are
39be supported for a foreseeable future or not? I am used of using libraries that 39being in development for 10 years plus (Python, C) and that gave me some sort of
40are being in development for 10 years plus (Python, C) and that gave me some 40comfort. And it is probably unfair to Node.js and community to expect same
41sort of comfort. And it is probably unfair to Node.js and community to expect 41dedication.
42same dedication. 42
43 43Moving forward ... Work started and things were great. **Speed of iteration was
44Moving forward ... Work started and things were great. 44insane**. For some feature that I would need a day in Golang only took me hour
45**Speed of iteration was insane**. For some feature that I would need a day 45or two. I became lazy! Using packages all over the place. Falling into the same
46in Golang only took me hour or two. I became lazy! Using packages all over 46trap as others. Packages on top of packages. And [npm](https://www.npmjs.com/)
47the place. Falling into the same trap as others. Packages on top of packages. 47didn't help at all. The way that the package manager works is just
48And [npm](https://www.npmjs.com/) didn't help at all. The way that the package 48horrendous. And not allowing to have node_modules outside the project is also
49manager works is just horrendous. And not allowing to have node_modules outside 49the stupidest idea ever.
50the project is also the stupidest idea ever. 50
51 51So at that point I started feeling the technical debt that comes with Node.js
52So at that point I started feeling the technical debt that comes with Node.js 52and the whole ecosystem. What nobody tells you is that **structuring large
53and the whole ecosystem. What nobody tells you is that 53Node.js apps** is more problematic than one would think. And going microservice
54**structuring large Node.js apps** is more problematic than one would think. 54for every single thing is also a bad idea. The amount of networking you
55And going microservice for every single thing is also a bad idea. The amount 55introduce with that approach always ends up being a pain in the ass. And I don't
56of networking you introduce with that approach always ends up being a pain in 56even want to go into system administration here. The overhead is
57the ass. And I don't even want to go into system administration here. The 57insane. Package-lock.json made many days feel like living hell for me. And I
58overhead is insane. Package-lock.json made many days feel like living hell 58would eat the cost of all this if it meant for better development
59for me. And I would eat the cost of all this if it meant for better development
60experience. Well, it didn't. 59experience. Well, it didn't.
61 60
62The **lack of Typescript** support in the interpreter is still mind boggling 61The **lack of Typescript** support in the interpreter is still mind boggling to
63to me. Why haven't they added native support yet for this is beyond me?! That 62me. Why haven't they added native support yet for this is beyond me?! That would
64would have solved so many problems. Lack of type safety became a problem 63have solved so many problems. Lack of type safety became a problem somewhere in
65somewhere in the middle of the project where the codebase was sufficiently 64the middle of the project where the codebase was sufficiently large enough to
66large enough to present problems. We started adding arguments to functions 65present problems. We started adding arguments to functions and there was **no
67and there was **no way to implicitly define argument types**. And because at 66way to implicitly define argument types**. And because at that point there were
68that point there were a lot of functions, it became impossible to know what 67a lot of functions, it became impossible to know what each one accepts,
69each one accepts, development became more and more trial and error based. 68development became more and more trial and error based.
70 69
71I tried **implementing Typescript**, but that would present a large refactor 70I 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. 71that we were not willing to do at that point. The benefits were not enough. I
73I also tried [Flow - static type checker](https://flow.org/) but implementation 72also tried [Flow - static type checker](https://flow.org/) but implementation
74was also horrible. What Typescript and Flow forces you is to have src folder 73was also horrible. What Typescript and Flow forces you is to have src folder and
75and then **transpile** your code into dist folder and run it with node. WTH is 74then **transpile** your code into dist folder and run it with node. WTH is that
76that all about. Why can't this be done in memory or some virtual file system? 75all about. Why can't this be done in memory or some virtual file system? Why? I
77Why? I see no reason why this couldn't be done like this. But it is what it is. 76see no reason why this couldn't be done like this. But it is what it is. I
78I abandoned all hope for static type checking. 77abandoned all hope for static type checking.
79 78
80One of the problems that resulted from not having interfaces or types was 79One of the problems that resulted from not having interfaces or types was
81inability to model out our data from **Elasticsearch**. I could have done 80inability to model out our data from **Elasticsearch**. I could have done a
82a **pedestrian implementation** of it, but there must be a better way of doing 81**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 82this 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! 83solution, which is also a possibility. I have looked, though. No juice!
85 84
86**Error handling?** Is that a joke? 85**Error handling?** Is that a joke?
87 86
88Thank god for **await/async**. Without it, I would have probably just abandoned 87Thank 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 88the whole thing and went with something else like Python. That's all I am going
90going to say about this :) 89to say about this :)
91 90
92I started asking myself a question if Node.js is actually ready to be used in 91I started asking myself a question if Node.js is actually ready to be used in a
93a **large scale applications**? And this was a totally wrong question. What I 92**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 93should 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 94application. And you don't get this in **marketing material** for Express or Koa
96Koa etc. They never tell you this. Making Node.js scale on infrastructure or 95etc. They never tell you this. Making Node.js scale on infrastructure or in
97in codebase is really **more of an art than a science**. And just like with the 96codebase is really **more of an art than a science**. And just like with the
98whole JavaScript ecosystem: 97whole JavaScript ecosystem:
99 98
100- impossible to master, 99- impossible to master,
@@ -103,10 +102,9 @@ whole JavaScript ecosystem:
103- error handling is a joke, 102- error handling is a joke,
104- standards? What standards? 103- standards? What standards?
105 104
106But on the other hand. As I did, you will also learn to love it. Learn to use 105But on the other hand. As I did, you will also learn to love it. Learn to use it
107it quickly and do impossible things in crazy limited time. 106quickly and do impossible things in crazy limited time.
108 107
109I hate to admit it. But I love Node.js. Dammit, I love it :) 108I hate to admit it. But I love Node.js. Dammit, I love it :)
110 109
1112023 Update: I hate Node.js! 1102023 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 54a7d1b..90fca24 100644
--- a/content/posts/2020-05-05-remote-work.md
+++ b/content/posts/2020-05-05-remote-work.md
@@ -5,29 +5,29 @@ date: 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 8I have been working remotely for the past 5 years. I love it. Love the freedom
9and make your schedule thingy. 9and make your schedule thingy.
10 10
11## You work more not less 11## You work more not less
12 12
13I've heard from people things like: "Oh, you are so lucky, working from home, 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 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 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 16whenever you like, you can go outside for a picnic if you want and stuff like
17that. 17that.
18 18
19This may be true if you work a day or two in a week from home. But if you go 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 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 21but then you start feeling the consequences of going fully remote. And it's not
22all rainbows and unicorns. Rather the opposite. 22all rainbows and unicorns. Rather the opposite.
23 23
24## Feeling lost 24## Feeling lost
25 25
26At first, I remembered I felt lost. I was not used to this kind of environment. 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. 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 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 29this later" starts creeping in. Well, I have the whole day ahead of me. I can do
30do this a bit later. 30this a bit later.
31 31
32## Hyper-performance 32## Hyper-performance
33 33
@@ -35,36 +35,37 @@ As 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 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. 36this hyper-performance. But this mode requires also a lot of peace and quiet.
37 37
38And here we come to the ugly parts of all this. **People rarely have the self-control** 38And here we come to the ugly parts of all this. **People rarely have the
39to not waste other people's time. It is paralyzing when people start calling 39self-control** to not waste other people's time. It is paralyzing when people
40you, sending you chat messages, etc. The thing is, that when I achieve this 40start calling you, sending you chat messages, etc. The thing is, that when I
41hyper-performance mode I am completely embroiled in the problem I am solving 41achieve this hyper-performance mode I am completely embroiled in the problem I
42and this kind of interruptions mess with your head. I need an hour at least to 42am solving and this kind of interruptions mess with your head. I need an hour at
43get back in the zone. Sometimes not achieving the same focus the whole day. 43least to get back in the zone. Sometimes not achieving the same focus the whole
44day.
44 45
45I know that life is not how you want it to be and takes its route but from what 46I 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 47I've learned this kind of interruptions can be avoided in 90% of the case easily
47easily just by closing any chat programs and putting your phone in a drawer. 48just by closing any chat programs and putting your phone in a drawer.
48 49
49## Suggestion to all the new remote workers 50## Suggestion to all the new remote workers
50 51
51- Stop wasting other people's time. You don't bother people at their desks 52- Stop wasting other people's time. You don't bother people at their desks in
52 in the office either. 53 the office either.
53- Do not replace daily chats in the hallways with instant messaging software. 54- Do not replace daily chats in the hallways with instant messaging software.
54 It will only interrupt people. Nothing good will come of it. 55 It will only interrupt people. Nothing good will come of it.
55- Set your working hours and try to not allow it to bleed outside these 56- Set your working hours and try to not allow it to bleed outside these
56 boundaries and maintain your routine. 57 boundaries and maintain your routine.
57- Be prepared that hours will be longer regardless of your good intentions 58- Be prepared that hours will be longer regardless of your good intentions and
58 and your well thought of routine. 59 your well thought of routine.
59- Try to be hyper-focused and do only one thing at the time. Multitasking is 60- Try to be hyper-focused and do only one thing at the time. Multitasking is the
60 the enemy of progress. 61 enemy of progress.
61- Avoid long meetings and if possible eliminate them. Rather take time to write 62- 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 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 large waste of time and most of the people attending them are there just
64 because the manager said so. 65 because the manager said so.
65- The software will not solve your problems. And throwing money at problems neither. 66- The software will not solve your problems. And throwing money at problems
66- If you are in a managerial position don't supervise any single minute of 67 neither.
67 workers. They are probably giving you more hours anyways. Track progress 68- If you are in a managerial position don't supervise any single minute of
69 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 70 weekly not daily. You hired them and give them the benefit of the doubt that
69 they will deliver what you agreed upon. 71 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 fabdc32..55086b1 100644
--- a/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
+++ b/content/posts/2020-08-15-systemd-disable-wake-onmouse.md
@@ -5,39 +5,41 @@ date: 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) 8I recently bought [ThinkPad
9just as a joke on eBay to test Linux distributions and play around with things 9X220](https://www.laptopmag.com/reviews/laptops/lenovo-thinkpad-x220) just as a
10and not destroy my main machine. Little to my knowledge I felt in love with it. 10joke on eBay to test Linux distributions and play around with things and not
11Man, they really made awesome machines back then. 11destroy my main machine. Little to my knowledge I felt in love with it. Man,
12they really made awesome machines back then.
12 13
13After changing disk that came with it to SSD and installing Ubuntu to test if  14After 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 15everything 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. 16the system would wake up from sleep even though the lid was shut down.
16 17
17I wouldn't even noticed it if laptop didn't have 18I wouldn't even noticed it if laptop didn't have [LED
18[LED sleep indicator](https://support.lenovo.com/lk/en/solutions/~/media/Images/ContentImages/p/pd025386_x1_status_03.ashx?w=426&h=262). 19sleep 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 20I 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 21[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 22with 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 23in 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. 24glue off and the whole screen got wrecked. So, I am a bit touchy about this.
24 25
25I went on solution hunting and to my surprise there is no easy way to disable 26I 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  27specific devices to perform wake up. Why is this not under the power management 
27tab in setting is really strange. 28tab in setting is really strange.
28 29
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/) 30After googling for a solution I found [this nice article describing the
30that worked for me. The only problem with this solution was that he added his 31solution](https://codetrips.com/2020/03/18/ubuntu-disable-mouse-wake-from-suspend/)
31solution to `.bashrc` and this triggers `sudo` that asks for a password each 32that worked for me. The only problem with this solution was that he added his
32time new terminal is opened, which get annoying quickly since I open a lot of 33solution to `.bashrc` and this triggers `sudo` that asks for a password each
34time new terminal is opened, which get annoying quickly since I open a lot of
33terminals all the time. 35terminals all the time.
34 36
35I followed his instructions and got to solution 37I followed his instructions and got to solution `sudo sh -c "echo 'disabled' >
36`sudo sh -c "echo 'disabled' > /sys/bus/usb/devices/2-1.1/power/wakeup"`. 38/sys/bus/usb/devices/2-1.1/power/wakeup"`.
37 39
38I created a system service file `sudo nano /etc/systemd/system/disable-mouse-wakeup.service` 40I created a system service file `sudo nano
39and removed `sudo` and replaced `sh` with `/usr/bin/sh` and pasted all that 41/etc/systemd/system/disable-mouse-wakeup.service` and removed `sudo` and
40in `ExecStart`. 42replaced `sh` with `/usr/bin/sh` and pasted all that in `ExecStart`.
41 43
42```ini 44```ini
43[Unit] 45[Unit]
@@ -68,4 +70,3 @@ This 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 70If 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 71I would create a shell script and call that instead of direclty doing it in
70service file. 72service 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 ac79a6d..91a04ad 100644
--- a/content/posts/2020-09-06-esp-and-micropython.md
+++ b/content/posts/2020-09-06-esp-and-micropython.md
@@ -7,14 +7,16 @@ draft: false
7 7
8## Introduction 8## Introduction
9 9
10A while ago I bought some [ESP8266](https://www.espressif.com/en/products/socs/esp8266) 10A while ago I bought some
11and [ESP32](https://www.espressif.com/en/products/socs/esp32) dev boards to 11[ESP8266](https://www.espressif.com/en/products/socs/esp8266) and
12play around with and I finally found a project to try it out. 12[ESP32](https://www.espressif.com/en/products/socs/esp32) dev boards to play
13around with and I finally found a project to try it out.
13 14
14For my project, I used [ESP32](https://www.espressif.com/en/products/socs/esp32) 15For 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). 16but I could easily choose
16This guide contains which tools I use and how I prepared my workspace to code 17[ESP8266](https://www.espressif.com/en/products/socs/esp8266). This guide
17for [ESP8266](https://www.espressif.com/en/products/socs/esp8266). 18contains which tools I use and how I prepared my workspace to code for
19[ESP8266](https://www.espressif.com/en/products/socs/esp8266).
18 20
19![ESP8266 and ESP32 boards](/assets/esp8366-micropython/boards.jpg) 21![ESP8266 and ESP32 boards](/assets/esp8366-micropython/boards.jpg)
20 22
@@ -29,16 +31,18 @@ mine and once I replaced it everything started to work.
29 31
30## Flashing the SOC 32## Flashing the SOC
31 33
32Plug your ESP8266 to USB port and check if the device was recognized with 34Plug your ESP8266 to USB port and check if the device was recognized with
33executing `dmesg | grep ch341-uart`. 35executing `dmesg | grep ch341-uart`.
34 36
35Then check if the device is available under `/dev/` by running `ls /dev/ttyUSB*`. 37Then check if the device is available under `/dev/` by running `ls
38/dev/ttyUSB*`.
36 39
37> **Linux users**: if a device is not available be sure you are in `dialout` 40> **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 41> group. You can check this by executing `groups $USER`. You can add a user to
39> `dialout` group with `sudo adduser $USER dialout`. 42> `dialout` group with `sudo adduser $USER dialout`.
40 43
41After these conditions are meet go to the navigate to [https://micropython.org/download/esp8266/](https://micropython.org/download/esp8266/) 44After these conditions are meet go to the navigate to
45[https://micropython.org/download/esp8266/](https://micropython.org/download/esp8266/)
42and download `esp8266-20200902-v1.13.bin`. 46and download `esp8266-20200902-v1.13.bin`.
43 47
44```sh 48```sh
@@ -48,14 +52,15 @@ cd esp8266-test
48wget https://micropython.org/resources/firmware/esp8266-20200902-v1.13.bin 52wget https://micropython.org/resources/firmware/esp8266-20200902-v1.13.bin
49``` 53```
50 54
51After obtaining firmware we will need some tooling to flash the firmware to 55After obtaining firmware we will need some tooling to flash the firmware to the
52the board. 56board.
53 57
54```sh 58```sh
55sudo pip3 install esptool 59sudo pip3 install esptool
56``` 60```
57 61
58You can read more about `esptool` at [https://github.com/espressif/esptool/](https://github.com/espressif/esptool/). 62You can read more about `esptool` at
63[https://github.com/espressif/esptool/](https://github.com/espressif/esptool/).
59 64
60Before flashing the firmware we need to erase the flash on device. Substitute 65Before flashing the firmware we need to erase the flash on device. Substitute
61`USB0` with the device listed in output of `ls /dev/ttyUSB*`. 66`USB0` with the device listed in output of `ls /dev/ttyUSB*`.
@@ -70,8 +75,8 @@ If flash was successfully erased it is now time to flash the new firmware to it.
70esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20200902-v1.13.bin 75esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20200902-v1.13.bin
71``` 76```
72 77
73If everything went ok you can try accessing MicroPython REPL with ` 78If everything went ok you can try accessing MicroPython REPL with ` screen
74screen /dev/ttyUSB0 115200` or `picocom /dev/ttyUSB0 -b115200`. 79/dev/ttyUSB0 115200` or `picocom /dev/ttyUSB0 -b115200`.
75 80
76> Sometimes you will need to press `ENTER` in `screen` or `picocom` to access 81> Sometimes you will need to press `ENTER` in `screen` or `picocom` to access
77> REPL. 82> REPL.
@@ -83,7 +88,7 @@ When you are in REPL you can test if all is working properly following steps.
83> machine.freq() 88> machine.freq()
84``` 89```
85 90
86This should output a number representing a frequency of the CPU (mine was 91This should output a number representing a frequency of the CPU (mine was
87`80000000`). 92`80000000`).
88 93
89When you are in `screen` or `picocom` these can help you a bit. 94When you are in `screen` or `picocom` these can help you a bit.
@@ -130,7 +135,7 @@ ampy --delay 2 --port /dev/ttyUSB0 cat boot.py
130 135
131### rshell 136### rshell
132 137
133Even though `ampy` is a cool tool I opted with `rshell` in the end since it's 138Even though `ampy` is a cool tool I opted with `rshell` in the end since it's
134much more polished and feature rich. 139much more polished and feature rich.
135 140
136```bash 141```bash
@@ -144,9 +149,9 @@ Now that `rshell` is installed we can connect to the board.
144rshell --buffer-size=30 -p /dev/ttyUSB0 -a 149rshell --buffer-size=30 -p /dev/ttyUSB0 -a
145``` 150```
146 151
147This will open a shell inside bash and from here you can execute multiple 152This 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 153commands. You can check what is supported with `help` once you are inside of a
149a shell. 154shell.
150 155
151```bash 156```bash
152m@turing ~/Junk/esp8266-test 157m@turing ~/Junk/esp8266-test
@@ -177,8 +182,8 @@ Use Control-D (or the exit command) to exit rshell.
177 182
178#### Moving files to flash 183#### Moving files to flash
179 184
180To avoid copying files all the time I used `rsync` function from the 185To avoid copying files all the time I used `rsync` function from the inside of
181inside of `rshell`. 186`rshell`.
182 187
183```bash 188```bash
184rsync . /pyboard 189rsync . /pyboard
@@ -186,11 +191,11 @@ rsync . /pyboard
186 191
187#### Executing scripts 192#### Executing scripts
188 193
189It is a pain to continuously reboot the device to trigger `/pyboard/boot.py` 194It is a pain to continuously reboot the device to trigger `/pyboard/boot.py` and
190and there is a better way of testing local scripts on remote device. 195there is a better way of testing local scripts on remote device.
191 196
192Lets assume we have `src/freq.py` file that displays CPU frequency of a 197Lets assume we have `src/freq.py` file that displays CPU frequency of a remote
193remote device. 198device.
194 199
195```py 200```py
196# src/freq.py 201# src/freq.py
@@ -218,4 +223,3 @@ repl
218 223
219- https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/ 224- https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/
220- http://docs.micropython.org/en/latest/esp8266/quickref.html 225- 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 d5d725e..113c67b 100644
--- a/content/posts/2020-09-08-bind-warning-on-login.md
+++ b/content/posts/2020-09-08-bind-warning-on-login.md
@@ -5,19 +5,18 @@ date: 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 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 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 10used to the cool features it has. But, regardless of that, I wanted to move to a
11a more standard shell because I was hopping back and forth with exporting 11more standard shell because I was hopping back and forth with exporting
12variables and stuff like that which got pretty annoying. 12variables and stuff like that which got pretty annoying.
13 13
14So I embarked on a mission to make [bash](https://www.gnu.org/software/bash/) 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 15more like [fish](https://fishshell.com/) and in the process found that I really
16missed autosuggest with TAB on changing directories. 16missed autosuggest with TAB on changing directories.
17 17
18I found a nice alternative that emulates [zsh](http://zsh.sourceforge.net/) 18I found a nice alternative that emulates [zsh](http://zsh.sourceforge.net/) like
19like autosuggestion and autocomplete so I added the following to my `.bashrc` 19autosuggestion and autocomplete so I added the following to my `.bashrc` file.
20file.
21 20
22```bash 21```bash
23bind "TAB:menu-complete" 22bind "TAB:menu-complete"
@@ -27,15 +26,16 @@ bind "set menu-complete-display-prefix on"
27bind '"\e[Z":menu-complete-backward' 26bind '"\e[Z":menu-complete-backward'
28``` 27```
29 28
30I haven't noticed anything wrong with this and all was working fine until I 29I haven't noticed anything wrong with this and all was working fine until I
31restarted my machine and then I got this error. 30restarted my machine and then I got this error.
32 31
33![Profile bind error](/assets/profile-bind-error/error.jpg) 32![Profile bind error](/assets/profile-bind-error/error.jpg)
34 33
35When I pressed OK, I got into the [Gnome shell](https://wiki.gnome.org/Projects/GnomeShell) 34When I pressed OK, I got into the [Gnome
36and all was working fine, but the error was still bugging me. I started looking 35shell](https://wiki.gnome.org/Projects/GnomeShell) and all was working fine, but
37for the reason why this is happening and found a solution to this error on 36the error was still bugging me. I started looking for the reason why this is
38[Remote SSH Commands - bash bind warning: line editing not enabled](https://superuser.com/a/892682). 37happening and found a solution to this error on [Remote SSH Commands - bash bind
38warning: line editing not enabled](https://superuser.com/a/892682).
39 39
40So I added a simple `if [ -t 1 ]` around `bind` statements to avoid running 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. 41commands that presume the session is interactive when it isn't.
@@ -51,4 +51,3 @@ fi
51``` 51```
52 52
53After 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 2eeea2e..aa3cce4 100644
--- a/content/posts/2020-09-09-digitalocean-sync.md
+++ b/content/posts/2020-09-09-digitalocean-sync.md
@@ -5,25 +5,25 @@ date: 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** 8I've been using [Dropbox](https://www.dropbox.com/) for probably **10+ years**
9now and I-ve became so used to it that it runs in the background that I don't 9now and I-ve became so used to it that it runs in the background that I don't
10even imagine a world without it. But it's not without problems. 10even imagine a world without it. But it's not without problems.
11 11
12At first I had problems with `.venv` environments for Python and the only 12At first I had problems with `.venv` environments for Python and the only
13solution for excluding synchronization for this folder was to manually exclude 13solution for excluding synchronization for this folder was to manually exclude a
14a specific folder which is not really scalable. FYI, my whole project folder is 14specific 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 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 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 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 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 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 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 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 22many files that OS has a problem counting them when you check the folder
23contents for size. 23contents for size.
24 24
25I wanted something similar to Dropbox. I could without the instant syncing 25I wanted something similar to Dropbox. I could without the instant syncing but
26but it would need to be fast and had the option for me to exclude folders like 26it would need to be fast and had the option for me to exclude folders like
27`node_modules, .venv, .git` and folders like that. 27`node_modules, .venv, .git` and folders like that.
28 28
29I went on a hunt for an alternative to [Dropbox](https://www.dropbox.com/) 29I went on a hunt for an alternative to [Dropbox](https://www.dropbox.com/)
@@ -33,48 +33,51 @@ and found:
33- [Sync.com](https://sync.com) 33- [Sync.com](https://sync.com)
34- [Box](https://www.box.com/) 34- [Box](https://www.box.com/)
35 35
36You know, the usual list of suspects. I didn't include [Google drive](https://drive.google.com) 36You know, the usual list of suspects. I didn't include [Google
37or [One drive](https://onedrive.live.com/) since they are even more draconian 37drive](https://drive.google.com) or [One drive](https://onedrive.live.com/)
38than Dropbox. 38since they are even more draconian than Dropbox.
39 39
40> All this does not stem from me being paranoid but recently these companies 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 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. 42> they share our data with 3rd party services. It is getting out of control.
43 43
44So, my main problem was still there. No way of excluding a specific folder 44So, my main problem was still there. No way of excluding a specific folder from
45from syncing. And before we go into "*But you have git, isn't that enough?*", 45syncing. And before we go into "*But you have git, isn't that enough?*", I must
46I must say, that many of the files (PDFs, spreadsheets, etc) I have in a `git` 46say, that many of the files (PDFs, spreadsheets, etc) I have in a `git` repo
47repo don't get pushed upstream to Git and I still want to have them synced 47don't get pushed upstream to Git and I still want to have them synced across my
48across my computers. 48computers.
49 49
50I initially wanted to use [rsync](https://linux.die.net/man/1/rsync) but I 50I initially wanted to use [rsync](https://linux.die.net/man/1/rsync) but I would
51would need to then have a remote VPS or transfer between my computers directly. 51need to then have a remote VPS or transfer between my computers directly. I
52I wanted a solution where all my files could be accessible to me without my 52wanted a solution where all my files could be accessible to me without my
53machine. 53machine.
54 54
55> **WARNING: This solution will cost you money!** DigitalOcean Spaces are $5 55> **WARNING: This solution will cost you money!** DigitalOcean Spaces are $5 per
56per month and there are some bandwidth limitations and if you go beyond that 56month and there are some bandwidth limitations and if you go beyond that you get
57you get billed additionally. 57billed additionally.
58 58
59Then I remembered that I could use something like [S3](https://en.wikipedia.org/wiki/Amazon_S3) 59Then I remembered that I could use something like
60since it has versioning and is fully managed. I didn't want to go down the AWS 60[S3](https://en.wikipedia.org/wiki/Amazon_S3) since it has versioning and is
61rabbit hole with this so I choose [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/). 61fully managed. I didn't want to go down the AWS rabbit hole with this so I
62choose [DigitalOcean Spaces](https://www.digitalocean.com/products/spaces/).
62 63
63Then I needed a command-line tool to sync between source and target. I found 64Then 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 65this nice tool [s3cmd](https://s3tools.org/s3cmd) and it is in the Ubuntu
65repositories. 66repositories.
66 67
67```bash 68```bash
68sudo apt install s3cmd 69sudo apt install s3cmd
69``` 70```
70 71
71After installation will I create a new Space bucket on DigitalOcean. Remember 72After 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`. 73the zone you will choose because you will need it when you will configure
74`s3cmd`.
73 75
74Then I visited [Digitalocean Applications & API](https://cloud.digitalocean.com/account/api/tokens) 76Then I visited [Digitalocean Applications &
75and generated **Spaces access keys**. Save both key and secret somewhere safe 77API](https://cloud.digitalocean.com/account/api/tokens) and generated **Spaces
76because when you will leave the page secret will not be available anymore to 78access keys**. Save both key and secret somewhere safe because when you will
77you and you will need to re-generate it. 79leave the page secret will not be available anymore to you and you will need to
80re-generate it.
78 81
79```bash 82```bash
80# enter your key and secret and correct endpoint 83# enter your key and secret and correct endpoint
@@ -101,10 +104,8 @@ When syncing int he other direction you will need to change the order of the
101I am planning to implement some sort of a `.ignore` file that will enable me to 104I am planning to implement some sort of a `.ignore` file that will enable me to
102have a project-specific exclude options. 105have a project-specific exclude options.
103 106
104I am currently running this every hour as a cronjob which is perfectly fine 107I am currently running this every hour as a cronjob which is perfectly fine for
105for now when I am testing how this whole thing works and how it all will turn 108now when I am testing how this whole thing works and how it all will turn out.
106out.
107 109
108I have also created a small Gnome extension which is still very unstable, but 110I 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. 111when/if this whole experiment pays of I will share on Github.
110
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 0253368..4c6b33e 100644
--- a/content/posts/2021-01-24-replacing-dropbox-with-s3.md
+++ b/content/posts/2021-01-24-replacing-dropbox-with-s3.md
@@ -5,27 +5,30 @@ date: 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 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). 9that could [replace Dropbox
10That solution worked quite nicely, and I was amazed how smashing together a 10eventually](/digitalocean-spaces-to-sync-between-computers.html). That solution
11couple of existing solutions would work this fine. 11worked quite nicely, and I was amazed how smashing together a couple of existing
12 12solutions would work this fine.
13I have been running that solution in the background for a couple of months now 13
14and kind of forgot about it. But recent developments around deplatforming and 14I have been running that solution in the background for a couple of months now
15having us people hostages of technology and big companies speed up my goals to 15and kind of forgot about it. But recent developments around deplatforming and
16become less dependent on [Google](https://edition.cnn.com/2020/12/17/tech/google-antitrust-lawsuit/index.html), 16having us people hostages of technology and big companies speed up my goals to
17[Dropbox](https://www.pcworld.com/article/2048680/dropbox-takes-a-peek-at-files.html) 17become less dependent on
18[Google](https://edition.cnn.com/2020/12/17/tech/google-antitrust-lawsuit/index.html),
19[Dropbox](https://www.pcworld.com/article/2048680/dropbox-takes-a-peek-at-files.html)
18etc and take back some control. 20etc and take back some control.
19 21
20I am not a conspiracy theory nut, but to be honest, what these companies are 22I 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 23doing 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, 24have 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 25YouTube and most of the services surrounding Google. And I must tell you, I feel
24feel so good. I haven't felt this way for a long time. 26so good. I haven't felt this way for a long time.
25 27
26**Anyways. Let's get to the meat of things.** 28**Anyways. Let's get to the meat of things.**
27 29
28Before you continue you should read my post about [syncing to Dropbox](/digitalocean-spaces-to-sync-between-computers.html). 30Before you continue you should read my post about [syncing to
31Dropbox](/digitalocean-spaces-to-sync-between-computers.html).
29 32
30> Also to note, I am using Linux on my machine with Gnome desktop environment. 33> 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 34This should work on MacOS too. To use this on Windows I suggest using
@@ -34,7 +37,7 @@ or [Cygwin](https://www.cygwin.com/).
34 37
35## Folder structure 38## Folder structure
36 39
37I liked structure from Dropbox. One folder where everything is located and 40I liked structure from Dropbox. One folder where everything is located and
38synced. So, that's why adopted this also for my sync setup. 41synced. So, that's why adopted this also for my sync setup.
39 42
40```go 43```go
@@ -45,11 +48,10 @@ synced. So, that's why adopted this also for my sync setup.
45 ↳ projects 48 ↳ projects
46``` 49```
47 50
48All of my code is located in `~/Vault/projects` folder. And most of the 51All of my code is located in `~/Vault/projects` folder. And most of the projects
49projects are Git repositories. I do not use this sync method for backup per 52are Git repositories. I do not use this sync method for backup per see but in
50see but in case I reinstall my machine I can easily recreate all the important 53case I reinstall my machine I can easily recreate all the important folder
51folder structure with one quick command. No external drives needed that can 54structure with one quick command. No external drives needed that can fail etc.
52fail etc.
53 55
54## Sync script 56## Sync script
55 57
@@ -86,8 +88,8 @@ notify-send \
86 "Vault sync succeded at `date +"%D %T"`" 88 "Vault sync succeded at `date +"%D %T"`"
87``` 89```
88 90
89This script also backups some of the dotfiles I use and sends notification to 91This script also backups some of the dotfiles I use and sends notification to
90Gnome notification center. It is a straightforward solution. Nothing special 92Gnome notification center. It is a straightforward solution. Nothing special
91going on. 93going on.
92 94
93> One obvious benefit of this is that I can omit syncing Node's `node_modules` 95> One obvious benefit of this is that I can omit syncing Node's `node_modules`
@@ -99,14 +101,13 @@ You can use this script in a combination with [Cron](https://en.wikipedia.org/wi
990 2 * * * sh ~/Vault/bin/vault-backup.sh 1010 2 * * * sh ~/Vault/bin/vault-backup.sh
100``` 102```
101 103
102When you start syncing your local stuff with a remote server you can review 104When you start syncing your local stuff with a remote server you can review your
103your items on DigitalOcean. 105items on DigitalOcean.
104 106
105![Dropbox Spaces](/assets/dropbox-sync/dropbox-spaces.png) 107![Dropbox Spaces](/assets/dropbox-sync/dropbox-spaces.png)
106 108
107I have been using this script now for quite some time, and it's working 109I have been using this script now for quite some time, and it's working
108flawlessly. I also uninstalled Dropbox and stopped using it completely. 110flawlessly. I also uninstalled Dropbox and stopped using it completely.
109 111
110All I need to do is write a Bash script that does the reverse and downloads 112All I need to do is write a Bash script that does the reverse and downloads from
111from remote server to local folder. This could be another post. 113remote server to local folder. This could be another post.
112
diff --git a/content/posts/2021-01-25-goaccess.md b/content/posts/2021-01-25-goaccess.md
index efbd175..1b6a330 100644
--- a/content/posts/2021-01-25-goaccess.md
+++ b/content/posts/2021-01-25-goaccess.md
@@ -7,16 +7,16 @@ draft: false
7 7
8## Introduction 8## Introduction
9 9
10I know! You cannot simply replace Google Analytics with parsing access logs and 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 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 12Analytics to the fullest extent and was usually interested in seeing page hits
13hits and which pages were visited most often. 13and which pages were visited most often.
14 14
15I recently moved my blog from Firebase to a VPS and also decided to remove 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 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 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 18I've had it. But I also need some insight of what is happening on a server and
19and which content is being read the most etc. 19which content is being read the most etc.
20 20
21I have looked at many existing solutions like: 21I have looked at many existing solutions like:
22 22
@@ -24,18 +24,18 @@ I have looked at many existing solutions like:
24- [Freshlytics](https://github.com/sheshbabu/freshlytics) 24- [Freshlytics](https://github.com/sheshbabu/freshlytics)
25- [Matomo](https://matomo.org/) 25- [Matomo](https://matomo.org/)
26 26
27But the more I looked at them the more I noticed that I am replacing one evil 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 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 29fantastic but would require installation of databases and something like PHP or
30or Node. And I was not ready to put those things on my fresh server. Also 30Node. And I was not ready to put those things on my fresh server. Also having
31having Docker installed is out of the question. 31Docker installed is out of the question.
32 32
33## Opting for log parsing 33## Opting for log parsing
34 34
35So, I defaulted to parsing already existing logs and generating HTML reports 35So, I defaulted to parsing already existing logs and generating HTML reports
36from this data. 36from this data.
37 37
38I found this amazing software [GoAccess](https://goaccess.io/) which provides 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. 39all the functionalities I need, and it's a single binary. Written in Go.
40 40
41GoAccess can be used in two different modes. 41GoAccess can be used in two different modes.
@@ -46,15 +46,16 @@ GoAccess can be used in two different modes.
46![GoAccess HTML](/assets/goaccess/goaccess-dash-html.png) 46![GoAccess HTML](/assets/goaccess/goaccess-dash-html.png)
47<center><i>Running in a browser</i></center> 47<center><i>Running in a browser</i></center>
48 48
49I, however, need this to run in a browser. So, the second option is the way 49I, however, need this to run in a browser. So, the second option is the way to
50to go. The Idea is to periodically run cronjob and export this report into a 50go. The Idea is to periodically run cronjob and export this report into a folder
51folder that gets then server by Nginx behind a Basic authentication. 51that gets then server by Nginx behind a Basic authentication.
52 52
53## Getting Nginx ready 53## Getting Nginx ready
54 54
55I choose Ubuntu on [DigitalOcean](https://www.digitalocean.com/). First I 55I choose Ubuntu on [DigitalOcean](https://www.digitalocean.com/). First I
56installed [Nginx](https://nginx.org/en/), and [Letsencrypt](https://letsencrypt.org/getting-started/) 56installed [Nginx](https://nginx.org/en/), and
57certbot and all the necessary dependencies. 57[Letsencrypt](https://letsencrypt.org/getting-started/) certbot and all the
58necessary dependencies.
58 59
59```sh 60```sh
60# log in as root user 61# log in as root user
@@ -90,26 +91,25 @@ server {
90} 91}
91``` 92```
92 93
93Now we check if the configuration is ok. We can do this with `nginx -t`. If 94Now we check if the configuration is ok. We can do this with `nginx -t`. If all
94all is ok, we can restart Nginx with `service nginx restart`. 95is ok, we can restart Nginx with `service nginx restart`.
95 96
96After all that you should add A record for this domain that points to IP of 97After all that you should add A record for this domain that points to IP of a
97a droplet. 98droplet.
98 99
99Before enabling SSL you should test if DNS records have propagated with 100Before enabling SSL you should test if DNS records have propagated with `curl
100`curl stats.domain.com`. 101stats.domain.com`.
101 102
102Now, it's time to provision TLS certificate. To achieve this, you execute command 103Now, it's time to provision TLS certificate. To achieve this, you execute
103`certbot --nginx`. Follow the wizard and when you are asked about redirection 104command `certbot --nginx`. Follow the wizard and when you are asked about
104always choose 2 (always redirect to HTTPS). 105redirection always choose 2 (always redirect to HTTPS).
105 106
106When this is done you can visit https://stats.domain.com and you should get 404 107When this is done you can visit https://stats.domain.com and you should get 404
107not found error which is correct. 108not found error which is correct.
108 109
109
110## Getting GoAccess ready 110## Getting GoAccess ready
111 111
112If you are using Debian like system GoAccess should be available in repository. 112If you are using Debian like system GoAccess should be available in repository.
113Otherwise refer to the official website. 113Otherwise refer to the official website.
114 114
115```sh 115```sh
@@ -148,19 +148,19 @@ goaccess \
148rm /var/log/nginx/access-all.log 148rm /var/log/nginx/access-all.log
149``` 149```
150 150
151Because after a while nginx creates multiple files with access logs we use 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 152[`zcat`](https://linux.die.net/man/1/zcat) to extract Gziped contents and create
153create a file that has all the access logs. After this file is used we 153a file that has all the access logs. After this file is used we delete it.
154delete it.
155 154
156If you want to exclude your home IP's result look at the `--exclude-ip` option 155If 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 156in 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 157your home IP by executing `curl ifconfig.me` from your local machine and NOT
159from the droplet. 158from the droplet.
160 159
161Test the script by executing `sh /var/www/html/stats.domain.com/generate-stats.sh` 160Test the script by executing `sh
162and then checking `https://stats.domain.com`. If you can see stats instead of 161/var/www/html/stats.domain.com/generate-stats.sh` and then checking
163404 than you are set. 162`https://stats.domain.com`. If you can see stats instead of 404 than you are
163set.
164 164
165It's time to add this script to cron with `cron -e`. 165It's time to add this script to cron with `cron -e`.
166 166
@@ -170,16 +170,17 @@ It's time to add this script to cron with `cron -e`.
170 170
171## Securing with Basic authentication 171## Securing with Basic authentication
172 172
173You probably don't want stats to be publicly available, so we should create a 173You probably don't want stats to be publicly available, so we should create a
174user and a password for Basic authentication. 174user and a password for Basic authentication.
175 175
176First 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`.
177 177
178Now we update config file with `nano /etc/nginx/sites-available/stats.domain.com`. 178Now we update config file with `nano
179You probably noticed that the file looks a bit different from before. This is 179/etc/nginx/sites-available/stats.domain.com`. You probably noticed that the
180because `certbot` added additional rules for SSL. 180file looks a bit different from before. This is because `certbot` added
181additional rules for SSL.
181 182
182Your location portion the config file should now look like. You should add 183Your location portion the config file should now look like. You should add
183`auth_basic` and `auth_basic_user_file` lines to the file. 184`auth_basic` and `auth_basic_user_file` lines to the file.
184 185
185```nginx 186```nginx
@@ -190,12 +191,12 @@ location / {
190} 191}
191``` 192```
192 193
193Test if config is still ok with `nginx -t` and if it is you can restart 194Test if config is still ok with `nginx -t` and if it is you can restart Nginx
194Nginx with `service nginx restart`. 195with `service nginx restart`.
195 196
196If you now visit `https://stats.domain.com` you should be prompted for username 197If you now visit `https://stats.domain.com` you should be prompted for username
197and password. If not, try reopening your browser. 198and password. If not, try reopening your browser.
198 199
199That is all. You now have analytics for your server that gets refreshed every 200That is all. You now have analytics for your server that gets refreshed every 10
20010 minutes. 201minutes.
201 202
diff --git a/content/posts/2021-06-26-simple-world-clock.md b/content/posts/2021-06-26-simple-world-clock.md
index f42af11..ed248dd 100644
--- a/content/posts/2021-06-26-simple-world-clock.md
+++ b/content/posts/2021-06-26-simple-world-clock.md
@@ -5,29 +5,32 @@ date: 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, 8Our team is spread across the world, from the USA all the way to Australia, so
9so having some sort of world clock makes sense. 9having some sort of world clock makes sense.
10 10
11Currently, I am using an extension for Gnome called 11Currently, I am using an extension for Gnome called [Timezone
12[Timezone extension](https://extensions.gnome.org/extension/2657/timezones-extension/), 12extension](https://extensions.gnome.org/extension/2657/timezones-extension/),
13and it serves the purpose quite well. 13and it serves the purpose quite well.
14 14
15But I also have a bunch of electronics that I bought through the time, and I 15But I also have a bunch of electronics that I bought through the time, and I am
16am not using any of them, and it's time to stop hording this stuff and use it 16not using any of them, and it's time to stop hording this stuff and use it in a
17in a project. 17project.
18 18
19A while ago I bought a small eInk display 19A while ago I bought a small eInk display [Inky
20[Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) 20pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) and I
21and I have a bunch of [Raspberry Pi's Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/) 21have a bunch of [Raspberry Pi's
22lying around that I really need to use. 22Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/) lying around that
23I really need to use.
23 24
24![Inky pHAT, Raspberry Pi Zero](/assets/world-clock/hardware.jpg) 25![Inky pHAT, Raspberry Pi Zero](/assets/world-clock/hardware.jpg)
25 26
26Since the Inky [Inky pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) 27Since the Inky [Inky
27is essentially a HAT, it can easily be added on top of the 28pHAT](https://shop.pimoroni.com/products/inky-phat?variant=12549254217811) is
28[Raspberry Pi Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/). 29essentially a HAT, it can easily be added on top of the [Raspberry Pi
30Zero](https://www.raspberrypi.org/products/raspberry-pi-zero/).
29 31
30First, I installed the necessary software on Raspberry Pi with `pip3 install inky`. 32First, I installed the necessary software on Raspberry Pi with `pip3 install
33inky`.
31 34
32And then I created a file `clock.py` in home directory `/home/pi`. 35And then I created a file `clock.py` in home directory `/home/pi`.
33 36
@@ -76,10 +79,11 @@ board.set_image(img)
76board.show() 79board.show()
77``` 80```
78 81
79And because eInk displays are rather slow to refresh and the clock requires 82And because eInk displays are rather slow to refresh and the clock requires
80refreshing only once a minute, this can be done through cronjob. 83refreshing only once a minute, this can be done through cronjob.
81 84
82Before we add this job to cron we need to make `clock.py` executable with `chmod +x clock.py`. 85Before we add this job to cron we need to make `clock.py` executable with `chmod
86+x clock.py`.
83 87
84Then we add a cronjob with `crontab -e`. 88Then we add a cronjob with `crontab -e`.
85 89
@@ -91,13 +95,13 @@ So, we end up with a result like this.
91 95
92![World Clock](/assets/world-clock/world-clock.jpg) 96![World Clock](/assets/world-clock/world-clock.jpg)
93 97
94And for the enclosure that can be 3D printed, but I haven't yet something like 98And for the enclosure that can be 3D printed, but I haven't yet something like
95this can be used. 99this can be used.
96 100
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> 101<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>
98 102
99You can download my [STL file for the enclosure here](/assets/world-clock/enclosure.stl), 103You can download my [STL file for the enclosure
100but make sure that dimensions make sense and also opening for USB port should 104here](/assets/world-clock/enclosure.stl), but make sure that dimensions make
101be added or just use a drill and some hot glue to make it stick in the 105sense and also opening for USB port should be added or just use a drill and some
102enclosure. 106hot glue to make it stick in the enclosure.
103 107
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 27e0905..31a2ea0 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
@@ -12,93 +12,91 @@ I was pleasantly surprised that the transition went so smoothly. Even better,
12it brought many benefits to my life. Such as increased focus, less stress 12it brought many benefits to my life. Such as increased focus, less stress
13about trivial things, etc. 13about trivial things, etc.
14 14
15It all started with me doing small changes like unsubscribing from emails that 15It all started with me doing small changes like unsubscribing from emails that I
16I have either subscribed to by accepting terms and conditions. Or even some 16have either subscribed to by accepting terms and conditions. Or even some more
17more malicious emails that I was getting because I was on a shared mailing 17malicious emails that I was getting because I was on a shared mailing list. And
18list. And the later ones I hate the most of all. How the hell do they keep 18the later ones I hate the most of all. How the hell do they keep sharing my
19sharing my email and sending me unsolicited emails and get away with it? I 19email and sending me unsolicited emails and get away with it? I have a suspicion
20have a suspicion that these marketing people share an Excel file between them 20that these marketing people share an Excel file between them and keep
21and keep resubscribing me when they import lists into Mailchimp or similar 21resubscribing me when they import lists into Mailchimp or similar software.
22software.
23 22
24It's fascinating to see how much crap you get subscribed to when you are not 23It'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 24paying 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 25and need constant monitoring and cleaning up. And because I want to have Inbox
27Zero, this presents an additional problem for me. 26Zero, this presents an additional problem for me.
28 27
29The stress that email presented for me didn't occur to me for a long time. I 28The stress that email presented for me didn't occur to me for a long time. I was
30was noticing that I was unable to go through one single hour without 29noticing that I was unable to go through one single hour without hysterically
31hysterically refreshing email. And if somebody wrote me something, I needed 30refreshing email. And if somebody wrote me something, I needed to see it right
32to see it right then, even though I didn't immediately reply to it. I can 31then, even though I didn't immediately reply to it. I can only describe this
33only describe this with FOMO (fear of missing out). I have no other explanation 32with FOMO (fear of missing out). I have no other explanation than that. It was
34than that. It was crippling, and I was constantly context switching, which I 33crippling, and I was constantly context switching, which I will address further
35will address further down this post in more details. 34down this post in more details.
36 35
37This was one of the reasons why I spawned up my personal email server, and I 36This was one of the reasons why I spawned up my personal email server, and I am
38am using it now as my primary and person email. I still have Gmail as my “junk” 37using 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 38email 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 39if there are any important emails that I got, but apart from that, it's sitting
41sitting dormant and collecting dust. 40dormant and collecting dust.
42 41
43The more I was watching the world loose it's self with allowing anti freedom 42The 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 43things 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 44change. 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 45grandiose opinion of myself to even think to try it. But what I can do is to not
47not subscribe to this consumer way of thinking. I will not be complicit in 46subscribe to this consumer way of thinking. I will not be complicit in this. My
48this. My moral and ethical stances won't allow it. So, this brings us to the 47moral and ethical stances won't allow it. So, this brings us to the second part
49second part of my journey. 48of my journey.
50 49
51I was using all these 3rd party services because I was either lazy or OK with 50I 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 51the 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 52privacy policies and everybody is OK with accepting them, and they pray on that
53more evil. It is evil if you sell your user's data in this manner. Nobody reads
55flaw in human nature. I really hate the hypocrisy they manage to muster. These 54flaw 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 55companies 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 56truly 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 57and 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 58years 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 59not 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 60gradual 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, 61thought about it, I felt repulsed. By really stopping and thinking about it, I
63I really mean stopping and thinking about it. Thoroughly and in depth. 62really mean stopping and thinking about it. Thoroughly and in depth.
64 63
65Each step I took depleted my character a bit more. Like I was trading myself 64Each step I took depleted my character a bit more. Like I was trading myself bit
66bit by bit without understanding what it all meant. What it meant to be a full 65by 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 66person, 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 67just 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 68scatter 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. 69divided is a person not fully there. Not at the moment. Not alive fully.
71 70
72I was unable to form long thoughts. Well, I thought I was. But now that I see 71I 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 72what being a full person is again, I can see that I was not at my 100% back
74then. 73then.
75 74
76A revolt was inevitable. There was no other way of continuing my story without 75A 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, 76it. Without taking back my attention, my thoughts, my time, and my privacy,
78regardless of how too late it maybe is. 77regardless of how too late it maybe is.
79 78
80This has nothing to do with conspiracy theories. Even less with changing the 79This 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 80world. All I wanted was to get my life back in order and not waste the energy
82that could be spent in other, better places. 81that could be spent in other, better places.
83 82
84I started reading more. I can focus now fully on things I work on. Furthermore, 83I 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 84I 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 85get 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 86to 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 87belonging again. Sense of purpose has returned with a vengeance. And I can now
89now help people without depleting myself. 88help people without depleting myself.
90 89
91The last step so far was to finish closing all the remaining online accounts 90The 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 91that 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. 92surprised that the answer was none. I wasn't logging in them and using them. I
94I stopped being afraid of FOMO. If somebody wants to get in contact me, they 93stopped being afraid of FOMO. If somebody wants to get in contact me, they will
95will find a way. I am one search away. 94find 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.
104 95
96We are not beholden to anybody. Our lives are our own. So dare yourself to
97delete Facebook, LinkedIn. To unsubscribe. Dare yourself to take your time and
98attention back. Use that time and energy to go for a walk without thinking about
99work. Read a book instead of reading comment on social media that you will
100forget in an hour. Enrich your life instead of wasting it. It only requires a
101small step. And you will feel the benefits immediately. Lose the weight of the
102world that is crushing you without your consent.
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 b8d93a6..0755282 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
@@ -7,32 +7,33 @@ draft: false
7 7
8## Introduction 8## Introduction
9 9
10I have been using [Ubuntu](https://ubuntu.com/) for quite a longtime now. I 10I have been using [Ubuntu](https://ubuntu.com/) for quite a longtime now. I have
11have used [Debian](https://www.debian.org/) in the past and [Manjaro](https://manjaro.org/). 11used [Debian](https://www.debian.org/) in the past and
12Also had [Arch](https://archlinux.org/) for some time and even ran 12[Manjaro](https://manjaro.org/). Also had [Arch](https://archlinux.org/) for
13[Gentoo](https://www.gentoo.org/) way back. 13some time and even ran [Gentoo](https://www.gentoo.org/) way back.
14 14
15What I learned from all this is that I prefer running a bit older versions and 15What I learned from all this is that I prefer running a bit older versions and
16having them be stable than run bleeding edge rolling release. For that reason, 16having them be stable than run bleeding edge rolling release. For that reason, I
17I stuck with Ubuntu for a couple of years now. I am also at a point in my life 17stuck with Ubuntu for a couple of years now. I am also at a point in my life
18where I just don't care what is cool or hip anymore. I just want a stable 18where I just don't care what is cool or hip anymore. I just want a stable system
19system that doesn't get in my way. 19that doesn't get in my way.
20 20
21During all this, I noticed that these distributions were getting very bloated 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 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 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 24installation min 1 GB of ram out of the box just to have a blank screen in front
25front of me? I get it, there are many things included in the distro to make my 25of me? I get it, there are many things included in the distro to make my life
26life easier. I understand. But at this point I have a feeling that modern Linux 26easier. 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). 27distributions are becoming similar to [Node.js project with
28Just a crazy number of packages serving very little or no purpose, just 28node_modules](https://devhumor.com/content/uploads/images/August2017/node-modules.jpg).
29Just a crazy number of packages serving very little or no purpose, just
29supporting other software. 30supporting other software.
30 31
31I felt I needed a fresh start. To start over with something minimal and clean. 32I 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. 33Something that would put a little more joy into using a computer again.
33 34
34For the first version, I wanted to target the following machines I have at 35For the first version, I wanted to target the following machines I have at home
35home that I want this thing to work on. 36that I want this thing to work on.
36 37
37```yaml 38```yaml
38# My main stationary work machine 39# My main stationary work machine
@@ -52,11 +53,11 @@ Memory: 15891MiB
52 53
53## How should I approach this? 54## How should I approach this?
54 55
55I knew I wanted to use [minimal Debian netinst ](https://www.debian.org/CD/netinst/) 56I knew I wanted to use [minimal Debian netinst
56for the base to give myself a head start. No reason to go through changing the 57](https://www.debian.org/CD/netinst/) for the base to give myself a head
57installer and also testing all that behemoth of a thing. So, some sort of 58start. No reason to go through changing the installer and also testing all that
58ricing was the only logical option to get this thing of the grounds somewhat 59behemoth of a thing. So, some sort of ricing was the only logical option to get
59quickly. 60this thing of the grounds somewhat quickly.
60 61
61> **What is ricing anyway?** 62> **What is ricing anyway?**
62> The term “RICE” stands for Race Inspired Cosmetic Enhancement. A group of 63> The term “RICE” stands for Race Inspired Cosmetic Enhancement. A group of
@@ -66,9 +67,9 @@ quickly.
66> than others... For more information, read this article 67> 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). 68> [What in the world is ricing!?](https://pesos.github.io/2020/07/14/what-is-ricing.html).
68 69
69I didn't want this to just be a set of config files for theming purpose. I 70I 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 71wanted 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. 72used 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. 73Fonts being applied across the distro and things like that.
73 74
74First, I choose terminal installer and left it to load additional components. 75First, I choose terminal installer and left it to load additional components.
@@ -87,10 +88,9 @@ downloaded from the internet during installation.
87 88
88![](/assets/dfd-rice/install-02.png) 89![](/assets/dfd-rice/install-02.png)
89 90
90 91I opted out of the popularity contest, and **now comes the important part**.
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
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
93utilities'. I also left an SSH server, so I was able to log in to the machine
94from my main PC. 94from my main PC.
95 95
96![](/assets/dfd-rice/install-03.png) 96![](/assets/dfd-rice/install-03.png)
@@ -100,50 +100,49 @@ system.
100 100
101![](/assets/dfd-rice/install-04.png) 101![](/assets/dfd-rice/install-04.png)
102 102
103That concluded the installation of base Debian and after restarting the 103That concluded the installation of base Debian and after restarting the computer
104computer I was prompted with the login screen. 104I was prompted with the login screen.
105 105
106![](/assets/dfd-rice/install-05.png) 106![](/assets/dfd-rice/install-05.png)
107 107
108Now that I had the base installation, it was time to choose what software do I 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 109want to include in this so-called distribution. I wanted out of the box
110developer experience, so I had plenty to choose. 110developer experience, so I had plenty to choose.
111 111
112Let's not waste time and go through the list. 112Let's not waste time and go through the list.
113 113
114## Desktop environments 114## Desktop environments
115 115
116I have been using [Gnome](https://www.gnome.org/) for my whole Linux life. 116I have been using [Gnome](https://www.gnome.org/) for my whole Linux life. From
117From version 2 forward. It's been quite a ride. I hated version 3 when it 117version 2 forward. It's been quite a ride. I hated version 3 when it came out
118came out and replaced version 2. But I got used to it. And now with version 118and replaced version 2. But I got used to it. And now with version 40+ they also
11940+ they also made couple of changes which I found both frustrating and 119made couple of changes which I found both frustrating and presently surprised.
120presently surprised.
121 120
122The amount of vertical space you loose because of the beefy title bars on 121The 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/) 122windows is ridiculous. And then in case of
124you also have tabs, and you are 100px deep. Vertical space is one of the most 123[Tilix](https://gnunn1.github.io/tilix-web/) you also have tabs, and you are
125important things for a developer. The more real estate you have, the more 124100px deep. Vertical space is one of the most important things for a
126code you can have in a viewport. 125developer. The more real estate you have, the more code you can have in a
126viewport.
127 127
128But on the other hand, I still love how Gnome feels and looks. I gotta give 128But on the other hand, I still love how Gnome feels and looks. I gotta give them
129them that. They really are trying to make Gnome feel unified and modern. 129that. They really are trying to make Gnome feel unified and modern.
130 130
131Regardless of all the nice things Gnome has, I was looking at the tiling 131Regardless of all the nice things Gnome has, I was looking at the tiling window
132window managers for some time, but never had the nerve to actually go with 132managers for some time, but never had the nerve to actually go with it. But now
133it. But now was the ideal time to give it a go. No guts, no glory kind of 133was the ideal time to give it a go. No guts, no glory kind of a thing.
134a thing.
135 134
136One of the requirements for me was easy custom layouts because I use a really 135One 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 136strange monitor with aspect ratio of 32:9. So relying on included layouts most
138most of them have is a non-starter. 137of them have is a non-starter.
139 138
140What I was doing in Gnome was having windows in a layout like the diagram 139What 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 140below. This is my common practice. And if you look at it you can clearly see I
142I was replicating tiling window manager setup in Gnome. 141was replicating tiling window manager setup in Gnome.
143 142
144![](/assets/dfd-rice/layout.png) 143![](/assets/dfd-rice/layout.png)
145 144
146That made me look into a bunch of tiling window managers and then tested them 145That made me look into a bunch of tiling window managers and then tested them
147out. Candidates I was looking at were: 146out. Candidates I was looking at were:
148 147
149- [i3](https://i3wm.org/) 148- [i3](https://i3wm.org/)
@@ -154,18 +153,20 @@ out. Candidates I was looking at were:
154- [Qtile](http://www.qtile.org/) 153- [Qtile](http://www.qtile.org/)
155- [dwm](https://dwm.suckless.org/) 154- [dwm](https://dwm.suckless.org/)
156 155
157You can also check article [13 Best Tiling Window Managers for Linux](https://www.tecmint.com/best-tiling-window-managers-for-linux/) 156You can also check article [13 Best Tiling Window Managers for
158I was referencing while testing them out. 157Linux](https://www.tecmint.com/best-tiling-window-managers-for-linux/) I was
158referencing while testing them out.
159 159
160While all of them provided what I needed, I liked i3 the most. What particular 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 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 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 163spiral, dwindle etc. I think i3 is a good entry-level window manager for
164somebody like me. 164somebody like me.
165 165
166## Batteries included 166## Batteries included
167 167
168The 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
169https://github.com/mitjafelicijan/dfd-rice.
169 170
170Currenly included: 171Currenly included:
171 172
@@ -193,7 +194,7 @@ Currenly included:
193- `docker` (with docker-compose) 194- `docker` (with docker-compose)
194- `ansible` 195- `ansible`
195 196
196Install script also allows you to install only specific packages (example for: 197Install script also allows you to install only specific packages (example for:
197essentials ohmybash docker rust). 198essentials ohmybash docker rust).
198 199
199```sh 200```sh
@@ -202,10 +203,10 @@ su - root \
202 essentials ohmybash docker rust 203 essentials ohmybash docker rust
203``` 204```
204 205
205Currently, most of these recipes use what Debian and this is totally fine with 206Currently, 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 207me since I never use bleeding edge features of a package. But if something major
207major would come to light, I will replace it with a possible compilation 208would come to light, I will replace it with a possible compilation script or
208script or something similar. 209something similar.
209 210
210This is some of the output from the installation script. 211This is some of the output from the installation script.
211 212
@@ -232,11 +233,11 @@ systemctl status docker --no-pager
232 233
233### Making bash pretty 234### Making bash pretty
234 235
235I really like [Oh My Zsh](https://ohmyz.sh/), but I don't like zsh shell. 236I really like [Oh My Zsh](https://ohmyz.sh/), but I don't like zsh shell. When
236When I used it, I constantly needed to be aware of it and running bash scripts 237I used it, I constantly needed to be aware of it and running bash scripts was a
237was a pain. So, I was really delighted when I found out that a version for 238pain. So, I was really delighted when I found out that a version for bash
238bash existed called [Oh My Bash](https://ohmybash.nntoan.com/). Let's take a 239existed called [Oh My Bash](https://ohmybash.nntoan.com/). Let's take a look at
239look at the recipe for installing it. 240the recipe for installing it.
240 241
241```sh 242```sh
242# ohmybash 243# ohmybash
@@ -246,29 +247,29 @@ T1=${!}
246wait ${T1} 247wait ${T1}
247``` 248```
248 249
249Because OhMyBash does `exec bash` at the end, this traps our script inside 250Because OhMyBash does `exec bash` at the end, this traps our script inside
250another shell and our script cannot continue. For that reason, I executed 251another shell and our script cannot continue. For that reason, I executed this
251this in background. But that presents a new problem. Because this is executed 252in background. But that presents a new problem. Because this is executed in
252in background, we lose track of progress naturally. And that strange trick 253background, we lose track of progress naturally. And that strange trick with
253with `T1=${!}` and `wait ${T1}` waits for the background process to finish 254`T1=${!}` and `wait ${T1}` waits for the background process to finish before
254before continuing to another task in bash script. 255continuing to another task in bash script.
255 256
256Check [Multi-Threaded Processing in Bash Scripts](https://www.cloudsavvyit.com/12277/how-to-use-multi-threaded-processing-in-bash-scripts/) 257Check [Multi-Threaded Processing in Bash Scripts](https://www.cloudsavvyit.com/12277/how-to-use-multi-threaded-processing-in-bash-scripts/)
257for more details. 258for more details.
258 259
259## Conclusion 260## Conclusion
260 261
261Take a look at https://github.com/mitjafelicijan/dfd-rice/blob/develop/tools/install.sh 262Take a look at
262script to get familiar with it. This is just a first iteration and I will 263https://github.com/mitjafelicijan/dfd-rice/blob/develop/tools/install.sh script
263continue to update it because I need this in my life. 264to get familiar with it. This is just a first iteration and I will continue to
265update it because I need this in my life.
264 266
265The current version boots in 4s to the login prompt, and after you log in, 267The current version boots in 4s to the login prompt, and after you log in, the
266the desktop environment loads in 2s. So, its fast, very fast. And on clean 268desktop environment loads in 2s. So, its fast, very fast. And on clean boot, I
267boot, I measured ~230 MB of RAM usage. 269measured ~230 MB of RAM usage.
268 270
269And this is how it looks with two terminals side by side. I really like the 271And 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, 272simplicity and clean interface. I will polish the colors and stuff like that,
271but I really do like the results. 273but I really do like the results.
272 274
273![](/assets/dfd-rice/desktop.png) 275![](/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 e3b7fa2..60d0400 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
@@ -7,9 +7,10 @@ draft: false
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) 10I have been reading a lot about
11lately and found them very intriguing. When you push away all the marketing 11[unikernernels](https://en.wikipedia.org/wiki/Unikernel) lately and found them
12speak and look at the idea, it makes a lot of sense. 12very intriguing. When you push away all the marketing speak and look at the
13idea, it makes a lot of sense.
13 14
14> A unikernel is a specialized, single address space machine image constructed 15> A unikernel is a specialized, single address space machine image constructed
15> by using library operating systems. ([Wikipedia](https://en.wikipedia.org/wiki/Unikernel)) 16> by using library operating systems. ([Wikipedia](https://en.wikipedia.org/wiki/Unikernel))
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 1ee82b5..6c598fe 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
@@ -7,14 +7,15 @@ draft: false
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 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) 11[Springboard: the secret history of the first real
12about the history of smartphones and phones in general. It brought back so many 12smartphone](https://www.youtube.com/watch?v=b9_Vh9h3Ohw) about the history of
13memories. I never had an actual smartphone before the Android. The closest to 13smartphones and phones in general. It brought back so many memories. I never had
14smartphone was [Sony Ericsson P1](https://www.gsmarena.com/sony_ericsson_p1-1982.php). 14an actual smartphone before the Android. The closest to smartphone was [Sony
15A fantastic phone and I broke it in Prague after a party and that was one of 15Ericsson P1](https://www.gsmarena.com/sony_ericsson_p1-1982.php). A fantastic
16those rare occasions where I was actually mad at myself. But nevertheless, 16phone and I broke it in Prague after a party and that was one of those rare
17after that phone, the next one was an Android one. 17occasions where I was actually mad at myself. But nevertheless, after that
18phone, the next one was an Android one.
18 19
19Before that, I only owned normal phones from Nokia and Siemens etc. Nothing 20Before that, I only owned normal phones from Nokia and Siemens etc. Nothing
20special, actually. These are the phones we are talking about. Before 2007. 21special, actually. These are the phones we are talking about. Before 2007.
@@ -34,42 +35,42 @@ Let's take a look at these beauties.
34 35
35## WAP - Wireless Application Protocol 36## WAP - Wireless Application Protocol
36 37
37Not that one! We are talking about Wireless Application Protocol and not 38Not that one! We are talking about Wireless Application Protocol and not Cardi
38Cardi B's song 😃 39B's song 😃
39 40
40WAP stands for Wireless Application Protocol. It is a protocol designed for 41WAP stands for Wireless Application Protocol. It is a protocol designed for
41micro-browsers, and it enables the access of internet in the mobile devices. 42micro-browsers, and it enables the access of internet in the mobile devices. It
42It uses the mark-up language WML (Wireless Markup Language and not HTML), WML 43uses the mark-up language WML (Wireless Markup Language and not HTML), WML is
43is defined as XML 1.0 application. Furthermore, it enables creating web 44defined as XML 1.0 application. Furthermore, it enables creating web
44applications for mobile devices. In 1998, WAP Forum was founded by Ericson, 45applications for mobile devices. In 1998, WAP Forum was founded by Ericson,
45Motorola, Nokia and Unwired Planet whose aim was to standardize the various 46Motorola, Nokia and Unwired Planet whose aim was to standardize the various
46wireless technologies via protocols. 47wireless technologies via protocols.
47[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/) 48[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
48 49
49WAP protocol was resulted by the joint efforts of the various members of WAP 50WAP 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, 51Forum. In 2002, WAP forum was merged with various other forums of the industry,
51resulting in the formation of Open Mobile Alliance (OMA). 52resulting in the formation of Open Mobile Alliance (OMA).
52[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/) 53[(source)](https://www.geeksforgeeks.org/wireless-application-protocol/)
53 54
54These were some wild times. Devices had tiny screens and data transmission rates 55These were some wild times. Devices had tiny screens and data transmission rates
55were abominable. But they were capable of rendering WML (Wireless Markup 56were abominable. But they were capable of rendering WML (Wireless Markup
56Language). This was very similar to HTML, actually. It is a markup language, 57Language). This was very similar to HTML, actually. It is a markup language,
57after all. 58after all.
58 59
59These pages could be served by [Apache](https://apache.org/) and could be 60These 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 61generated by CGI scripts on the backend. The only difference was the limited
61markup language. 62markup language.
62 63
63## WML - Wireless Markup Language 64## WML - Wireless Markup Language
64 65
65Just like web browsers use HTML for content structure, older mobile device 66Just 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 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 68browsers, 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 69just like XHTML and MathML, but not HTML) and does not use the same metaphor as
69as HTML. HTML is a single document with some metadata packed away in the head, 70HTML. HTML is a single document with some metadata packed away in the head, and
70and a body encapsulating the visible page. With WML, the metaphor does not 71a body encapsulating the visible page. With WML, the metaphor does not envisage
71envisage a page, but rather a deck of cards. A WML file might have several 72a page, but rather a deck of cards. A WML file might have several pages or cards
72pages or cards contained within it. 73contained within it.
73[(source)](https://www.w3.org/wiki/Introduction_to_mobile_web) 74[(source)](https://www.w3.org/wiki/Introduction_to_mobile_web)
74 75
75```html 76```html
@@ -82,7 +83,8 @@ pages or cards contained within it.
82</wml> 83</wml>
83``` 84```
84 85
85There is an amazing tutorial on [Tutorialpoint about WML](https://www.tutorialspoint.com/wml/index.htm). 86There is an amazing tutorial on [Tutorialpoint about
87WML](https://www.tutorialspoint.com/wml/index.htm).
86 88
87## Converting Digg to WML 89## Converting Digg to WML
88 90
@@ -166,24 +168,24 @@ with open('www/index.wml', 'w+') as fp:
166 fp.write(html) 168 fp.write(html)
167``` 169```
168 170
169This script will create a folder `www` and in the folder `www/images` for 171This script will create a folder `www` and in the folder `www/images` for
170storing resized images. 172storing resized images.
171 173
172> Be sure you don't use SSL and use just normal HTTP for serving the content. 174> 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. 175> These old phones will have problems with TLS 1.3 etc.
174 176
175If you look at the python file, I convert all the images into tiny B&W images. 177If 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 178They should be WBMP (Wireless BitMaP) but I choose JPEGs for this, and it seems
177seems to work properly. 179to work properly.
178 180
179Because I currently don't have a phone old enough to test it on, I used an 181Because 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/) 182emulator. And it was really hard to find one. I found [WAP
181on shareware junction, and it did the job well enough. I will try to find and 183Proof](http://wap-proof.sharewarejunction.com/) on shareware junction, and it
182actual device to test it on. 184did the job well enough. I will try to find and actual device to test it on.
183 185
184<video src="/assets/wap/emulator.mp4" controls></video> 186<video src="/assets/wap/emulator.mp4" controls></video>
185 187
186If you are using Nginx to serve the contents, add a directive to the hosts file 188If you are using Nginx to serve the contents, add a directive to the hosts file
187that will automatically server `index.wml` file. 189that will automatically server `index.wml` file.
188 190
189```nginx 191```nginx
@@ -195,6 +197,5 @@ server {
195## Conclusion 197## Conclusion
196 198
197Well, this was pointless, but very fun! I hope you enjoyed it as much as I did. 199Well, 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, 200I will try to find an old phone to test it on. If you have any questions, feel
199feel free to ask in the comments. 201free 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 c1da4a5..23c1cf3 100644
--- a/content/posts/2022-06-30-trying-out-helix-editor.md
+++ b/content/posts/2022-06-30-trying-out-helix-editor.md
@@ -5,27 +5,27 @@ date: 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 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 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. 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 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. 12time to spice life up with something new.
13 13
14I have been on this search for a couple of years. I have tried Vim, Neovim, 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 15Emacs, Doom Emacs, Micro and couple more. Among most of them, I liked Micro and
16and Doom Emacs the most. Micro editor was a little too basic for me. And Doom 16Doom Emacs the most. Micro editor was a little too basic for me. And Doom Emacs
17Emacs was a bit too hardcore. This does not reflect on any of the editors. It's 17was a bit too hardcore. This does not reflect on any of the editors. It's just
18just my personal preference. 18my personal preference.
19 19
20> I tried Helix Editor about a year ago. But I didn't pay attention to 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 21> Tried it and saw it's similar to Vi and just said no. I was premature to
22> dismiss it. 22> dismiss it.
23 23
24One of the things I actually miss is line wrapping for certain files. When 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 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 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 27take kindly of new lines between sentences. Not paragraphs, sentences. And I use
28use Markdown to write this blog you are reading. 28Markdown to write this blog you are reading.
29 29
30But other than this, I have been extremely satisfied by it. It's been a pleasant 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. 31surprise. There have been zero issues with the editor.
@@ -39,15 +39,14 @@ npm install -g typescript typescript-language-server
39 39
40I am still getting used to the keyboard shortcuts and getting better. What Helix 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 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 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 43you would need. It goes to extreme measures to show a user what is going on with
44with popups that show you what the keyboard shortcuts are. 44popups that show you what the keyboard shortcuts are.
45 45
46And it comes us packed with many 46And it comes us packed with many
47[really good themes](https://github.com/helix-editor/helix/wiki/Themes). 47[really good themes](https://github.com/helix-editor/helix/wiki/Themes).
48 48
49![Editor](/assets/helix-editor/editor.png) 49![Editor](/assets/helix-editor/editor.png)
50 50
51It's still young but has this mature feeling to it. It has sane defaults and 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). 52mimics Vim (works a bit differently, but the overall idea is similar).
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 15bbf2b..e26088b 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
@@ -7,37 +7,38 @@ draft: false
7 7
8## Introduction 8## Introduction
9 9
10Lately, I have been thinking a lot about the nature of life, what are the 10Lately, I have been thinking a lot about the nature of life, what are the
11foundation blocks of life and things like that. It's remarkable how complex 11foundation blocks of life and things like that. It's remarkable how complex and
12and on the other hand simple the creation is when you look at it. The miracle 12on the other hand simple the creation is when you look at it. The miracle of
13of life keeps us grounded when our imagination goes wild. If the DNA are the 13life keeps us grounded when our imagination goes wild. If the DNA are the blocks
14blocks of life, you could consider them to be an API nature provided us to 14of life, you could consider them to be an API nature provided us to better
15better understand all of this chaos masquerading as order. 15understand all of this chaos masquerading as order.
16 16
17I have been reading a lot about superintelligence and our somehow misguided 17I have been reading a lot about superintelligence and our somehow misguided path
18path to create general artificial intelligence. What would the building blocks 18to create general artificial intelligence. What would the building blocks or our
19or our creation look like? Is the compression really the ultimate storage of 19creation look like? Is the compression really the ultimate storage of
20information? Will our creation also ponder this questions when creating new 20information? Will our creation also ponder this questions when creating new
21worlds for themselves, or will we just disappear into the vastness of 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 22possibilities? It is a little offensive that we are playing God whilst being
23completely ignorant of our own reality. Who knows! Like many other 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 24breakthroughs, this one will also come at a cost not known to us when it finally
25finally happens. 25happens.
26 26
27To keep things a bit lighter, I decided to convert some popular DNA sequences 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 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 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 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 31instead of parsing it will find a way into better understanding, or at least
32enjoying the creation and cryptic nature of life. 32enjoying the creation and cryptic nature of life.
33 33
34## DNA encoding and primer example 34## DNA encoding and primer example
35 35
36I have been exploring DNA in the past in my post from about 3 years ago in 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) 37[Encoding binary data into DNA
38where I have been converting all sorts of data into DNA sequences. 38sequence](/encoding-binary-data-into-dna-sequence.html) where I have been
39converting all sorts of data into DNA sequences.
39 40
40This will be a similar exercise but instead of converting to DNA, I will be 41This will be a similar exercise but instead of converting to DNA, I will be
41generating tones from Nucleotides. 42generating tones from Nucleotides.
42 43
43| Nucleotides | Note | Frequency | 44| Nucleotides | Note | Frequency |
@@ -49,12 +50,13 @@ generating tones from Nucleotides.
49 50
50Since we do not have T in equal-tempered scale, I choose D to represent T note. 51Since we do not have T in equal-tempered scale, I choose D to represent T note.
51 52
52You can check [Frequencies for equal-tempered scale, A4 = 440 Hz](https://pages.mtu.edu/~suits/notefreqs.html). 53You can check [Frequencies for equal-tempered scale, A4 = 440
53For this tuning, we also choose `Speed of Sound = 345 m/s = 1130 ft/s = 770 miles/hr`. 54Hz](https://pages.mtu.edu/~suits/notefreqs.html). For this tuning, we also
55choose `Speed of Sound = 345 m/s = 1130 ft/s = 770 miles/hr`.
54 56
55Now that we have this out of the way, we can also brush up on the DNA 57Now that we have this out of the way, we can also brush up on the DNA sequencing
56sequencing a bit. This is a famous quote I also used for the encoding tests, 58a bit. This is a famous quote I also used for the encoding tests, and it goes
57and it goes like this. 59like this.
58 60
59> How wonderful that we have met with a paradox. Now we have some hope of 61> How wonderful that we have met with a paradox. Now we have some hope of
60> making progress. 62> making progress.
@@ -72,16 +74,16 @@ AACCTCACCAAACGGGACAAGATCGCCGGCGGGCTAGTATACAAGAACGCTTGCCAGTAC
72AACC 74AACC
73``` 75```
74 76
75This is what we gonna work with to get things rolling forward, when creating 77This is what we gonna work with to get things rolling forward, when creating
76parser and waveform generator. 78parser and waveform generator.
77 79
78## Parsing DNA data 80## Parsing DNA data
79 81
80This step is rather simple one. All we need to do is parse input DNA sequence in 82This 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 83[FASTA format](https://en.wikipedia.org/wiki/FASTA_format) well known in
82in [Bioinformatics](https://en.wikipedia.org/wiki/Bioinformatics) to extract 84[Bioinformatics](https://en.wikipedia.org/wiki/Bioinformatics) to extract single
83single Nucleotides that will be converted into separate tones based on 85Nucleotides that will be converted into separate tones based on equal-tempered
84equal-tempered scale explained above. 86scale explained above.
85 87
86```python 88```python
87nucleotide_tone_map = { 89nucleotide_tone_map = {
@@ -101,8 +103,9 @@ def generate_from_dna_sequence(sequence):
101 103
102## Generating sine wave 104## Generating sine wave
103 105
104Because we are essentially creating a long stream of notes we will be appending 106Because 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. 107sine notes to a global array we will later use for creating a WAV file out of
108it.
106 109
107```python 110```python
108import math 111import math
@@ -118,7 +121,7 @@ def append_sinewave(freq=440.0, duration_milliseconds=500, volume=1.0):
118 return 121 return
119``` 122```
120 123
121The sine wave generated here is the standard beep. If you want something more 124The sine wave generated here is the standard beep. If you want something more
122aggressive, you could try a square or saw tooth waveform. 125aggressive, you could try a square or saw tooth waveform.
123 126
124## Generating a WAV file from accumulated sine waves 127## Generating a WAV file from accumulated sine waves
@@ -144,13 +147,13 @@ def save_wav(file_name):
144 wav_file.close() 147 wav_file.close()
145``` 148```
146 149
14744100 is the industry standard sample rate - CD quality. If you need to save 15044100 is the industry standard sample rate - CD quality. If you need to save on
148on file size, you can adjust it downwards. The standard for low quality is, 151file size, you can adjust it downwards. The standard for low quality is, 8000 or
1498000 or 8kHz. 1528kHz.
150 153
151WAV files here are using short, 16 bit, signed integers for the sample size. 154WAV 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 155So, we multiply the floating-point data we have by 32767, the maximum value for
153for a short integer. 156a short integer.
154 157
155> It is theoretically possible to use the floating point -1.0 to 1.0 data 158> 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 159> directly in a WAV file, but not obvious how to do that using the wave module
@@ -159,8 +162,9 @@ for a short integer.
159## Generating Spectograms 162## Generating Spectograms
160 163
161I have tried two methods of doing this and both were just fine. I however opted 164I 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) 165out to use the [SoX - Sound eXchange, the Swiss Army knife of audio
163one because it didn't require anything else. 166manipulation](https://linux.die.net/man/1/sox) one because it didn't require
167anything else.
164 168
165```shell 169```shell
166sox output.wav -n spectrogram -o spectrogram.png 170sox output.wav -n spectrogram -o spectrogram.png
@@ -174,8 +178,9 @@ An example spectrogram of Ludwig van Beethoven Symphony No. 6 First movement.
174 178
175![Ludwig van Beethoven Symphony No. 6 First movement](/assets/dna-synthesized/symphony-no6-1st-movement.png) 179![Ludwig van Beethoven Symphony No. 6 First movement](/assets/dna-synthesized/symphony-no6-1st-movement.png)
176 180
177The other option could also be in combination with [gnuplot](http://www.gnuplot.info/). 181The other option could also be in combination with
178This would require an intermediary step, however. 182[gnuplot](http://www.gnuplot.info/). This would require an intermediary step,
183however.
179 184
180```shell 185```shell
181sox output.wav audio.dat 186sox output.wav audio.dat
@@ -183,7 +188,8 @@ tail -n+3 audio.dat > audio_only.dat
183gnuplot audio.gpi 188gnuplot audio.gpi
184``` 189```
185 190
186And input file `audio.gpi` that would be passed to gnuplot looks something like this. 191And input file `audio.gpi` that would be passed to gnuplot looks something like
192this.
187 193
188``` 194```
189# set output format and size 195# set output format and size
@@ -214,9 +220,9 @@ plot "audio_only.dat" with lines lt rgb 'red'
214 220
215## Pre-generated sequences 221## Pre-generated sequences
216 222
217What I did was take interesting parts from an animal's genome and feed it to a 223What 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 224tone 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 225MP3, so they can be played in a browser. The last step was creating a
220spectrogram based on a WAV file. 226spectrogram based on a WAV file.
221 227
222### Niels Bohr quote 228### Niels Bohr quote
@@ -229,8 +235,9 @@ spectrogram based on a WAV file.
229 235
230### Mouse 236### Mouse
231 237
232This is part of a mouse genome `Mus_musculus.GRCm39.dna.nonchromosomal`. 238This is part of a mouse genome `Mus_musculus.GRCm39.dna.nonchromosomal`. You
233You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/mus_musculus/dna/). 239can get [genom data
240here](http://ftp.ensembl.org/pub/release-106/fasta/mus_musculus/dna/).
234 241
235<audio controls> 242<audio controls>
236 <source src="/assets/dna-synthesized/mouse/out.mp3" type="audio/mpeg"> 243 <source src="/assets/dna-synthesized/mouse/out.mp3" type="audio/mpeg">
@@ -240,8 +247,9 @@ You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/mus_m
240 247
241### Bison 248### Bison
242 249
243This is part of a bison genome `Bison_bison_bison.Bison_UMD1.0.cdna`. 250This is part of a bison genome `Bison_bison_bison.Bison_UMD1.0.cdna`. You can
244You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bison_bison_bison/cdna/). 251get [genom data
252here](http://ftp.ensembl.org/pub/release-106/fasta/bison_bison_bison/cdna/).
245 253
246<audio controls> 254<audio controls>
247 <source src="/assets/dna-synthesized/bison/out.mp3" type="audio/mpeg"> 255 <source src="/assets/dna-synthesized/bison/out.mp3" type="audio/mpeg">
@@ -251,8 +259,9 @@ You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bison
251 259
252### Taurus 260### Taurus
253 261
254This is part of a taurus genome `Bos_taurus.ARS-UCD1.2.cdna`. 262This is part of a taurus genome `Bos_taurus.ARS-UCD1.2.cdna`. You can get
255You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bos_taurus/cdna/). 263[genom data
264here](http://ftp.ensembl.org/pub/release-106/fasta/bos_taurus/cdna/).
256 265
257<audio controls> 266<audio controls>
258 <source src="/assets/dna-synthesized/taurus/out.mp3" type="audio/mpeg"> 267 <source src="/assets/dna-synthesized/taurus/out.mp3" type="audio/mpeg">
@@ -262,14 +271,14 @@ You can get [genom data here](http://ftp.ensembl.org/pub/release-106/fasta/bos_t
262 271
263## Making a drummer out of a DNA sequence 272## Making a drummer out of a DNA sequence
264 273
265To make things even more interesting, I decided to send this data via MIDI to 274To make things even more interesting, I decided to send this data via MIDI to my
266my [Elektron Model:Samples](https://www.elektron.se/en/model-samples). This is 275[Elektron Model:Samples](https://www.elektron.se/en/model-samples). This is a
267a really cool piece of equipment that supports MIDI in via USB and 3.5 mm 276really cool piece of equipment that supports MIDI in via USB and 3.5 mm audio
268audio jack. 277jack.
269 278
270Elektron is connected to my MacBook via USB cable and audio out is patched to 279Elektron is connected to my MacBook via USB cable and audio out is patched to a
271a Sony Bluetooth speaker I have that supports 3.5 mm audio in. Elektron 280Sony Bluetooth speaker I have that supports 3.5 mm audio in. Elektron doesn't
272doesn't have internal speakers. 281have internal speakers.
273 282
274![](/assets/dna-synthesized/elektron/IMG_0619.jpg) 283![](/assets/dna-synthesized/elektron/IMG_0619.jpg)
275 284
@@ -277,9 +286,9 @@ doesn't have internal speakers.
277 286
278![](/assets/dna-synthesized/elektron/IMG_0622.jpg) 287![](/assets/dna-synthesized/elektron/IMG_0622.jpg)
279 288
280For communicating with Elektron, I choose `pygame` Python module that has MIDI 289For 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 290built in. With this, it was rather simple to send notes to the device. All I did
282did was map MIDI notes to the actual Nucleotides. 291was map MIDI notes to the actual Nucleotides.
283 292
284Before all of this I also checked Audio MIDI Setup app under MacOS and checked 293Before all of this I also checked Audio MIDI Setup app under MacOS and checked
285MIDI Studio by pressing ⌘-2. 294MIDI Studio by pressing ⌘-2.
@@ -329,20 +338,21 @@ pygame.midi.quit()
329<video src="/assets/dna-synthesized/elektron/elektron.mp4" controls></video> 338<video src="/assets/dna-synthesized/elektron/elektron.mp4" controls></video>
330 339
331All of this could be made much more interesting if I choose different 340All of this could be made much more interesting if I choose different
332instruments for different Nucleotides, or doing more funky stuff with Elektron. 341instruments 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 342But for now, this should be enough. It is just a proof of concept. Something to
334to play around with. 343play around with.
335 344
336## Going even further 345## Going even further
337 346
338As you probably notice, the end results are quite similar to each other. This 347As you probably notice, the end results are quite similar to each other. This is
339is to be expected because we are operating only with 4 notes essentially. What 348to 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/) 349could make this more interesting is using something like
341to create more interesting sounds. By transposing notes or using effects based 350[Supercollider](https://supercollider.github.io/) to create more interesting
342on repeated data in a sequence. Possibilities are endless. 351sounds. By transposing notes or using effects based on repeated data in a
352sequence. Possibilities are endless.
343 353
344It is really astonishing what can be achieved with a little bit of code and an 354It 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 355idea. I could see this becoming an interesting background soundscape instrument
346if done properly. It could replace random note generator with something more 356if done properly. It could replace random note generator with something more
347intriguing, biological, natural. 357intriguing, biological, natural.
348 358
@@ -351,4 +361,3 @@ music 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 361The 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 362wonder. It kind of puts Occam’s Razor in its place. Nature for sure loves to
353make things as energy efficient as possible. 363make things as energy efficient as possible.
354
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 faa2df1..e82e364 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
@@ -5,10 +5,10 @@ date: 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 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. 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 10This makes regulating the strength of a current easier than normally. Because of
11of lower stream strength and high temperatures, algae has formed on the river. 11lower 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. 12This is the first time I've seen something like this in my whole life.
13 13
14Below are some photographs taken from a DJI drone capturing the event. 14Below are some photographs taken from a DJI drone capturing the event.
@@ -25,6 +25,6 @@ Below are some photographs taken from a DJI drone capturing the event.
25 25
26![Algae on Sava](/assets/algae-sava/dji-algae-5.jpg) 26![Algae on Sava](/assets/algae-sava/dji-algae-5.jpg)
27 27
28I will try to get more photos of this in the future days and if something 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. 29intriguing shows up will post it again on the blog.
30 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 120dcae..78595fa 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
@@ -7,23 +7,23 @@ draft: false
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 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 11opinionated post! I will learn more about this in the future, and probably
12slightly change my mind about some of the things I criticize.* 12slightly change my mind about some of the things I criticize.*
13 13
14I have started working on a hobby project about two weeks ago, and I wanted to 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 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 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 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 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. 19of my brain that finds discovery the highest of the mountains to climb.
20 20
21What I always wanted to make was a coding game, that you would play in a 21What I always wanted to make was a coding game, that you would play in a browser
22browser (just to eliminate building binaries for each operating system) where 22(just to eliminate building binaries for each operating system) where you would
23you would level up your character and go into these scriptable battles. You 23level up your character and go into these scriptable battles. You know, RPG
24know, RPG elements. 24elements.
25 25
26So, the natural way to go would be some sort of SPA (single page application) 26So, the natural way to go would be some sort of SPA (single page application)
27with basic routing and some state management. Nothing crazy. 27with basic routing and some state management. Nothing crazy.
28 28
29> **Before we move on**, I have to be transparent. Take my views on this with 29> **Before we move on**, I have to be transparent. Take my views on this with
@@ -31,92 +31,92 @@ with basic routing and some state management. Nothing crazy.
31> and my knowledge is full of gaps. This is my experience using some of these 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. 32> products for the first time or in a limited capacity.
33 33
34Having this out of the way, I got myself a fresh pot of coffee and down the 34Having this out of the way, I got myself a fresh pot of coffee and down the
35rabbit hole I went. 35rabbit hole I went.
36 36
37## Giving React JS a spin 37## Giving React JS a spin
38 38
39I first tried [React JS](https://reactjs.org/). I kind of like it. Furthermore, 39I first tried [React JS](https://reactjs.org/). I kind of like it. Furthermore,
40I have worked with libraries like this in the past and also wrote a couple of 40I have worked with libraries like this in the past and also wrote a couple of
41them (nothing compared to that level), but I had the basic understanding of 41them (nothing compared to that level), but I had the basic understanding of what
42what was going on. I rolled up a project quickly and had basic things done in 42was going on. I rolled up a project quickly and had basic things done in a
43a matter of two hours, which was impressive. 43matter of two hours, which was impressive.
44 44
45I prefer using [Tailwind CSS](https://tailwindcss.com/) for my styling 45I prefer using [Tailwind CSS](https://tailwindcss.com/) for my styling
46pleasures, and integrating that was also a painless experience. It was actually 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 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 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 49`postcss` stuff was taken care of by adding a couple of things in config files
50(all described really well in their documentation). 50(all described really well in their documentation).
51 51
52It is not that different from Vue which I have had more encounters with in the 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 53past People will probably call me a lunatic for saying this. But you know, it is
54is the truth. Same same, but different. I still believe that using libraries 54the truth. Same same, but different. I still believe that using libraries like
55like this is beneficial. I am not a JavaScript purist. They all have their 55this is beneficial. I am not a JavaScript purist. They all have their quirks,
56quirks, but at the end of the day, I truly believe it’s worth it. 56but at the end of the day, I truly believe it’s worth it.
57 57
58## Bundlers and Transpilers 58## Bundlers and Transpilers
59 59
60I still reject calling [Typescript](https://www.typescriptlang.org/) to 60I still reject calling [Typescript](https://www.typescriptlang.org/) to
61[JavaScript](https://www.javascript.com/) conversion a "compilation process". 61[JavaScript](https://www.javascript.com/) conversion a "compilation process". I
62I call them [transpilers](https://devopedia.org/transpiler), and I don’t care! 😈 62call them [transpilers](https://devopedia.org/transpiler), and I don’t care! 😈
63 63
64And 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
65it!
65 66
66![Compiling vs Transpiling](/assets/state-of-web/compiling-vs-transpiling.png) 67![Compiling vs Transpiling](/assets/state-of-web/compiling-vs-transpiling.png)
67 68
68The first one that I ever used was [webpack](https://webpack.js.org/), and it 69The first one that I ever used was [webpack](https://webpack.js.org/), and it
69was an absolute horrific experience. Saying this, it is an absolutely 70was an absolute horrific experience. Saying this, it is an absolutely fantastic
70fantastic tool. I felt more like a config editor than actually a programmer. 71tool. I felt more like a config editor than actually a programmer. To be fair,
71To be fair, I am a huge fan of [make](https://www.gnu.org/software/make/), 72I am a huge fan of [make](https://www.gnu.org/software/make/), and you can do as
72and you can do as you wish with this information. I like my build systems 73you wish with this information. I like my build systems simple.
73simple.
74 74
75Also, isn’t it interesting that we need something like [Babel](https://babeljs.io/) 75Also, isn’t it interesting that we need something like
76to make JavaScript code work in a browser that has only one client side 76[Babel](https://babeljs.io/) to make JavaScript code work in a browser that has
77scripting available, which is by no accident also JavaScript. Why? I know 77only one client side scripting available, which is by no accident also
78why it’s needed, but seriously, why. 78JavaScript. Why? I know why it’s needed, but seriously, why.
79 79
80I haven’t used Babel for years now. Or if I did, it was packaged together by 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 81some other bundler thingy. Which does not make things better, but at least I
82I didn’t need to worry about it. 82didn’t need to worry about it.
83 83
84I really don’t like complicated build systems. I really don’t like abstracting 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 85code and making things appear magical. The older I get, the more I appreciate
86clear and clean, expressive code. No one-liners, if possible. 86clear and clean, expressive code. No one-liners, if possible.
87 87
88But I have to give props to [Vite](https://vitejs.dev/)! This was one of the 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 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 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 91degree. But at least it didn’t force me to configure 700 lines of JSON. And I
92I know that this makes me a hypocrite. You can’t have it all. Nonetheless, 92know that this makes me a hypocrite. You can’t have it all. Nonetheless, my
93my reasoning here is, if using bundlers is inevitable, then at least they 93reasoning here is, if using bundlers is inevitable, then at least they should
94should provide an excellent developer experience. 94provide an excellent developer experience.
95 95
96I also noticed that now the catch-all phrase is “blazingly fast” and 96I also noticed that now the catch-all phrase is “blazingly fast” and “lightning
97“lightning fast” and “next generation” and stuff like that. I mean, yeah, 97fast” and “next generation” and stuff like that. I mean, yeah, tools should get
98tools should get faster with time. But saying that starting a project now takes 98faster with time. But saying that starting a project now takes 2 seconds instead
992 seconds instead of 20 seconds is something that is a break it or make it kind 99of 20 seconds is something that is a break it or make it kind of a deal is
100of a deal is ridiculous. I don’t mind waiting a couple of seconds every couple 100ridiculous. I don’t mind waiting a couple of seconds every couple of days. I
101of days. I also don’t create 700 projects every day, and also who does? This 101also don’t create 700 projects every day, and also who does? This argument has
102argument has no bite. All I want is a decent reload time (~100ms is more than 102no bite. All I want is a decent reload time (~100ms is more than good enough for
103good enough for me) and that is it. 103me) and that is it.
104 104
105You don’t need to sell me benefits if I only get them when I start a fresh 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 106project, and then try to convince me that this is somehow changing the fate of
107of the universe. First of all, it is not. And second, if this is your only 107the universe. First of all, it is not. And second, if this is your only argument
108argument for your tool, I would advise you to maybe re-focus your efforts to 108for your tool, I would advise you to maybe re-focus your efforts to something
109something else. Vite says that startup times are really fast. And if that 109else. Vite says that startup times are really fast. And if that would be the
110would be the only thing differentiating it from other tools, I would ignore 110only thing differentiating it from other tools, I would ignore it. But it has
111it. But it has some really compelling features like 111some really compelling features like [Hot Module
112[Hot Module Replacement](https://www.geeksforgeeks.org/reactjs-hot-module-replacement/) 112Replacement](https://www.geeksforgeeks.org/reactjs-hot-module-replacement/) that
113that really works well. It was a joy to use. 113really works well. It was a joy to use.
114 114
115So, I will be definitely using Vite in the future. 115So, I will be definitely using Vite in the future.
116 116
117## Jam Stack, Mach Stack no snack 117## Jam Stack, Mach Stack no snack
118 118
119Let's get a couple of the acronyms out of the way, so we all know what we are 119Let's get a couple of the acronyms out of the way, so we all know what we are
120talking about: 120talking about:
121 121
122- Jam Stack - JavaScript, API and Markup 122- Jam Stack - JavaScript, API and Markup
@@ -124,74 +124,75 @@ talking about:
124 124
125It is so hard to follow all these new trendy things happening around you, that 125It is so hard to follow all these new trendy things happening around you, that
126it makes you have a massive **FOMO** all the time. But on the other hand, you 126it makes you have a massive **FOMO** all the time. But on the other hand, you
127also don’t want to be that old fart that doesn’t move with the times and still 127also don’t want to be that old fart that doesn’t move with the times and still
128writes his trusty jQuery code while listening to Blink 182 All the small things 128writes his trusty jQuery code while listening to Blink 182 All the small things
129on full blast. It’s a good song, don’t get me wrong, but there are other songs 129on full blast. It’s a good song, don’t get me wrong, but there are other songs
130out there. 130out there.
131 131
132I have to admit. [Vercel](https://vercel.com/) is really cool! Love the 132I have to admit. [Vercel](https://vercel.com/) is really cool! Love the
133simplicity of the service. You could compare it to [Netlify](https://www.netlify.com/). 133simplicity of the service. You could compare it to
134I haven’t tried Netlify extensively, but from a couple of experimental 134[Netlify](https://www.netlify.com/). I haven’t tried Netlify extensively, but
135deployments I still prefer Vercel. It is much more streamlined, but maybe this 135from a couple of experimental deployments I still prefer Vercel. It is much more
136is bias in me. I really like Vercel’s Analytics, which give you a 136streamlined, but maybe this is bias in me. I really like Vercel’s Analytics,
137[Core Web Vitals report](https://web.dev/vitals/) in their admin console. Kind 137which give you a [Core Web Vitals report](https://web.dev/vitals/) in their
138of cool, I’m not going to lie. 138admin console. Kind of cool, I’m not going to lie.
139 139
140This whole idea about frontend and backend merging into [SSR (server-side rendering)](https://www.debugbear.com/blog/server-side-rendering) 140This whole idea about frontend and backend merging into [SSR (server-side
141looks so good on paper. It almost doesn’t come with any major flaws. 141rendering)](https://www.debugbear.com/blog/server-side-rendering) looks so good
142on paper. It almost doesn’t come with any major flaws.
142 143
143But when it comes to the actual implementation, there is much to be desired. 144But when it comes to the actual implementation, there is much to be desired.
144I’m going to lump [Next.js](https://nextjs.org/) and [Nuxt.js](https://nuxtjs.org/) 145I’m going to lump [Next.js](https://nextjs.org/) and
145together because they are essentially the same thing, just a different library. 146[Nuxt.js](https://nuxtjs.org/) together because they are essentially the same
147thing, just a different library.
146 148
147Now comes the reality. Mixing backend and frontend in this manner creates this 149Now 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 150weird mental model where you kind of rely on magical properties of these
149libraries. You relinquish control over to them for better developer experience. 151libraries. You relinquish control over to them for better developer experience.
150But is that really true? Initially, I was so stoked about it. However, the 152But is that really true? Initially, I was so stoked about it. However, the more
151more I used them, the more I felt uncomfortable. I felt dirty, actually. Maybe 153I used them, the more I felt uncomfortable. I felt dirty, actually. Maybe this
152this is because I come from old ways of doing things where you control every 154is because I come from old ways of doing things where you control every step of
153step of request, and allowing something to hijack it feels like blasphemy. 155request, and allowing something to hijack it feels like blasphemy.
154 156
155More than that, some pretty significant technical issues arose from this. How 157More than that, some pretty significant technical issues arose from this. How do
156do you do JWT token authentication? You put it in `api` folder and then do some 158you 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 159fetching 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 160some 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 161you 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 162that this whole thing was not meant to be used like this, and it all feels and
161looks like a huge hack. 163looks like a huge hack.
162 164
163The issue I have with this is that they over-promise and under-deliver. They 165The 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 166want to be an all-in-one replacement for everything, and they don’t deliver on
165on this promise. And how could they?! We have to be fair. It is an impossible 167this promise. And how could they?! We have to be fair. It is an impossible task.
166task.
167 168
168They sell you [NoOps](https://www.geeksforgeeks.org/overview-of-noops/), but 169They 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 170when 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 171Hello 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. 172deployment strategy that relies on many moving parts is never a good idea.
172Abstracting too much is usually a sign of bad architecture. 173Abstracting too much is usually a sign of bad architecture.
173 174
174Lately, this has become a huge trend that will for sure bite us in the future. 175Lately, 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 176And 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 177[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 178their 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 179that is not an issue, it comes down to the principle of things. AWS is known for
179for having multiple “currencies“ inside their projects like write operations, 180having multiple “currencies“ inside their projects like write operations, read
180read operations, etc. which add up, and it creates this impossible to track 181operations, etc. which add up, and it creates this impossible to track billing
181billing scheme. It all behaves suspiciously like a pay-to-win game you could 182scheme. It all behaves suspiciously like a pay-to-win game you could find on
182find on mobile phones that scams you out of your money. 183mobile phones that scams you out of your money.
183 184
184And as far as I am concerned, the most important thing was me not coding the 185And 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 186functionalities for the game I want to make. I was battling libraries and cloud
186cloud providers. How to deploy, what settings are relevant. Bad documentation 187providers. How to deploy, what settings are relevant. Bad documentation or
187or multiple versions of achieving the same thing. You are getting bombarded 188multiple versions of achieving the same thing. You are getting bombarded by all
188by all this information, and you don’t really have any control over it. 189this information, and you don’t really have any control over it.
189Production-ready code becomes a joke, essentially. Especially if you tend to 190Production-ready code becomes a joke, essentially. Especially if you tend to
190work on that project for a prolonged period of time. 191work on that project for a prolonged period of time.
191 192
192All of these options end up creating a fatigue. What to choose, what not to 193All 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 194choose. Unnecessary worrying about if the stack will still be deemed worthy in
194in six months. There is elegance in simplicity. 195six months. There is elegance in simplicity.
195 196
196> JavaScript UI frameworks and libraries work in cycles. Every six months or 197> 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> so, a new one pops up, claiming that it has revolutionized UI development.
@@ -202,102 +203,101 @@ in six months. There is elegance in simplicity.
202 203
203![To many options](/assets/state-of-web/2008-vs-2020.png) 204![To many options](/assets/state-of-web/2008-vs-2020.png)
204 205
205And this jab at these libraries and cloud providers is not done out of malice. 206And 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 207It 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 208technologies 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 209all the power you have to a library or a cloud provider is in my opinion a
209stupid move. 210stupid move.
210 211
211## Tailwind CSS still rocks! 212## Tailwind CSS still rocks!
212 213
213You know, many people say negative things about Tailwind. And after a lot of 214You know, many people say negative things about Tailwind. And after a lot of
214deliberation, I came to the conclusion that Tailwind is good for two types of 215deliberation, I came to the conclusion that Tailwind is good for two types of
215developers. Tailwind is good for a complete noob or a senior developer. A 216developers. Tailwind is good for a complete noob or a senior developer. A
216complete noob doesn’t really care about inner workings of CSS, and a senior 217complete noob doesn’t really care about inner workings of CSS, and a senior
217developer also doesn’t care about CSS. Well, at least, not anymore. And 218developer also doesn’t care about CSS. Well, at least, not anymore. And
218developers in between usually have the biggest issues with it. Not always of 219developers in between usually have the biggest issues with it. Not always of
219course, but in a lot of cases. 220course, but in a lot of cases.
220 221
221I like the creature comforts of Tailwind. Being utility first would make me 222I 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 223argue that it is actually more similar to [Sass](https://sass-lang.com/) or
223[Less](https://lesscss.org/) than something like Bootstrap. Not technically, 224[Less](https://lesscss.org/) than something like Bootstrap. Not technically, but
224but ideologically. After I started using it, I never looked back. I use it 225ideologically. After I started using it, I never looked back. I use it every
225every time I need to do something web related. 226time I need to do something web related.
226 227
227Writing CSS for general things feels like going several steps back. Instead of 228Writing 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 229focusing on what you are actually trying to achieve, you focus on notations like
229like [BEM](https://en.bem.info/methodology/css/), code structuring, optimizing 230[BEM](https://en.bem.info/methodology/css/), code structuring, optimizing HTML
230HTML size. Just doing things that make 0.1% difference. You know that saying: 231size. Just doing things that make 0.1% difference. You know that saying: Early
231Early optimization is the root of all evil. Exactly that. 232optimization is the root of all evil. Exactly that.
232 233
233I am also not saying that Tailwind is the cure for everything. Sometimes custom 234I 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 235CSS is necessary. But from what I found out in using it for almost two years in
235in a production environment (on a site getting quite a lot of traffic and 236a production environment (on a site getting quite a lot of traffic and
236constantly being changed), I can say without any reservations that Tailwind 237constantly being changed), I can say without any reservations that Tailwind
237saved our asses countless times. We would be rewriting CSS all the time without 238saved 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. 239it. And I don’t really think writing CSS is the best way to spend my time.
239 240
240I have also noticed that people who criticize Tailwind the most never actually 241I 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 242used it in a real project that has a long lifetime with plenty of changes that
242will happen in the future. 243will happen in the future.
243 244
244But you know, whatever floats your boat! 245But you know, whatever floats your boat!
245 246
246## Code maintainability 247## Code maintainability
247 248
248Somehow, people also stopped talking about maintenance. If you constantly try 249Somehow, people also stopped talking about maintenance. If you constantly try to
249to catch the latest and greatest train, you are by that logic always trying 250catch the latest and greatest train, you are by that logic always trying new
250new things. Which is a good thing if you want to learn about technologies and 251things. Which is a good thing if you want to learn about technologies and try
251try them. But for the production environment, you have to have a stable stack 252them. But for the production environment, you have to have a stable stack that
252that doesn’t change every 6 months. 253doesn’t change every 6 months.
253 254
254You can lock dependencies for sure. Nevertheless, the hype train moves along 255You can lock dependencies for sure. Nevertheless, the hype train moves along
255anyway. And the mindset this breeds goes against locking the code. This 256anyway. And the mindset this breeds goes against locking the code. This
256bleeding-edge rolling release cycle is not helping. That is why enterprise 257bleeding-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 258solutions usually look down on these popular stacks and only do bare minimum to
258appear hip and cool. 259appear hip and cool.
259 260
260With that said, I still think that progress is good, but should be taken with a 261With 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 262grain 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 263rarely updated, going with the latest stack is a possible way to go. But, if you
263you are working on a project that lasts for years, you should probably approach 264are working on a project that lasts for years, you should probably approach it
264it with some level of caution. Web development is often times too volatile. 265with some level of caution. Web development is often times too volatile.
265 266
266## Web development has a marketing issue 267## Web development has a marketing issue
267 268
268I noticed that almost every project now has this marketing spin put on it. 269I 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 270Everything is blazingly fast now. I get it, they are competing for your
270attention, but what happened to just being truthful and not inflating reality. 271attention, but what happened to just being truthful and not inflating reality.
271 272
272And in order to appeal to mass market, they leave things out of their marketing 273And 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 274materials. These open-source projects are now behaving more and more like
274companies do. Which is a scary thought on its self. 275companies do. Which is a scary thought on its self.
275 276
276And we are also seeing a rise in a concept of building a company in the open, 277And 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 278which 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 279lure people and then lock them in their ecosystem, there is where I have issues
279with it. 280with it.
280 281
281This might be because I have been using GNU/Linux for 20 years now and have 282This might be because I have been using GNU/Linux for 20 years now and have been
282been so beholden for my success to open-source that I see issues when 283so beholden for my success to open-source that I see issues when open-source is
283open-source is being used to trick people into a false sense of security that 284being used to trick people into a false sense of security that these projects
284these projects are built in the spirit of open-source. Because there is a 285are built in the spirit of open-source. Because there is a difference. They are
285difference. They are NOT! They have a really specific goal in mind. And the 286NOT! They have a really specific goal in mind. And the open-source is being used
286open-source is being used as a delivery system. Which is in my opinion 287as a delivery system. Which is in my opinion disgusting!
287disgusting!
288 288
289## Conclusion 289## Conclusion
290 290
291I will end my post with this. Web development is running now in circles. People 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) 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 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 294so passé. And I am so tired of it all. Of blazingly fast libraries, of all these
295these new technologies that are actually just a remake of old ones. Of just 295new technologies that are actually just a remake of old ones. Of just the
296the general spirit of the web. I will just use what I already know. Which worked 296general spirit of the web. I will just use what I already know. Which worked 10
29710 years ago and will work 10 years after this. I will adopt a couple of 297years ago and will work 10 years after this. I will adopt a couple of little
298little tools like Vite. But I will not waste my time on this anymore. 298tools like Vite. But I will not waste my time on this anymore.
299 299
300It was a good exercise to get in touch with what’s new now. Nothing really 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 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. 302code and make the project that I wanted to make in the first place.
303 303
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 2739764..05a8167 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
@@ -5,60 +5,61 @@ date: 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, 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. 9you are the observer, director, and audience in this tiny movies.
10 10
11What you do is to attempt to imagine what would be happening around you based 11What you do is to attempt to imagine what would be happening around you based on
12on a title of the song and let the song help you fill the void in your story. 12a title of the song and let the song help you fill the void in your story.
13 13
14I made these songs is Logic Pro X. Every year or so I do this kind of thing 14I made these songs is Logic Pro X. Every year or so I do this kind of thing and
15and make a couple of songs similar to this. But this is the first time I am 15make a couple of songs similar to this. But this is the first time I am posting
16posting about it. 16about it.
17 17
18You can listen to the whole set on [Youtube](https://www.youtube.com/watch?v=_5oXBhSmF3c) 18You can listen to the whole set on
19or scroll down the page and there are embedded players for each song. 19[Youtube](https://www.youtube.com/watch?v=_5oXBhSmF3c) or scroll down the page
20and there are embedded players for each song.
20 21
21## A bunch of inter-dimensional people with loud clocks 22## A bunch of inter-dimensional people with loud clocks
22 23
23A group of inter-dimensional people are going up and down the elevator with 24A group of inter-dimensional people are going up and down the elevator with you
24you while having loud clocks around their necks. Each clock ticks on a different 25while having loud clocks around their necks. Each clock ticks on a different
25frequency. A lot of other sounds are getting drawn into your dimension, 26frequency. A lot of other sounds are getting drawn into your dimension,
26resulting in a strange merging of dimensions. 27resulting in a strange merging of dimensions.
27 28
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> 29<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>
29 30
30## Two black holes conversing about the weather 31## Two black holes conversing about the weather
31 32
32You are a traveler in a spaceship flying very close to two colliding black holes 33You 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 34having a discussion about the weather while tearing each other apart. During all
34all this your ship is getting pulled into the event horizon of both black 35this your ship is getting pulled into the event horizon of both black holes,
35holes, putting a lot of strain on your spaceship. 36putting a lot of strain on your spaceship.
36 37
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> 38<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>
38 39
39## A planet where every organism is a plant 40## A planet where every organism is a plant
40 41
41You land on a planet where every living organism is a plant and among those 42You 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 43plants 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 44contact with the native species. Your visit takes place in a giant cave where
44you are meeting these plants, and they are talking to you. 45you are meeting these plants, and they are talking to you.
45 46
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> 47<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>
47 48
48## Bio implants having a fit and reprogramming your brain 49## Bio implants having a fit and reprogramming your brain
49 50
50In a distant future where everybody has bio implants, you have just received 51In 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, 52your first one, which happens to be a brain implant. Something goes wrong, and
52and your implant is starting to misbehave, and you are experiencing brain 53your implant is starting to misbehave, and you are experiencing brain
53malfunctions. You are on the streets at night a couple of hours after your 54malfunctions. You are on the streets at night a couple of hours after your
54procedure. You can feel your sanity breaking down. 55procedure. You can feel your sanity breaking down.
55 56
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> 57<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>
57 58
58## Cow animation 59## Cow animation
59 60
60I also made this little cow animation. Go into full screen to see the effects 61I also made this little cow animation. Go into full screen to see the effects in
61in more details. 62more details.
62 63
63<video src="/assets/microsoundtrack/cow.m4v" controls loop></video> 64<video src="/assets/microsoundtrack/cow.m4v" controls loop></video>
64 65
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 4ec307f..a03a2a4 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
@@ -5,32 +5,33 @@ date: 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, 8Over the past few weeks, I have been really thinking about terminal emulators,
9how we interact with computers, the separation of text-based programs and GUI 9how we interact with computers, the separation of text-based programs and GUI
10ones. To be perfectly honest, I got pissed off one evening when I was cleaning 10ones. To be perfectly honest, I got pissed off one evening when I was cleaning
11up files on my computer. Normally, I go into console and do `ncdu` and check 11up files on my computer. Normally, I go into console and do `ncdu` and check
12where the junk is. Then I start deleting stuff. Without any discrimination, 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 13usually. But when it comes to screenshots, I have learned that it's good to keep
14keep them somewhere near if I need to refer to something that I was doing. I 14them somewhere near if I need to refer to something that I was doing. I am an
15am an avid screenshot taker. So at that point I checked Pictures folder and 15avid screenshot taker. So at that point I checked Pictures folder and also did a
16also did a basic search `find . -type f -name "*.jpg"` for all the JPEG files 16basic search `find . -type f -name "*.jpg"` for all the JPEG files in my home
17in my home directory and immediately got pissed off. Why can’t I see thumbnails 17directory and immediately got pissed off. Why can’t I see thumbnails in my
18in my terminal? I know why, but why in the year of 2022 this is still a 18terminal? I know why, but why in the year of 2022 this is still a problem. I am
19problem. I am used to traversing my disk via terminal. I am faster, and I am 19used to traversing my disk via terminal. I am faster, and I am more comfortable
20more comfortable this way. But when it comes to visualization, I then need to 20this way. But when it comes to visualization, I then need to revert to GUI
21revert to GUI applications and again find the same file to see it. I know that 21applications and again find the same file to see it. I know that programs like
22programs like `feh` and `sxiv` are available, but I would just like to see the 22`feh` and `sxiv` are available, but I would just like to see the preview. Like
23preview. Like [Jupyter notebook](https://jupyter.org/) or something similar. 23[Jupyter notebook](https://jupyter.org/) or something similar. Just having it
24Just having it inline. Part of a result. 24inline. Part of a result.
25 25
26It also didn’t help that I was spending some time with the [Plan 9](https://plan9.io/plan9/) 26It also didn’t help that I was spending some time with the [Plan
27Operating system. More specifically [9FRONT](http://9front.org/). The way 279](https://plan9.io/plan9/) Operating system. More specifically
28that [ACME editor](http://acme.cat-v.org/) handles text editing is just 28[9FRONT](http://9front.org/). The way that [ACME editor](http://acme.cat-v.org/)
29wonderful. Different and fresh somehow, even though it’s super old. 29handles text editing is just wonderful. Different and fresh somehow, even though
30 30it’s super old.
31So, I went on a lookout for an interesting way of visualizing results of some 31
32query. I found these applications to be outstanding examples of how not to be 32So, I went on a lookout for an interesting way of visualizing results of some
33a captive of a predetermined way of doing things. 33query. I found these applications to be outstanding examples of how not to be a
34captive of a predetermined way of doing things.
34 35
35- [Wolfram Mathematica](https://www.wolfram.com/mathematica/) 36- [Wolfram Mathematica](https://www.wolfram.com/mathematica/)
36- [Jupyter notebooks](https://jupyter.org/) 37- [Jupyter notebooks](https://jupyter.org/)
@@ -38,56 +39,56 @@ a captive of a predetermined way of doing things.
38- [Temple OS](https://templeos.org/) 39- [Temple OS](https://templeos.org/)
39- [Emacs](https://www.gnu.org/software/emacs/) 40- [Emacs](https://www.gnu.org/software/emacs/)
40 41
41My idea is not as out there as ACME is, but it is a spin on the terminal 42My 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 43emulators. I like the modes that Vi/Vim provides you with. I like the way the
43the Emacs does its own `M-x` `M-c`. Furthermore, I really like how Mathematica 44Emacs does its own `M-x` `M-c`. Furthermore, I really like how Mathematica and
44and Jupyter present the data in a free flowing form. And I love how Temple OS 45Jupyter present the data in a free flowing form. And I love how Temple OS is
45is basically a C interpreter on some level. 46basically a C interpreter on some level.
46 47
47> **Note:** This is part 1 of the journey. Nowhere finished yet. I am just 48> **Note:** This is part 1 of the journey. Nowhere finished yet. I am just
48> tinkering with this at the moment. This whole thing can easily spectacularly 49> tinkering with this at the moment. This whole thing can easily spectacularly
49> fail. 50> fail.
50 51
51So I started. I knew that I wanted to have the couple of modes, but I didn’t 52So 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 53like 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 54toggle and indicate to the user that they are in a special mode. Like Vi does
54for Normal and Visual mode. 55for Normal and Visual mode.
55 56
56These modes would for the first version be: 57These modes would for the first version be:
57 58
58- *Preview mode* (toggle with Ctrl + P) 59- *Preview mode* (toggle with Ctrl + P)
59 - When this mode would be enabled, the `ls` command would try to find images 60 - 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 from the results and display thumbnails from them in the terminal itself.
61 No ASCII art. Proper images. In a grid! 62 No ASCII art. Proper images. In a grid!
62- *Detach mode* (toggle with Ctrl + D) 63- *Detach mode* (toggle with Ctrl + D)
63 - When this mode would be enabled, every command would open a new window 64 - When this mode would be enabled, every command would open a new window
64 and execute that command in it. This would be useful for starting `htop` 65 and execute that command in it. This would be useful for starting `htop`
65 in a separate window. 66 in a separate window.
66 67
67The reason for having these modes togglable is to not ask for previews every 68The reason for having these modes togglable is to not ask for previews every
68time. You enable a mode and until you disable it, it behaves that way. 69time. You enable a mode and until you disable it, it behaves that way. Purely
69Purely out of ergonomic reasons. 70out of ergonomic reasons.
70 71
71I would like to treat every terminal I open as a session mentally. When I start 72I would like to treat every terminal I open as a session mentally. When I start
72using the terminal, I start digging deeper into the issue I am trying to resolve. 73using the terminal, I start digging deeper into the issue I am trying to
73And while I am doing this, I would like to open detached windows etc. A lot of 74resolve. And while I am doing this, I would like to open detached windows
74these things can be done easily with something like [i3](https://i3wm.org/), 75etc. A lot of these things can be done easily with something like
75but also that pull you out of the context of what you were doing. I would 76[i3](https://i3wm.org/), but also that pull you out of the context of what you
76like to orchestrate everything from one single point. 77were doing. I would like to orchestrate everything from one single point.
77 78
78In planning for this project, I knew that I would need to use a language like 79In planning for this project, I knew that I would need to use a language like C
79C and a library such as [SDL2](https://www.libsdl.org/) in order to achieve 80and a library such as [SDL2](https://www.libsdl.org/) in order to achieve the
80the desired results. I had considered other options, but ultimately determined 81desired results. I had considered other options, but ultimately determined that
81that [SDL2](https://www.libsdl.org/) was the best fit based on its capabilities 82[SDL2](https://www.libsdl.org/) was the best fit based on its capabilities and
82and reputation in the programming community. 83reputation in the programming community.
83 84
84At first, I thought the idea of a hardware accelerated terminal was a bit of 85At first, I thought the idea of a hardware accelerated terminal was a bit of a
85a joke. It seemed like such a niche and unnecessary feature, especially given 86joke. It seemed like such a niche and unnecessary feature, especially given the
86the fact that terminal emulators have been around for decades and have always 87fact that terminal emulators have been around for decades and have always relied
87relied on software rendering. But to be fair, [Alacritty](https://alacritty.org/) 88on software rendering. But to be fair, [Alacritty](https://alacritty.org/) is
88is doing the same thing. Well, they are doing a remarkable job at it. 89doing the same thing. Well, they are doing a remarkable job at it.
89 90
90So, I embarked on a journey. Everything has to start somewhere. For me, it 91So, I embarked on a journey. Everything has to start somewhere. For me, it
91started with creating a window! It has to start somewhere. 🙂 92started with creating a window! It has to start somewhere. 🙂
92 93
93```c 94```c
@@ -101,28 +102,31 @@ SDL_Window *window = SDL_CreateWindow(
101 102
102I continued like this to get some text displayed on the screen. 103I continued like this to get some text displayed on the screen.
103 104
104I noted that [`TTF_RenderText_Solid`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_Solid) 105I noted that
105rendered text really poorly. There were no antialiasing at all. In my wisdom, 106[`TTF_RenderText_Solid`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_Solid)
106I never checked the documentation. Well, that was a fail. To uneducated like 107rendered text really poorly. There were no antialiasing at all. In my wisdom, I
107me: `TTF_RenderText_Solid` renders Latin1 text at fast quality to a new 8-bit 108never checked the documentation. Well, that was a fail. To uneducated like me:
109`TTF_RenderText_Solid` renders Latin1 text at fast quality to a new 8-bit
108surface. So, that's why the texts looked like shit. No wonder. 110surface. So, that's why the texts looked like shit. No wonder.
109 111
110Remarks on `TTF_RenderText_Solid`: This function will allocate a new 8-bit, 112Remarks 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 113palettized surface. The surface's 0 pixel will be the colorkey, giving a
112transparent background. The 1 pixel will be set to the text color. 114transparent background. The 1 pixel will be set to the text color.
113 115
114After I replaced it with [`TTF_RenderText_LCD`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_LCD) 116After I replaced it with
115which renders Latin1 text at LCD subpixel quality to a new ARGB surface, the 117[`TTF_RenderText_LCD`](https://wiki.libsdl.org/SDL_ttf/TTF_RenderText_LCD) which
116text started looking good. Really make sure you read the documentation. It’s 118renders Latin1 text at LCD subpixel quality to a new ARGB surface, the text
117actually good. As a side note, you can find all the documentation regarding 119started looking good. Really make sure you read the documentation. It’s actually
118[SDL2 on their Wiki](https://wiki.libsdl.org/). 120good. As a side note, you can find all the documentation regarding [SDL2 on
119 121their Wiki](https://wiki.libsdl.org/).
120After that was done, I started working on displaying other things like 122
121`Preview` and `Detach` modes. This wasn’t really that hard. In SDL2 you can 123After that was done, I started working on displaying other things like `Preview`
122check all the available events with `while (SDL_PollEvent(&event) > 0)` and 124and `Detach` modes. This wasn’t really that hard. In SDL2 you can check all the
123have a bunch of switch statements to determine which key is currently being 125available events with `while (SDL_PollEvent(&event) > 0)` and have a bunch of
124pressed. More about keys, [SDLKey](https://documentation.help/SDL/sdlkey.html) 126switch statements to determine which key is currently being pressed. More about
125and mroe about pooling the events on [SDL_PollEvent](https://documentation.help/SDL/sdlpollevent.html). 127keys, [SDLKey](https://documentation.help/SDL/sdlkey.html) and mroe about
128pooling the events on
129[SDL_PollEvent](https://documentation.help/SDL/sdlpollevent.html).
126 130
127```c 131```c
128while (SDL_PollEvent(&event) > 0) 132while (SDL_PollEvent(&event) > 0)
@@ -144,9 +148,9 @@ while (SDL_PollEvent(&event) > 0)
144} 148}
145``` 149```
146 150
147After that was somewhat working correctly, I started creating a struct that 151After 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 152would hold all the commands and results and I call them Cells. Yes, I stole that
149that naming idea from Jupyter. 153naming idea from Jupyter.
150 154
151```c 155```c
152typedef struct 156typedef struct
@@ -159,13 +163,15 @@ typedef struct
159} Cell; 163} Cell;
160``` 164```
161 165
162I am at a place now where I am starting to implement scrolling. This will for 166I 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. 😂 167sure be fun to code. Memory management in C is super easy. 😂
164 168
165I have also added a simple [INI file like configuration](https://en.wikipedia.org/wiki/INI_file) 169I have also added a simple [INI file like
166support. It is done in an [STB style of header](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) 170configuration](https://en.wikipedia.org/wiki/INI_file) support. It is done in an
167and maps to specific options supported by the terminal. It is not universal, 171[STB style of
168and the code below demonstrates how I will use it in the future. 172header](https://github.com/nothings/stb/blob/master/docs/stb_howto.txt) and maps
173to specific options supported by the terminal. It is not universal, and the code
174below demonstrates how I will use it in the future.
169 175
170```c 176```c
171#ifndef CONFIG_H 177#ifndef CONFIG_H
@@ -239,8 +245,8 @@ extern Config read_config_file(const char *filename)
239#endif 245#endif
240``` 246```
241 247
242This is as far as I managed to get for now. I have a daily job and this 248This 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 249prohibits me to work on these things full time. But I should probably get back
244back and finish this. At least have a simple version working out, so I can 250and finish this. At least have a simple version working out, so I can start
245start testing it on my machines. Fingers crossed. 🕵️‍♂️ 251testing it on my machines. Fingers crossed. 🕵️‍♂️
246 252
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 3d07072..adef7e9 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
@@ -5,21 +5,20 @@ date: 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 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. 9GitHub only as a mirror. As a result, I constantly forget to push to GitHub.
10 10
11To push to multiple origins at once in Git, you can create a custom Git alias 11To push to multiple origins at once in Git, you can create a custom Git alias or
12or use a script to automate the process. Here's an example of how you can 12use a script to automate the process. Here's an example of how you can achieve
13achieve this using a Git alias: 13this using a Git alias:
14 14
15```sh 15```sh
16git 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"'
17``` 17```
18 18
19This command creates a Git alias called `pushall` which, when executed, will 19This command creates a Git alias called `pushall` which, when executed, will
20push the changes to all the remote repositories associated with the current 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 21repository. To use it, simply run `git pushall` instead of `git push` when you
22you want to push to all the remote repositories at once. 22want to push to all the remote repositories at once.
23 23
24That'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 6b73bb1..fb8add2 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
@@ -5,72 +5,69 @@ date: 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 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 9easy to feel burnt out or disinterested. I have lost the passion for coding over
10over the past couple of months and it looked like I will never enjoy the 10the past couple of months and it looked like I will never enjoy the coding as
11coding as much as I did. 11much as I did.
12 12
13I was feeling burnt out with programming. I thought taking a break from it 13I was feeling burnt out with programming. I thought taking a break from it and
14and focusing on other activities that I enjoy might be helpful. This way, I 14focusing on other activities that I enjoy might be helpful. This way, I could
15could come back to programming with a fresh perspective and renewed energy. 15come back to programming with a fresh perspective and renewed energy. I also
16I also thought about learning a new programming language or technology to 16thought about learning a new programming language or technology to keep things
17keep things interesting and challenging. 17interesting and challenging.
18 18
19However, what I didn't realize was that learning a new language or technology 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 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. 21re-evaluate why I had lost my passion for programming in the first place. This
22This involved taking a deep look into what I was doing that resulted in 22involved taking a deep look into what I was doing that resulted in this rut.
23this rut.
24 23
25Sometimes, it's easy to get caught up in the hype of new technologies or 24Sometimes, 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 25languages, 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 26learning and experimenting. However, it's important to remember that the latest
28latest and greatest isn't always the best fit for our projects or our 27and 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 28interests. 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 29to focus on what truly interests us and what we're passionate about. This can
31can help us stay motivated and engaged with our work, rather than feeling 30help us stay motivated and engaged with our work, rather than feeling like we're
32like we're just going through the motions. 31just going through the motions.
33 32
34I expressed that I had lost my passion for coding over the past couple of 33I 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 34months, 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 35myself too thin and not focus on completing interesting projects. In order to
37to regain my passion for coding, I need to focus on projects that truly 36regain my passion for coding, I need to focus on projects that truly interest me
38interest me and give me a sense of purpose and motivation. 37and give me a sense of purpose and motivation.
39 38
40Recently, I have been playing World of Warcraft more frequently and have 39Recently, I have been playing World of Warcraft more frequently and have become
41become interested in developing addons for the game. 40interested in developing addons for the game.
42 41
43This quickly resulted in me creating three addons that improve the quality 42This quickly resulted in me creating three addons that improve the quality of
44of life, and I subsequently developed a more useful add-on that encapsulates 43life, and I subsequently developed a more useful add-on that encapsulates all
45all the others I made. 44the others I made.
46 45
47I found it interesting that this action sparked a new interest in me. 46I found it interesting that this action sparked a new interest in me.
48Additionally, I discovered the Lua language, which reminded me that coding 47Additionally, I discovered the Lua language, which reminded me that coding
49should be fun rather than just a struggle with a language. It should be 48should be fun rather than just a struggle with a language. It should be pure,
50pure, unadulterated fun. 49unadulterated fun.
51 50
52I wasn't fighting the syntax, nor was I focused on finding the most optimal 51I 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 52solution. I simply created things without the pressure of making them the best
54best they could possibly be. 53they could possibly be.
55 54
56This made me realize that I actually adore simple languages that get out of 55This made me realize that I actually adore simple languages that get out of the
57the way and let you express what you want to do. It forced me to rethink a 56way and let you express what you want to do. It forced me to rethink a lot about
58lot about what I use and what I actually enjoy. 57what I use and what I actually enjoy.
59 58
60I have decided to stick to the basics. For a scripting language, I will use 59I 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 60Lua. For networking, I will use Golang. And for any special needs, I will rely
62rely on C. I do not require Rust, Nim, or Zig. This selection is more than 61on C. I do not require Rust, Nim, or Zig. This selection is more than sufficient
63sufficient for my needs. I have to stay true to this simplicity. There is 62for my needs. I have to stay true to this simplicity. There is something to the
64something to the Occam's Razor. 63Occam's Razor.
65 64
66I've been struggling with a lack of creativity lately, but now I'm experiencing 65I'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 66a 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 67to 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 68needed some time. Looking back, I don't think I've taken any significant time
70off in the last 10 years. 69off in the last 10 years.
71 70
72Suddenly, I find myself with the energy and passion to complete multiple 71Suddenly, I find myself with the energy and passion to complete multiple small
73small projects. It doesn't feel like a chore at all. Who knew I needed WoW 72projects. It doesn't feel like a chore at all. Who knew I needed WoW to
74to kickstart everything. Inspiration really does come from the strangest 73kickstart everything. Inspiration really does come from the strangest places.
75places.
76
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 f5240da..ead4276 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
@@ -5,37 +5,38 @@ date: 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 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 9like this editor and wanted to write something here that will remind me to use
10use it again in a while when/if it becomes available for Linux. 10it again in a while when/if it becomes available for Linux.
11 11
12**TLDR:** I think this code editor is very cool and has a massive potential. 12**TLDR:** I think this code editor is very cool and has a massive potential. I
13I hope they don’t mess up with adding a plugin ecosystem to it! 13hope they don’t mess up with adding a plugin ecosystem to it!
14 14
15Out of morbid curiosity, I started using the [Zed editor](https://zed.dev/) 15Out of morbid curiosity, I started using the [Zed editor](https://zed.dev/) on
16on my Mac. Zed is a high-performance, multiplayer code editor developed by 16my Mac. Zed is a high-performance, multiplayer code editor developed by the
17the creators of Atom and Tree-sitter. Written in Rust so it has to be 17creators of Atom and Tree-sitter. Written in Rust so it has to be blazingly
18blazingly fast! 😊 It's a joke, calm down. 18fast! 😊 It's a joke, calm down.
19 19
20Over the past year, I have switched between [Helix editor](https://helix-editor.com/) 20Over the past year, I have switched between [Helix
21and [VS Code](https://code.visualstudio.com/), but for the last couple of 21editor](https://helix-editor.com/) and [VS
22months, I have been using Helix exclusively. 22Code](https://code.visualstudio.com/), but for the last couple of months, I have
23been using Helix exclusively.
23 24
24I've been genuinely impressed by Zed. When you open a file, it automatically 25I'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). 26detects its type and downloads the corresponding [LSP (language
26The list of supported languages is not extensive, but it's still impressive. 27server)](https://en.wikipedia.org/wiki/Language_Server_Protocol). The list of
27It's a great example of how to create a product that stays out of your way. 28supported languages is not extensive, but it's still impressive. It's a great
29example of how to create a product that stays out of your way.
28 30
29![Zed 1](/assets/zed/zed-1.png?style=bigimg) 31![Zed editor](/assets/zed/zed-1.png?style=bigimg)
30 32
31For C development it downloaded [clangd](https://clangd.llvm.org/) and setting 33For C development it downloaded [clangd](https://clangd.llvm.org/) and setting
32up missing dependencies in code was rather easy. For this project I use 34up 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 35[SDL2](https://www.libsdl.org/) for rendering terminal emulator. It’s a hobby
34hobby project, don’t worry about it. 36project, don’t worry about it.
35 37
36If you are going to give this a try and you are using C, I suggest checking 38If you are going to give this a try and you are using C, I suggest checking two
37two files in the root of your project folder. If you don't have them, 39files in the root of your project folder. If you don't have them, create them.
38create them.
39 40
40**compile_flags.txt** 41**compile_flags.txt**
41 42
@@ -44,10 +45,9 @@ create them.
44-I/opt/homebrew/include/SDL2 45-I/opt/homebrew/include/SDL2
45``` 46```
46 47
47Easy way of checking what the appropriate includes for a specific library is 48Easy way of checking what the appropriate includes for a specific library is to
48to use `pkg-config` and in my case `pkg-config SDL2 --cflags-only-I`. But this 49use `pkg-config` and in my case `pkg-config SDL2 --cflags-only-I`. But this is
49is nothing new to C/C++ devs. Just a noter for people who are using Visual 50nothing new to C/C++ devs. Just a noter for people who are using Visual Studio.
50Studio.
51 51
52**.clang-format** 52**.clang-format**
53 53
@@ -58,31 +58,30 @@ BasedOnStyle: Mozilla
58 58
59I 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.
60 60
61They really have something special here. Although there is no version available 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, 62for Linux yet, I will stick to Helix. This impressive piece of engineering is,
63above all, an amazing example of craftsmanship. 63above all, an amazing example of craftsmanship.
64 64
65They have a bunch of amazing integrated functionalities like live desktop 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 66sharing, code sharing in a live coding session. There is a lot of pretentious
67marketing speak there but the product is still amazing! 67marketing speak there but the product is still amazing!
68 68
69For me the speed and the simplicity of the product was the most impressive 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. 70thing. You get that: it just works feeling. A rare thing in 2023.
71 71
72![Zed 2](/assets/zed/zed-2.png?style=bigimg) 72![Zed editor](/assets/zed/zed-2.png?style=bigimg)
73 73
74They also managed to add [Github Copilot](https://github.com/features/copilot) 74They also managed to add [Github Copilot](https://github.com/features/copilot)
75in a non obtrusive way. To me, everything feels very intentional and 75in a non obtrusive way. To me, everything feels very intentional and
76specifically selected. It's minimal yet maximally effective. 76specifically selected. It's minimal yet maximally effective.
77 77
78<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>
79 79
80It is a perfect balance between VS Code, Jetbrains IDE’s and something like 80It is a perfect balance between VS Code, Jetbrains IDE’s and something like VIM
81VIM or Helix. 81or Helix.
82 82
83I just hope they **DON’T** add plugin support and keep it like it is. They as a 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 84vendor should add stuff to it with great deliberation and thought. And this way
85way the product will stay fast and focused. That’s my two cents. 85the product will stay fast and focused. That’s my two cents.
86 86
87Amazing 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 e1e45e8..16739de 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
@@ -7,66 +7,65 @@ type: posts
7tags: [] 7tags: []
8--- 8---
9 9
10I have been using some approximation of [Git Flow](https://jeffkreeftmeijer.com/git-flow/) 10I have been using some approximation of [Git
11for years now and never really questioned it to be honest. When I create a repo 11Flow](https://jeffkreeftmeijer.com/git-flow/) for years now and never really
12I create develop branch and set it as default one and then merge to master 12questioned it to be honest. When I create a repo I create develop branch and set
13from there. Seems reasonable enough. 13it as default one and then merge to master from there. Seems reasonable enough.
14 14
15One thing that I have learned is that long living branches are the devil. 15One thing that I have learned is that long living branches are the devil. They
16They always end up making a huge mess when they need to be merged eventually 16always end up making a huge mess when they need to be merged eventually into
17into master. So by that reason, what is the develop branch if not the longest 17master. So by that reason, what is the develop branch if not the longest living
18living feature branch. And from my personal experience there was never a 18feature branch. And from my personal experience there was never a situation
19situation where I wasn’t sweating bullets when I had to merge develop back 19where I wasn’t sweating bullets when I had to merge develop back to master.
20to master.
21 20
22This realisation started to give me pause. So why the hell am I doing this, 21This realisation started to give me pause. So why the hell am I doing this, and
23and is there a better way. Well the solution was always there. And it comes 22is there a better way. Well the solution was always there. And it comes in a
24in a form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). 23form of [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging).
25 24
26So what are git tags? Git tags are references to specific points in a Git 25So 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 26repository's history. They are used to mark important milestones, such as
28releases or significant commits, making it easier to identify and access 27releases or significant commits, making it easier to identify and access
29specific versions of a project. 28specific versions of a project.
30 29
31Somehow we have all hijacked the meaning of the master branch that it has 30Somehow we have all hijacked the meaning of the master branch that it has to be
32to be the most releasable version of code. And this is also where the confusing 31the most releasable version of code. And this is also where the confusing about
33about versioning the software kicks in. Because master branch implicitly says 32versioning the software kicks in. Because master branch implicitly says that we
34that we are dealing with the rolling release type of a software. And by having 33are dealing with the rolling release type of a software. And by having a develop
35a develop branch we are hacking around this confusion. With a separation of 34branch we are hacking around this confusion. With a separation of develop and
36develop and master we lock functionalities into place and forcing a stable 35master we lock functionalities into place and forcing a stable vs development
37vs development version of the software. 36version of the software.
38 37
39But if that is true and the long living branches are the devil then why have 38But 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 39develop at all. I think that most of this comes to how continuous integration is
41is being done. There usually is no granular access to tags and CD software 40being done. There usually is no granular access to tags and CD software deploys
42deploys what is present on a specific branch, may that be master for production 41what is present on a specific branch, may that be master for production and
43and develop for staging. This is a gross simplification and by having this 42develop for staging. This is a gross simplification and by having this in place
44in place we have completely removed tagging as a viable option to create a 43we have completely removed tagging as a viable option to create a fix point in
45fix point in software cycle that says, this is the production ready code. 44software cycle that says, this is the production ready code.
46 45
47One cool thing about tags are that you can checkout a specific tag. So they 46One 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 47behave very similarly as branches in that regard. And you don’t have the
49overhead of having two mainstream branches. 48overhead of having two mainstream branches.
50 49
51So what is the solution? One approach is to use development workflow, where 50So what is the solution? One approach is to use development workflow, where all
52all changes are made on the smaller branches and continuously merged into 51changes are made on the smaller branches and continuously merged into
53master. Where the software is ready to be pushed to production you tag the 52master. 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 53master branch. This approach eliminates the need for long-lived branches and
55simplifies the development process. It also encourages developers to make 54simplifies the development process. It also encourages developers to make small,
56small, incremental changes that can be tested and deployed quickly. However, 55incremental changes that can be tested and deployed quickly. However, this
57this approach may not be suitable for all projects or teams that heavily rely 56approach may not be suitable for all projects or teams that heavily rely on
58on automated deployment based on branch names only. 57automated deployment based on branch names only.
59 58
60This also requires that developers always keep production in mind. No more 59This 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 60living on an island of the develop branch. All your actions and code need to be
62be ready to meet production standards on a much smaller timescale. 61ready to meet production standards on a much smaller timescale.
63 62
64I think that we have complicated the workflow in an honest attempt to make 63I 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 64things more streamlined but in the process of doing this, we have inadvertently
66made our lives much more complicated. 65made our lives much more complicated.
67 66
68In conclusion, it's important to re-evaluate our workflows from time to time 67In conclusion, it's important to re-evaluate our workflows from time to time to
69to see if they still make sense and if there are better alternatives available. 68see if they still make sense and if there are better alternatives available.
70Long-living branches can be problematic, and using tags to mark important 69Long-living branches can be problematic, and using tags to mark important
71milestones can simplify the development process. 70milestones can simplify the development process.
72 71
diff --git a/content/posts/2023-05-31-re-inventing-task-runner-that-i-actually-used-daily.md b/content/posts/2023-05-31-re-inventing-task-runner-that-i-actually-used-daily.md
index 17fdaf6..1abfd1e 100644
--- a/content/posts/2023-05-31-re-inventing-task-runner-that-i-actually-used-daily.md
+++ b/content/posts/2023-05-31-re-inventing-task-runner-that-i-actually-used-daily.md
@@ -5,55 +5,49 @@ date: 2023-05-31T12:21:10+02:00
5draft: false 5draft: false
6--- 6---
7 7
8Couple of months ago I had this brilliant idea of re-inventing the wheel 8Couple of months ago I had this brilliant idea of re-inventing the wheel by
9by making an alternative for make. And so I went. Boldly into the 9making an alternative for make. And so I went. Boldly into the battle. And to my
10battle. And to my big surprise my attempt resulted in not a completely 10big surprise my attempt resulted in not a completely useless piece of software.
11useless piece of software. 11
12 12My initial requirements were quite simple but soon grow into something more
13My initial requirements were quite simple but soon grow into something 13ambitious. And looking back I should have stuck to the simple version. My
14more ambitious. And looking back I should have stuck to the simple 14laziness was on my side this time though. Because I haven’t implemented some of
15version. My laziness was on my side this time though. Because I haven’t 15the features I now realise I really didn’t need them and they would bog the
16implemented some of the features I now realise I really didn’t need them 16whole program and make it be something it was never meant to be.
17and they would bog the whole program and make it be something it was
18never meant to be.
19 17
20My basic requirements were following: 18My basic requirements were following:
21 19
22- Syntax should be a tiny bit inspired by Rake and Rakefiles. 20- Syntax should be a tiny bit inspired by Rake and Rakefiles.
23- Should borrow the overall feel of a unit test experience. 21- Should borrow the overall feel of a unit test experience.
24- Using something like Python would be a bit of an overkill. 22- Using something like Python would be a bit of an overkill.
25- The program must be statically compiled, so it can run on same 23- The program must be statically compiled, so it can run on same architecture
26 architecture without libc, musl dependencies or things like that. 24 without libc, musl dependencies or things like that.
27- Install ruby for rake is a bit overkill and can not be done 25- Install ruby for rake is a bit overkill and can not be done with certain
28 with certain really lightweight distributions like Alpine 26 really lightweight distributions like Alpine Linux. This tool would be usable
29 Linux. This tool would be usable on such lightweight systems 27 on such lightweight systems for remote debugging.
30 for remote debugging. 28- I want to use it for more than just compiling things. I want to use it as an
31- I want to use it for more than just compiling things. I want to 29 entry-point into a project, and I want this to help me indirectly document the
32 use it as an entry-point into a project, and I want this to 30 project as well.
33 help me indirectly document the project as well. 31- It should be an abstraction over bash shell or the default system shell.
34- It should be an abstraction over bash shell or the default
35 system shell.
36 - Each task essentially becomes its own shell instance. 32 - Each task essentially becomes its own shell instance.
37- Must work on Linux and macOS systems. 33- Must work on Linux and macOS systems.
38- By default, running `erd` list all the available tasks (when 34- By default, running `erd` list all the available tasks (when I use make, I
39 I use make, I usually put a disclaimer that you should check 35 usually put a disclaimer that you should check Makefile to see all available
40 Makefile to see all available target). 36 target).
41- Should support passing arguments when you run it from a shell. 37- Should support passing arguments when you run it from a shell.
42- Normal variable as the same as environmental variables. There 38- Normal variable as the same as environmental variables. There is no
43 is no distinction. Every variable is also essentially an 39 distinction. Every variable is also essentially an environment variable and
44 environment variable and can be used by other programs. 40 can be used by other programs.
45- State between tasks is not shared, and this makes this “pure” 41- State between tasks is not shared, and this makes this “pure” shell instances.
46 shell instances. 42- Should be single-threaded for the start and later expanded with `@spawn`
47- Should be single-threaded for the start and later expanded 43 command.
48 with `@spawn` command.
49- Variables behave like macros and are preprocessed before evaluation. 44- Variables behave like macros and are preprocessed before evaluation.
50- Should support something like `assure` that would check if 45- Should support something like `assure` that would check if programs like C
51 programs like C compiler or Python (whatever the project 46 compiler or Python (whatever the project requires) are installed on a machine.
52 requires) are installed on a machine.
53 47
54Quite a reasonable list of requirements. I do this things already in my 48Quite a reasonable list of requirements. I do this things already in my
55Makefiles or/and Bash scripts. But I would like to avoid repeating 49Makefiles or/and Bash scripts. But I would like to avoid repeating myself every
56myself every time I start working on something new. 50time I start working on something new.
57 51
58So I started with the following syntax. 52So I started with the following syntax.
59 53
@@ -111,13 +105,12 @@ end
111end 105end
112``` 106```
113 107
114One thing that I really like about Errand. Yes, this is what it is 108One thing that I really like about Errand. Yes, this is what it is called. And
115called. And it is available at 109it is available at https://git.mitjafelicijan.com/errand.git/about/. Moving
116https://git.mitjafelicijan.com/errand.git/about/. Moving on. One thing 110on. One thing that I really like is that a task is a persistent shell. By that I
117that I really like is that a task is a persistent shell. By that I mean, 111mean, that the whole task, even if it contains multiple command in one shell.
118that the whole task, even if it contains multiple command in one shell. 112In make each line in a target is that and you need to combine lines or add `\`
119In make each line in a target is that and you need to combine lines or 113at the end of the line.
120add `\` at the end of the line.
121 114
122```bash 115```bash
123# How you do this things in make. 116# How you do this things in make.
@@ -126,43 +119,40 @@ target:
126 python script.py 119 python script.py
127``` 120```
128 121
129This solves this problem. Consider each task and what is being executed 122This solves this problem. Consider each task and what is being executed in that
130in that task a shell that will only close when all the tasks are 123task a shell that will only close when all the tasks are completed.
131completed. 124
132 125By self-documenting I mean that if you are in a directory with `Errandfile` in,
133By self-documenting I mean that if you are in a directory with 126if you only type `erd` and press enter it should by default display all the
134`Errandfile` in, if you only type `erd` and press enter it should by 127possible targets. In make i was doing this by having a first target be something
135default display all the possible targets. In make i was doing this by 128like `default` that echos the message “Check Makefile for all available target.”
136having a first target be something like `default` that echos the message 129Because all of the tasks in Errand require a message I use that to display let’s
137“Check Makefile for all available target.” Because all of the tasks in 130call it table of contents.
138Errand require a message I use that to display let’s call it table of 131
139contents. 132Because I don’t use any external dependencies this whole thing can be statically
140 133compiled. So that also checked one of the boxes.
141Because I don’t use any external dependencies this whole thing can be 134
142statically compiled. So that also checked one of the boxes. 135It works on Linux and on a Mac so that’s also a bonus. I don’t believe this
143 136would work on Windows machines because of the way that I use shell instances. By
144It works on Linux and on a Mac so that’s also a bonus. I don’t believe 137you could use something like Windows Subsystem for Linux and run it in
145this would work on Windows machines because of the way that I use shell 138there. That is a valid option.
146instances. By you could use something like Windows Subsystem for Linux 139
147and run it in there. That is a valid option. 140To finish this essay off, how was it to use it in “real life”. I have to be
148 141honest. Some of the missing features still bother me. `@dotenv` directive is
149To finish this essay off, how was it to use it in “real life”. I have to 142still missing and I need to implement this ASAP.
150be honest. Some of the missing features still bother me. `@dotenv` 143
151directive is still missing and I need to implement this ASAP. 144Another thing that needs to happen is support for streaming output. Currently
152 145commands like `docker-compose` that runs in foreground mode is not compatible
153Another thing that needs to happen is support for streaming output. 146with Errand. So commands that stream output are an issue. I need to revisit how
154Currently commands like `docker-compose` that runs in foreground mode is 147I initiate shell and how I read stdout and stderr. But that shouldn’t be a
155not compatible with Errand. So commands that stream output are an issue. 148problem.
156I need to revisit how I initiate shell and how I read stdout and stderr. 149
157But that shouldn’t be a problem. 150I have been very satisfied with this thing. I am pleasantly surprised by how
158 151useful it is. I really wanted to test this in the wild before I commit to it. I
159I have been very satisfied with this thing. I am pleasantly surprised by 152have more abandoned project than Google and it’s bringing a massive shame to my
160how useful it is. I really wanted to test this in the wild before I 153family at this point. So I wanted to be sure that this is even useful. And it
161commit to it. I have more abandoned project than Google and it’s 154actually is. Quite surprised at myself.
162bringing a massive shame to my family at this point. So I wanted to be 155
163sure that this is even useful. And it actually is. Quite surprised at 156I really need to package this now and write proper docs. And maybe rewrite
164myself. 157tokeniser. Its atrocious right now. Site to behold! But that is an issue for
165 158another time.
166I really need to package this now and write proper docs. And maybe
167rewrite tokeniser. Its atrocious right now. Site to behold! But that is
168an issue for another time.