TIL How to Jump to Matching Bracket in Vim

I’ve started using Flutter, the mobile SDK for the Dart language. Dart reminds of Java and JavaScript. It’s quite verbose. If you have nested functions and classes, it’s hard to find the matching brackets and parentheses. Sometimes the start of a function or class is not on your screen, and it’s hard to get a quick visual overview. There are plugins that color the brackets differently, for example, Junegunn’s rainbow_parentheses.vim or luochen1990’s rainbow.
Read more →

TIL How to Revert Last Git Commit but Keep Changes

Read more →

TIL About Finding the Path Environment Variables With Fish Shell

The fish_user_paths are the alternative for $PATH in fish shell. But how do I find out, what’s in my fish path? echo $fish_user_paths | tr " " "\n" | nl This gives you an array of path environment variables. You can erase a path with set -e fish_user_paths[1]. Be aware that the array is mutable, so if you delete an item, another one will take its place. Further Reading How to remove a path from $PATH variable in fish?
Read more →

TIL About Text Search in Mongodb

Read more →

TIL How to Refactor Try Catch With Either Monad

Today I watched the course Hardcore Functional Programming in JavaScript, v2. The instructor, Brian Lonsdorf, shows you functional programming principles with JavaScript and introduces concepts like currying, functors and monads. One interesting application is the refactoring of a try-catch-block to the Either monad. const fs = require('fs') const getPort = () => { try { const str = fs.readFileSync('config.json') const config = JSON.parse(str) return config.port } catch (e) { return 3000 } } const result = getPort() const Right = (x) => ({ map: (f) => Right(f(x)), chain: (f) => f(x), fold: (f, g) => g(x), inspect: () => Right(${x}), }) const Left = (x) => ({ map: (f) => Left(x), chain: (f) => Left(x), fold: (f, g) => f(x), inspect: () => Left(${x}), }) const fromNullable = (x) => (x !
Read more →

TIL About Joining Tmux Panes

I love using Tmux for my terminal. I have a tiling window manager (i3) for my 15” notebook. On the left side I open a web browser. Now I can watch videos, read tutorials, develop React applications, etc. On the right side of my screen I use tmux with two or three panes. The major pane holds a NeoVim instance. That’s what I’m using as my text editor for coding.
Read more →

TIL: How to Use Curl(ie) With Bearer Tokens

I use curlie (for curl) and fish shell (for bash). Original post by Niel de Wet: Using cURL to authenticate with JWT Bearer tokens. Get The Bearer Token You must install jq for parsing json from the command line. The following command queries the authentication endpoint with the required credentials and stores the JWT bearer token in an environment variable. set -x AUTH_TOKEN (curlie post https://hostname/auth/signin username='your username' password='your password' | jq -r '.
Read more →

TIL About Streamlit’s Magic

Streamlit allows you to write Markdown within a Python file (.py): import streamlit as st st.title("Otto Group Product Classification Challenge 🛍") st.markdown("## 1. Problem Statement") st.markdown( "Given a dataset with 93 features, create a predictive model which is able to distinguish between the main product categories." ) st.markdown("### 1.2 Evaluation") st.markdown( "The evaluation for the competition is multi-class logarithm loss. See Kaggle: Evaluation." ) I like that I can write Markdown, but the syntax is cumbersome.
Read more →

TIL: Linux - Delete Files Older Than X Days

Today I learned that you can pass a date argument to find. I wanted to delete all files that were older than 10 days using the command line. We can use find which ships with every Linux distribution. find . -type f -mtime +20 Find all files that are older than 20 days in the current directory. Now let’s delete them: find . -type f -mtime +20 -exec rm -f {} ; I use fd as an alternative to find:
Read more →

TIL About Git Attributes

Today I learned that I can set up my own filters for doing substitutions on commit/checkout with Git. Why is that useful? GitHub restricts files to 100 MB. What if you want to push a file to your GitHub repository that’s bigger than 100 MB? You can use Clean and Smudge to compress your file. images are from https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes Clean and Smudge Decide which file types you want to compress and add them to .
Read more →