Monday, October 28, 2013

Tuesday, October 22, 2013

Install wget in Mac using terminal

This is my history from the terminal installing wget in mac

210  which wget
  211  curl -O http://ftp.gnu.org/gnu/wget/wget-1.13.4.tar.gz
  212  tar -xzf wget-1.13.4.tar.gz
  213  cd wget-1.13.4
  214  ./configure --with-ssl=openssl
  215  make
  216  sudo make install
  217  wget --help
  218  cd .. && rm -rf wget*
  219  ls
  220  history

Monday, October 21, 2013

Check and curl the file list.

So, I had downloaded a bunch of files using curl.
However, the number of files seem to be less than what I had in the list.

Simple program to check if the file exists, else download using curl.

My trouble was that the list had repeated items. Had not checked before running around... Sigh!


clc

fid = fopen('urls.txt');
flist = textscan(fid, '%s');
fclose(fid);

for jj = 1:length(flist{1})
    fn = flist{1}{jj}
   
    fnlocal = fn(28:length(fn));
   
    if exist(fnlocal,'file')>0
        jj
        fnlocal
        pause(0.5)
        % do nothing
       
    else
        %curl
       
        command = ['curl -L -O ' fn];
        system(command)
       
    end
end

Install using software-center in Ubuntu

So I had trouble getting Meld diff viewer software using the software center.
Whenever I tried to install it, it asked the password for the first user.

This can be solved by sudoing the software center from terminal
$ sudo software-center

Then Install the Meld diff viewer.
 


Friday, October 18, 2013

Download from list using curl in shell/terminal

So, I had to get data from a text file with the list of url.
I saved the url (one per line) in a txt file. Then executed the command
-O saves teh given name in the server. -L gracefully handles redirects if any.

xargs -n 1 curl -O -L < urls.txt

Remove "Subscribe to: posts (atom) " from Blogger

Search for "blog feed links" Change "!=" tp "==" so that subscribe to posts will be visible only in the posts page.
  <b:if cond='data:blog.pageType == "item"'> <!-- Blog feed links -->
If you want to remove the subscribe to comments feature, then remove the following:
  <b:include data='post.feedLinks' name='feedLinksBody'/>

In the following block:

  <b:includable id='feedLinks'>
  <b:if cond='data:blog.pageType == "item"'> <!-- Blog feed links -->
    <b:if cond='data:feedLinks'>
      <div class='blog-feeds'>
        <b:include data='feedLinks' name='feedLinksBody'/>
      </div>
    </b:if>

    <b:else/> <!--Post feed links -->
    <div class='post-feeds'>
      <b:loop values='data:posts' var='post'>
        <b:if cond='data:post.allowComments'>
          <b:if cond='data:post.feedLinks'>
   <b:include data='post.feedLinks' name='feedLinksBody'/>         
          </b:if>
        </b:if>
      </b:loop>
    </div>
  </b:if>
</b:includable>

Saturday, October 12, 2013

Creating CDF plot.

Generate a CDF plot

close all
y = randn(1,40000);
figure
hist(y,40)
title('Histogram')
% xlimit([-3,3])

  saveas(gcf, ['SAVE/''Histogram-Gaussian', num2str(mm)], 'png')

figure
cdfplot(y)
  saveas(gcf, ['SAVE/''CDF-Gaussian', num2str(mm)], 'png')
        

Monday, October 7, 2013

Load saved figure and save in fullscreen size

Code
% Load figure
filename =dir;
filename.name
for jj = 3:length(filename)
    this = filename(jj).name;
    hfig=  openfig(this,'reuse');
    set(hfig,'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
     set(hfig,'paperorientation','portrait');

 %     saveas(gcf,[this,'.png'])
% pause
 
end