Created
September 11, 2017 19:16
-
-
Save liuyigh/9691030a914a5d69bb59430ddc0ce933 to your computer and use it in GitHub Desktop.
iPyTerm - AppleScript Based iTerm2 launcher for IPython
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on run {input, parameters} | |
#!/usr/bin/osascript | |
-- Run ipython on a new iTerm (OS X version) | |
-- See http://www.iterm2.com/#/section/documentation/scripting | |
tell application "iTerm" | |
activate | |
set ipy to (make new terminal) | |
tell ipy | |
activate current session | |
launch session "Default Session" | |
tell the last session | |
set name to "IPython" | |
write text "ipython --pylab" | |
delay 2 | |
write text "import numpy as np" | |
write text "import pandas as pd" | |
write text "from pandas import Series, DataFrame" | |
write text "np.set_printoptions(linewidth=120)" | |
end tell | |
end tell | |
end tell | |
return input | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very useful script!
If you add &";exit" after the jupyter command, then after you Ctrl-C on the jupyter server, the shell will exit and the itTerm2 tab will close. This a little hassle of having to do this manually.