Inspired by @chelsea 's blog post (http://blog.beeminder.com/easythings/), I would like to do a review of my year as many of my goals have been running for longer than that.
Still, that means changing settings to 15-20 goals and then changing them back.
Would be nice if something could be hacked in in the next few days
This sounds so awesome, but I have no idea how to use it. Can you give me a place to start? Like what is this written in and what do I do with it to make it run?
Hey there tall girl. Thatās a hard question to answer without knowing what you know, so what follows is going to be a really lousy answer. Apologies in advance. Hope it gives you a place to start, and maybe sparks a whole new learning quest for 2017.
Thatās a unix shell script, a little program that I wrote on my Mac using a text editor (vim) in the Terminal app. If that sentence is mostly gibberish, thereās a learning curve ahead.
If youāre on a Mac, the simplest way to run it is probably to copy it into a plain text file in your home folder, replace the your_token and your_username bits, and then, in Terminal, type sh my_text_file.txt and press return.
If youāre not on a Mac, then thatās probably not very helpful, sorry. But youāre an old hand at setting up Beeminder goals, so if learning to program using the command line is important, you know what to doā¦
Of course, running random bits of code from the internet without understanding what itās going to do can be super dangerous. This script asks Beeminder for a list of all of your goal names, then for each one, asks Beeminder to change the graphās start date. But you shouldnāt take my word for that.
So glad to hear that it was at least vaguely helpful. I never know how much egg-sucking to include without inadvertently crossing into patronising.
There must be better ways on Windows to use our API. I just donāt know what they are. But someone here probably does.
15+ years ago, I would have suggested trying ācygwinā, which provided a unix shell-like layer overtop of w2k. There might be a modern equivalent, something that makes it easy to use the same script (even though itās a quick and dirty hack). But a VM will do the trick if itās easy.
PS: one of my brothers still has an elvish email address that dates from when he was around the same ageā¦
You were remarkably helpful, given that my question was extremely vague and I gave little to no indication of my prior experience. Thanks for being patient with me.
@philip, Do you think you might be able to help me out with this?
n00b question: If Iāve got this, how do I get the STARTRANGE variable where 2019-01-12 is? Iāve tried a few of the things I know from other languages, and my guess is that the problem Iām having has to do with single vs. double quoting, but thatās where I hit a brick wall, and Iād love to fix it, because this would make it so that every time I run it, all of my goals would show the last 85 days.
#!/bin/sh
# from https://www.beeminder.com/api/v1/auth_token.json
AUTH_TOKEN=yeAhRiGHt
USER=myusername
STARTRANGE="$(date -v-84d '+%Y-%m-%d')"
for GOAL in $( curl https://www.beeminder.com/api/v1/users/$USER.json?auth_token=$AUTH_TOKEN | sed -e 's/[^[]*//; s/^.//; s/].*//; s/[",]/ /g' )
do
echo $GOAL
curl -X PUT -d '{"tmin":"2019-01-12"}' https://www.beeminder.com/api/v1/users/$USER/goals/$GOAL.json?auth_token=$AUTH_TOKEN --header "Content-Type: application/json" > /dev/null
done
Hi Mary! Definitely a quoting problem, as you suspected. As you know, single quotes donāt expand variables, but double quotes do. Of course, those are plain ascii quotes, not newfangled āsmartā quotes, which sometimes trips me up.
The current line in my script looks like this, with the date in $TMIN:
Unfortunately, that looks remarkably like @phiās suggestion, so I can only say that it works for me on my mac. I canāt read the error message in your images, so canāt begin to suggest whatās gone wrong.
My current tmin.sh script uses that pattern, if you want to download a working example.