Skip to content

Instantly share code, notes, and snippets.

@AStupidBear
AStupidBear / mysshpass.py
Created February 26, 2018 05:45 — forked from jlinoff/mysshpass.py
Simple python script to emulate sshpass using only pthon standard libraries, tested on python-2.7 and python-3.4.
#!/usr/bin/env python
# License: MIT Open Source
# Copyright (c) 2016 Joe Linoff
'''
The tool runs ssh or scp as a child process with a connected psuedo
terminal (pty).
It will automatically answer yes to the "Are you sure you want to
continue connecting (yes/no)?" if it comes up.
addprocs(1)
const rr1=RemoteRef()
const rr2=RemoteRef(2)
@everywhere function do_sendrecv(N, rr1, rr2)
myid() == 1 && print("$N : ")
if myid() == 1
rr_put = rr2
addprocs(1)
@everywhere function echo_on_sock(s, N)
while true
try
read(s, Float64, (N,))
write(s, fill(Float64(myid()), N))
catch e
#println("closed by remote $e")
import MPI
function do_sendrecv(N)
comm = MPI.COMM_WORLD
MPI.Barrier(comm)
rank = MPI.Comm_rank(comm)
size = MPI.Comm_size(comm)