open improved
This commit is contained in:
17
open.sh
17
open.sh
@@ -2,8 +2,25 @@
|
|||||||
|
|
||||||
day=$(date +'%-d')
|
day=$(date +'%-d')
|
||||||
day0=$(date +'%d')
|
day0=$(date +'%d')
|
||||||
|
time=$(date +'%H')
|
||||||
|
|
||||||
# /usr/bin/open https://adventofcode.com/2020/day/$day/input
|
# /usr/bin/open https://adventofcode.com/2020/day/$day/input
|
||||||
|
mkdir -p day$day0/data/
|
||||||
|
cp module.py day$day0/
|
||||||
|
touch day$day0/data/sample.txt
|
||||||
|
|
||||||
|
current_epoch=$(date +%s)
|
||||||
|
if [ $time -gt 6 ]; then
|
||||||
|
day0=$(( $day0 + 1 ))
|
||||||
|
fi
|
||||||
|
target_epoch=$(date -j "12${day0}06002020.00" +%s)
|
||||||
|
|
||||||
|
echo "Sleep for $target_epoch - $current_epoch "
|
||||||
|
sleep_seconds=$(( $target_epoch - $current_epoch ))
|
||||||
|
echo "Sleep for $sleep_seconds"
|
||||||
|
sleep $sleep_seconds
|
||||||
|
|
||||||
|
day=$(date +'%-d')
|
||||||
|
day0=$(date +'%d')
|
||||||
curl -b cookies.txt https://adventofcode.com/2020/day/$day/input -o day$day0/data/data.txt
|
curl -b cookies.txt https://adventofcode.com/2020/day/$day/input -o day$day0/data/data.txt
|
||||||
curl -b cookies.txt https://adventofcode.com/2020/day/$day -o day$day0/index.html
|
curl -b cookies.txt https://adventofcode.com/2020/day/$day -o day$day0/index.html
|
||||||
|
|||||||
Reference in New Issue
Block a user