<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Bogdan Cornianu’s Blog]]></title><description><![CDATA[Hi, my name is Bogdan and I'm a software developer. Welcome to my personal blog!
Here you'll find news, reviews, tutorials and how-tos on software related topics and from time to time also my thoughts on unrelated topics.]]></description><link>https://www.bogdancornianu.com</link><image><url>https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png</url><title>Bogdan Cornianu’s Blog</title><link>https://www.bogdancornianu.com</link></image><generator>Substack</generator><lastBuildDate>Fri, 03 Apr 2026 19:57:30 GMT</lastBuildDate><atom:link href="https://www.bogdancornianu.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Bogdan Cornianu]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[bogdancornianu@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[bogdancornianu@substack.com]]></itunes:email><itunes:name><![CDATA[Bogdan Cornianu]]></itunes:name></itunes:owner><itunes:author><![CDATA[Bogdan Cornianu]]></itunes:author><googleplay:owner><![CDATA[bogdancornianu@substack.com]]></googleplay:owner><googleplay:email><![CDATA[bogdancornianu@substack.com]]></googleplay:email><googleplay:author><![CDATA[Bogdan Cornianu]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Vim for everyday use]]></title><description><![CDATA[Prologue: edit, save and exit!]]></description><link>https://www.bogdancornianu.com/p/vim-for-everyday-use</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/vim-for-everyday-use</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Sun, 10 Oct 2021 09:05:24 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<ol><li><p><a href="#prologue">Prologue: edit, save and exit!</a></p></li><li><p><a href="#introduction">Introduction</a></p></li><li><p><a href="#modes">Modes</a></p></li><li><p><a href="#navigation">Navigation</a></p></li><li><p><a href="#editing">Editing</a></p></li><li><p><a href="#search">Search</a></p></li><li><p><a href="#commands">Useful commands</a></p></li><li><p><a href="#customization">Customization</a></p></li><li><p><a href="#conclusion">Conclusion</a></p></li></ol><h2>Prologue: edit, save and exit!</h2><p>Edit a file with Vim: <br>1.<strong> <code>vim &lt;filename&gt;</code></strong><br>2. Press <strong><code>i</code></strong><br>3. Make your changes</p><p>Saving in Vim: <br>1. Press <strong><code>ESC</code></strong><br>2. Press <strong><code>:</code></strong><br>3. Type<strong> <code>w</code></strong></p><p>Exit Vim:<br>1. Press <strong><code>ESC</code></strong><br>2. Press <strong><code>:</code></strong><br>3. Type <strong><code>q!</code></strong></p><h2>Introduction</h2><p>When using Vim I often find myself trying to remember how to do various things: how do you comment on multiple lines of code? what&#8217;s the shortcut for undo? what was the command for setting line numbers? With this post, I&#8217;m trying to gather all this information in one place so I can easily find it at a later date and hope that it will be useful to you too.</p><p>Vim is a clone of Vi and stands for <strong><a href="https://en.wikipedia.org/wiki/Vi">Vi</a> IMproved</strong>. It was written by <a href="https://en.wikipedia.org/wiki/Bram_Moolenaar">Bram Moolenaar</a> and released to the public in 1991. Vi itself was written as a visual editor for the <a href="https://en.wikipedia.org/wiki/Ex_(text_editor)">ex</a> line editor which in turn was inspired by <a href="https://en.wikipedia.org/wiki/Ed_(text_editor)">ed</a>. Ed was the line editor on the Unix operating system.</p><p>You might be wondering what is a line editor and how is it different from a text editor?<br>A line editor is a limited text editor; limited in the sense that you edit the text but you don&#8217;t see the result immediately because there&#8217;s no monitor to output the text. It was used especially on teletypes (which are printers with keyboards) that had no video display and therefore no ability to interactively move a cursor or see the result of your editing, unlike a screen-based text editor.</p><h2>Modes</h2><p>Vim has several modes, in which characters that you type have different meanings.</p><ul><li><p>Normal</p><ul><li><p>this is the default mode</p></li><li><p>can be accessed by pressing <strong><code>ESC</code> </strong>or <strong><code>CTRL-[</code></strong></p></li><li><p>characters typed in this mode have special meaning and are used for manipulating, searching and navigating within the text</p></li></ul></li><li><p>Insert</p><ul><li><p>can be accessed by:</p><ul><li><p>pressing <strong><code>i</code> </strong>enters insert mode before the cursor</p></li><li><p>pressing <strong><code>I</code></strong> enters insert mode at the start of the current line</p></li><li><p>pressing <strong><code>a</code></strong> enters insert mode after the cursor</p></li><li><p>pressing <strong><code>A</code></strong> enters insert mode at the end of the current line</p></li></ul></li><li><p>characters don&#8217;t have a special meaning in this mode; they appear as you type them</p></li></ul></li><li><p>Visual</p><ul><li><p>can be accessed by pressing <strong><code>v</code></strong> and will also mark a selection start point</p></li><li><p>used for making text selections</p></li><li><p>useful for copy, paste, delete, replace operations</p></li></ul></li><li><p>Command</p><ul><li><p>can be accessed by typing <strong><code>:</code></strong></p></li><li><p>a prompt appears at the bottom of the window where you can input your commands</p></li><li><p>useful for things which can&#8217;t be done easily in the normal mode</p></li></ul></li><li><p>Replace</p><ul><li><p>easily replace text by writing over it</p></li><li><p>from normal mode, position your cursor over the first character that you want to replace; press <code>R</code> and start typing your text; when done, press <strong><code>ESC</code></strong></p></li></ul></li></ul><h2>Navigation</h2><h2>Editing</h2><h2>Search</h2><h2>Useful commands</h2><p><strong>Find and replace</strong><br><strong><code>:%s/foo/bar/g</code></strong><br><strong><code>:</code></strong> enter command mode<br><strong><code>%</code></strong> search across all lines (optional)<br><strong><code>/foo</code></strong> search for &#8220;foo&#8221;<br><strong><code>/bar</code></strong> replace with &#8220;bar&#8221;<br><strong><code>/g</code></strong> global otherwise will execute only once per line</p><p><strong>Show line number</strong><br><strong><code>:set number</code></strong><br><strong>:</strong> enter command mode<br><strong><code>set</code> </strong>builtin command<br><strong><code>number</code> </strong>option to be configured<br>There are a lot of options that can be configured. Please see <a href="https://www.shortcutfoo.com/blog/top-50-vim-configuration-options/">https://www.shortcutfoo.com/blog/top-50-vim-configuration-options/</a> for a more complete list.</p><p><strong>Comment / uncomment multiple lines</strong><br>Comment:<br>Go to the first line you want to comment. Press <strong><code>CTRL-v</code></strong> and use the arrow key to select until the last line you want to comment. Press<strong> <code>SHIFT-i</code></strong> and then write your comment character (<strong><code>#</code></strong> for Python, <strong><code>//</code></strong> for C, C++, etc.). Press <strong><code>ESC</code> </strong>to exit visual mode.</p><p>Uncomment:<br>Go to the first line you want to uncomment. Press <strong><code>CTRL-v</code></strong> and use the arrow keys to select all the lines you want to uncomment. Press <strong><code>d</code></strong> to delete characters and then press <strong><code>ESC</code></strong>.</p><h2>Customization</h2><p>You can create a <strong><code>.vimrc</code></strong> file in your home directory and add various configuration options which will be applied to Vim.<br>For an example of what a <strong><code>vimrc</code></strong> file looks like, please see <a href="https://vim.fandom.com/wiki/Example_vimrc">https://vim.fandom.com/wiki/Example_vimrc</a></p><h2>Conclusion</h2><p>Vim can be confusing if you&#8217;re used to text editors like nano, joe, notepad. I think it&#8217;s confusing because it has different modes which are specialized for different things. This is Vim&#8217;s greatest power and also its weakness because if you don&#8217;t take the time to get comfortable with this modes, you&#8217;ll be lost and frustrated.</p><p>I tried to summarize the most useful commands and shortcuts for making it easier to edit text in Vim. However, there&#8217;s a lot more power to Vim and several books have been written to show this like &#8220;Practical Vim&#8221; by Drew Neil, &#8220;Pro Vim&#8221; by Mark McDonnell, and others.</p><p>If you have any favorite shortcuts or snippets please let me know in the comments.<br>Thank you!</p>]]></content:encoded></item><item><title><![CDATA[A possible solution for no sound in Firefox on Ubuntu]]></title><description><![CDATA[For the last couple of days I was having a weird issue with Firefox on Ubuntu, namely there was no sound.]]></description><link>https://www.bogdancornianu.com/p/a-possible-solution-for-no-sound-in-firefox-on-ubuntu</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/a-possible-solution-for-no-sound-in-firefox-on-ubuntu</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Sun, 07 Feb 2021 11:58:35 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>For the last couple of days I was having a weird issue with Firefox on Ubuntu, namely there was no sound.</p><p>After searching all over the Internet and trying different solutions I finally found one that worked and I wanted to share it with you in case you find yourself in the same situation.</p><p><strong>Note:</strong> before running the following command, please make sure you have a backup of your data!</p><p>Run this command in a terminal:</p><pre><code>rm ~/.config/pulse/*
</code></pre><p>And restart your computer.</p><p>You should now have a working sound in Firefox.</p>]]></content:encoded></item><item><title><![CDATA[How to get environment variables from a running process in Linux]]></title><description><![CDATA[In Linux, everything is a file.]]></description><link>https://www.bogdancornianu.com/p/how-to-get-environment-variables-from-a-running-process-in-linux</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/how-to-get-environment-variables-from-a-running-process-in-linux</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Sun, 04 Oct 2020 10:24:57 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Linux, everything is a file. Even running processes are represented as files. You will find all the running processes in <code>/proc/</code>, with a separate directory for each process id.</p><pre><code>ps aux | grep [process name]  # to get the process ID
cat /proc/[process ID]/environ | tr '\0' '\n'
</code></pre><p>What the above commands do, is:</p><ul><li><p>Get the id of a process by name</p></li><li><p>print the contents of the &#8220;environ&#8221; file for that process</p></li><li><p>print each environment variable on a new line; <code>tr</code> stands for &#8220;translate&#8221;</p></li></ul><p></p>]]></content:encoded></item><item><title><![CDATA[SQL Database Course]]></title><description><![CDATA[I&#8217;ve recently finished a great database course &#8220;Mastery with SQL&#8221; which I recommend to anyone interested in learning modern SQL as well as some specific PostgreSQL features.]]></description><link>https://www.bogdancornianu.com/p/sql-database-course</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/sql-database-course</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Mon, 08 Jun 2020 14:16:56 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>I&#8217;ve recently finished a great database course &#8220;<a href="https://www.masterywithsql.com/">Mastery with SQL</a>&#8221; which I recommend to anyone interested in learning modern SQL as well as some specific PostgreSQL features.</p><p>It starts with the SQL fundamentals and builds up all the way to window functions, views and query performance optimizations.</p><p>Although it isn&#8217;t free, I&#8217;ve learned a lot from finishing this course and I consider it is well worth the money.</p>]]></content:encoded></item><item><title><![CDATA[Swave audio player library]]></title><description><![CDATA[Together with Cosmin Seviciu, we built a JavaScript audio player library with visualizations.]]></description><link>https://www.bogdancornianu.com/p/swave-audio-player-library</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/swave-audio-player-library</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Sat, 10 Aug 2019 09:59:38 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Together with Cosmin Seviciu, we built a JavaScript audio player library with visualizations.</p><p>Swave uses <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API">Web Audio APIs</a> for visualizations, <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement">HTMLAudioElement</a> for audio streaming and a <a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API">Canvas</a> element to draw the sound bars.</p><p>Live Demo: <a href="https://bogdan-cornianu.github.io/swave/examples/">https://bogdan-cornianu.github.io/swave/examples/</a><br>Source code <a href="https://github.com/bogdan-cornianu/swave">https://github.com/bogdan-cornianu/swave</a><br>NPM package <a href="https://www.npmjs.com/package/swave">https://www.npmjs.com/package/swave</a></p>]]></content:encoded></item><item><title><![CDATA[Book Review: Level Up! The Guide to Great Video Game Design, 2nd Edition]]></title><description><![CDATA[If you ever wanted to make a video game, it is pretty easy nowadays having game engines and game development environments such as Unity 3D and Unreal Engine being free.]]></description><link>https://www.bogdancornianu.com/p/book-review-level-up-the-guide-to-great-video-game-design-2nd-edition</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/book-review-level-up-the-guide-to-great-video-game-design-2nd-edition</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Wed, 09 Jan 2019 15:59:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>If you ever wanted to make a video game, it is pretty easy nowadays having game engines and game development environments such as Unity 3D and Unreal Engine being free. There are also a lot of tutorials and documentation on how to use them.</p><p>When it comes to game design, there aren&#8217;t as many resources. In my opinion, one of the best book to learn about game design is &#8220;Level Up! The Guide to Great Video Game Design, 2nd Edition&#8221; by Scott Rogers.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nJ_C!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nJ_C!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nJ_C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg" width="245" height="309" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:309,&quot;width&quot;:245,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!nJ_C!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 424w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 848w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!nJ_C!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffed92db9-08fb-4153-ac2b-aadbbeefc47f_239x300.jpeg 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The chapters in the book are called levels and as you progress through the book you level up, just like in a game. There are 18 levels and some bonus material. The bonus material contains, among others, a game design template, a list of mechanics and hazards, a list of game genres, a list of possible game environments.</p><p>You will learn why story is important for the gameplay, and how too much will ruin it. The game design document is an important part of the game design process and should be the first thing you do. You will learn about the three Cs: Character, Camera, Controls and how to best use each one of them to make a great game experience. For example, the way your hero looks, and everything he does is shaped by his personality. If your hero is funny, then his looks should reflect that. A very important advice in the book being, &#8220;Form follows function&#8221;.</p><p>Designing a game level is easy once you know how to create enemies, where to place them and how to guide the player. Power-ups will spice your gameplay, but you should use them wisely, they are more of a balancing act.</p><p>I recommend this book to anyone interested in creating video games or anyone who is curious about what goes into making a game. It is not a technical book, there are no code samples. The books isn&#8217;t meant for a specific game genre, it has a general approach and you&#8217;ll have to customize the solutions to your specific needs.</p>]]></content:encoded></item><item><title><![CDATA[How to investigate Ubuntu slow boot]]></title><description><![CDATA[Investigating why Ubuntu boots slowly can be difficult.]]></description><link>https://www.bogdancornianu.com/p/how-to-investigate-ubuntu-slow-boot</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/how-to-investigate-ubuntu-slow-boot</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Thu, 13 Dec 2018 04:22:30 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/87e6c2d1-ad96-449f-8b74-b014a8935544_300x169.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Investigating why Ubuntu boots slowly can be difficult. There are a lot of things that can go wrong: a lingering service, a bad config file, a wrong disk uuid in fstab and others.</p><p>In my opinion the easiest way to start is by using &#8220;systemd-analyze&#8221; which is part of systemd.<br>Since version 15.04, Ubuntu has switched from upstart to systemd as the default system and service manager. Systemd is not something specific to Ubuntu, but rather an industry standard that other major distributions have adopted as well: Debian, Fedora and CentOS to name a few.<br>&#8220;systemd-analyze&#8221; gives us information about what programs are run on startup and how much time they need to start.<br></p><p>There are around a dozen options that we can use from systemd-analyze to see where the startup bottleneck is. But from a time perspective we&#8217;re only interested in a few of them (to see the rest of the options available you can run &#8220;man systemd-analyze&#8221; in a terminal):<br></p><p>The options that we are interested in are:</p><ul><li><p><a href="#plot-command">plot</a></p></li><li><p><a href="#time-command">time</a></p></li><li><p><a href="#blame-command">blame</a></p></li><li><p><a href="#critical-chain-command">critical-chain</a></p></li></ul><h3><em>plot<strong>&nbsp;</strong></em></h3><p>Outputs the svg code with all the started services, their dependencies and how long it took for them to start.</p><p>For a better visualization you can pipe the output to an svg file and then open it with an image viewer:<br></p><pre><code>$ systemd-analyze plot &gt; init.svg</code></pre><p><br>You should be looking for long red bars. These bars represent the time it took for that process to start.<br></p><p>When opening the generated svg, you should see something similiar to</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CjlQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CjlQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 424w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 848w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 1272w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CjlQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png" width="700" height="394" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:394,&quot;width&quot;:700,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:null,&quot;alt&quot;:&quot;systemd-analyze plot&quot;,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="systemd-analyze plot" title="systemd-analyze plot" srcset="https://substackcdn.com/image/fetch/$s_!CjlQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 424w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 848w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 1272w, https://substackcdn.com/image/fetch/$s_!CjlQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbd1eb1f5-01b6-4b18-8d3a-5aae3806a546_300x169.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h3><em>time</em></h3><p>Shows the amount of time spent after the bootloader has given control to the kernel up until the userspace finished initialization.</p><pre><code>$ systemd-analyze time
Startup finished in 7.541s (firmware) + 5.696s (loader) + 4.053s (kernel) + 8.206s (userspace) = 25.498sgraphical.target reached after 8.068s in userspace</code></pre><p><br>The values in this example are for my laptop which has an i7 processor, 16GB of RAM and a 512GB SSD.<br>If you use an older system, you may not see the firmware data as this is available only for EFI/UEFI systems.<br>If a lot of time is spent in <em><strong>firmware</strong></em>, there might be an hardware issue.<br>Time in <em><strong>loader</strong></em> is the time needed by your bootloader, typically Grub. If a considerable amount of time is spent here it might mean that the bootloader can&#8217;t find some disks or maybe some kernel boot parameters are wrong.<br><em><strong>Kernel</strong></em> time is used for loading drivers and other initializations. After the kernel finished its startup it will launch the init process (which usually has the id 1).<br>The init process, in our case is systemd and represents time spent in <em><strong>userspace</strong></em>.</p><h3><em>blame</em></h3><p>Displays an ordered list of services, from slowest to fastest.</p><pre><code>$ systemd-analyze blame
6.272s NetworkManager-wait-online.service
          2.998s plymouth-quit-wait.service
           930ms dev-sda6.device
           795ms fwupd.service
           632ms snapd.service
           547ms motd-news.service
           449ms plymouth-start.service
           396ms NetworkManager.service
           325ms upower.service
           274ms systemd-logind.service
</code></pre><h3><em>critical-chain</em></h3><p>Similar to blame, but it takes into account dependencies between services. The slow starting services will be highlighted in red.</p><pre><code>$ systemd-analyze critical-chain
The time after the unit is active or started is printed after the "@" character.
The time the unit takes to start is printed after the "+" character.

graphical.target @8.068s
&#9492;&#9472;multi-user.target @8.068s
  &#9492;&#9472;kerneloops.service @8.058s +10ms
    &#9492;&#9472;network-online.target @8.056s
      &#9492;&#9472;NetworkManager-wait-online.service @1.783s +6.272s
        &#9492;&#9472;NetworkManager.service @1.385s +396ms
          &#9492;&#9472;dbus.service @1.359s
            &#9492;&#9472;basic.target @1.356s
              &#9492;&#9472;sockets.target @1.356s
                &#9492;&#9472;snapd.socket @1.354s +2ms
                  &#9492;&#9472;sysinit.target @1.354s
                    &#9492;&#9472;systemd-timesyncd.service @1.137s +215ms
                      &#9492;&#9472;systemd-tmpfiles-setup.service @1.125s +9ms
                        &#9492;&#9472;local-fs.target @1.123s
                          &#9492;&#9472;run-snapd-ns-docker.mnt.mount @2.093s
                            &#9492;&#9472;run-snapd-ns.mount @1.818s
                              &#9492;&#9472;swap.target @262ms
                                &#9492;&#9472;swapfile.swap @157ms +104ms
                                  &#9492;&#9472;systemd-remount-fs.service @147ms +7ms
                                    &#9492;&#9472;systemd-journald.socket @140ms
                                      &#9492;&#9472;system.slice @139ms
                                        &#9492;&#9472;-.slice @137ms
