How do I programatically control a Chrome instance from the command line? - linux

How do I control a running Google Chrome instance from the command line? I'm hoping there's something like a -remote flag that will allow me to send in some javascript or somesuch. In particular, I would like to reload the topmost document on the foremost window.
I'm especially interested in Linux/MacOS solutions.

Take a look at http://code.google.com/p/chromedevtools/ . It might be you can use the Debugging Protocol to do the job.
There is also an Ruby Client.
There is also chromix.

You can use this command line tool if you're on a Mac - it uses the Chrome Scripting API, I guess
https://github.com/prasmussen/chrome-cli

Related

Vimscript function calls from terminal emulator

I have Language server client (vim-lsc) installed as a plugin in neovim. This client interacts with a language server for couple of languages, like python or R, and provides features like autocomplete, variable renaming etc...
One feature I want to use is the code execution, in which case you can select the part of the code and then send it to the LSP server for evaluation and get the response for it. I can do a similar thing if I create a terminal emulator "term://python" and copy paste the code there, but in this way there are two "servers" running, one via the LSP server and other from the terminal, similar to what vim-matlab does.
I was hoping to be able to do both with just one instance of python or R or MATLAb running. If there is a way to send the typed "command" in the terminal emulator to the LSP server via the vim-lsc plugin, then the job can be done with just one instance running.
I also thought of making a vimscript which creates a buffer that emulates terminal (like how Conque or vim-terminal do) and then capture and pass the commands via that script. Although, I was not able to figure out how those plugin made the prompt and command output non-modifiable but keeping the current typed command by the user modifiable.
My reason for preferring the LSP route and not opting for plugins like vimterm is that they don't provide various features like autocomplete and refactoring.
Any suggestions would be welcome. Thanks.
EDIT: I would like to clarify that as of now I don't think vim-lsc has the capability to send the executeCommand request. I wrote a small vimscript (sepatate code) which is able to do that. I plan to submit a pull-request in time and have the feature available in vim-lsc, hence the inclusion of vim-lsc in the description. Apologies for the confusion.
If it's part of the LSP protocol, and you can indeed send the code to the LSP server for execution, then it's not one that vim-lsc has implemented; I can't find it in the helpfile. Best thing you can do is search on the issue page and/or post about the feature yourself.

How can I run a Chrome extension in NW.js?

This question is pretty short and self explanatory. I'm wondering how I can run my Chrome extension in NW.js.
I know you can run an app in NW.js and I think you can run extensions as well?
I can't find much on the topic. Back in 2013 the way to do it seemed to be:
nw [path to manifest.json] --load-extension
Any ideas are appreciated!
Yes you can.
First off, download the extension you want. For this example I'll be using this debugging tool, which adds an additional tab in the dev tools window.
Inside your NW.js package.json file, ensure you have an entry called chromium-args.
Ensure its value contains --enable-extensions --load-extension=relative_path_to_extension_manifest.
My package.json looks like this:
After restarting the application, the extension shows up as expected:
Something I'll add is that the full Chrome API might not be available to you. I couldn't find info about what NW.js supports, but Electron definitely does not support the entire API, so this might have similar restrictions.
I also noticed you mention in the comments that you need to assign a hotkey of sorts. I'd need to know what you were trying to do, but essentially you have the option of either using a browser mechanism such as addEventListener('keydown', myHandler) or using the NW.js API depending on your exact needs.

linux or windows terminal over the web

I'm planing to make a web app which will allow you to have a Linux Terminal on a web page so that you can execute any command an get the response as if you were in front of your linux terminal.
I planed to use NodeJS as it is server side JavaScript, asynchronous and fast.
Also I saw this wich does exactly what i'm trying to do, I peeked in the source code, but didn't found something useful, I also analysed it with google chrome developer tools on the network tab, but there is absolutely nothing even while executing some commands and getting responses. How is this possible ? what technology do you think they used ?
So I wanted to get your advice, your experience in order to start it the right way.
I firstly decided to use NodeJS, but if there is another programming language or Framework more appropriate for this kind of application please let me know.
If you want a real terminal in the browser using node.js on the backend, you might give tty.js a try.
Alternatively you can use the pty.js module manually which is used by tty.js. Along with that, you could also use xterm for doing the browser-side terminal emulation.

BlackBerry Code Signing on Linux without GUI

After a lot of searching I have yet to find a way to sign a BlackBerry application on a Linux distribution with no GUI.
As of right now I'm getting the error "Unable to request signatures until this application has completed the initial key generation.". The problem is I'm not able to register the CSI files it seems via CLI. Has anyone accomplished this without setting up X11?
Yes, its definitely possible to do this on a headless Linux box. Heck, I do it on a headless Solaris/UltraSPARC server :-)
For actually running the tool, I like http://bb-ant-tools.sf.net/ . If you are using an older version of the signature tool, you may need to make some modifications as described on http://slashdev.ca/ .
While the tool is fully controllable from command-line parameters, it does unfortunately still require access to a running X server to function. The workaround for this is to install "Xvfb" (a fake X server for purposes like this), launch it in the background on your system, then set the DISPLAY variable so the signature tool will use it for its non-interactive GUI.
Blackberry sigtool may not be supported in Linux and it may be only partially working. BB dev tools are still Windows-centric.

Erlang: is there a module analogous to Python "webbrowser"?

I've used Python webbrowser module and I would love something equivalent in Erlang. What I am trying to do is open a browser window/tab from Erlang.
I can't find anything in the official Erlang documentation. Is there such a thing?
I assume you mean the Python webbrowser module, not webserver. The code for this module is instructive; it looks for various browsers and picks the best option. It interacts with the browser by running a shell command. Firefox supports a -remote command line argument to control an existing Firefox process. (IE seems to be handled simply by passing the url to the iexplore.exe)
The module also detects if it's running on Windows and tries to find out the Windows default browser and use that. Likewise, on Mac OS X, it uses the open command, which will use the default browser.
You should be able to implement this with open_port/2.

Resources