Skip to content

Instantly share code, notes, and snippets.

@ei-grad
Last active December 2, 2015 00:29
Show Gist options
  • Save ei-grad/c61014f5137e1c1171f6 to your computer and use it in GitHub Desktop.
Save ei-grad/c61014f5137e1c1171f6 to your computer and use it in GitHub Desktop.
import subprocess
from datetime import datetime
from time import sleep, time
import locale
import psutil
locale.setlocale(locale.LC_ALL, locale.getdefaultlocale())
while True:
t = time()
sleep(0.5 - (t * 2 - int(t * 2)) / 2. + 0.001)
subprocess.call(['xsetroot', '-name', "CPU:%s%% MEM:%s%% | %s" % (
psutil.cpu_percent(), psutil.virtual_memory().percent,
datetime.now().strftime('%c')
)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment