2010-03-11

Gnuplot Histogram

If you want to bin data in Gnuplot, something like this should work (taken from a mailing list):

bw = 5   # substitute what you want 
bin(x,width)=width*floor(x/width) 
plot 'data' using (bin($1,bw)):(1.0) smooth freq with boxes

Screen Scrollback

In screen, it's easy enough to set up a scrollback history buffer of the desired length (although I forget exactly how to do it). But it's not obvious how to scroll the window back. You need to use copy mode. Assuming 'C-a' is your screen hotkey, use 'C-a ?' to check for the keyboard shortcut.

For me, you can enter copy mode with 'C-a [', after which you are free to move the cursor around, which scrolls the window. It looks like normal Vi or Emacs shortcuts are fine for scrolling. You can cancel copy mode and go back to the bottom with 'C-c'; or you can press space, scroll elsewhere, and press space again to highlight and copy text and then go back to the bottom.

2010-03-04

Concatenating Images with ImageMagick

It turns out that it's very easy to concatenate images with ImageMagick. For example,

montage +frame +shadow +label -tile NxM -geometry +0+0 *.jpg joined.jpg
where N is the number of tiles across and M is the number of tiles down. Courtesy of Curioso.

2010-03-01

xclip on Ubuntu

In an earlier post (Shell tidbits) I gave a script that uses xclip to send the clipboard into a temporary file, edit it in a text editor like gvim, and then put the new contents back into the clipboard when the text editor is closed. Unfortunately, Ubuntu supplies xclip-0.08-8, which doesn't have proper UTF-8 support. This was causing weird artifacts in my e-mails. The issue dissappears completely if you install xclip from the source package available on its SourceForge homepage.