my workflow + note taking (linux/android) as a cs undergrad

Published 2024-08-11

dotfiles repo is here, for those with adhd-mind or too lazy to read the whole thing a tl;dr is at the end.

intro

in case you don't know i have been a linux+nvim+tmux guy for really long time. with a pretty decent typing speed (i do use a normal keyboard tho, might give these a try later), i really care about the tools and tech I use, reason: most of my time is spend infront of my laptop screen (~ daily avg of 5hrs of wakatime just in my code editor I know some of you will be there with more than mine) but anyway after yrs of tweaking and customizing things, i finally have something i can write about. before starting with my actual workflow, I would just like to share some principles on which I refine about the things to get the maximum possible efficiency,

i3

the worflow

linux distro

imagine windows. jokes aside tbh the distro doesn't really matter for me, i choose fedora cuz it just works for me, i have used arch btw, ubuntu, debian (buster, bullseye, sid) and porbably any other obsecure linux distro out there you probably could have heard of (except gentoo, i have a life lol) and can use either of them, but as said fedora just worked for me and I do NOT see any reason to move from it or reinstall something, even though I happened to have an ansible install script for my setup to bootstrap most of the things and installation, but still, i dont need to use it unless some update breaks my system, which coming to my next point..

bleeding edge but stability

just as it says, fedora has a release cycle of 6 months, and acc. to me those are cruicial and i always update to the latest versions sometimes maybe after delaying it for a week cuz sometimes there are some hotfixes, as of writing i am using fedora 40 and remember upgrading it from 38 or 39 and it was flawless.

ps many have told me about opensuse tumbelweed after reading this, let me say you i am happy with fedora, and don't see any reason to switch right now.

but RHEL ?

I don't really care, even though they are the main sponsor of the project, I kinda look it at the same way vercel is the main company behind NextJS and canonical behind ubuntu.

why not nix-os ?

i have tried nixos in the past, and the problem with (atleast what I faced) it is the way of it doing everything in it's own unique way (which i did in the past for sometime) but as I more push myself do things, i find it kinda counter productive to actually get something done and it getting in my way with it's own set of rules and configuration, i might be too old (19 btw ahem) but i priority my work and i don't want to relearn linux, i don't need the extensive collection of software (well maybe i do need coming to that later), i can just use my distro package manager dnf for most stuff and compile/build the other dev tools I need, and maybe for the rest...


yes I also got nix pkg manager in my system, and these are the packages I have installed with it. other than the nix-shell is also pretty cool.

fq-0.11.0
go-1.22.2
nix-2.21.2
signal-desktop-7.5.1
ueberzugpp-2.9.4
yazi-0.2.4
(END)

if you use an application launcher like me ln -s <pkg> /usr/bin/<pkg> is an extra step to get them in dmenu i heard rofi or other application launchers does by default but i got no idea. even tho nix is in my $PATH, I don't mind this.

window manager

i am using i3 right now, no fuzz, I have been a fan of bspwm before (back while I was using arch btw!), actually the reason I switched to i3 is funny. i was looking for just doing the terminal install of fedora (when my arch install broke with some breaking bug introduced by some annoying update uhh). i get to know that there are fedora spins available so I just downloaded the first one (happens to be i3, there was Sway but I didn't want to go with wayland just yet) which doesn't ship with a whole desktop environment, and after that it worked really well for me, that I just didn't bothered switching to anything else, but hey, if you are one of those who thinks i3 is bad, probably give it a try, regardless my bspwm and hyprland (probably a story of another time for my wayalnd experience, i didn't had nvidia in my old laptop so i tried them back then) dotfiles are also available in the repo as i has spent also pretty long time with them (those are not updated though).

shell

yet, my shell looks pretty clean though and snappy (very imp!).

shell

code editor

here comes the fun part.

neovim

my nvim dot files are again available in the repo. i should still mention tho as i am still pretty much new to nvim (yet i heavily use it) the dots are a modified version of kickstart.nvim which got me started with nvim. i plan on rewriting it from scratch some day, but that haven't happened yet. oh i also use this script stolen from ThePrimeagen to quickly launch my projects and open them with neovim and edit afterwards.

oh before you ask my wallpapers collection is avialable here.


In case you are new to these whole nvim stuff watch this playlist from again ThePrimeagen other than that, just reading the :help and :Tutor guide while getting yourself familiar with vim keybinds in general, is all you need.

tmux

I think after vim keybinds tmux has the biggest impact I have on my life, I highly recommend you trying it out and read their man page it is pretty intuitive, and even though my prefix is C-space, you might just want to keep it to C-b which is the default one. For me tho Uhh it's hard to get things out of your muscle memory isn't it ? So I just use my custom keybinds.

unbind C-b
set -g prefix C-Space
bind C-Space send-prefix

managing passwords (laptop)

I use pass which stores all my password encrypted with my gpg key in my laptop locally and later backup then in my git server past git <cmd>, I've also been using it with dmenu (my application launcher, and it's damn fast and efficient) and I'd probably never switch to any cloud based solution.

