I have recently started using Pluto.jl, and it is quite nice (and visually appealing). The question is: how do I set up a "pluto server", like the similar thing with jupyter. It must be easy, but I see no docs.
If your ip address is 0.0.0.0 on port 1234 run:
Pluto.run("0.0.0.0", 1234)
Source: https://github.com/fonsp/Pluto.jl/issues/398#issuecomment-689659028
Related
livecode is a R package for broadcasting code for live code demonstrations. I would like to use it for teaching R in online classrooms. The package can be installed from github and runs excellent on my computer and the result is very promising. Once installed from github:
remotes::install_github("rundel/livecode")
library(livecode)
You can start your web server via server = livecode::serve_file(). Next your browser pops up and shows you a syntax-hightlighted live broadcast of your coding. A benefit in comparison to a screenshare of code is that this broadcast delivers plain text which is scalable from the recipient. I tested it on my phone, worked great. No more scaling of RStudio in order to make people see your code. Furthermore text (the script) can be saved from browser.
https://www.rstudio.com/resources/rstudioconf-2020/livecode-broadcast-your-live-coding-sessions-from-and-to-rstudio/
My problem is, I cannot figure out how to configure my private work environment such that this broadcast can be received from outside my local network. serve_file can specify an ip and port. I tried to set it to my computer ip (found via ipconfig) and open port 80 (for http) in my router.
Can anybody support me in how to make a livecode broadcast to the global internet?
I contacted the package author and he suggested to follow this blogpost:
https://bitsandbricks.github.io/post/code-live-from-rstudio-and-share-it-with-the-world-in-real-time/
It suggests to use ngrok, a service that provides tunnels to localhost. This acutally worked for me for some seconds, killing my livecode package in the next moment. At the moment, I can no longer use livecode not even as a localhost. I assume this error may just be my fault. The blogpost provides an easy answer to my question.
I am a developer of ROS projects. Recently I am trying using ROS(melodic) on WSL2(Windows Subsystem for Linux), and all things works just great. But I got some trouble when I want to use another PC which also in the same local area network(LAN) to communicate with. Before setting the environment variables like "ROS_MASTER_URI, ROS_IP", I know that since WSL 2 work on Hyper-V so the IP show on WSL2 is not the one in the real LAN. I have to do some command like below in order to make everyone in LAN communicate with the specific host:PORT on WSL2.
netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr
But here comes a new question:
The nodes which use TCPROS to communicate with each other have a random PORT every time I launch the file.
How can I handle this kind of problem?
Or is there any information on the internet that I can have a look?
Thank you.
The root problem is described in WSL issue #4150. To quote from that thread,
WSL 2 seems to NAT it's virtual network, instead of making it bridged
to the host NIC.
Option 1 - Port forwarding script on login
Note: From #kraego's comment (and the edited question, which I'm just seeing based on the comment), this is probably not a good option for ROS, since the port numbers are randomly assigned. This makes port forwarding something that would have to be dynamically done.
There are a number of workarounds described in that issue, for which you've already figured out the first part (the port forwarding). The primary technique seems to be to create a PowerShell script to detect the IP address and create the port forwarding rules that runs upon Windows login. This particular comment near the top of the thread seems to be the canonical go-to answer, although many people have posted their tweaks or alternatives throughout the very long thread.
One downside - I believe the script that is mentioned there needs to be run at logon since the WSL subsystem seems to only want to run when a user is logged in. I've found that attempting to run a WSL service or instance through Windows OpenSSH results in that instance/service shutting down soon after the SSH session is closed, unless the user is already logged into Windows with a WSL instance opened.
Option 2 - WSL1
I would also propose that, assuming it fits your workflow and if the ROS works on it (it may not, given the device access you need, but not sure), you can simply use WSL1 instead of WSL2 to avoid this. You can try this out by:
Backing up your existing distro (from PowerShell or cmd, use wsl --export <DistroName> <FileName>
Import the backup into a new WSL1 instance with wsl --import <NewDistroName> <InstallLocation> <FileNameOfBackup> --version 1
It's possible to simply change versions in place, but I tend to like to have a backup anyway before doing it, and as long as you are backing up, you may as well leave the original in place.
The command ip tcp_metrics on Linux systems can be very helpful e.g. for analyzing historic network connections of the server without having access to log files.
Is something similar to this command available on Windows based systems?
It seems like netsh interface {ipv4|ipv6} show destinationcache will do the job I was looking for, although there are not as many details available as in ip tcp_metrics.
I would like to connect via ssh to certain equipment in a network.
The requisites are:
It must run a command and capture the output of the ssh session in R (or in bash, or any other programming language, but I would prefer it in R language)
It must enter a plain-text password (as this equipment hasn't been accessed before, and can't be changed with a rsa keypair), so the ssh.utils package doesn't meet this requirement
sshpass can't be used, as I have noticed that it doesn't work for some devices I tested.
I've read all this posts but I can't find an effective way to perform it: link 1, link 2, link 3, link 4
I know the requirements are hard to accomplish, but thank you for your effort!
EDIT:
Sorry if I didn't make myself understandable. I mean I work locally in R and I want to connect to +3000 devices in all of my network via ssh. It is Ubiquiti equipment, and the only open ports are 80 and 22.
If ssh doesn't work, I will use the RSelenium package for R and extract info from port 80. But first I will try with ssh pory 22 as it is a lot more efficient than opening an emulated browser.
The big problem in all these Ubiquiti equipment is that they have a password to log in. That's why requisite No.2 is needed. When I must enter a server that I know, I spend time setting up the rsa keypair so that I don't have to enter a password everytime I connect to a specific server, but it's impossible (or at least, for me it's impossible) to configure all +3000 Ubiquiti equipment with these keypairs.
That's why I don't use snmp, for example, as this equipment maybe they have it activated or not, or the snmp configuration is mistaken. I mean, I have to use something that's activated by default, and in a way, ordered. And only port 80 and port 22 are activated and I know all the user's and password's equipment.
And sshpass is an utility in UNIX/Linux like this link explains that works for servers but doesn't work for Ubiquiti equipment, as long as I've tested it. So I can't use it.
The command I need to extract the output from is mca-status. Simply by entering that into the console makes it print some stats I will like to get from the Ubiquiti equipment.
Correct me, please, if I am wrong in something I've posted. Thanks.
I think you have this wrong. I also have no idea what you are trying to say in point 2, and I have not idea what point 3 is supposed to say.
Now: ssh is a authentication mechanism allowing you (trusted) access to another machine and the ability to run a command. This can be as simple as
edd#max:~$ ssh bud Rscript -e '2+2'
[1] 4
edd#max:~$
where I invoke R (or rather, Rscript) on the machine 'bud' (my desktop) from a session on the machine 'max' (my server). That command could be anything including something which writes to temporary or permanent files. You can then retrieve those files via scp.
Authentication is handled independently -- on Unix we often use ssh-agent which run in the background and against you authenticate on login.
Finally I solved it using the rPython package and the python's paramiko module, as there was no way to do it purely via R.
library(rPython)
python.exec(python.code = c("import paramiko",
"ssh = paramiko.SSHClient()",
"ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())",
sprintf('ssh.connect("%s", username="USER", password="PASSWORD") ', IP),
'stdin, stdout, stderr = ssh.exec_command("mca-status")',
'stats = stdout.readlines()'))
I am trying to send messages between computers using AutoIt TCPListen and TCPConnect function. It works fine on local machine and on the computers that are sharing my local network. But when I try to use it on global connections, it fails. In other words
TCPListen("127.0.0.1",33891)
or
TCPListen("192.168.0.105",33891)
is working fine but when I try this global IP:
TCPListen("131.160.148.126",33891)
is does not work. Is it possible to communicate using your public IP address? If yes, then please tell me where I'm wrong.
When using the TCP functions on a global scale you must make sure you port forward the data recieved from that port to the machine you would like to see it on.
Here is a guide: http://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router