How do zsh ansi colour codes work?

Running the following code in your terminal should tell you whether your terminal supports 256 colors. for COLOR in {0..255} do for STYLE in “38;5″ do TAG=”\033[${STYLE};${COLOR}m” STR=”${STYLE};${COLOR}” echo -ne “${TAG}${STR}${NONE}  ” done echo done it also shows you the code for each color in the form 38;5;x where x is the code for one … Read more

How do I check if a variable is set in zsh?

The typical way to do this in Zsh is: if (( ${+SOME_VARIABLE} )); then For example: if (( ${+commands[brew]} )); then brew install mypackage else print “Please install Homebrew first.” fi In Zsh 5.3 and later, you can use the -v operator in a conditional expression: if [[ -v SOME_VARIABLE ]]; then The POSIX-compliant test … Read more

Font issues while integrating ZSH on Visual Studio Code

Following this little guide solved the issue making-powerline-work-in-visual-studio-code-terminal. IMPORTANT: if you already have a powerline font installed (e.g. it looks fine inside your system terminal), skip step 1. Install a patched version of your desired font directly from https://github.com/powerline/fonts. Apparently doing the “quick installation” (e.g. sudo apt-get install fonts-powerline) does not work in this case. … Read more

Remove entry from array

To remove element number $i: a=(“${(@)a[1,$i-1]}” “${(@)a[$i+1,$#a]}”) (The simpler construct a=($a[1,$i-1] $a[$i+1,-1]) also removes empty elements.) ADDED: To remove any occurence of b: a=(“${(@)a:#b}”) :# is the hieroglyph to remove matching elements; “” and (@) is to operate correctly on arrays even if they contain empty elements.

How can I run two isolated installations of Homebrew?

Install Homebrew natively on Apple Silicon (will install to /opt/homebrew by default): /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” Install Intel-emulated Homebrew (will install to /usr/local by default): arch –x86_64 /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” If you haven’t yet installed Rosetta 2, you’ll need to run softwareupdate –install-rosetta first. Create an alias for Intel homebrew. I’m calling … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)