Skip to content

Instantly share code, notes, and snippets.

@CognitiveDisson
CognitiveDisson / .gitconfig
Last active April 1, 2022 09:50
Git config
[alias]
fr = "!f() { echo Fetch ${1:-$3} and rebase to ${1:-$3}/${2:-master} && git fetch ${1:-$3} && git rebase ${1:-$3}/${2:-master}; }; if git ls-remote --exit-code upstream > /dev/null; then f $1 $2 'upstream'; else f $1 $2 'origin'; fi"
@CognitiveDisson
CognitiveDisson / bzqfzf.fish
Last active July 29, 2023 22:54
Bazel fuzzy finder ( fzf ) with bat preview
# Example: vim (bzqfzf //...)
# Description: Fish functions (should be easily converted to zsh) for Basel fuzzy search.
# Requirements:
# bazel
# brew install fzf
# brew install bat
# Note: Put each function to separate `.fish` file.
@CognitiveDisson
CognitiveDisson / bzqfzf.sh
Created August 29, 2023 11:35
bzqfzf for zsh
# Example: vim (bzqfzf //...)
# Description: ZSH functions (should be easily converted to zsh) for Basel fuzzy search.
# Requirements:
# bazel
# brew install fzf
# brew install bat
# Add "source ~/.zsh_functions/bzqfzf.sh" to `~/.zshrc`
@CognitiveDisson
CognitiveDisson / pwned.sh
Last active May 5, 2024 01:44
One line to check pwned password
# Execute fc -p for the zsh shell if you want to remove it from the history.
# In this method, you don't pass the actual password value.
# Instead, you only send the first five characters of its SHA1 hash
# and then grep for the second part of the checksum locally within the response.
echo -n '<your_password>' | \
openssl dgst -sha1 -hex | \
awk '{print $2}' | \
tr a-z A-Z | \
xargs -I % sh -c 'curl -s "https://api.pwnedpasswords.com/range/$(echo % | cut -c -5)" | grep "$(echo % | cut -c 6-)"' | \
cut -d ":" -f2 | \