Skip to content

Instantly share code, notes, and snippets.

@adduc
adduc / README.md
Last active January 25, 2025 22:18
Function to initialize new exercise

Bash function for new exercises

I find myself frequently creating one-off repos to test a concept or technology. To streamline this process, I have written a bash function and included it in my bashrc configuration.

When invoked, it creates a new directory, creates a mercurial repository preconfigured for git integration with a main bookmark activated, creates a README.md file, and then opens the directory in my editor of choice (VSCode).

@adduc
adduc / README.md
Last active January 25, 2025 21:01
bash prompt

Bash Prompt

My current directory structure can result in lengthy directory paths, which can make for difficult bash prompts with Fedora's default prompt. To deal with this, I constructed a bash prompt that allows for lengthy directory paths without impacting where the cursor for the command begins.

PS1

# set prompt: <horizontal line>\n<green>user@hostname</green>:<cyan>current directory</cyan>\n<yellow>time</yellow> $
export PS1="\[\033[1;30m\]$(printf '─%.0s' {1..80})\n\[\033[0;32m\]\u@\h\[\033[0m\]:\[\033[0;36m\]\w\[\033[0m\]\n\[\033[0;33m\]\t\[\033[0m\] $ "
@adduc
adduc / README.md
Last active January 27, 2025 22:34
Fixing problem: k3s shows as a new node every time its recreated

Problem: k3s shows as a new node every time its recreated

Solution: Pass --node-name=example as parameter to the server or agent command.

 services:
   server:
     image: rancher/k3s:v1.32.0-k3s1
     command:
 - server