How to pipe input to sublimetext on linux?

Assuming Sublime still doesn’t support opening STDIN, a straightforward solution is to dump the output to a temporary file, open the file in sublime, and then delete the file. Say you create a script called tosubl in your bin directory as follows: #!/bin/bash TMPDIR=${TMPDIR:-/tmp} # default to /tmp if TMPDIR isn’t set F=$(mktemp $TMPDIR/tosubl-XXXXXXXX) cat … Read more

How to run ” ps cax | grep something ” in Python?

See Replacing shell pipeline: import subprocess proc1 = subprocess.Popen([‘ps’, ‘cax’], stdout=subprocess.PIPE) proc2 = subprocess.Popen([‘grep’, ‘python’], stdin=proc1.stdout, stdout=subprocess.PIPE, stderr=subprocess.PIPE) proc1.stdout.close() # Allow proc1 to receive a SIGPIPE if proc2 exits. out, err = proc2.communicate() print(‘out: {0}’.format(out)) print(‘err: {0}’.format(err)) PS. Using shell=True can be dangerous. See for example the warning in the docs. There is also the … Read more

Pipe vs. Temporary File

One big difference is that with the pipe, processes A and B can be running concurrently, so that B gets to work on the output from A before A has finished producing it. Further, the size of the pipe is limited, so A won’t be able to produce vastly more data than B has consumed; … Read more

How to display the currency symbol to the right in Angular

Since Angular2 RC6 version you can set default locale directly in your app module (providers): import {NgModule, LOCALE_ID} from ‘@angular/core’; @NgModule({ providers: [{ provide: LOCALE_ID, useValue: ‘de-DE’ // ‘de-DE’ for Germany, ‘fr-FR’ for France … }, ] }) Afterwards the currency pipe should pick up the locale settings and move the symbol to right: @Component({ … Read more

Angular – Observable with async pipe used multiple times in template… Good Practice or Bad?

Using the async pipe makes handling subscriptions much easier. It automatically handles unsubscribing unlike subscribing in the component. That said, there is a better pattern than what the example is showing. Rather than having multiple async calls on components, you can write it 2 different ways. I’m assuming these components are in the same template … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)