odd-even weeks or calculating fortnights
Dec. 7th, 2017 01:03 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
This calculates even weeks, that is, it can calculate fortnights:
expr \( `date +%s` / 604800 \) % 2 >/dev/null || echo "even"
or if you want odd weeks:
expr \( `date +%s` / 604800 + 1 \) % 2 >/dev/null || echo "odd"
There are 604800 seconds in a week.
"% 2" gives the remainder after division by 2.
When expr evaluates to zero the command after the OR (||) is run.
My rubbish collection is on alternate weeks. But cron doesn't know about fortnights and I only put my rubbish out once every two or three months (I don't have much waste). So I use this in cron to trigger an alert on the appropriate day:
0 10 * * mon expr \( `date +\%s` / 604800 + 1 \) \% 2 > /dev/null || alert "garbage day"
I can't remember why I escaped the "%" symbols. I think maybe cron chokes on them if you don't.
Oh, I should add that "alert" is not a standard command. It is a script that I wrote which puts a notice on the screen and uses speech synthesis to announce the message.
expr \( `date +%s` / 604800 \) % 2 >/dev/null || echo "even"
or if you want odd weeks:
expr \( `date +%s` / 604800 + 1 \) % 2 >/dev/null || echo "odd"
There are 604800 seconds in a week.
"% 2" gives the remainder after division by 2.
When expr evaluates to zero the command after the OR (||) is run.
My rubbish collection is on alternate weeks. But cron doesn't know about fortnights and I only put my rubbish out once every two or three months (I don't have much waste). So I use this in cron to trigger an alert on the appropriate day:
0 10 * * mon expr \( `date +\%s` / 604800 + 1 \) \% 2 > /dev/null || alert "garbage day"
I can't remember why I escaped the "%" symbols. I think maybe cron chokes on them if you don't.
Oh, I should add that "alert" is not a standard command. It is a script that I wrote which puts a notice on the screen and uses speech synthesis to announce the message.
no subject
Date: 2017-12-09 08:06 pm (UTC)I would like chickens, but Julie won't allow it. Being far out in the country we have rodents anyway.
"Solar furnace" sounds impressive, but it's not. I simply have a fresnel lens that I'm clumsily experimenting with on small pieces. Here are a couple of examples of the power of the sun reaching more than 3,000°C:
https://www.youtube.com/watch?v=svAPyyUJUCo
https://www.youtube.com/watch?v=drE54ctrHBY
My fresnel lens is much smaller and I don't need very high temperatures so I can use a much more diffuse spot instead of focussing to a tiny point. High density polyethylene from milk bottles melts at only about 180°C. Here is one of the videos that inspired me:
http://www.youtube.com/watch?v=W_XUJwINdLw
and this young kid:
http://www.youtube.com/watch?v=rpXq6mnbCus
I'm considering forking out the money for an infrared non-contact temperature gauge (about $60), but I think I might need to find a way to accurately work out the temperature at the plastic instead of at the light spot.
https://www.jaycar.com.au/economy-non-contact-thermometer/p/QM7215
The milk bottles used as a temperature store in the little house don't need to be strong. They will just sit close to each other, but not touching, to let the air move all around them. They'll sit on grids of either welded steel reinforcing mesh (like that used in concrete foundations), or, if I can work out a way to make it, a polyethylene grid. This way they don't need to take any weight and don't need structural strength. They'll be there only to hold the water which will have great thermal inertia.
Flaps at the bottom and top of the heat stores will be opened to the room and/or the outside depending on the temperatures. The flaps will be controlled by my computer. It's tedious to do that by hand and I can make mistakes. At the moment my place gets heated and cooled by opening and closing my door during the day and night depending on temperatures. The thermal inertia of this place is pretty good (it's on a concrete slab) and it stays at about 23°C most of the time through heatwaves and cold snaps. I don't use a heater or cooler.
no subject
Date: 2017-12-10 02:03 pm (UTC)We're pretty light on for food waste. For me it's stuff like the scraps from onions, mostly.
My partner is a bit paleo and the like, but for all of that, we're never actually filled the composter to bursting.
I would like chickens, but Julie won't allow it. Being far out in the country we have rodents anyway.
But free EGGS!
The milk bottles used as a temperature store in the little house don't need to be strong.
no subject
Date: 2017-12-10 11:08 pm (UTC)