Skip to content

Instantly share code, notes, and snippets.


Roman Perepelitsa romkatv

View GitHub Profile
View gist:6677c3dce1090e4cc515c3a1d64582cc
XTerm Control Sequences
Edward Moy
University of California, Berkeley
Revised by
Stephen Gildea
X Consortium (1994)
romkatv / migrate-zsh-dotfiles.zsh
Last active February 4, 2023 23:51
Migrate zsh dotfiles from the home directory to another directory on the same machine
View migrate-zsh-dotfiles.zsh
# This command moves your zsh dotfiles (.zshrc, .zsh_history, etc.)
# from the home directory to ~/.config/zsh. It's been verified to
# work correctly if you are using zsh4humans. With other zsh configs
# your mileage may vary.
# How to:
# 1. Close all terminals except one.
# 2. Copy-paste this command into the only remaining terminal.
() {
romkatv / run-command.zsh
Last active April 10, 2023 16:35
Zsh function to run a command and capture its status, stdout and stderr
View run-command.zsh
# Runs "$@" in a subshell with the caller's options, sets reply=(stdout stderr)
# and returns the status of the executed command. Both stdout and stderr are
# captured completely, including NUL bytes, incomplete UTF-8 characters and
# trailing LF, if any.
# Example:
# % zsh-run-command ls -d ~ /garbage
# % printf 'status: %s\nstdout: %s\nstderr: %s\n' $? "${(q+)reply[@]}"
# status: 2
romkatv / srand32.zsh
Last active January 17, 2021 02:35
View srand32.zsh
# Returns a random 32-bit number.
# If /dev/urandom is cryptographically secure, so is srand32.
# If zsh is compiled with 64-bit number support, the result
# is non-negative. Otherwise it may be negative and the value
# is governed by the rules of unsigned-to-signed conversion in C.
# Examples:
# % print -r -- $(( srand32() ))
View p10k-bubbles.zsh
# Generated by Powerlevel10k configuration wizard on 2020-04-12 at 20:28 CEST.
# Based on romkatv/powerlevel10k/config/p10k-classic.zsh, checksum 30399.
# Wizard options: nerdfont-complete + powerline, small icons, classic, unicode, dark,
# 24h time, round separators, round heads, round tails, 2 lines, disconnected, no frame,
# sparse, many icons, concise, instant_prompt=quiet.
# Type `p10k configure` to generate another config.
# Config for Powerlevel10k with classic powerline prompt style. Type `p10k configure` to generate
# your own config based on it.
romkatv /
Created February 14, 2020 07:39
Anecdote: gitstatus performance in a large Git repository
  • Source: starship/starship#921.
  • Timing for git status: between 12 and 15 seconds.
    • Method of timing: likely time git status.
    • Reported time: probably wall time.
    • Cold or hot: unknown.
  • Timing for gitstatus_query: between 3 and 4 seconds.
    • Method of timing: unknown.
    • Reported time: probably wall time.
    • Cold or hot: unknown.
  • gitstatusd command-line arguments: unknown.
romkatv / Advent of Code
Last active December 31, 2019 16:48
Advent of Code 2019
View Advent of Code
romkatv / omz-prompt-bench.zsh
Last active November 30, 2019 11:04
Measure zsh prompt latency with various themes
View omz-prompt-bench.zsh
# Measure zsh prompt latency with various themes:
# 1. Run the docker command.
# 2. Type `ZSH_THEME=XXX exec zsh` where `XXX` is a theme name such as
# `agnoster` or `powerlevel10k/powerlevel10k`.
# 3. Type `zsh-prompt-benchmark` and press and hold ENTER until benchmark
# results appear. It takes about 10 seconds.
docker run -e TERM -it --rm archlinux/base bash -uexc '
pacman -Sy --noconfirm zsh git
git clone --depth=1 ~/.oh-my-zsh
romkatv / p10k-portable.zsh
Created November 12, 2019 08:14
View p10k-portable.zsh
# Powerlevel10k configuration file restricted to 8-color ASCII. Produced by
# running `p10k configure` while at 1387763f2719661dc7e43e86a5bfd24cc357d6a0
# and then editing ~/.p10k.zsh. Configuration wizard header follows.
# Generated by Powerlevel10k configuration wizard on 2019-11-12 at 08:45 CET.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 11792.
# Wizard options: compatible, lean, 2 lines, disconnected, no frame, sparse, concise.
# Type `p10k configure` to generate another config.
# Temporarily change options.
romkatv /
Last active March 16, 2023 17:44

Here's how it looks with White on Black color scheme:


Tango Dark


Solarized Light