Geeky things: X-Clipboard synchronization, file/mime types, and commandline uploading

Geeky things I learned recently:

You can send standard output to multiple processes at the same time using tee:

echo “blah” | tee >(xclip -i -s primary) >(xclip -i -s clipboard)

You can find out if a file is binary using the command “file” and a simple grep operation:

binary=$(file -b $1 | grep text)

And you can find out if a file is an image using xdg-mime:

mimetype=$(xdg-mime query filetype $file| grep image)
if [ “$mimetype” = “” ]; then
echo “Not an image, skipping.”
fi

Related: You can upload to pastebins easily using pastebinit, upload images to imgur from bash, and (woo) do screencaps and upload to imgur in one fell swoop.

See?

Mind you, I started doing this about three hours ago. Because this scene from Malcom in the Middle is what any kind of programming is like.

blankWas this post helpful or insightful? Buy me a coffee here or here and share this post with others!

Popular posts:

  • The difference between boundaries and rules
  • Two Ways to get CMYK Separation Using GIMP Instead of Photoshop in 2022
  • Weekend Project: Whole House and Streaming Audio for Free with MPD
  • Word Porn Quotes
  • If there's one Nazi (or a racist) at the table...
  • Odds and Ends: Optimizing SSHFS, moving files into subdirectories, and getting placeholder images

Recent Posts