Skip to content

Instantly share code, notes, and snippets.

View kpbaks's full-sized avatar
🐏

Kristoffer Plagborg Bak Sørensen kpbaks

🐏
View GitHub Profile
@kpbaks
kpbaks / debug-macro.cpp
Created May 25, 2023 20:22
a neat debug macro for c++
#include <cstdarg>
#include <cstdio>
#include <unistd.h>
namespace escape_codes {
constexpr const char *reset = "\033[0m";
constexpr const char *red = "\033[31m";
constexpr const char *green = "\033[32m";
constexpr const char *yellow = "\033[33m";
constexpr const char *blue = "\033[34m";
@kpbaks
kpbaks / as-tree.py
Created April 22, 2023 19:12
Print out format similar to `find` or `fd` in a tree like struture similar to `tree`
#!/usr/bin/env python3
import argparse
import functools
import itertools
import os
import sys
from dataclasses import dataclass
from typing import Callable, List
@kpbaks
kpbaks / config.toml
Created April 18, 2023 17:27
My Helix config
# theme = "catppuccin_macchiato" # see `:theme <tab>` for all themes available
theme = "tokyonight_storm" # see `:theme <tab>` for all themes available
[editor]
line-number = "relative"
mouse = true
true-color = true
scrolloff = 10
scroll-lines = 5
cursorline = true
@kpbaks
kpbaks / .clang-format
Created October 22, 2022 10:16
My preferred config for clang-format
---
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowShortLambdasOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
ColumnLimit: 100
IndentWidth: 4
IndentRequiresClause: true
InsertBraces: true
@kpbaks
kpbaks / .editorconfig
Created October 16, 2022 20:50
Default .editorconfig that I prefer
[*.py]
indent_style = space
indent_size = 4
[*.{c,h}]
indent_style = tab
indent_size = 4
@kpbaks
kpbaks / tmux-helpers.sh
Last active May 20, 2022 08:40
helper functions to setup a tmux grid layout with commands run in them.
select-pane() { tmux select-pane -t ${SESSION} -${1} ; }
pane-down() { select-pane D ; }
pane-up() { select-pane U ; }
pane-left() { select-pane L ; }
pane-right() { select-pane R ; }
send-tmux-cmd() { tmux send-keys -t ${1} "${2}" C-m ; }
TMUX_HELPERS_ON_PANE_CREATE=""
@kpbaks
kpbaks / drone.sh
Created May 19, 2022 12:43
automate the tabs and leave work earlier
#!/usr/bin/env bash
SESSION=drone
function send_tmux_cmd() {
tmux send-keys -t ${SESSION} "${1}" C-m
}
function send_cmd() {
send_tmux_cmd "source ~/amr_ws/devel/setup.bash"