Geeky things: X-Clipboard synchronization, file/mime types, and commandline uploading1 min read

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
  • Review: MAFA - MPD client for Android
  • If there's one Nazi (or a racist) at the table...
  • Weekend Project: Whole House and Streaming Audio for Free with MPD
  • Organizing and Tiling Your Windows on #Openbox Using Only... Openbox
  • Getting the Weather And Forecast with A Bash Script

Recent Posts