Skip to content

Instantly share code, notes, and snippets.

@thejhh
Created February 3, 2013 12:14
Show Gist options
  • Select an option

  • Save thejhh/4701550 to your computer and use it in GitHub Desktop.

Select an option

Save thejhh/4701550 to your computer and use it in GitHub Desktop.
Script that creates google calendar events for turn changes in LT31 online Freeciv game.
#!/bin/sh
game="LT31"
start_turn=66
start_time=1359900000
end_turn=200
hours=23
for((i=$start_turn; i<=$end_turn; i++)); do
turn="$i"
timestamp="$(calc -p "$start_time + ($i-$start_turn) *$hours*3600")"
date_start="$(date -d '@'"$timestamp" '+%Y-%m-%dT%H:%M:%S')"
date_end="$(date -d '@'"$(calc -p "$timestamp + 1800")" '+%Y-%m-%dT%H:%M:%S')"
date="$date_start,$date_end"
google calendar add --reminder='60m' -d "$date" "$game/T$turn"
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment