zsh fun
Browse filesSigned-off-by: Balazs Horvath <acsipont@gmail.com>
.zshrc
CHANGED
@@ -1,5 +1,28 @@
|
|
1 |
alias ezc="nvim ~/.zshrc && source ~/.zshrc"
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
# This function, `update_conda`, automates the process of upgrading all packages in every conda environment.
|
4 |
# It performs the following steps:
|
5 |
# 1. Retrieves the list of all conda environments using `conda env list` and extracts their names.
|
@@ -131,7 +154,8 @@ display_custom_help() {
|
|
131 |
echo "----------------------------------------------------------------------------------------------------------------------"
|
132 |
echo "LLMs"
|
133 |
echo "---"
|
134 |
-
echo "conda activate openwebui && open-webui
|
|
|
135 |
echo "ollama serve"
|
136 |
echo "----------------------------------------------------------------------------------------------------------------------"
|
137 |
echo "Taggers + Captioners"
|
@@ -342,6 +366,8 @@ copy_matching_caption_files() {
|
|
342 |
# The script uses a for loop to iterate through all .txt files in the target directory.
|
343 |
# It utilizes the 'sed' command to perform an in-place replacement of the search_text with the replace_text in each file.
|
344 |
# After processing all files, it prints a message indicating the completion of the text replacement operation.
|
|
|
|
|
345 |
replace_text_in_files() {
|
346 |
local target_dir=$1
|
347 |
local search_text=$2
|
@@ -356,11 +382,8 @@ replace_text_in_files() {
|
|
356 |
echo "Text replacement complete in $target_dir!"
|
357 |
}
|
358 |
|
359 |
-
# Example usage:
|
360 |
-
# replace_text_in_files "/path/to/directory" "squishy (artist)" "by squishy (artist)"
|
361 |
-
|
362 |
-
|
363 |
# This script adds a specified prefix to the beginning of each text file in a given directory.
|
|
|
364 |
# Usage: inject_to_captions <directory> <prefix>
|
365 |
# Arguments:
|
366 |
# <directory> - The directory containing the text files to be modified.
|
@@ -374,14 +397,18 @@ inject_to_captions() {
|
|
374 |
if [[ -d "$dir" ]]; then
|
375 |
for file in "$dir"/*.txt; do
|
376 |
if [[ -f "$file" ]]; then
|
377 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
# Use a temporary file to store the modified content
|
379 |
local temp_file=$(mktemp)
|
380 |
-
echo "${prefix}, $(cat "$file")" > "$temp_file"
|
381 |
mv "$temp_file" "$file"
|
382 |
echo "Added '${prefix}, ' to the front of $file"
|
383 |
-
else
|
384 |
-
echo "The tag '${prefix}' already exists in $file"
|
385 |
fi
|
386 |
fi
|
387 |
done
|
@@ -563,7 +590,7 @@ c() {
|
|
563 |
python main.py --listen 0.0.0.0 --preview-method taesd --use-pytorch-cross-attention --disable-xformers --front-end-version Comfy-Org/ComfyUI_frontend@latest --fast
|
564 |
}
|
565 |
|
566 |
-
alias cp='cp --
|
567 |
alias t="tensorboard --logdir=$HOME/output_dir/logs"
|
568 |
alias rt="vim ~/.tmux.conf && echo \"Reloading tmux config\" && tmux source ~/.tmux.conf"
|
569 |
alias zr="vim ~/.zshrc && echo \"Reloading zsh config\" && source ~/.zshrc"
|
|
|
1 |
alias ezc="nvim ~/.zshrc && source ~/.zshrc"
|
2 |
|
3 |
+
# This function, rejiggle_captions, takes two arguments: a tag and a directory.
|
4 |
+
# It searches for all .txt files in the specified directory and its subdirectories.
|
5 |
+
# If a file contains the specified tag, the function removes the tag from its original position
|
6 |
+
# and prepends it to the beginning of the file.
|
7 |
+
# Usage: rejiggle_captions <tag> <directory>
|
8 |
+
rejiggle_captions() {
|
9 |
+
local tag="$1"
|
10 |
+
local dir="$2"
|
11 |
+
|
12 |
+
if [[ -z "$tag" || -z "$dir" ]]; then
|
13 |
+
echo "Usage: rejiggle_captions <tag> <directory>"
|
14 |
+
return 1
|
15 |
+
fi
|
16 |
+
|
17 |
+
find "$dir" -type f -name "*.txt" | while read -r file; do
|
18 |
+
if grep -q "$tag" "$file"; then
|
19 |
+
sed -i "s/$tag//g" "$file"
|
20 |
+
sed -i "1s/^/$tag, /" "$file"
|
21 |
+
fi
|
22 |
+
done
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
# This function, `update_conda`, automates the process of upgrading all packages in every conda environment.
|
27 |
# It performs the following steps:
|
28 |
# 1. Retrieves the list of all conda environments using `conda env list` and extracts their names.
|
|
|
154 |
echo "----------------------------------------------------------------------------------------------------------------------"
|
155 |
echo "LLMs"
|
156 |
echo "---"
|
157 |
+
echo "conda activate openwebui && PORT=6969 $HOME/source/repos/open-webui/backend/start.sh"
|
158 |
+
#echo "conda activate openwebui && open-webui serve --port 6969"
|
159 |
echo "ollama serve"
|
160 |
echo "----------------------------------------------------------------------------------------------------------------------"
|
161 |
echo "Taggers + Captioners"
|
|
|
366 |
# The script uses a for loop to iterate through all .txt files in the target directory.
|
367 |
# It utilizes the 'sed' command to perform an in-place replacement of the search_text with the replace_text in each file.
|
368 |
# After processing all files, it prints a message indicating the completion of the text replacement operation.
|
369 |
+
# Example usage:
|
370 |
+
# replace_text_in_files "/path/to/directory" "squishy (artist)" "by squishy (artist)"
|
371 |
replace_text_in_files() {
|
372 |
local target_dir=$1
|
373 |
local search_text=$2
|
|
|
382 |
echo "Text replacement complete in $target_dir!"
|
383 |
}
|
384 |
|
|
|
|
|
|
|
|
|
385 |
# This script adds a specified prefix to the beginning of each text file in a given directory.
|
386 |
+
# If the prefix already exists in the text file, it moves the prefix to the front of the text file without leaving extra commas or spaces.
|
387 |
# Usage: inject_to_captions <directory> <prefix>
|
388 |
# Arguments:
|
389 |
# <directory> - The directory containing the text files to be modified.
|
|
|
397 |
if [[ -d "$dir" ]]; then
|
398 |
for file in "$dir"/*.txt; do
|
399 |
if [[ -f "$file" ]]; then
|
400 |
+
if grep -q "$prefix" "$file"; then
|
401 |
+
# Move the existing prefix to the front of the text file without leaving extra commas or spaces
|
402 |
+
local temp_file=$(mktemp)
|
403 |
+
sed "s/$prefix//" "$file" | sed "1s/^/${prefix}, /" | sed 's/^, //' | sed 's/,,/,/g' | sed 's/, ,/,/g' | sed 's/ ,/,/g' > "$temp_file"
|
404 |
+
mv "$temp_file" "$file"
|
405 |
+
echo "Moved '${prefix}' to the front of $file"
|
406 |
+
else
|
407 |
# Use a temporary file to store the modified content
|
408 |
local temp_file=$(mktemp)
|
409 |
+
echo "${prefix}, $(cat "$file")" | sed 's/,,/,/g' | sed 's/, ,/,/g' | sed 's/ ,/,/g' > "$temp_file"
|
410 |
mv "$temp_file" "$file"
|
411 |
echo "Added '${prefix}, ' to the front of $file"
|
|
|
|
|
412 |
fi
|
413 |
fi
|
414 |
done
|
|
|
590 |
python main.py --listen 0.0.0.0 --preview-method taesd --use-pytorch-cross-attention --disable-xformers --front-end-version Comfy-Org/ComfyUI_frontend@latest --fast
|
591 |
}
|
592 |
|
593 |
+
alias cp='cp --reflink=auto'
|
594 |
alias t="tensorboard --logdir=$HOME/output_dir/logs"
|
595 |
alias rt="vim ~/.tmux.conf && echo \"Reloading tmux config\" && tmux source ~/.tmux.conf"
|
596 |
alias zr="vim ~/.zshrc && echo \"Reloading zsh config\" && source ~/.zshrc"
|