Skip to content

Instantly share code, notes, and snippets.

View DictXiong's full-sized avatar

Dict Xiong DictXiong

View GitHub Profile
@DictXiong
DictXiong / electricity_balance.zsh
Created July 30, 2023 03:23
THU Electricity Balance
#!/bin/zsh
set -e
_USERNAME="<your username at myhome.tsinghua.edu.cn>"
_PASSWORD="<your password at myhome.tsinghua.edu.cn>"
tmp=$(curl -fsSL http://myhome.tsinghua.edu.cn/web_netweb_user/noLogin.aspx | grep VIEWSTATE)
viewstate=$(echo $tmp | head -n 1 | sed 's/.*value="\(.*\)".*/\1/g')
viewstategen=$(echo $tmp | tail -n 1 | sed 's/.*value="\(.*\)".*/\1/g')
test -n "$viewstate"