Giter Club home page Giter Club logo

push's Introduction

push

Python Micro Shell - One file shell for micropython micro controllers - cd, pwd, cat , redirect, wget, mkdir, rmdir, rm, etc

This is designed to quickly give you a mini linix like shell. Tested on ESP32, ESP8266, RPI PICO W.

To use make sure you have micropython installed first.

To install the shell, just connect with thonny or whatever your using to manage your microdevice. Copy the push.py file on the device and save as push.py Then from the micropython cli "import push". It has a quick wifi connect built in, a crude editor that works similiar to cat'ng text into the console, wget (that works like curl), an ntp sync tool. The "exec" command will run a python script. You may want to make a lib directory first "mkdir lib" for exec as micropython defaulty has the lib directory is in its path. So for instance to call test.py with function hello(): place test.py in the lib directory and from the shell call it with "exec test.hello()" exec will also run native micropython functions for example os.listdir()

Its recommended to use the absolute path when working with directories and files.

Supports ls, cat, cd, pwd, mkdir, rmdir, rm, rename, cp, grep, wc, ifconfig, wget(works like curl),
and redirect ">". Supports PIPE now. No switches or flags.

if for some reason the shell crashes then you can restart it with "import push" and "push.shell()"

Here is the output of a test drive:

MicroPython v1.19.1-773-g988b6e2da on 2022-12-15; ESP32 module with ESP32

Type "help()" for more information.

>>> import push


  • PUSH - Python Micro SHELL *
  • ls,pwd,cd,uname,df,cat *
  • rmdir,rm,mkdir,cp,edit *
  • ifconfig,wget,connect,> *

$ifconfig

IP........... 0.0.0.0 NETMASK.......0.0.0.0 GATEWAY.......0.0.0.0 $

$connect Enter SSID: mynetwork Enter wifi pw: mypassword attempting to connect..

Check ifconfig..

$ifconfig

IP........... 192.168.1.18 NETMASK.......255.255.255.0 GATEWAY.......192.168.1.1 $

$ls boot.py push.py tmp $mkdir lib Directory lib created.

$cd lib lib $pwd /lib

$wget https://www.ntppool.org/en/

<title>pool.ntp.org: the internet cluster of ntp servers</title> <script> if (!NP) var NP = {}; </script>

<-- truncated for berevity demo-->

You can install other libraries from github using wget://yourgithub_raw_link > /lib/yourfilename.py

Example (Download uping and ping a network host): $cd /lib
$wget https://gist.githubusercontent.com/shawwwn/91cc8979e33e82af6d99ec34c38195fb/raw/ca2e629a54abcb18b1c4f766d594507cea41289a/uping.py > uping.py $ $cd .. .. $exec uping.ping("192.168.1.190") PING 192.168.1.190 (192.168.1.190): 64 data bytes 84 bytes from 192.168.1.190: icmp_seq=1, ttl=64, time=19.888000 ms 84 bytes from 192.168.1.190: icmp_seq=2, ttl=64, time=25.198000 ms 84 bytes from 192.168.1.190: icmp_seq=3, ttl=64, time=16.527000 ms 84 bytes from 192.168.1.190: icmp_seq=4, ttl=64, time=10.604000 ms 4 packets transmitted, 4 packets received $

$uname esp32 esp32 1.19.1 v1.19.1-773-g988b6e2da on 2022-12-15 ESP32 module with ESP32

$ntpsync time sync'd with: pool.ntp.org (2022, 12, 18, 23, 57, 4, 6, 352)

$ $cd tmp tmp $ $edit test.txt EDIT MODE DETECTED...

(ENTER STOPEDIT to stop)

this is a test STOPEDIT File test.txt created..

$cat test.txt this is a test

$cd .. .. $exec os.listdir() ['boot.py', 'lib', 'push.py', 'tmp']

$

push's People

Contributors

elahtrebor avatar

Stargazers

Francisco Hernandez avatar Greg Baker avatar Andy Piper avatar Martin Milan avatar

Watchers

Martin Milan avatar  avatar

push's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.