Last active
May 1, 2024 20:37
-
-
Save afiodorov/fd80ca866f457706a8ab9d9f1d37fd96 to your computer and use it in GitHub Desktop.
.zshrc snippets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function find_and_activate_venv() { | |
current_dir=$PWD | |
while [ "$current_dir" != "/" ]; do | |
if [ -d "$current_dir/.venv" ]; then | |
source "$current_dir/.venv/bin/activate" | |
return | |
fi | |
current_dir=$(dirname "$current_dir") | |
done | |
echo "No .venv folder found." | |
} | |
alias v=find_and_activate_venv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"coc.preferences.formatOnSaveFiletypes": [ | |
"typescript", | |
"typescriptreact", | |
"javascript", | |
"javascriptreact", | |
"solidity", | |
"css", | |
"json", | |
"python", | |
"go" | |
], | |
"python.formatting.provider": "black", | |
"python.linting.mypyEnabled": true, | |
"python.linting.ruffEnabled": true, | |
"python.formatting.provider": "ruff" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
def main(): | |
input_data = sys.stdin.read().replace("\r\n", "\n") | |
sys.stdout.write(input_data.rstrip("\n")) | |
if __name__ == "__main__": | |
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
input=$(cat | base64 -w 0) # Encode the input as a single line base64 string | |
powershell.exe -command "[Text.Encoding]::UTF8.GetString([Convert]::FromBase64String('$input')) | Set-Clipboard" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
powershell.exe -c 'Get-Clipboard' | remove_last_newline.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment