Skip to content

Instantly share code, notes, and snippets.

View dwymark's full-sized avatar

Daniel Wymark dwymark

View GitHub Profile
@dwymark
dwymark / copy-to-chat
Last active December 2, 2023 11:26
Copy selection to chatgpt-cli (on Linux, in XFCE)
#!/bin/bash
CHAT=/home/$USER/.local/bin/chatgpt-cli
TEMP_FILE="/tmp/selection_$(date +%Y%m%d%H%M%S).txt"
xclip -o -selection primary > "$TEMP_FILE"
xfce4-terminal -e "bash -c '$CHAT -c $TEMP_FILE ; sleep 5'"
@dwymark
dwymark / copy-file.sh
Last active July 1, 2023 04:13
copy-file
#!/bin/bash
# Check if xclip is installed
if ! command -v xclip >/dev/null 2>&1; then
echo "Error: xclip is not installed. Please install xclip to use this script." >&2
exit 1
fi
# Check if a file name is provided as an argument
if [ $# -eq 0 ]; then