A while ago I made a tiny function in my ~/.zshrc to download a video from the link in my clipboard. I use this nearly every day to share videos with people without forcing them to watch it on whatever site I found it. What’s a script/alias that you use a lot?

# Download clipboard to tmp with yt-dlp
tmpv() {
  cd /tmp/ && yt-dlp "$(wl-paste)"
}
  • gonzo-rand19@moist.catsweat.com
    link
    fedilink
    arrow-up
    21
    arrow-down
    2
    ·
    5 days ago

    Here are probably the most useful ones. I prefer for rm to be interactive so I don’t accidentally delete something important and for mkdir to create a parent directory if necessary.

    alias rm='rm -i'
    alias mkdir='mkdir -p'
    alias podup='podman-compose down && podman-compose pull && podman-compose up -d'
    

    This extract function (which I didn’t make myself, I got it from when I was using nakeDeb) has been pretty useful too.

    function extract()
    {
         if [ -f $1 ] ; then
             case $1 in
                 *.tar.bz2)   tar xvjf $1     ;;
                 *.tar.gz)    tar xvzf $1     ;;
                 *.bz2)       bunzip2 $1      ;;
                 *.rar)       unrar x $1      ;;
                 *.gz)        gunzip $1       ;;
                 *.tar)       tar xvf $1      ;;
                 *.tbz2)      tar xvjf $1     ;;
                 *.tgz)       tar xvzf $1     ;;
                 *.zip)       unzip $1        ;;
                 *.Z)         uncompress $1   ;;
                 *.7z)        7z x $1         ;;
                 *.xz)        unxz $1         ;;
                 *)           echo "'$1' cannot be extracted via >extract<" ;;
             esac
         else
             echo "'$1' is not a valid file"
         fi
    }
    
    • frozen@lemmy.frozeninferno.xyz
      link
      fedilink
      arrow-up
      2
      ·
      3 days ago

      I have a similar docker/podman alias, except I pull first. This greatly reduces downtime between down and up, which is nice for critical services.