interactive

get output from a paramiko ssh exec_command continuously

我的未来我决定 提交于 2019-11-27 07:40:01
I am executing a long-running python script via ssh on a remote machine using paramiko. Works like a charm, no problems so far. Unfortunately, the stdout (respectively the stderr) are only displayed after the script has finished! However, due to the execution time, I'd much prefer to output each new line as it is printed , not afterwards. remote = paramiko.SSHClient() remote.set_missing_host_key_policy(paramiko.AutoAddPolicy()) remote.connect("host", username="uname", password="pwd") # myScript produces continuous output, that I want to capture as it appears stdin, stdout, stderr = remote.exec

Is there a way to squash a number of commits non-interactively?

可紊 提交于 2019-11-27 06:07:19
I'm trying to squash a range of commits - HEAD to HEAD~3. Is there a quick way to do this, or do I need to use rebase --interactive? Make sure your working tree is clean, then git reset --soft HEAD~3 git commit -m'new commit message' n8tr I personally like wilhelmtell's solution: git reset --soft HEAD~3 git commit -m 'new commit message' However, I made an alias with some error checking so that you can do this: git squash 3 'my commit message' I recommend setting up aliases that actually run scripts so that it is easier to (a) code up your scripts and (b) do more complex work with error

Including JavaScript in SVG

跟風遠走 提交于 2019-11-27 05:19:34
问题 I am trying to create an interactive SVG code with JavaScript, by embedding the JavaScript in the SVG. I don't know if this is the right way to do this: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg" onkeypress="move()"> <script type="text/javascript"> <![CDATA[ var x; var y; function move() { x = new Number

Interactive shell using PHP

陌路散爱 提交于 2019-11-27 04:58:28
Just wondering, is it possible to create an interactive shell, using PHP alone. I mean something like you have with databases, python, etc. If it is, how? Wiseguy Yes, it's possible. In order to be interactive, the program must be able to wait for and read in user input from stdin . In PHP, you can read from stdin by opening a file descriptor to 'php://stdin' . Taken from an answer to different question , here's an example of an interactive user prompt in PHP (when run from the command line, of course): echo "Continue? (Y/N) - "; $stdin = fopen('php://stdin', 'r'); $response = fgetc($stdin);

C++ interpreter / console / snippet compiler

北战南征 提交于 2019-11-27 03:37:16
问题 I am looking for a program where I can enter a C++ code snippet in one window, press a button, and get output in another window. Compilation should somehow be hidden behind the button. On a per-snippet basis would be fine, full interactive probably asking too much. It should run under Linux/Unix. Main use case would be learning/testing/short debugging, etc. Related stuff I found: -- the Reinteract project for python (which i'm told sage has features similar to) -- the same thread for C# here:

Interactive shell using Docker Compose

杀马特。学长 韩版系。学妹 提交于 2019-11-27 02:27:03
Is there any way to start a interactive shell in a container using Docker Compose only? I've tried something like this, in my docker-compose.yml: myapp: image: alpine:latest entrypoint: /bin/sh When I start this container using docker-compose up it's exited immediately. Are there any flags I can add to the entrypoint command, or as and additional option to myapp, to start as interactive shell? I know there are native docker command options to achieve this, just curious if it's possible using only Docker Compose, too. You need to include the following lines in your docker-compose.yml: stdin

Implement an interactive shell over ssh in Python using Paramiko?

大兔子大兔子 提交于 2019-11-27 01:09:52
I want to write a program (in Python 3.x on Windows 7) that executes multiple commands on a remote shell via ssh. After looking at paramikos' exec_command() function, I realized it's not suitable for my use case (because the channel gets closed after the command is executed), as the commands depend on environment variables (set by prior commands) and can't be concatenated into one exec_command() call as they are to be executed at different times in the program. Thus, I want to execute commands in the same channel. The next option I looked into was implementing an interactive shell using

How can I start an interactive console for Perl?

旧城冷巷雨未停 提交于 2019-11-26 23:46:39
问题 How can I start an interactive console for Perl, similar to the irb command for Ruby or python for Python? 回答1: You can use the perl debugger on a trivial program, like so: perl -de1 Alternatively there's Alexis Sukrieh's Perl Console application, but I haven't used it. 回答2: Not only did Matt Trout write an article about a REPL, he actually wrote one - Devel::REPL I've used it a bit and it works fairly well, and it's under active development. BTW, I have no idea why someone modded down the

Equivalent of Python's dir in Javascript

让人想犯罪 __ 提交于 2019-11-26 22:55:40
问题 when I write Python code from the interpreter I can type dir() to have a list of names defined in the current scope. How can achieve to have the same information, programmatically, when I develop Javascript code from a browser using an interactive console like firebug, chrome console, etc? 回答1: There are a couple of functions which do just this in the code for ChatZilla, you'll have to check the licence properly to see if you can just rip them out and use them wherever. The relevant functions

Interactive input/output using python

吃可爱长大的小学妹 提交于 2019-11-26 22:15:27
I have a program that interacts with the user (acts like a shell), and I want to run it using python subprocess module interactively. That means, I want the possibility to write to stdin and immediately get the output from stdout. I tried many solutions offered here, but none of them seems to work for my needs. The code I've written based on Running an interactive command from within python import Queue import threading import subprocess def enqueue_output(out, queue): for line in iter(out.readline, b''): queue.put(line) out.close() def getOutput(outQueue): outStr = '' try: while True: #Adds