command-line-interface

How to pipe Node.js scripts together using the Unix | pipe (on the command line)?

三世轮回 提交于 2019-12-02 17:26:45
I see how to pipe stuff together using Node.js streams, but how do you pipe multiple scripts together using the Unix | , given that some of these scripts can be async? $ ./a.js | ./b.js Example: a.js (chmod 0755) #!/usr/bin/env node setTimeout(function(){ console.log(JSON.stringify({ foo: 'bar' })); }, 10); b.js (chmod 0755) #!/usr/bin/env node console.log(process.argv); This is the output: $ ./a.js | ./b.js [ 'node', '/Users/viatropos/tests/b.js' ] events.js:72 throw er; // Unhandled 'error' event ^ Error: write EPIPE at errnoException (net.js:883:11) at Object.afterWrite (net.js:700:19) At

Can't paste text at a TFX-CLI console (NPM)

和自甴很熟 提交于 2019-12-02 17:11:27
问题 I'm unable to paste text at CLI prompts when running tfx-cli. I've just installed Node v8.9.1 LTS. Unfortunately, the tfx-cli install hung the first time through. I pressed Ctrl+C to cancel it, ran it again, and the second time it completed. (In the text that flashed across my screen during the second run, I believe I saw something about 'failed' and 'rollback.') I don't know whether the initial failure is contributing to my problem. When I run tfx login , I get this prompt first: > Service

How do I delete a versioned bucket in AWS S3 using the CLI?

淺唱寂寞╮ 提交于 2019-12-02 16:36:19
I have tried both s3cmd : $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to S3. The command for removing a bucket also doesn't work (from the AWS CLI): $ aws s3 rb s3://my-versioned-bucket/ --force Cleaning up. Please wait... Completed 1 part(s) with ... file(s) remaining remove_bucket failed: s3://my-versioned-bucket/ A client error (BucketNotEmpty) occurred when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in

How to remove globally a package from Composer?

两盒软妹~` 提交于 2019-12-02 14:34:23
I ran this command to install globally PHPUnit : composer global require 'phpunit/phpunit=3.7.*' Now I want to uninstall globally PHPUnit . Any ideas? To remove a globally installed package run: composer global remove phpunit/phpunit global command lets you to run many commands like install , require or update as if you were running them from the COMPOSER_HOME directory. Read the related documentation here: http://getcomposer.org/doc/03-cli.md#global COMPOSER_HOME depends on your system (on Linux it's ~/.composer ), see http://getcomposer.org/doc/03-cli.md#composer-home for more details. Also

How to change the project in gcp using cli commands

冷暖自知 提交于 2019-12-02 14:11:13
How can i change the current running project to another project in GCP ( Google Cloud Platform ) account using cli commands other than using gcloud init manually. $gcloud projects list will list the projects running on my account. I want to change the current project to any other project from the list using a cli command. Zachary Newman gcloud config set project my-project You may also set the environment variable $CLOUDSDK_CORE_PROJECT . BlocksByLukas Make sure you are authenticated with the correct account: gcloud auth list * account 1 account 2 Change to the project's account if not: gcloud

Delete node_modules folder recursively from a specified path using command line

风格不统一 提交于 2019-12-02 14:09:36
I have multiple npm projects saved in a local directory. Now I want to take backup of my projects without the node_modules folder, as it is taking a lot of space and can also be retrieved any time using npm install . So, I need a solution to delete all node_modules folders recursively from a specified path using the command line interface. Any suggestions/ help is highly appreciable. Darius M. Print out a list of directories to be deleted: find . -name 'node_modules' -type d -prune Delete directories from the current working directory: find . -name 'node_modules' -type d -prune -exec rm -rf '{

How do I avoid typing “git” at the begining of every Git command?

女生的网名这么多〃 提交于 2019-12-02 14:02:12
I'm wondering if there's a way to avoid having to type the word git at the beginning of every Git command. It would be nice if there was a way to use the git command only once in the beginning after opening a command prompt to get into "Git mode" . For example: git> After which every command we type is by default interpreted as a Git command. In a way similar to how we use the MySQL shell to write database commands: mysql> This will save me from having to type git hundreds of times a day. NOTE: I'm using git-bash , on Windows. You might want to try gitsh . From their readme: The gitsh program

Skip download if files exist in wget?

怎甘沉沦 提交于 2019-12-02 13:55:56
This is simplest example running wget: wget http://www.example.com/images/misc/pic.png but how to make wget skip download if pic.png is already available? plundra Try the following parameter: -nc , --no-clobber : skip downloads that would download to existing files. Sample usage: wget -nc http://example.com/pic.png Daniel Sokolowski The -nc , --no-clobber option isn't the best solution as newer files will not be downloaded. One should use -N instead which will download and overwrite the file only if the server has a newer version, so the correct answer is: wget -N http://www.example.com/images

How to configure Mac OS X term so that git has color? [closed]

♀尐吖头ヾ 提交于 2019-12-02 13:48:50
I've seen a Mac OS X git demo online in which it's configured to have multiple colors. For example, his prompt is amber, his ls directory is purple and his git diff output has ~ 4 colors (pink, light green, red, pale yellow). Can you tell me how can I configure Mac OS X terminal to achieve that? It's definitely Mac OS X Terminal.app, not iTerm. phloopy William Purcell's answer only enables color for the 'git diff' command. Do this to enable colors for all git commands: $ git config --global color.ui true William Pursell To display color in the output of git diff, you need to configure git. Try

Loop to keep adding spaces in string?

放肆的年华 提交于 2019-12-02 13:18:36
问题 I have the following code: sHexPic = string_to_hex(sPic); sHexPic.insert(sHexPic.begin() + 2,' '); sHexPic.insert(2," "); I would like to know how I can put this into a counted loop and add a space after every 2nd character. So far all this does is make this string "35498700" into "35 498700", which in the end I want the final result to be something like "35 49 87 00". I assume you would have to get the length of the string and the amount of characters in it. I am trying to achieve this in c+