Posts tagged: cli
All posts with the tag "cli"
backup distrobox image
Using pbpaste for command substitution keeps sensitive or long URLs out of
your shell history. Instead of typing git clone https://github.com/user/repo-with-long-name.git, copy the URL to clipboard and
run git clone "$(pbpaste)". This prevents the URL from appearing in
~/.bash_history or ~/.zsh_history.
To get pbpaste working on both Xorg and Wayland, add this to your shell config:
if [[ $(command -v wl-copy) ]]; then
alias pbcopy='wl-copy'
pbpaste() { wl-paste; }
elif [[ $(command -v xclip) ]]; then
alias pbcopy='xclip -selection clipboard'
pbpaste() { xclip -selection clipboard -o; }
fi
The function approach (instead of alias) enables command substitution, while
the quotes around $(pbpaste) handle spaces and special characters safely.
Now you can use it.
git clone "$(pbpaste)"
More importantly secrets can stay out of your history.
export GITHUB_TOKEN="$(pbpaste)"
export AWS_ACCESS_KEY_ID="$(pbpaste)"
export AWS_SECRET_ACCESS_KEY="$(pbpaste)"
export DATABASE_URL="$(pbpaste)"
Today I discovered the Urllink function in bash from the ujust tool from
ublue.it. Seems like a cool trick, but might not work
everywhere.
########
### Special text formating
########
## Function to generate a clickable link, you can call this using
# url=$(Urllink "https://ublue.it" "Visit the ublue website")
# echo "${url}"
function Urllink (){
URL=$1
TEXT=$2
# Generate a clickable hyperlink
printf "\e]8;;%s\e\\%s\e]8;;\e\\" "$URL" "$TEXT${n}"
}
```j
I’ve had a couple of uploads to twitter fail recently and has been a pain. I tried some online converters for convenience, but none of them worked. I reached out to chatgpt and found succeess with this ffmpeg command.
ffmpeg -i input.mp4 \
-vf "scale=trunc(oh*a/2)*2:min(720\,trunc(ih*a/2)*2)" \
-c:v libx264 -profile:v high -level:v 4.1 \
-b:v 3500k -maxrate 3500k -bufsize 7000k \
-pix_fmt yuv420p \
-c:a aac -b:a 128k -ar 44100 \
-movflags +faststart \
output.mp4