Skip to content

Instantly share code, notes, and snippets.

@liuyigh
Created September 11, 2017 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liuyigh/9691030a914a5d69bb59430ddc0ce933 to your computer and use it in GitHub Desktop.
Save liuyigh/9691030a914a5d69bb59430ddc0ce933 to your computer and use it in GitHub Desktop.
iPyTerm - AppleScript Based iTerm2 launcher for IPython
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
@AstroMike
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment