Skip to content

Instantly share code, notes, and snippets.

@bbarenblat
Created April 10, 2018 17:34
Show Gist options
  • Save bbarenblat/019796aa58b47d03a324a94669e9848c to your computer and use it in GitHub Desktop.
Save bbarenblat/019796aa58b47d03a324a94669e9848c to your computer and use it in GitHub Desktop.
#!/bin/sh
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# https://www.apache.org/licenses/LICENSE-2.0/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# sitd sends you periodic reminders to sit up straight. To prevent
# desensitization, it sends them at random intervals. We shouldn't send
# reminders too frequently, though.
readonly MIN=5 # minutes
readonly MAX=25
# The implementation is quite simple. We wait a random amount of time somewhere
# between $MIN and $MAX minutes, and then we send a notification.
while true; do
sleep $(echo "$MIN * 60 + $RANDOM % (($MAX - $MIN) * 60)" | bc)
notify-send -i object-flip-vertical 'Sit up!' 'Please sit up straight.'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment