What are named pipes?

Both on Windows and POSIX systems, named-pipes provide a way for inter-process communication to occur among processes running on the same machine. What named pipes give you is a way to send your data without having the performance penalty of involving the network stack. Just like you have a server listening to a IP address/port … Read more

Force line-buffering of stdout in a pipeline

you can try stdbuf $ stdbuf –output=L ./a | tee output.txt (big) part of the man page: -i, –input=MODE adjust standard input stream buffering -o, –output=MODE adjust standard output stream buffering -e, –error=MODE adjust standard error stream buffering If MODE is ‘L’ the corresponding stream will be line buffered. This option is invalid with standard … Read more

Preserve colouring after piping grep to grep

grep sometimes disables the color output, for example when writing to a pipe. You can override this behavior with grep –color=always The correct command line would be grep –color=always WORD * | grep -v AVOID This is pretty verbose, alternatively you can just add the line alias cgrep=”grep –color=always” to your .bashrc for example and … Read more

Using Pipes within ngModel on INPUT Elements in Angular

You can’t use Template expression operators(pipe, save navigator) within template statement: (ngModelChange)=”Template statements” (ngModelChange)=”item.value | useMyPipeToFormatThatValue=$event” https://angular.io/guide/template-syntax#template-statements Like template expressions, template statements use a language that looks like JavaScript. The template statement parser differs from the template expression parser and specifically supports both basic assignment (=) and chaining expressions (with ; or ,). However, certain … Read more

How to trick an application into thinking its stdout is a terminal, not a pipe

Aha! The script command does what we want… script –return –quiet -c “[executable string]” /dev/null Does the trick! Usage: script [options] [file] Make a typescript of a terminal session. Options: -a, –append append the output -c, –command <command> run command rather than interactive shell -e, –return return exit code of the child process -f, –flush … Read more

How to open every file in a folder

Os You can list all files in the current directory using os.listdir: import os for filename in os.listdir(os.getcwd()): with open(os.path.join(os.getcwd(), filename), ‘r’) as f: # open in readonly mode # do your stuff Glob Or you can list only some files, depending on the file pattern using the glob module: import os, glob for filename … Read more

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