Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. l = range(0,100000)
  2. for i in l:
  3. if i%1000==0:
  4. print i
  5. for j in l:
  6. s = i + j
  7.  
  8. screen -d -m -L python test.py
  9.  
  10. #define _GNU_SOURCE
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <dlfcn.h>
  14.  
  15.  
  16. char *getenv(const char *s) {
  17. static char *(*getenv_real)(const char *s) = NULL;
  18.  
  19. if (getenv_real == NULL) {
  20. getenv_real = dlsym(RTLD_NEXT, "getenv");
  21.  
  22. setlinebuf(stdout);
  23. }
  24.  
  25. return getenv_real(s);
  26. }
  27.  
  28. gcc -O2 -o linebufferedstdout.so -fpic -shared linebufferedstdout.c -ldl -lc
  29.  
  30. $ LD_PRELOAD=./linebufferedstdout.so python test.py | tee -a test.out
  31. 0
  32. 1000
  33. 2000
  34. 3000
  35. 4000
  36.  
  37. ./program | tee a.txt
  38.  
  39. $ sudo apt-get install expect
  40. $ unbuffer python program.py | cat -
  41. <watch output immediately show up here>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement