[{"content":"I was watching Miguel Grinberg\u0026rsquo;s talk on Pycon 2017 Asynchronous Python for the Complete Beginner last night. And tried a code snippet on my computer which is not really connected to the talk or async programming.\nfrom time import sleep def hello() -\u0026gt; None: print(\u0026quot;Hello\u0026quot;, end=\u0026quot; \u0026quot;) sleep(3) print(\u0026quot;World!\u0026quot;) if __name__ == \u0026quot;__main__\u0026quot;: hello() What do you think will happen if we run the code? Terminal print\u0026rsquo;s Hello first, then after three seconds we see World! appear, right? Actually, no.\nWe see the code is sleeping for 3 seconds and then Hello World! appear in the terminal. This happens because Python print function is buffered. It doesn\u0026rsquo;t show anything in terminal until it find a newline (\\n is the default value for end in print function) or the buffer get\u0026rsquo;s filled up or we force the function to flush (write in terminal from the buffer).\nfrom time import sleep def hello() -\u0026gt; None: print(\u0026quot;Hello\u0026quot;, end=\u0026quot; \u0026quot;, flush=True) sleep(3) print(\u0026quot;World!\u0026quot;) if __name__ == \u0026quot;__main__\u0026quot;: hello() This code will show Hello first and World! after three seconds as expected.\nBut what if we don\u0026rsquo;t want to change our code? We can run the code with -u flag like python -u filename.py. We can also set an enviroment variable to bypass this. If we set PYTHONUNBUFFERED to 1 with export PYTHONUNBUFFERED=1 then we can run the code as we normally do and it\u0026rsquo;ll behave as expected.\nThis is just random things that I probably never use in real life, but I found it interesting and thought I\u0026rsquo;d share.\n","permalink":"https://rozari0.github.io/posts/til-python-buffer/","title":"TIL: Python Print Buffer"},{"content":" How to fix Bengali font issue in arch Linux So, every time I reinstall Arch, I must rediscover why my Bengali font is broken everywhere. Then I install every Bengali font universe has to offer, but it still doesn\u0026rsquo;t fix shit.\nThe main problem is that gnu-noto-fonts comes as the default, which doesn\u0026rsquo;t have good support for Bengali scripts. We just have to install noto-fonts, which is an alternative to gnu-noto-fonts. We need this because most of the software we use daily requires at least one ttf-font source and this one has decent Bengali font support. And then we can remove the gnu-noto-fonts and refresh the font cache.\n1. Install noto-fonts sudo pacman -S noto-fonts 2. Remove gnu-free-fonts sudo pacman -Rns gnu-free-fonts 3. Refreshing cache fc-cache -fv Now everything should work fine; if not close your current desktop session and log-in again.\nRTFM\u0026rsquo;s:\nhttps://wiki.archlinux.org/title/Localization/Bengali ","permalink":"https://rozari0.github.io/posts/how-to-fix-bengali-font-in-arch-linux/","title":"How to fix Bengali font issue in arch Linux"}]