Scientific Computing

Workarounds for emergency sshfs mount

One day, I suddenly couldn’t SSHFS mount via the head end server from any computer.

  • could not ssh into the main head end server
  • could ssh into the individual cluster units.
  • could not sshfs mount from those cluster units
  • could see files via ssh.

Workaround:

Using a Windows guest virtual machine, I was able to mount the windows side of the network share (that I can typically always mount via sshfs) I could sftp and scp from one of the cluster nodes (not the head end node, since I couldn’t get in via ssh).

Probably a weird, incorrect workaround–but it got the badly needed files in a pinch.

sshfs connection needs trailing slash

SSHFS allows accessing directories and files on remote SSH servers as if they were on your local PC. One quirk is that accessing a large number of small files will incur a speed penalty.

When specifying the remote directory using sshfs, include a trailing slash to avoid Input/Output Error messages.

  • correct: sshfs -o workaround=rename joe@server:/opt/netfiles/ ~/Z
  • incorrect: sshfs -o workaround=rename joe@server:/opt/netfiles ~/Z

Lamborghini R485 tractor on Jay Leno's Garage

Lamborghini R485 tractor:

Engine Horsepower torque weight
4 cyl diesel air-cooled 85 350 ft-lb 8000 lbs

A few quotes from Jay Leno’s Garage:

  • Ferrucio Lamborghini said to have originated tractor pulls against dominant brands of tractors like Fiat.
  • 12 speed transmission, first gear up to 0.3 mph, 12th gear up to 14 mph.
  • Two-footed clutch
  • Lamborghini said to have exported fewer than 20 tractors to California, targeted for vineyards and olive groves where low tractor height was valuable.

REGEX formatted date from string

This is a regular expression string to get YYYY-MM-DD string from arbitrary length string:

(19|20)dd([- /.])(0[1-9]|1[012])2(0[1-9]|[12][0-9]|3[01])

With Matlab/Octave regex for dates works like:

input = '09av8joj23oit2pojiijo/20398/vj89/2012-10-15/0298f9082j23'; %random stuff with date in it

regStr = '(19|20)dd([- /.])(0[1-9]|1[012])2(0[1-9]|[12][0-9]|3[01])';

[startIndex,endIndex] = regexp(input,regStr,'start','end')

myDate = input(startIndex:endIndex);

Making a 2D pyramid in MATLAB

Make a square-base 2D data pyramid in Matlab, where:

N
number of pixels per side (e.g. 512)
MinVal
minimum data value (e.g. 0)
MaxVal
maximum data value (e.g. 65535)
N = 256;
MinVal = 0;
MaxVal = 2^16 - 1;

data = nan(N);
temp = uint16(MinVal:round((MaxVal-MinVal)/(N/2)):MaxVal);

for i = 1:N/2
  data(i,i:end-i+1) = temp(i);
  data(i:end-i+1,i) = temp(i);
  data(end-i+1,i:end-i+1) = temp(i);
  data(i:end-i+1,end-i+1) = temp(i);
end

figure, mesh(data)

The values at the “base” of the pyramid are zero, and increase linearly on each side to 65,535. This sort of figure might be useful when testing an optical flow algorithm.