# generate a password and in clipboard (auto expires in 30 secs)
pass generate -c example.com/username

# add additional information
pass insert --multiline path/to/data

btw you can also store env variables like api keys inside pass, I do it atleast.

2fa

Even though I am using Aegis for 2FA with Recovery/Backup Codes for accounts backuped seperately, you can use pass-otp even though I do not recommend keeping them both in same device, as it defeats the whole purpose of 2fa.

android

custom rom ?

I find lineageOS pretty much interesting but as I don't have a officially supported device and not much experience with custom roms in general, so I am avoiding it for now, but in future I am definetly going to give this a try.

managing passwords (phone)

with ssh and git simple. i'll try to give some steps later in the post on how to get this setup.


pass has an android app which you can look for, the next thing you will need open-keychain to decrypt yoru password, now it used to be flawlessly and worked for me in the past, but recently breaking OCB/AEAD default introduced by GnuPG cuaused it to break but dont worry you can fix it, by disabling the the unsupported AEAD Mechanism, the arch wiki explains it well, so you can follow that.


But in case, you just don't feel like disabling it, you can always import your GPG Keys and manually lookup your password, the way I do for now. This is a bit tediuos but it works without relying on any "broken" tool.

# (assuming you have clones your pass git repo locally in your phone)
cd /data/.../pass # set an alias for this 
# z pass # (i use zoxide) so no need for an alias
# make sure you have all the termux api pkgs installed
gpg -d example.com/username.gpg | termux-clipboard-set

tip: you can easily write a script to fuzzy search the pass. i have one in my phone, but it is so trivial to write your own, so i am not sharing mine here. if i later publish a modified version of my dotfiles optimized for termux and android it will be with it.

note taking

journaling

I have been using jrnl pretty long for this purpose and it stores all my entries in plan text format with all the goodness of encrytion, and it also get synced up with my git server, cuz again it's just a text file + encrypted, the good thing being it is written in python and uses the crytography module, which you can easily decrypt using a simple script (from their docs)

#!/usr/bin/env python3
"""
Decrypt a jrnl v2 encrypted journal.

Note: the `cryptography` module must be installed (you can do this with
something like `pip3 install crytography`)
"""

import base64
import getpass
from pathlib import Path

from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC

filepath = input("journal file path: ")
password = getpass.getpass("Password: ")

with open(Path(filepath), "rb") as f:
    ciphertext = f.read()

password = password.encode("utf-8")
kdf = PBKDF2HMAC(
    algorithm=hashes.SHA256(),
    length=32,
    salt=b"\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8",
    iterations=100_000,
    backend=default_backend(),
)

key = base64.urlsafe_b64encode(kdf.derive(password))

print(Fernet(key).decrypt(ciphertext).decode("utf-8"))

So even if jrnl doesn't exist in the future I do not fear of loosing access of my journal. And in case you are thinking of a good password, I just use my password manager and encrypt it with that.

vim + latex

this requires it's own blog. subscribe to the rss feed (if i happen to add it. remember this site is completely written from scratch and things are always wip and i also have other things to do including a uni classes to join in)or just follow me on x for updates.

obsidian

I don't use obsidian in my laptop as said, it is only in phone, and I mostly do the reading or quick skimming part from there, I have seperate file in my obsidian vault where I make edits in my phone, to avoid merge conflicts (which often happens atleast for me), in the late rpart we will be discussing about sync.

edit: i'm not using obsidian anywhere anymore, i use a script written by me to sync my files using git, and do edits with nvim inside termux itself if needed from my phone. i have been having so many merge conflicts by using obsdiian in phone and nvim in my laptop, and as i am too lazy to resolve all of them, i got rid of it altogether.


the sync guide is still below if anyone wants to replicate my prev setup.

sync

As I don't use the Obsidian Desktop, in my laptop, a normal git repo and the well-known git commands alr does the job of backing up for me (I could setup a crontab but unnecessary for me i just run my sync script manually), for obsidian mobile you need to setup a few things, as I use termux, and have git installed there (apt update && apt install git) and have my ssh configured (guide) once you are done: run the sshd daemon (assuming you have it installed in termux) and copy your id with ssh-copy-id 192.168.0.<HOST ID> -p 8022 to your phone from the laptop, and the next time you ssh add your phone local ip in your known_hosts, and you are good to go.


