Skip to content

Instantly share code, notes, and snippets.

View nathnx's full-sized avatar

nathnx nathnx

View GitHub Profile
@nathnx
nathnx / battery.py
Created January 20, 2017 03:40 — forked from lloeki/battery.py
Battery status script for Mac OS X
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from subprocess import Popen, PIPE
def ioreg_battery_info():
output = Popen(["ioreg", "-r", "-k", "LegacyBatteryInfo", "-w", "0"], stdout=PIPE).communicate()[0]
try: #python3