</code></pre><p><br>By using all this information from <em><strong>systemd-analyze</strong></em>&nbsp;we can find out what is slowing the startup process. Once we know that, we can dig deeper and get to the root of the problem.</p>]]></content:encoded></item><item><title><![CDATA[Change swap size in Ubuntu 18.04 or newer]]></title><description><![CDATA[[Updated July 26, 2020]: Change swapfile permission; Set swapfile in /etc/fstab.]]></description><link>https://www.bogdancornianu.com/p/change-swap-size-in-ubuntu</link><guid isPermaLink="false">https://www.bogdancornianu.com/p/change-swap-size-in-ubuntu</guid><dc:creator><![CDATA[Bogdan Cornianu]]></dc:creator><pubDate>Sat, 11 Aug 2018 16:57:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!po-p!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F897c0581-8faf-461e-9829-5f2caa6629bb_512x512.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>[Updated July 26, 2020]: Change swapfile permission; Set swapfile in /etc/fstab.</em></p><p>Swap is a special area on your computer, which the operating system can use as additional RAM.<br>Starting with Ubuntu 17.04, the swap partition was replaced by a swap file. The main advantage of the swap file is easy resizing.</p><p><strong>Note:</strong> before running the following commands, please make sure you have a backup of your data!</p><p>In the following example, we&#8217;ll extend the swap space available in the /swapfile from 4 GB to 8 GB.</p><ol><li><p>Turn off all swap processes</p></li></ol><pre><code>sudo swapoff -a
</code></pre><p>2. Resize the swap</p><pre><code>sudo dd if=/dev/zero of=/swapfile bs=1G count=8
</code></pre><p>if = input file<br>of = output file<br>bs = block size<br>count = multiplier of blocks</p><p>3. Change permission</p><pre><code>sudo chmod 600 /swapfile
</code></pre><p>4. Make the file usable as swap</p><pre><code>sudo mkswap /swapfile
</code></pre><p>5. Activate the swap file</p><pre><code>sudo swapon /swapfile
</code></pre><p>6. Edit /etc/fstab and add the new swapfile if it isn&#8217;t already there</p><pre><code>/swapfile none swap sw 0 0
</code></pre><p>7. Check the amount of swap available</p><pre><code>grep SwapTotal /proc/meminfo
</code></pre><p></p>]]></content:encoded></item></channel></rss>