once you are in your phone via ssh in laptop (btw you can type/copy these commands from your phone too, I just prefer to use my laptop) and now clone your git repo from remote server (if you have your repo private which is most likely, configure the same ssh public key from your ~/.ssh/id_ed25519 to inside your git server (most git servers let you add multiple keys including github) also I do not recommend using same ssh keys for different systems and incase you don't want to do ssh, find your personal access token (or just your ssh passowrd if you are running your own git instance).


after succesflly cloning the repo get to obsidian in your mobile locate the clone repo and install the git community plugin fill in those. Now it is as easy as using the command palette (swipe down is the gesture btw if you don't know) and you can run your regular git push/pull commands. If you happen to create so many merge conflicts just like me, limit yourself for just revieiwing notes in mobile and use only one file for adding new entries (atleast that's what I do), regardless you can always pull up git again and fix the merge conflicts by yourself.

ps in case you think this method is a little bit weird, you can always pay for obsidian for syncing your files and storing them in their cloud (which technically goes against my ethics) but anyway, one of my friend showed me obsidia-livesync which I think might worth for you to give a try.


as said I don't use this setup anymore and I now have my own script for backing up and nvim to make edits inside termux itself.

misc.

ffmpeg

i think you alr know about this one. i use it for screen recording (with the help of x11grab) with the following command:

ffmpeg -video_size 1920x1080 -framerate 25 -f x11grab -i :0.0 output.mp4

minor editing of all sort of video files and even streaming sometimes, ffmpeg is super powerful. video codecs conversion.

kdenlive/gimp

kdenlive: basic editing. (i am not a video editor lol), i'll still mostly prefer and use ffmpeg wherever I can. gimp: again for illustration purposes and sometimes blurring out some porting of an image file are the only use cases I use it for.

steam & gaming

i sometimes (very rarely) play games in my desktop, well it's fun and the only game i ever played and love is factorio and the good thing is it works natively on linux, with any issues, it just works so well (audio, no screen tearing, full screen, window management) even tho it is priced a bit more, but i have to say the efforts and the work the devs put into making this is great and it literally deserves respect, if you are thinking of playing the game please buy it.

factorio

lichess in mobile while travelling or when i feel lazy, that's it.

docs and stuff

Yes once in a while I also need to write word documents and work on something together with my classmates, for that purpose I solely rely on google docs and it's collaboration tool, other than that I use onlyoffice (imo the most MS Office friendly suite out there for linux)


anyway for making slides I again hop on this tool made by antfu sli.dev which let's me make cool presentations while staying within my erxisting workflow of terminal and nvim, really worth trying it if you are using PowerPoint or Apple Keynote.

windows

Even tho I really hate syaing this, yes I need to boot into windows once in a while to just build something to support the users of worlds most used operating and system and often times just to test something or try an obsecure software which is windows only, the performance is off the mark inside a VM, in case someone wondering I am using VitIO-WIN and QUEMU for my virtual machines, it just works fine most of the time, for transfering my files and other things I use WinSCP for windows and ssh if it's linux vm.

windows

Some other good optimization I would recommend is winutil and tweak things in there.

browser extensions

newsboat

boring rss viewer, I use vim keybinds with it, and have other keybinds set for steaming a video with mpv or opening them in browser.

macro v set browser "setsid -f mpv --really-quiet --no-terminal" ; open-in-browser ; set browser "$BROWSER %u"

below is a screenshot of my rss feed (opened fireship yt channel)

nw

mpv

well everyone knows about mpv, i also use it for making clips of stuff I watch (incld making clip of a yt video).

music

once upon a time... i used to use mpd + mpc + ncmpcpp, and download albums and play songs and manage my music collection locally, but that's not a thing anymore, sadly i just couldn't happen to get time and effort to collect those.


now, i just pay for spotify premium and it got all my music collection, and i am completely fine with that, the convenience it provides worths the money even tho i am aware of all those fact that you dont own your music the artists are not paid well, spotofy is pushing podcasts more and more and you should buy albums instead. still.. i can't help. i like music. i coudln't have paid for ytmusic or apple music, cuz i don't like the video thingy of ytm (+ music quality is less than spotify) and apple music doesn't have all the music of artists I listen to. so i think i am good with spotify for now, might change later dunno i could be based too cuz all of my frnds use spotify so yea, go with what you like, also not to mention spotify got the best dev docs other with a great api support and active community.


saying all that, their desktop client in linux is pretty meh tho (electron go brr) and also I need to use flatpak for them, so I just use spotifyd (stripped ver. of librespot to be used as a daemon) it has some issues (like not restarting after suspend, you can write a systemd command for that to restart on suspend, but i just do it manually pkill spotifyd && spotifyd doesn't bother me much, there are some other caveat too like you can't download music without the official client, again it doesn't matter for me as i don't download music in my laptop anyway, most of my offline listening if i am travelling/or want to some time out of internet. it happens in my phone, so I am fine and quite happy with as it is for now.

[global]

username = "<YOUR EMAIL>"
password_cmd = "pass show spotify"
use_mpris = true
dbus_type = "session"

device_name="spotifyd"

# F32 (best)
# S32 (very good)
# S24 (good)
# S16 (fair)
audio_format = "F32"

bitrate = 320

cache_path = "/home/ag/.cache/spotifyd"

max_cache_size = 5000000000 # ~ 5GB

volume_normalisation = true
autoplay = true
device_type = "speaker"

there are few other options include psst, spotify-tui i just use the web ui as a client, cuz i sometimes find some cool album cover art there.

spotify


edit: someone just told me about this spotify client written in qt, which seems good to me spotify-qt.

honourable mentions

tl;dr

btw wait.


if you know more or want to suggest improvements pls lmk via my email or other social, i'll be more than happy to hear from you. thanks if you read this far, or even just skipped ahead the whole thing and reading the last line :^)

cya.