In order to automate running and debugging node.js applications the debug URL needs to be opened from a script; eg.:
chromium "chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9230/9229"&
If I copy paste the URL in chromium is working fine.
however as I have stated this step needs to be automated.
How to open an URL of the form chrome-devtools://devtools/bundled/inspector.html in chromium/google-chrome from script or command line (Linux)?
It's not clear if your goal is just to have this automated for you, or if you want to figure out a way to script this yourself.
That said, there is a package on NPM called inspect-process that automates the process of opening DevTools windows. (Github). It serves as a replacement on the command-line for node. e.g.:
inspect myScript.js instead of node myScript.js
and it automatically opens up a DevTools window.
If you needed to script this process yourself you could likely use code from that package as well.
At the moment, this doesn't appear to be possible. I did find this bug report in the Chrome forums.
The only solution I was able to find was to use AppleScript as described here, but you said Linux so that won't be of much help to you.
Related
Not quite sure if it possible at all, so decided to ask here.
I need to automate some things and search the way to drag'n'drop local file to browser window (with specific URL) via Terminal command for uploading.
I use Mac, but I think Linux will fit here as well.
If there is any solution or module on Bash / Python / Node.js I will gladly give it a try.
take a look at requests package in python language.
you can make a POST request and send information you want to the web server.
Now that I am done with my project that was developed using PyCharm in a virtual environment, I need to distribute the code to my work machine; however, I am not certain on how to do this. Do I need to create a build of sorts so the code an run independently of the PyCharm IDE? Can someone please point me to the correct documentation on this crucial next step?
This really depends on what and how you're using the code for. If you just want to run it on your computer and it's a single file, you can open the command line/terminal and type python3 your_file_name and it will run the file (where your_file_name is the path to your .py file from whatever directory you're in). I assume you have python installed on your work machine, but if not, go here:
https://www.python.org/downloads/
If you have a more complex project or you want to deploy your code on a website or a server, these are probably good places to start.
https://www.jetbrains.com/help/pycharm/deploying-applications.html
https://docs.python.org/3.0/howto/webservers.html
EDIT: Added this as another useful link:
https://docs.python-guide.org/dev/virtualenvs/
I want to edit GS (google app script) files in a decent editor (Emacs or VIM) and keep it under git, so I need to be able to install it to run it.
Right now I copy the whole file and paste it into the code window in the browser, which is clearly suboptimal.
I wonder if there is a way to do it.
For some reason, Edit With Emacs does not work with the script editor.
The google apps script
Importing and Exporting Projects guide details using the Drive REST API
Note: Import/Export of scripts is limited to Standalone scripts
Only standalone scripts can be imported or exported. Container-bound scripts cannot be accessed through the Google Drive REST API.
This Google repo details how to work with scripts in a local dev environment
It uses node-google-apps-script which is really all you need to import/export your script project to a local machine and back to Google
It is a little bit of work setting it up; there are quite a few steps to work through
Despite this question is a bit old, I consider it could be useful for someone still wanting to edit App Scripts outside the browser.
There is a tool named clasp which aims to provide a way to edit an app script project in a local environment: https://github.com/google/clasp.
You just need to install via:
npm install -g #google/clasp
And enable the Google Apps Script API: https://script.google.com/home/usersettings
To use it, you should include a package.json via npm init (tested with version 2.4.0) and then make:
clasp login
clasp clone "projectID"
Afterwards, you could edit the files with your favorite editor. Finally, you could push the changes via:
clasp push
For more information, please check the repository of the project, pointed out above.
We are using groovy to build our java applications. The goal of the groovy script is to checkout from SVN, run MVN, download release notes from Jira, allow user to edit release notes, then upload everything to S3 for public consumption.
My question comes in on the editing of the release notes. I would like to have groovy run vim on a txt file and allow the user to edit the file and quit vim. On vim exit I would like the script to continue along. This should run on a headless linux server. I have it working locally on my mac using the open command but we are moving our builds to a central AWS linux server.
Something like this is what I'm looking for:
println "Downloading release notes..."
"vi RELEASE-NOTES.txt".execute().waitFor()
println "Uploading the edited release notes here"
FWIW the solution I am using on Mac OS is:
"open -eW RELEASE-NOTES.txt".execute().waitFor();
It opens TextEdit, allows me to edit and save the file, on quitting TextEdit the app moves on and uploads my edited file.
I think the VI solution fails because you no longer have a console (but you weren't very specific about this).
I'm embarassed to say I don't know how to fix this on a Unix machine, on DOS I would use "command /c vi" to run it in a new command shell, but even then it might be a trick to give that shell a "Console" for you to input in (in windows it would open up a new window).
Something like what you said MIGHT work if you piped the user input/output to the app stdin/out, but I bet some linux guru knows a better way.
Problem is that "Groovy" owns the console allocated to user I/O. If you could put groovy in the background (equivilent of ctrl-z) or switch to another console (perhaps using Screen or Linux's multiple consoles) you might be able to pull it off, but I probably wouldn't try it myself.
Redirecting I/O might be a better bet, or just go find a non-gui text editor written in Java and integrate it (Might be your best bet).
It doesn't seem possible, as per this answer, because java's way of handling processes is just piping streams of bytes, which doesn't relate to piping video/tty/whatever. A possible solution is to open a new window with xterm. Since you are on a headless linux, i'm not sure this will work. Are you connecting via SSH? What about trying connect to the server using ssh -X and then run the command? (Or does the "headless" implies the minus X doesn't work? :-) )
println "Downloading release notes..."
['xterm', '-e', 'vi RELEASE_NOTES.txt'].execute().waitFor()
println "Uploading the edited release notes here"
And... have you thought about writing such a script in shell? Seems a bit more suited, IMO.
I think #Bill K's suggestion would be great, but after a quick googling i couldn't found any java CLI editor.
I am trying to open image files, pdf files and music files using Cygwin, a terminal that provides Linux functionality in Windows. So far I have not successfully executed a command that would accomplish what I want. I can only open text files at this moment using vim text editor.
Edit: Thanks for the comments. I am looking to open files using appropriate windows applications. Also, I do not know how I can figure out whether XServer is already installed and why would I need XServer to resolve my issue in the first place.
Use the cygstart utility, e.g.,
cygstart foo.bmp
will open up the image file in Paint.
It’s in the cygutils package, which I believe is installed by default. It has a man page that shows that you can use it to open URLs in your browser, among other things.