screen Sulks

Occasionally I put my screen session into a state that I call sulking – it refuses to take new input. This happens in two ways – one, my screen session gets fired into the background, and I left with the message [1]+ Stopped screen; the other seems to lock the screen from showing me any input. In the second state I can navigate among screen sessions, and create new instances, but not type.

After much thrashing about, I learned that when I hit C-a z (Control a, z) I put the session in the background, and it can be returned with the command fg. Similarly, if I hit C-a s I have locked the session to input, and to return it I need to hit C-a q. Good things to know.

Padding Numbers in Filenames

I sometimes find myself with scads of files in a directory that, due to the vagaries of sort() do not show up in the “right” order. For example, 1.png, 2.png, … 751.png.

I was poking around with rename, but I wasn’t finding a good way to do this. Thankfully, a poster on TLUG showed me how to use sprintf to get the results I wanted, like so:

rename -n 's/(\d+)/sprintf("%04d", $1)/e' *.png

Very neat.

Go to Date WordPress Widget

This is the widget code to have a Go to Date widget in WordPress. It requires the correct permalink structure, but it is easy to paste into a text widget and it works nicely.

<script type="text/javascript">

function gotodate() {
  var baseurl = ""
  var y = document.getElementById("year").value;
  var m = document.getElementById("month").value;
  var d = document.getElementById("day").value;
  //debug alert(y + m + d);
  var newloc = baseurl + y + "/" + m + "/" + d
  window.location = newloc

      <td> </td>
      <td><input type="text" id="year" size="4" maxlength="4" /></td>
      <td><input type="text" id="month" size="2" maxlength="2" /></td>
      <td><input type="text" id="day" size="2" maxlength="2" /></td>
      <td><input type="button" value="Go" onclick="javascript:gotodate();" /></td>