Skip to content

Instantly share code, notes, and snippets.

@Suzhou65
Last active September 21, 2020 09:17
Show Gist options
  • Select an option

  • Save Suzhou65/93dc47c0a489747ef21bd246ca1b1e3e to your computer and use it in GitHub Desktop.

Select an option

Save Suzhou65/93dc47c0a489747ef21bd246ca1b1e3e to your computer and use it in GitHub Desktop.
Raspberry Pi Automatically Report
import re
import os
import sys
import subprocess
from subprocess import PIPE
from subprocess import Popen

p1 = Popen(["ps", "-x"], stdout=PIPE)
p2 = Popen(["grep", "HentaiAtHome"], stdin=p1.stdout, stdout=PIPE)
p1.stdout.close()

psawk = ['awk","NR==1{print$3,$5}"]
         p3 = subprocess.Popen(psawk, stdin=p2.stdout, stdout=subprocess.PIPE)
         p2.stdout.close()
         p4 = p3.communicate()[0];
         output = p4.replace('R','S').replace('l','').replace(+,'').replace(' ','').replace('-','').decode("utf-8")
         p3.stdout.close()
         
print(output)
pi@raspberrypi:~/python $ python test.py
Sjava
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment