Skip to content

Instantly share code, notes, and snippets.

@georgewsinger
Created August 23, 2019 17:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georgewsinger/d71d33a5a272aa5cc12b3fad240eb657 to your computer and use it in GitHub Desktop.
Save georgewsinger/d71d33a5a272aa5cc12b3fad240eb657 to your computer and use it in GitHub Desktop.
test.m
Attributes[remoteExecute] = {HoldAllComplete};
remoteExecute[(*remote_,*)expr_] :=
Module[{compressed = Compress[Unevaluated[expr]],
ubuntuBox = RemoteConnect["192.162.0.2", "username", "password"]},
compressed = ExportString[ToString[Hold[expr], InputForm], "Base64"];
ToExpression[
RemoteRunProcess[ubuntuBox,
"wolframscript -format InputForm -code 'ReleaseHold[ImportString[\
\"" <> Uncompress[compressed] <> "\",\"Base64\"]]'",
"StandardOutput"]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment