git stash

Instead of commiting before switching a git branch, you can stash your modifications.


$ git stash

This command save the current state of developpement. You can now switch to another branch.


$ git stash apply

Restore from your last stash

you can also inspect all your stashed state with


$ git stash list

or


$ git stash show

Advertisements

matplotlib subplot

Usually, if you were a Matlab user, you probably creating multiple subplots with the following code:


>>> from matplotlib.pyplot import *

>>> f=plt.figure()

>>> ax1=f.add_subplot(211)

>>> ax2=f.add_subplot(212)

>>> ax3=f.add_subplot(221)

>>> ax4=f.add_subplot(222)

But Matplotlib, allow a better way to do this :


 >>> from matplotlib.pyplot import *

>>> f,ax = plt.subplots(2,2) # Mind the ‘s’ !

 

Then ax is a numpy array with


>>> np.shape(ax)

(2,2)


Now you can easily plot on the ax of you choice.

Here’s a minimal example:


 >>> import scipy as sp

>>> from matplotlib.pyplot import *

>>> f,ax = plt.subplots(2,2)

>>> a1=sp.rand(2,2)

>>> a2=sp.rand(15,15)

>>> a3=sp.rand(30,30)

>>> ax[0,0].plot(a1[:,0],a1[:,1],’ob’)

>>> ax[1,0].plot(a2[:,0],a2[:,1],’or’)

>>> ax[1,1].plot(a3[:,0],a3[:,1],’ob’)

>>> plt.show()

 


Bookmarklets list for safari iOS

If you want to improve safari iOS capabilities, your best option is bookmarklets. Bookmarklets enable the possibility, through a bookmark, to run a java script and thus add some interesting features.

For instance, you can share a web site adress with google+, save a website in PDF, or open it into Goodreader ( see my quick review here ). There is thousand of examples of possibility offers with bookmarklets.

I highly recommend to discover it with this web site, with a nice list of usefull bookmarklets for safari iOS.

For a more complete list, you can also see this web site


iPad app for scientific article reviewing

When you write an article, multiple reviews from your own and/or from the contributors may quickly spend your whole paper supply.

When I bought my iPad, one of my first motivation was to achieve an old “zero paper” dream. After one year and a half of intensive use, I can clearly state that I failed the “zero paper” quest, but  I made significant progress in my “reducing paper” one.

Actually, one App from the AppStore has really helps in that task: Goodreader .

Ok, this name could sound obvious for many of you, but for those who never heard about it, I just want to make a quick presentation.

Goodreader is more than a annotating pdf app, because it allow also you to manage files. It allows connection to all the most popular cloud services ( Dropbox, Box.net, google drive, skydrive…), local network ( ftp,afp,smb,…) but also to your mailbox.

My classical workflow is :

  1. On my PC : symbolic link on my Dropbox account of my paper directory
  2. switch to the iPad and  Goodreader to connect to my Dropbox
  3. get the pdf and directly annotate on it.
  4. Do the annotation and upload change to the dropbox
  5. return to the PC  ( tex writer is a very efficient – but expensive – latex editor including  compilation for ipad) to update my latex code with my annotated pdf

The text annotations are compliant with acrobat format. Note that last version has update the “hand free” annotation which is now very efficient.