Interprocess communication in Python

The multiprocessing library provides listeners and clients that wrap sockets and allow you to pass arbitrary python objects. Your server could listen to receive python objects: from multiprocessing.connection import Listener address = (‘localhost’, 6000) # family is deduced to be ‘AF_INET’ listener = Listener(address, authkey=b’secret password’) conn = listener.accept() print ‘connection accepted from’, listener.last_accepted while … 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

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