Skip to content

Instantly share code, notes, and snippets.

@afiodorov
Last active May 1, 2024 20:37
Show Gist options
  • Save afiodorov/fd80ca866f457706a8ab9d9f1d37fd96 to your computer and use it in GitHub Desktop.
Save afiodorov/fd80ca866f457706a8ab9d9f1d37fd96 to your computer and use it in GitHub Desktop.
.zshrc snippets
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
{
"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"
}
#!/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()
#!/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"
#!/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