macOS: How to render thin(ner) strokes in Alacritty

After going through omakub 1 and its source, I wanted to recreate it on macOS as much as possible. The first thing was to use Alacritty. I had tried it in the past, but moved to Wezterm. The reason I stopped was because there was no support for panes or tabs (which is by design) But now that I’m anyway using Zellij for that, I decided to give Alacritty another chance.

Continue Reading »

Django: Create new project in an existing folder

Default command for creating a new project is : django-admin startproject my_new_project Django will then create a folder called my_new_project (if it does not exist) But if folder my_new_project exists (even if empty) we get error like : CommandError: '/path/to/my_new_project' already exists The way around is to specify a folder name after the project name like django-admin startproject my_new_project existing_folder See the documentation for details.

Rust: How non-primitive types are available in the default scope

In rust, str is a primitive type, but many non-primitive types are also in scope by default. e.g. We do not need to add use statement to use Vec - which is NOT a primitive type. It comes from std::vec So Vec::new() is really std::vec::Vec::new() Vec::new() works because Rust inserts this at the beginning of every module: use std::prelude::v1::*; This makes Vec (and String, Option and Result) available by default.

Continue Reading »

How Zellij saved me

OK, title is a bit of clickbait. It saved me some inconvinence 😉 Yesterday, Wezterm crashed. At first, I was worried that all my “work” is lost (few blog posts were in-progress and open in helix) But I had forgotten that I always start zellij these days. So all my “work” was indeed there. All I had to do was zellij ls followed by zellij a my_session1 (and my_session2 and so on)

Continue Reading »

Importance of Making Things

On the knowledge project podcast, Shane parrish interviewed Kevin Kelly The link above has good high level overview with timestamps. Definitely check it out. One thing that is not covered in the timestamps (hence I can’t link to the exact conversation) is about Importance of making things 1 Kevin says something to the effect of, don’t stop making things (that you care about) just because they are not the greatest or the best.

Continue Reading »

Homework for Life

In One percent better podcast 1, Joe interviews Matthew Dicks Matthew explains the Homework for Life 2 as (paraphrased) At the end of each day, write down important “stories” (not memories) of the day. Else life passes by, and we don’t remember what you did 12 years from today. (Cause all days look the same in past) He is a teacher. He asks his students to narrate stories (on a Monday, start of the school) He mentions that 10-year olds can come up with excellent stories.

Continue Reading »

Vivaldi Browser

I switched to 1 Vivaldi browser after reading this post by Mike Kennedy To be fair, I had installed and tried Vivaldi a long time ago. But I think things got better this time around. I seem to have stuck with it for long time. One benefit of chromium based browsers (like Vivaldi) is that user has access to vast amount of extensions from Chrome Web store. 2 Just today, I explored two other “features” which I’m not sure how I feel about.

Continue Reading »

`#[cfg]` attrib vs `cfg!` macro in Rust

When I published my previous post on mastodon, Sebastian pointed out 1 that using #[cfg] is better than cfg! macro. Documentation explains that : cfg!, unlike #[cfg], does not remove any code and only evaluates to true or false. For example, all blocks in an if/else expression need to be valid when cfg! is used for the condition, regardless of what cfg! is evaluating. Thanks, Sebastian! See this thread for the original discussion.

Continue Reading »

Rust : Use println! only in Debug Build

We all know we shouldn’t use print debugging, and yet we all do 😉 1 Jokes apart, when I’m still developing the code, I use the debugger where possible. But sometimes, I want to keep certain print statements to verify runtime behaviour, especially when rolling out new feature and when there are too many variations (some of them unknown) in incoming data. I’m aware, logging is the right way to handle this (with loglevel set to debug or something), but it seems too much when developing toy projects.

Continue Reading »

`Vec::with_capacity` in Rust

At first, I assumed since we’ve declared the capacity upfront, it would be maximum capacity of the Vec Turns out, since Vec is expected to shrink and grow, as needed, there is no maximum capacity for Vec It just ensures that “sufficient” memory is allocated to the Vec, such that memory reallocation is not required. On the other hand, if you need more that what you declared with with_capacity, you will get it, but there will need to be reallocation (of memory), so it will be inefficient.

Continue Reading »