1
Fork 0
mirror of https://github.com/Steffo99/config-fish.git synced 2024-12-22 06:44:22 +00:00

Add some random stuff

This commit is contained in:
Steffo 2023-11-13 04:44:50 +01:00
parent 78ef972de7
commit ddac797bbf
Signed by: steffo
GPG key ID: 2A24051445686895
5 changed files with 62 additions and 3 deletions

3
functions/btm.fish Normal file
View file

@ -0,0 +1,3 @@
function btm --description 'alias btm btm --enable_gpu_memory'
command btm --enable_gpu_memory $argv;
end

20
functions/dalle.fish Normal file
View file

@ -0,0 +1,20 @@
function dalle
set base_url "https://api.openai.com"
set response (curl --silent "$base_url/v1/images/generations" -H 'Content-Type: application/json' -H "Authorization: Bearer $OPENAI_API_KEY" -d '{"n": 1, "size": "1024x1024", "prompt":"'$argv[1]'"}')
echo "$response" | jq
set error (echo "$response" | jq '.error')
if test "$error" != "null"
return 1
end
set timestamp (echo "$response" | jq --raw-output '.created')
set image_url (echo "$response" | jq --raw-output '.data[0].url')
set output "/home/steffo/Pictures/DALL·E²/$timestamp - "$argv[1]".png"
wget --quiet --output-document="$output" "$image_url"
open "$output" > /dev/null 2> /dev/null
end

View file

@ -1,11 +1,11 @@
function discord_export
if test -z "$DISCORD_TOKEN_BOT"
echo_error "\$DISCORD_TOKEN_BOT is not set."
if test -z "$DISCORD_TOKEN"
echo_error "\$DISCORD_TOKEN is not set."
return
end
set channels "--channel "$argv
set channels (string split -- " " "$channels")
discord-chat-exporter-cli export --bot $channels
discord-chat-exporter-cli export --bot --token $DISCORD_TOKEN $channels
end

33
functions/redocker.fish Normal file
View file

@ -0,0 +1,33 @@
function redocker
set project (docker compose config --format json | jq .name)
echo_progress "Pulling images used by "
echo_highlight "$project"
echo_progress "..."
echo
docker compose pull
echo_progress "Building images using by "
echo_highlight "$project"
echo_progress "..."
echo
docker compose build
echo_progress "Taking down "
echo_highlight "$project"
echo_progress "..."
echo
docker compose down
echo_progress "Bringing up "
echo_highlight "$project"
echo_progress "..."
echo
docker compose up -d
echo_progress "Opening logs of "
echo_highlight "$project"
echo_progress "..."
echo
docker compose logs -f
end

View file

@ -0,0 +1,3 @@
function telegram-emoji
magick -background none "$argv[1]" -resize "100x100^" -gravity "center" -extent "100x100" "$argv[1].telegram-emoji.png"
end