sed -e 's/$/\r/' inputfile > outputfile
sed -e 's/\r$//' inputfile > outputfile
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile
Start the notebook in no-browser mode and specify a port (different from any other port on the server):
jupyter notebook --no-browser --port=[XXXX]
Optional: start the notebook in tmux
or screen
so that you can later close the terminal while be able to run the notebook (e.g. if you are runing a lon task).
find . -name '*.jpg' | # find jpegs | |
awk 'BEGIN{ a=1 }{ printf "mv \"%s\" %02d.jpg\n", $0, a++ }' | # build mv command | |
bash # run that command | |
# Source: http://stackoverflow.com/a/10780250/2086547 |
When a file has been created on a different system from the one you are using, some cariage returns characters cause problems when commiting to git. You can fix this problem by running one of the following commands, depending on your system.
sed -e 's/$/\r/' inputfile > outputfile # UNIX to DOS (adding CRs)
sed -e 's/\r$//' inputfile > outputfile # DOS to UNIX (removing CRs)
perl -pe 's/\r\n|\n|\r/\r\n/g' inputfile > outputfile # Convert to DOS
perl -pe 's/\r\n|\n|\r/\n/g' inputfile > outputfile # Convert to UNIX (Mac OS X)
perl -pe 's/\r\n|\n|\r/\r/g' inputfile > outputfile # Convert to old Mac
Explanations of how to install and use IPython Notebook with a venv and multiple virtualenv (one for Python 2 and one for Python 3).
We run step-by-step and detail all the operations. A quicker, more concise guide can be found at the end of this gist.
We create first one venv for each version of Python.
mkvirtualenv -p /path/to/python2.7 venv-name
deactivate
def datetime_to_timestamp(dt, epoch=datetime(1970, 1, 1)): | |
""" | |
Convert datetime into timestamp (in seconds). | |
:param dt: Datetime object to convert | |
:param epoch: Base Epoch to be counted from, default is 01.01.1970 | |
:return: Number of seconds since the Epoch | |
""" | |
return int((dt - epoch).total_seconds()) |
def datenum_to_datetime(datenum): | |
""" | |
Convert Matlab datenum into Python datetime. | |
:param datenum: Date in datenum format | |
:return: Datetime object corresponding to datenum. | |
""" | |
days = datenum % 1 | |
hours = days % 1 * 24 | |
minutes = hours % 1 * 60 |