Skip to content

2024-10

Environment variables

Linux environment variables

Arch Wiki: environment variables

System-wide

  • /etc/profile is sourced by all POSIX-compatible shells upon login.
  • Files inside the /etc/profile.d/ directory will also be read.

Bash

  • ~/.profile or ~/.bash_profile for login bash instances.
  • ~/.bashrc for every interactive bash instance.

Zsh

  • ~/.zshenv for environment variables in all zsh instances.
  • ~/.zprofile for every login zsh instance.
  • ~/.zshrc for every interactive zsh instance.

Note

zsh does not source ~/.profile by default because of the difference between bash and zsh syntaxes. You can add this line to ~/.zprofile or ~/.zshenv to make zsh shells read `~/.profile correctly.

~/.zshenv
skip_global_compinit=1
test -r ${HOME}/.profile && emulate sh -c 'source ${HOME}/.profile'

X Window

  • ~/.xinitrc is sourced by startx.
  • ~/.xprofile is sourced by display managers (e.g., GDM, SDDM)

Systemd and Wayland

  • ~/.config/environment.d/*.conf: sourced by systemd. Also, they are used in Wayland sessions where xinitrc and xprofile files are not available.

Windows environment variables

Environment variables in Powershell

Session variables

Variables created by set are bound to the current session and not persistent.

$Env:FOO = "example"
$Env:FOO

Persistent variables

  • GUI: Windows Settings -> Advanced system settings -> Set Environment Variables.
  • Powershell: [Environment]::SetEnvironmentVariable('KEY', 'VAL', 'Machine')
  • Cmd: SETX KEY VAL

Removing large binary blobs in the git tree

Git filter-repo is a filter-branch replacement for rewriting history written in a single-file python script.

To wipe large binary files entirely:

git filter-repo --strip-blobs-bigger-than 100M

Bonus: Remove sensitive content

git filter-repo --use-base-name --path id_dsa --path id_rsa --invert-paths
git filter-repo --replace-text passwords.txt

Git reset

  • Mixed reset (default): discard untracked files, but the changed files are preserved but not marked for commit.
  • Hard reset: Resets the index and working tree. Any changes to tracked files in the working tree since commit are discarded.
  • Soft reset: Does not touch the index file or the working tree at all (but resets the head to commit)
git reset --hard <SHA>   # Reset git history to a specific commit

git reset HEAD~          # Reset state to the previous commit (~)

Purge Git database entirely

Erase all history in the Git repo to start over with all the current files. This also clears big file records in the Git database.

git checkout --orphan newBranch  # Create an orphan branch to hold the files
git add -A  && git commit        # Add all files and commit them
git branch -D main               # Deletes the main branch
git branch -m main               # Rename the current orphan branch to main
git push -f origin main          # Force push main branch to remote (e.g. github)
git gc --aggressive --prune=all  # Remove the old files in the database

LaTeX Bookmarks

LaTeX Distributions

  • TexLive : de-facto standard TeX distribution.
  • MiKTeX : A just enough TeX distribution.
  • TinyTeX : for R markdown publication.
  • Tectonic : A modernized, complete, self-contained TeX/LaTeX engine.

TeX Editors

  • Overleaf : An online LaTeX project and document manager.
  • LaTeX workshop for VS code
  • TexLab for VS Code : rich editing support for the LaTeX typesetting system powered by the TexLab language server
  • Lyx : A What You See Is What You Mean document processor.
  • TEXMAKER : A free cross-platform LaTeX editor.
  • SwiftLaTeX : SwiftLaTeX is a WYSIWYG Browser-based LaTeX Editor, based on the [Tectonic][] engine.
  • TexWorks : Lowering the entry barrier to the TeX world.

LaTeX Online Tools

CI/CD for building LaTeX documents

GitHub actions for automatically compile LaTeX documents on pushing changes.