Slide 1

Slide 1 text

iTerm2ͷεςʔλεόʔͷ ίϯϙʔωϯτΛࣗ࡞͢Δ (ͨͿΜPythonॳ৺ऀͰ΋Ͱ͖Δ) PyData.Okinawa + PythonBeginnersԭೄ ߹ಉษڧձ 2019 University of Ryukyus Kaito Akita

Slide 2

Slide 2 text

ळా ւਓ ֶ೥ ླྀٿେֶେֶӃ 2೥ ग़਎ ෱Ԭݝ๺۝भࢢ ޷͖ͳ৯΂෺ ೋ࿠ܥ ΍͍ͬͯΔ͜ͱ Hugkun CEO (ΞϧόΠτ) Πϯϑϥۀ຿ ͖͋ͨ ͔͍ͱ

Slide 3

Slide 3 text

iTerm2஌ͬͯΔਓ

Slide 4

Slide 4 text

iTerm2࢖ͬͯΔਓ

Slide 5

Slide 5 text

iTerm2ͱ͸ • TerminalͱiTermͷޙܧऀʹมΘΔ΋ͷͰ͢ • macOS10.12Ҏ߱Λ౥ࡌͨ͠MacͰಈ࡞͢Δ • iTerm2͸ɺ͋ͳ͕ͨৗʹ๬ΜͰ͍ͨ͜ͱΛܾ ͯ͠஌Βͳ͔ͬͨػೳͰɺ୺຤Λݱ୅ʹಋ͘

Slide 6

Slide 6 text

iTerm2ͷػೳ • Split Panes • Hotkey Window • Search • Autocomplete ͳͲ

Slide 7

Slide 7 text

εςʔλεόʔͱ͸ • 3.3.0͔Β͍ͭͨػೳ • ·ͩbetaςετதͰstableͰϦϦʔε͸͞Εͯ ·ͤΜ

Slide 8

Slide 8 text

εςʔλεόʔͱ͸

Slide 9

Slide 9 text

εςʔλεόʔઃఆํ๏ • Preferences > Profiles > Session > Status bar enabled > Configure Status Bar

Slide 10

Slide 10 text

ຊ୊

Slide 11

Slide 11 text

ίϯϙʔωϯτͷ࡞Γํ • Python API • Status Bar Component • Python RuntimeΛΠϯετʔϧ
 Scripts > Manage > Install Python Runtime • Scripts > Manage > New Python Script

Slide 12

Slide 12 text

ίϯϙʔωϯτͷ࡞Γํ

Slide 13

Slide 13 text

ίϯϙʔωϯτͷ࡞Γํ

Slide 14

Slide 14 text

ίϯϙʔωϯτͷ࡞Γํ • ~/Library/Application Support/iTerm2/ ScriptsͷύεҎԼʹϑΝΠϧ͕Ͱ͖Δ • Scripts > Manage > Reveal Scripts in Finder

Slide 15

Slide 15 text

ίϯϙʔωϯτͷ࡞Γํ #!/usr/bin/env python3.7 import asyncio import iterm2 # This script was created with the "basic" environment which does not support adding dependencies # with pip. async def main(connection): # This is an example of using an asyncio context manager to register a custom control # sequence. You can send a custom control sequence by issuing this command in a # terminal session in iTerm2 while this script is running: # # printf "\033]1337;Custom=id=%s:%s\a" "shared-secret" "create-window" async with iterm2.CustomControlSequenceMonitor(connection, "shared-secret", r'^create-window$') as mon: while True: match = await mon.async_get() await iterm2.Window.async_create(connection) # This instructs the script to run the "main" coroutine and to keep running even after it returns. iterm2.run_forever(main)

Slide 16

Slide 16 text

ίϯϙʔωϯτͷ࡞Γํ • ͋ͱ͸ΞΠσΞ࣍ୈʂʂ • αϯϓϧͱ͔ݟͳ͕Β࡞͍ͬͯ͘ • aync await ग़ͯ͘Δ͚ͲͦΜͳʹཧղ͍ͯ͠ ͳͯ͘΋େৎ෉

Slide 17

Slide 17 text

ίϯϙʔωϯτͷ࡞Γํ

Slide 18

Slide 18 text

ίϯϙʔωϯτͷ࡞Γํ • εΫϦϓτͷঢ়گ͸ Scripts > Manage > Console ͔Β֬ೝͰ͖Δ • ~/Library/ApplicationSupport/iTerm2/ Scripts/Autolaunch/ҎԼʹ഑ஔ͢Δ͜ͱͰࣗ ಈͰεΫϦϓτΛಡΈࠐΜͰ͘ΕΔ

Slide 19

Slide 19 text

·ͱΊ • GitHub • takezyou/iterm-wifi-component • takezyou/iterm-weather-component

Slide 20

Slide 20 text

·ͱΊ • ·ͩɼbetaςετத͕ͩे෼҆ఆͯ͠ಈ͍͍ͯΔ • Pythonͷجૅ஌͕ࣝ͋Ε͹࡞Δ͜ͱ͕Ͱ͖Δ • wifiͷεςʔλεόʔͷίϯϙʔωϯτΛ࡞੒ͯ͠issueΛ౤͛ͨ • Qiita • iTerm2εςʔλεόʔͷࣗ࡞ίϯϙʔωϯτΛ࡞੒ͯ͠Έͨ • iTerm2ࣗ࡞ίϯϙʔωϯτ࡞Γํʂʂ