5 easy steps to start editing python notebooks over SSH

ref:
5 easy steps to start editing python notebooks over SSH
http://fizzylogic.nl/2017/11/06/edit-jupyter-notebooks-over-ssh/

When you work with Linux machines on Amazon EC2 or Azure over SSH and want to edit interactive python code you’ve got a challenge. There is vim and other console based editors, but that might not be what you want. Here’s how you can edit python code in your browser over SSH in 5 steps.

Step 1: Install jupyter on your remote machine

Jupyter is a webbased python editor that works with notebooks. Notebooks are interactive pieces of python mixed with markdown code.

It’s cool because you can write several fragments of code and execute them one after another. When one of the fragments doesn’t work you can simply edit and run it again. The global variables defined in the other fragments are still there.

Want some documentation with your code? Add a markdown fragment and go wild. The cool thing about notebooks is that you’re not only editing python code and writing docs. It also visualizes graphs generated using pyplot.

The fact that you can do this kind of stuff in a notebook makes it ideal for creating experiments. It may not be suitable for production, but it is pretty much the only way I want to experiment when setting up protoypes.

You can install jupyter using the following command:

pip install jupyter

  
Bash
Copy

Execute this command on the remote machine you want to work on.
Once installed you can start editing notebooks.

Step 2: Start the jupyter notebook editor

Typically you’d start jupyter using the command jupyter notebook. But this opens up the browser, which is not available through an SSH session. So instead run the following command to start the jupyter notebook server without opening a browser:

jupyter notebook --no-browser --port=8080

  
Bash
Copy

Notice the port setting. Keep this port in mind when executing the next step.

Step 3: Setup a SSH tunnel to your remote machine

To access the notebook on your remote machine over SSH, set up a SSH tunnel to the remote machine using the following command:

ssh -N -L 8080:localhost:8080 <remote_user>@<remote_host>

  
Bash
Copy

This command opens op a new SSH session in the terminal. I’ve added the option -N to tell SSH that I’m not going to execute any remote commands. This ensures that the connection cannot be used in that way, see this as an added security measure.

I’ve also added the -L option that tells SSH to open up a tunnel from port 8080 on the remote machine to port 8080 in my local machine.

Step 4: Open the notebook in your browser

Now that you have a tunnel to the remote machine, open up your browser and navigate to http://localhost:8080/. This will fire up the jupyter notebook web interface.

Step 5: Enjoy your python notebooks

Time to start hacking! Keep in mind that the notebooks you save will be stored on the remote machine. So if you want to backup the notebook files you will have to either push them to git or download them to your local machine.

Enjoy!

内容概要:文章详细介绍了电梯门禁(梯控)系统的硬件安装与接线要点。首先强调了梯控板与楼层按键对接的重要性,包括遵循一一对应原则以避免错层、越层问题,允许空层存在以适应实际需求。接着阐述了不同接线方式(COM、NO、NC端口的不同组合)对用户权限的影响,如单层权限用户刷卡直达指定楼层,多层权限用户在特定接线方式下的操作限制。硬件安装方面,强调了无源干触点设计原则以确保电气隔离,防止系统间干扰,以及读卡器接入时的规范要求。文章还介绍了梯控系统的技术原理,如身份验证机制(二维码/IC卡/人脸识别)、消防联动功能(紧急情况下释放所有楼层权限),并指出该系统适用于小区、写字楼等场景,支持机器人乘梯SDK扩展。最后,根据不同场景需求提出了适用的接线方式选择,如严格管控场景下选择4.3接线以实现精准权限控制,限制多层用户手动选层场景下选择4.1接线并配合软件权限设置。; 适合人群:从事电梯安装维护的技术人员、楼宇自动化工程师及相关领域的管理人员。; 使用场景及目标:①指导技术人员正确安装和接线梯控系统,确保系统安全稳定运行;②帮助管理人员了解不同接线方式对用户权限的影响,以便根据实际需求选择合适的配置方案;③提升楼宇安全管理和服务质量,特别是在小区、写字楼等场所的应用。; 其他说明:梯控系统的正确安装和接线不仅关系到系统的正常运作,更直接影响到用户的安全和使用体验。因此,在实际操作中务必严格按照规范执行,同时关注最新的技术发展和应用场景变化,以确保系统始终处于最佳状态。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值