Skip to content
Snippets Groups Projects
Commit df66ab29 authored by Recolic Keghart's avatar Recolic Keghart
Browse files

update dir

parent 9029a1ea
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
[[ $1 == '' ]] && echo "usage: $0 sign/ans/all" && exit 1
[[ $_openid == "" ]] && echo 'Give openid or url please:' && read _openid
_openid=$(echo "$_openid" | sed 's/^.*openid=//g')
echo "Set openid to $_openid"
_url="https://www.teachermate.com.cn/wechat/wechat/guide/answer?openid=$_openid"
_audio_player="mpg123"
#_audio_player="cvlc --play-and-exit"
function _segfault_detected () {
echo "WARNING: segfault captured!"
while true; do
$_audio_player error.mp3
[[ $? == 127 ]] && exit 127
sleep 2
done
}
if [[ $1 == all ]]; then
_openid="$_openid" $0 sign &
_openid="$_openid" $0 ans
exit 0
fi
cd impl
if [[ $1 == sign ]]; then
_url="$_url" _audio_player="$_audio_player" ./daemon-signin.fish
[[ $? == 127 ]] && exit 127
_segfault_detected
fi
if [[ $1 == ans ]]; then
_url="$_url" _audio_player="$_audio_player" ./daemon-answer.fish
[[ $? == 127 ]] && exit 127
_segfault_detected
fi
cd ..
File moved
File moved
#!/usr/bin/fish #!/usr/bin/fish
#Usage: fill _openid with openid from url of the page "学生->答题". #Usage: fill _openid with openid from url of the page "学生->答题".
set _openid ''
test "$_openid" = ""; and echo 'Give openid or url please:'; and read _openid
set _openid (echo "$_openid" | sed 's/^.*openid=//g')
echo "Set openid to $_openid"
set _url "https://www.teachermate.com.cn/wechat/wechat/guide/answer?openid=$_openid"
set _audio_player "mpg123"
#set _audio_player "cvlc --play-and-exit"
function _check_and_warn function _check_and_warn
if _all_answered if _all_answered
echo "LOG> exit because all question answered." echo "LOG> exit because all question answered."
......
#!/usr/bin/fish #!/usr/bin/fish
set _openid ''
test "$_openid" = ""; and echo 'Give openid or url please:'; and read _openid
set _openid (echo "$_openid" | sed 's/^.*openid=//g')
echo "Set openid to $_openid"
set _url "https://www.teachermate.com.cn/wechat/wechat/guide/signin?openid=$_openid"
set _audio_player "mpg123"
#set _audio_player "cvlc --play-and-exit"
set tmpfl (mktemp) set tmpfl (mktemp)
rm $tmpfl
while true while true
sleep 5 test -f $tmpfl; and sleep 5
date date
curl -L "$_url" 2>/dev/null > $tmpfl curl -L "$_url" 2>/dev/null > $tmpfl
if grep '{"data":\[\],"msg":"unauthorized"}' $tmpfl if grep '{"data":\[\],"msg":"unauthorized"}' $tmpfl
......
File moved
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment