{"id":15971151,"url":"https://github.com/glurp/netvector","last_synced_at":"2025-04-04T15:43:14.954Z","repository":{"id":141875059,"uuid":"102002286","full_name":"glurp/netvector","owner":"glurp","description":"Remote display for simple graphic via SSH","archived":false,"fork":false,"pushed_at":"2017-09-20T15:36:03.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T01:37:49.809Z","etag":null,"topics":["gui","ssh"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/glurp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-31T13:14:04.000Z","updated_at":"2019-01-07T11:52:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"ae7a4e3c-3baa-448c-9f83-3594d5940eb1","html_url":"https://github.com/glurp/netvector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2Fnetvector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2Fnetvector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2Fnetvector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/glurp%2Fnetvector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/glurp","download_url":"https://codeload.github.com/glurp/netvector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208018,"owners_count":20901568,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gui","ssh"],"created_at":"2024-10-07T20:08:07.200Z","updated_at":"2025-04-04T15:43:14.938Z","avatar_url":"https://github.com/glurp.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"Presentation\n============\n\nSometime, a distant host has  little environment\n* with TCP/IP\n* without any Xorg, graphics display, graphics libraries\n\n\n\nFor this cases, displaying some graphics (text/vector/raster) from distant host is not easy. Typical case are :\n\n* embeded Linux with little memory : Omega2, Linkit Smart, Arduino Yun...\n* router on OpenWrt\n* Cloud Server without any remote display amin.\n\n\n\n\n\nThis tool offer a basic solution:\n\n* a client, connect to host (ssh or tcp)\n* if ssh, it run a distant program (shell script or others)\n* this program print on STDOUT some lines of text which are vector graphics order\n* client show the resulting graph one the (gtk) display.\n\nHere a example of clock display (code in ```srv_clock.rb```) client show :\n\n![clock](https://user-images.githubusercontent.com/27629/29925133-a7c12f2c-8e5f-11e7-8c92-7f6125610dbb.png)\n\n\nPros/Cons\n* (+) very light , serveur-side and client-side\n* (-) very limited, http/canvas are more powerful\n\n\nUsage\n======\nUsage:\n```ruby\n   \u003eruby client.rb ip-host user  pass|noport  ssh|tcp|local   command...\n```\n\nExamples :\n```sh\n   ruby client.rb 192.168.0.1 root 1234 ssh ruby srv_clock.rb 22\n   ruby client.rb ab.net root 1234 ssh ruby -e \"'$stdout.sync=true;loop {puts \"CLEAR;POS,0,20///# {Time.now};END\" ;sleep 3}'\"\n   ruby client.rb ab.net root 8787 tcp -\n```\n\n\n\nFor TCP usage, shell server can be run with ```netcat``` :\n\n```shell\n nc  -kl 8787 -c ./srv.sh\n```\n\n(-l for listen TCP, port 8787, -k server keep online after client disconnection, -c command to run on connection, stdin/stdout piped on socket)\n\n\n\nIn Ruby, server TCP can use ```gserver``` gem, or minitcp :\n\n```ruby\nMServer.service(8787,\"0.0.0.0\",22) do |socket|\n  socket.on_timer(1000) do\n     socket.write \"CLEAR;POS, 1/20 /// Free Disk=\u003e #{`df -h | grep tmp | head -1`};END\"\n  end\n  socket.wait_end\nend\nsleep\n```\n\n```local```  usage is for test : run a local command, piped his output.\n\n\n\nVector graphic Langage\n=====\n\nline is splited with ```/\\s*[,/]\\s*/```.\nusage is to use ',' for all, except for x/y point or w/h size, in these case, use '/'.\n\nso: ```DDDD/1,2,3```  is same as : ```DDDD,2, 1/3```  or  ```DDDD, 2/1/3```\n\n\n\n\n```\n  echo \"CLEARBG\"                            # start backgound vector list\n  echo \"DIM, 100 / 200\"                     # set dimensiion of client drawing area\n  ....                                      # use pos/rect/pline/poly/ova\n  echo \"ENDBG\"                              # end of background list (no refresh!)\n\n  echo \"CLEAR\"                              # start vector list\n  echo \"FONT,size,name,color\"               # attributes for text\n  echo \"POS,x/y /// Date: $(date)\"          # text at x/y position (size nd color can(t be specified!)\n  echo \"RECT,#00F, #F00, 0, x/y, w/h\"       # horizontal rectangle : (bgcolor fgcolor border-width)  x y w h\n  echo \"PLINE, #888, #888, 10, 0/50, 200/50, 200/60, 0/60\" # poly-line: bgcolor fgcolor border-width x y x y...\n  eco  \"POLYG,#888, #888, 10, 0/50, 200/50, 200/60, 0/60\" #  plygone  : bgcolor fgcolor border-width x y x y...\n  echo \"OVAL, #888, #888, 10, 0/50, 200\"    # circle : bgcolor fgcolor border-width x-center y-center r\n\n######   echo \"END\"                                #  end of list , refresh\n```\n\n\nAt 'END' commande, refresh do a redraw of backdround layout AND THEN foreground layout.\nSo backgound can be a  heavy vectored (a svg export should be done...) , and forground show only varying vector.\n\nExample : output of srv_clock.rb :\n---\n\n```\nCLEARBG\nRECT, #CCC, #CCC, 0 , 0 / 0 , 200  / 100\nPLINE, #888, #888, 10, 0 / 70, 200 / 70, 200 / 80, 0 / 80\nOVAL, #AAA, #FEE, 3, 150.0 / 50.0, 30.3\nOVAL, #AAA, #AAA, 1, 150.0 / 50.0, 3\nPLINE, #AAA, #AAA, 1, 152.82226850822664 / 23.14790882505662, 153.1358538980296 / 20.1643431389518\n.... graduations drawing...\nPLINE, #AAA, #AAA, 3, 150.0 / 26.0, 150.0 / 20.0\nENDBG\n\nCLEAR\nPOS, 10 / 15 /// Date: 16:43:48\nPOS, 10 / 30 /// ls: 49\nPLINE, #AAB, #AAB, 2, 150.0 / 50.0, 159.3377195495643 / 61.7391223527862\nPLINE, #ABA, #ABA, 2, 150.0 / 50.0, 126.18924716845254 / 53.007997605543295\nPLINE, #BAA, #BAA, 2, 150.0 / 50.0, 121.46830451114539 / 40.72949016875159\nEND\nCLEAR\nPOS, 10 / 15 /// Date: 16:43:49\nPOS, 10 / 30 /// ls: 49\nPLINE, #AAB, #AAB, 2, 150.0 / 50.0, 159.3377195495643 / 61.7391223527862\nPLINE, #ABA, #ABA, 2, 150.0 / 50.0, 126.18403349074828 / 52.96643544177182\nPLINE, #BAA, #BAA, 2, 150.0 / 50.0, 122.59363627072197 / 37.79790070772599\n```\n\n\nExamples of server programs\n========\n\n\n```shell\n#!/bin/bash\necho  \"CLEAR\"\necho \"POS, 40 / 40 /// Hello ! \"\necho \"PLINE, #888, #888, 10, 0 / 50, 200 / 50\"\necho \"END\"\nsleep 3\nwhile :; do \n  echo \"CLEAR\"\n  echo \"RECT, #CCC, #CCC, 0, 0 / 0, 200 / 100\"\n  echo \"POS, 10 / 15 /// Date: $(date | awk ' {printf $4}')\"\n  echo \"POS, 10 / 30 /// ls: $(ls -1 | wc -l)\"\n  echo \"PLINE, #888, #888, 10, 0/50, 200/50, 200/60, 0/60\"\n  echo \"END\"\n  sleep 1\ndone\n```\n\n\nTODO\n====\n\n* [x] Force size of client drawing area\n* [x] 2 layers : one static, at startup, other dynamic\n* [x] Text with style : font, size, color\n* [ ] Raster image (?)\n* [ ] scp integration : copy script to server before execution (?)\n* [ ] test unit\n* [ ] a gem (?)\n\nLicense\n=======\nThis project is licensed under the terms of the MIT license.\n\n```client.rb```  is only  a proof of concept. If the idea pleases someone, the language could be extended and client part writing in compiled lang (Crystal ?  :)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglurp%2Fnetvector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fglurp%2Fnetvector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fglurp%2Fnetvector/lists"}