112
submitted 18 hours ago by als@lemmy.blahaj.zone to c/linux@lemmy.ml

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)"
}
you are viewing a single comment's thread
view the rest of the comments
[-] qpsLCV5@lemmy.ml 4 points 12 hours ago* (last edited 12 hours ago)

it's somewhat vibe coded but the one i probably use the most is this one to swap between speakers and headset. the device name to look for is just put directly in there, it'd take some adjustment to run it on different machines. this is in my .bashrc:

# switch sinks
toggle_audio() {
  # Find headset sink ID dynamically
  headset_id=$(pactl list sinks short | grep "Plantronics" | awk '{print $1}')
  
  # Find speakers sink ID dynamically
  speakers_id=$(pactl list sinks short | grep "pci-0000_05_00.6" | awk '{print $1}')
  
  # Get current default sink
  current_sink=$(pactl get-default-sink)
  
  # Get current sink ID
  current_id=$(pactl list sinks short | grep "$current_sink" | awk '{print $1}')
  
  # Toggle between the two
  if [ "$current_id" = "$headset_id" ]; then
    pactl set-default-sink "$speakers_id"
    echo "Switched to speakers (Sink $speakers_id)"
  else
    pactl set-default-sink "$headset_id"
    echo "Switched to headset (Sink $headset_id)"
  fi
}

generally i try not to use too many custom things because for work i regularly work on all kinds of different servers and i've just been too lazy to set up some solution to keep it all in sync. someday....

this post was submitted on 23 Jun 2025
112 points (99.1% liked)

Linux

55556 readers
1116 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS