github.com/icexin/eggos@v0.4.2-0.20220216025428-78b167e4f349/docs/usage.md (about)

     1  # Javascript interpreter
     2  
     3  ``` sh
     4  root@eggos# js
     5  >>> console.log("hello world")
     6  hello world
     7  >>> reg = new RegExp("hello")
     8  >>> console.log(reg)
     9  /hello/
    10  >>> resp = reg.test("hello world")
    11  >>> console.log(resp)
    12  true
    13  >>> var url = "http://baidu.com"
    14  >>> resp = http.Get(url)
    15  >>> console.log(resp)
    16  <html>
    17  <meta http-equiv="refresh" content="0;url=http://www.baidu.com/">
    18  </html>
    19  ```
    20  
    21  # Mount samba filesystem
    22  
    23  ``` sh
    24  root@eggos# mount smb://icexin:eggos@172.28.90.3:445/sambashare /share
    25  root@eggos# cd /share
    26  root@eggos# ls
    27  -rw-rw-rw- 111 fib.js
    28  root@eggos# cat fib.js
    29  function fib(n) {
    30          if (n == 1 || n == 2) {
    31                  return 1;
    32          }
    33          return fib(n-1) + fib(n-2);
    34  }
    35  
    36  console.log(fib(10))
    37  
    38  root@eggos# js fib.js
    39  55
    40  
    41  ```
    42  
    43  # Run nes emulator
    44  
    45  First run `QEMU_GRAPHIC=true QEMU_ACCEL=true mage graphic`
    46  
    47  ``` sh
    48  root@eggos# ls /share
    49  -rw-rw-rw- 111   fib.js
    50  -rw-rw-rw- 40976 mario.nes
    51  root@eggos# nes -rom /share/mario.nes
    52  ```
    53  
    54  - `W`, `S`, `A`, `D` mapping `up`, `down`, `left` and `right`.
    55  - `K`, `J` mapping `A` and `B`
    56  - `space` and `enter` mapping `select` and `start`
    57  - `Q` to quit game.
    58  
    59  # GUI
    60  
    61  First run `QEMU_GRAPHIC=true QEMU_ACCEL=true mage graphic`
    62  
    63  ``` sh
    64  root@eggos# uidemo
    65  ```
    66  
    67  
    68  # Chipmunk2D physics engine
    69  
    70  First run `QEMU_GRAPHIC=true QEMU_ACCEL=true mage graphic`
    71  
    72  ``` sh
    73  root@eggos# phy
    74  ```
    75  
    76  # HTTP server
    77  
    78  Running a HTTP server in background.
    79  
    80  ``` sh
    81  root@eggos# go httpd
    82  ```
    83  
    84  visit http://127.0.0.1:8080/debug/pprof in browser