Thursday, November 13, 2014

Byobu shortcuts for screen/ssh

Byobu is a lifesaver for multiple jobs to be done on the command line via ssh client.
Currently I am using it in putty.
You can create, close and detach... and come right back to the place you left off!

Here are some of the handy commands

Start with byobu

Ctrl-a, c: create a new window
F8: rename
Ctrl-a C-a - Go back to the previous window

Ctrl-a <0-9> - Switch to screen # 0-9.
If you want to go to screen # 10,
Ctrl-a ' - Enter a screen number to switch to two digit number

Ctrl-a " - View a list of the current screens, which will allow you to select one from the list

Ctrl-a d - Detach the whole screen session and fork to the background. Very useful for remote sessions you want to leave open. The command "screen -r" will resume your screen session.

Ctrl-a, k: kill the screen. Usually detach is good; but sometimes you need to kill the screen/process.

If you hit F9, you can set options to start with byobu screen.

Ctrl-a, n or p does next and p



Thursday, September 18, 2014

Map data matlab plot

Plotting Map in Matlab with the colorbar and NaNs set as transparent white.

Just call it with the lat,lon and Z (same size), and do caxis of your desire at the end. Voila!
Save it.
function hhf = mapme(Latitude, Longitude, Z)
hhf = figure
load coast
latlim=[floor(min(min(Latitude))),ceil(max(max(Latitude)))];
lonlim=[floor(min(min(Longitude))),ceil(max(max(Longitude)))];
ax = worldmap(latlim, lonlim);
pcolorm(Latitude, Longitude, Z);
geoshow(lat, long,'Color', 'black' )
colormap;
set(gcf,'Color','white')
% map2 = colormap; map2( 64, : ) = 1; colormap(map2);
colorbar

Wednesday, September 10, 2014

Map/ Figure with white color bar assignment to the lowest value

Sometimes we need the figures or plots showing the maps. The oceans/missing values are indicated in the data as NaN or -9999. This code will plot the data with the lowest value being shown as white color.
A = rand(55);

figure;
imagesc(A)
colormap(jet(33))
map2 = colormap; map2( 1, : ) = 1; colormap(map2)
cmap = colormap; % cmap nicely puts colormap into 3 col data
colorbar

Open Chrome or Firefox from command using matlab

This simple script in Windows 7/8 worked fine.

Sometime I need to open multiple urlwant string
urlwant = ["nabinkm.com"]
Voila!
   system(['start chrome ',urlwant])

Friday, August 29, 2014

Turn off the spotlight and turn it on

Turn off the spotlight and turn it on using these commands in terminal.
sudo mdutil -i off

sudo mdutil -E /

Monitor Temperature in Mac using bash script command line

The code is simple thanks to the temperature monitor app
Just do ./runTapp.sh &
in the terminal, and you are good to go!
#!/bin/sh
cd /Applications/TemperatureMonitor.app/Contents/MacOS/
./tempmonitor -th > ~/Desktop/CPUtempData.csv
while true
do
    ./tempmonitor -tv >> ~/Desktop/CPUtempData.csv
    /bin/sleep 60
done

Reference:
http://www.bresink.com/osx/216202/Docs-en/commandline.html