aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar gimpei <gim.kobayashi@gmail.com> 2017-08-13 06:24:55 +0900
committerGravatar gimpei <gim.kobayashi@gmail.com> 2017-08-13 06:24:55 +0900
commit9b7b935f7944206fdd3581a5c5da4b3c1dd39f8a (patch)
tree31989271c397643b76152402283ae11ee49a0b47
downloadkawaii-term-9b7b935f7944206fdd3581a5c5da4b3c1dd39f8a.tar.gz
a
-rw-r--r--kawaii-term.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/kawaii-term.py b/kawaii-term.py
new file mode 100644
index 0000000..f868fb9
--- /dev/null
+++ b/kawaii-term.py
@@ -0,0 +1,12 @@
+import sys
+import os
+import re
+if '--mem' in sys.argv:
+ for line in os.popen('cat /proc/meminfo').read().split('\n'):
+ if 'MemFree' in line:
+ line = line.strip()
+ # デフォルトではKB表現だから、メガバイトで表現する
+ mem = re.split(r'\s{1,}', line)[-2]
+ mem = '%d MB'%(int(mem)//1000)
+ print( mem )
+ break