Current Lab
Sleep & Cognition »
Netherlands Institute for Neuroscience »
Previous Lab
Eagleman Lab »
The practical problem I had was to copy a paragraph from a pdf file into a text file. The text, however, would present always a line break on every line of the paragraph in the pdf. This is based on the method described in Answer my Searches.
import pygtk
pygtk.require('2.0')
import gtk
# get the clipboard
clipboard = gtk.clipboard_get()
text = clipboard.wait_for_text()
corrected = text.replace('\n', ' ')
clipboard.set_text(corrected)
# make our data available to other applications
clipboard.store()
Send an email to your account with the log file of a Matlab computation, when the analysis has finished (requires sendEmail). Open a gmail account to send the email.
fid = fopen('analysis_log','w');
output = sprintf(['analysis n.' num2str(k) ' has finished\n']);
fwrite(fid, output);
fclose(fid);
matlab -nosplash -nojvm -r "automaticscript; exit"
cat analysis_log | sendEmail -f OUTGOING_ACCOUNT@gmail.com \
-t INCOMING_ACCOUNT@gmail.com -u analysis_log -xp PASSWORD -m ""
where OUTGOING_ACCOUNT@gmail.com is the account you just created in gmail and PASSWORD is its password. The password is in plain text, that's why I prefer opening a new, empty, account to using my own.
INCOMING_ACCOUNT@gmail.com is your normal email account.
Based on the Lookup button from the Merriam-Webster dictionary, you can create a bookmark that, when pressed, will show a prompt in which you can search for a term in Pubmed.
javascript:{void(Qr=prompt('Enter%20term%20or%20DOI%20to%20find%20in%20PubMed:',''))}
{void(window.open('http://www.ncbi.nlm.nih.gov/sites/entrez/query.fcgi?db=pubmed&term='+escape(Qr)+'%20'))}
In order to access some scientific journals, you sometimes need to use a proxy server. The address of the proxy is usually visible on the address bar. If you have found an interesting paper, you might want to swith to the proxy without having to enter the page again. In this case, you can use this javascript example:
javascript:document.location.href="http://"+window.location.host+".PROXY.ADDRESS.COM/"+window.location.pathname;
or
javascript:document.location.href="http://PROXY.ADDRESS.COM/http/"+window.location.host+"/"+window.location.pathname;
depending on your proxy configuration.
Create a bookmark with a meaningful name (Switch to proxy) and add the javascript in the location. Then, when you encounter a page in which you need to use the proxy to log in, press on the bookmark and it will show you the same page but adding the PROXY.ADDRESS.COM to your address bar.