├── zen.png ├── LICENSE ├── README.md └── zen.sh /zen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j-lord/zen/HEAD/zen.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Jaysin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zen 2 | Zen messenger randomly constructs **random** messages to **random** people in **random** groups. 3 | 4 | Script should be run at random times to express thoughtfulness and consideration towards loved ones. 5 | 6 | ### Quick Install Procedure 7 | 1. Open terminal 8 | 9 | 10 | ![Alt text](/../screenshots/Terminal.jpg?raw=true "Termainal Window") 11 | 12 | - Fork Repository 13 | ```bash 14 | sudo wget https://github.com/j-lord/zen/raw/master/zen.sh 15 | ```` 16 | - If you don't have wget installed, use curl. 17 | ```bash 18 | curl -LOk https://github.com/j-lord/zen/raw/master/zen.sh 19 | ```` 20 | ...eventually you'll want to install [Homebrew](http://brew.sh) and [wget](http://stackoverflow.com/a/17094214). 21 | 22 | - Make script executable 23 | ```bash 24 | sudo chmod u+x zen.sh 25 | ``` 26 | 27 | - If using Mac OS 28 | You'll be ready to execute. 29 | ```bash 30 | sudo ./zen.sh 31 | ``` 32 | ![Alt text](/../screenshots/zen1.png?raw=true "Zen Example") 33 | ![Alt text](/../screenshots/zen2.png?raw=true "Zen Example") 34 | ![Alt text](/../screenshots/zen3.png?raw=true "Zen Example") 35 | ![Alt text](/../screenshots/zen4.png?raw=true "Zen Example") 36 | 37 | 1. If Linux 38 | Open zen.sh comment out the last chuck of code for osascript instructions and pick a messaging technique. 39 | 40 | 1. If PC 41 | Throw away your computer and buy a mac or Linux box ; ) 42 | 43 | 2. Then you should be ready to execute. 44 | ```bash 45 | sudo ./zen.sh 46 | ``` 47 | 48 | ### License 49 | 50 | ### The MIT License (MIT) 51 | 52 | Copyright (C) 2016 ~ Jaysin Lord ~ hello@fortlord.io 53 | -------------------------------------------------------------------------------- /zen.sh: -------------------------------------------------------------------------------- 1 | ##################################################################### 2 | # * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * # 3 | 4 | #### #### Stay calm, Remain relaxed, 5 | ###### ###### Keep ZEN 6 | ######## ######## 7 | ################# 8 | ################# 9 | ############### 10 | ############# 11 | ########## This script was crafted using the 12 | ######## finest Itanian leather 13 | ###### 14 | #### ... and love 15 | ## 16 | # 17 | # 18 | 19 | # * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * # 20 | ##################################################################### 21 | # If on Mac, change MY_NUMBER, group names, and group numbers. 22 | # make file exacutable 23 | 24 | #!/bin/bash 25 | MY_NUMBER="+13334567778" 26 | scriptName=zen.sh 27 | # 28 | # GROUPS, NAMES, and NUMBERS (like a sudo map) 29 | ladies=("Amy":"+123" "Brittany":"+234" "Dana":"+345" "Lisa":"+456") 30 | family=("Gma":"+987" "Mom":"+876" "Dad":"+765" "Aunt Sandy":"+654") 31 | mates=("Dominic":"+111" "Jeremy":"+222" "Thomas":"+333" "Matt":"+444") 32 | number_of_groups=3 33 | # group 0=ladies 1=family 2=mates 34 | # 35 | # gounp_name=("Name":"+countryCodePhone_number" "Name"...and so on) 36 | # 37 | # to add a group, add info here under the last group and 38 | # advance number_of_groups + 1 39 | 40 | ############# Pick random Group and random Person ############# 41 | target_group=$[ RANDOM % number_of_groups ] 42 | 43 | if [ $target_group -eq 0 ]; then 44 | person_index=$[$RANDOM % ${#ladies[@]}]; 45 | target_name=${ladies[person_index]}; 46 | elif [ $target_group -eq 1 ]; then 47 | person_index=$[$RANDOM % ${#family[@]}]; 48 | target_name=${family[person_index]}; 49 | elif [ $target_group -eq 2 ]; then 50 | person_index=$[$RANDOM % ${#mates[@]}]; 51 | target_name=${mates[person_index]}; 52 | # . 53 | # . 54 | # elif [ $target_group -eq N ]; then 55 | # person_index=$[$RANDOM % ${#GROUPNAME[@]}]; 56 | # target_name=${GROUPNAME[person_index]}; 57 | else 58 | echo "Error!" 59 | echo "Make sure you really have ${number_of_groups} groups?" 60 | fi 61 | ############################################################### 62 | 63 | name=${target_name%%:*} # information preceding colon -> name: 64 | number=${target_name#*:} # information following colon -> :number 65 | 66 | ################### Messsage database ####################### 67 | # Current hour 68 | hourNow="$(date +%H)"; 69 | 70 | # shell will interpret hourNow as an octal number (with leading 0) 71 | # to avoid this, remove the leading zero using parameter expansion. 72 | hourNow=${hourNow#0} 73 | 74 | # add all time depended variables here 75 | if (( hourNow >= 6 )) && (( hourNow < 12 )); then 76 | time_of_day="morning"; HHH="have"; GGG="is"; TTT="tonight"; 77 | 78 | elif (( hourNow >= 12 )) && (( hourNow <= 17 )); then 79 | time_of_day="afternoon";HHH="are having"; GGG="is going"; TTT="later"; 80 | 81 | elif (( hourNow >= 17 )) && (( hourNow <= 24 )); then 82 | time_of_day="evening"; HHH="had"; GGG="has been"; TTT=""; 83 | fi 84 | # this assumes no messages will be sent from 12 midnight to 6:00 am 85 | 86 | # Will be working on building a larger message database 87 | ladies_start=( "Good $time_of_day" "Hey $name" "What's up $name," 88 | "I've been thinking about you all $time_of_day," "Just wanted to tell you" 89 | "I just texted to say" "Good $time_of_day love,") 90 | ladies_end=( "I miss you." "I hope that you ${HHH} a great day." 91 | "I hope that your day ${GGG} great." "you're really great, I hope you know that." 92 | "I can't wait to see you." "you have a way of making me smile no matter what." "you're beautiful.") 93 | family_start=( "Good $time_of_day" "Hey $name" "I've been meaning to call you" ) 94 | family_end=( "I hope all has been well at home." 95 | "I will be home later next month love you." "let's talk sometime next week, are you free any time?" ) 96 | # male punctuation use tends to be more so grammerically inconsistent 97 | mates_start=("Good day sir" "Hey" "What's up" "Yo") 98 | mates_end=("what's going on $TTT" "what are you doing later?" 99 | "are we going out tonight?" "how's everything been going.") 100 | ################################################################# 101 | 102 | ################# Build random message ######################### 103 | messageCode=$target_group; 104 | # generate message beginning and ending 105 | # wanted to simply state beginning=$[ $RANDOM % ${#random_group[@]} ]; 106 | # but I was unable to find an elegant solution to a bash-type 2D array 107 | 108 | case $messageCode in # case (group number) in all 109 | 0) 110 | begining=$[ $RANDOM % ${#ladies_start[@]} ]; 111 | endning=$[ $RANDOM % ${#ladies_end[@]} ]; 112 | # assigns begining/ending index 113 | random_beginning=${ladies_start[$begining]}; 114 | random_ending=${ladies_end[$endning]}; 115 | # assigns begining/ending messages 116 | ;; 117 | 1) 118 | begining=$[ $RANDOM % ${#family_start[@]} ]; 119 | endning=$[ $RANDOM % ${#family_end[@]} ]; 120 | random_beginning=${family_start[$begining]}; 121 | random_ending=${family_end[$endning]}; 122 | ;; 123 | 2) 124 | begining=$[ $RANDOM % ${#mates_start[@]} ]; 125 | endning=$[ $RANDOM % ${#mates_end[@]} ]; 126 | random_beginning=${mates_start[$begining]}; 127 | random_ending=${mates_end[$endning]}; 128 | ;; 129 | *) 130 | echo "Error!" 131 | echo "Make sure you really have ${number_of_groups} groups?" 132 | ;; 133 | esac 134 | 135 | sentence="${random_beginning} ${random_ending}" 136 | #the space between beginning ^ and ending puts the space between the two 137 | # parts of the sentences this is by far the most important space to have ever existed. 138 | 139 | # this gets the current directory that the icon is located in 140 | dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd):zen.png" 141 | # this says take directory name dir replace all occurances of (//) with (/) 142 | dir=${dir////:} 143 | ################################################################## 144 | 145 | ########## The Following Takes advantage of Apple's osascript ########## 146 | #### This will work only if you are on a mac and logged into your iCloud account 147 | osascript <&/dev/null 172 | 173 | ###################################################################### 174 | 175 | # Can Send actual message a couple of other ways 176 | 177 | # 1. Using Twilio --> number format +15556667777 178 | # curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/ACCOUNTNUMBER/Messages.json' \ 179 | # --data-urlencode "To=$number" \ 180 | # --data-urlencode "From=$MY_NUMBER" \ 181 | # --data-urlencode "Body=${sentence}" \ 182 | # -u ACba25802cbbd29f1ec807f26a429abfcc:AUTHORIZATIONTOKEN <-- get from site 183 | 184 | # Twilio pros: Complete abstraction, absolute flexability 185 | # cons: there is a fee but its only $1.00 a month + $0.0075 per message 186 | # 50 messages a week would cost ($1.00 + $0.0075*200) = $2.50 / month 187 | # https://www.twilio.com/sms/pricing 188 | 189 | # 2. Using textbelt --> number format 5556667777 190 | 191 | # curl -X POST http://textbelt.com/text \ 192 | # -d number=${MY_NUMBER} \ 193 | # -d "message=${sentence}" 194 | 195 | # textbelt pros: Quick and effortless 196 | # cons: messages look HORRIBLE. If the goal is complete abstraction 197 | # this is not your choice. Its better for sending reminders or 198 | # notifications to yourself 199 | # http://textbelt.com/#sthash.mtXpg60r.dpuf 200 | 201 | # 3. using Apple Script (If on mac) 202 | # directions above 203 | # Apple Script pros: complete intergration of the system along with 204 | # notification plane. Take advantage of the ability to send iMessages. 205 | # cons: can only be used on Mac. 206 | --------------------------------------------------------------------------------