aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--async/weather.txt7
-rw-r--r--templte.bashrc41
-rw-r--r--weather.py6
3 files changed, 52 insertions, 2 deletions
diff --git a/async/weather.txt b/async/weather.txt
index 6c85f18..b64fe83 100644
--- a/async/weather.txt
+++ b/async/weather.txt
@@ -7,3 +7,10 @@
1502616676___shower rain
1502616719___shower rain
1502616773___shower rain
+1502617325___light rain
+1502617369___light rain
+1502617400___light rain
+1502617437___light rain
+1502617507___light rain
+1502618393___light rain
+1502618548___light rain
diff --git a/templte.bashrc b/templte.bashrc
new file mode 100644
index 0000000..64d846c
--- /dev/null
+++ b/templte.bashrc
@@ -0,0 +1,41 @@
+
+
+### KAWAII-TERMINAL!
+### .bashrcの最後尾に追加してください
+export TERM=xterm-256color
+FREE_MEM()
+{
+ python3 $HOME/kawaii-term/kawaii-term.py --mem
+}
+CPU_USAGE()
+{
+ python3 $HOME/kawaii-term/kawaii-term.py --vmstat
+}
+DISK_USAGE(){
+ python3 $HOME/kawaii-term/kawaii-term.py --disk
+}
+GET_WEATHER() {
+ python3 $HOME/kawaii-term/weather.py
+}
+RIGHT_PRONPT()
+{
+ # パディング幅を%*s ${COLUMNS}で指定できるが、tmux経由だと、よく破綻しているので、ハードコードでもいいかもしれない
+ printf "%*s" 210 "$(tput setaf 199)$(tput bold)$(CPU_USAGE)$(tput sgr0) $(tput setaf 2)$(DISK_USAGE) $(tput setaf 123)[TENKI:$(GET_WEATHER)]$(tput sgr0)"
+}
+
+export PS1='$(free_mem) prompt > '
+GREEN="\[$(tput setaf 2)\]"
+PINK="\[$(tput setaf 199)\]"
+YELLOW="\[$(tput setaf 220)\]"
+ORANGE="\[$(tput setaf 202)\]"
+BLUE="\[$(tput setaf 33)\]"
+CYAN="\[$(tput setaf 111)\]"
+RESET="\[$(tput sgr0)\]"
+ULINE="\[$(tput smul)\]"
+EULINE="\[$(tput rmul)\]"
+BOLD="\[$(tput bold)\]"
+STIM="\[$(tput sitm)\]" # 斜線開始
+RTIM="\[$(tput ritm)\]" # 斜線終了
+BCC_T="\[$(tput setb 7)\]"
+WHOAMI="⚡ "
+export PS1="\[\$(tput sc; RIGHT_PRONPT; tput rc)\]$WHOAMI${BCC_T}${BOLD}${YELLOW}@${RESET} ${STIM}${CYAN}[\$(FREE_MEM)]${RESET}${RTIM} ${ULINE}${ORANGE}192.168.15.104${RESET}${EULINE} ${BOLD}${BLUE}=>${RESET}"
diff --git a/weather.py b/weather.py
index 52ca691..8a97a5b 100644
--- a/weather.py
+++ b/weather.py
@@ -13,8 +13,10 @@ import sys
from multiprocessing import Process
ok = None
+
+home = os.environ['HOME']
# check the exists of recent prediction
-with open('async/weather.txt','r') as f:
+with open('{home}/kawaii-term/async/weather.txt'.format(home=home),'r') as f:
line = None
for line in f:
...
@@ -36,7 +38,7 @@ def async_update():
obj = json.loads( raw )
desc = obj['weather'][0]['description']
save = '___'.join( map(str,[int(time.time()), desc] ) )
- os.system('echo {save} >> async/weather.txt'.format( save=save ) )
+ os.system('echo {save} >> {home}/kawaii-term/async/weather.txt'.format( save=save, home=home ) )
if ok is not None:
p = Process(target=async_update, args=())