├── install.sh
├── README.md
├── com.cohere.welcomemessage.plist
├── LICENSE
├── .gitignore
└── welcome
/install.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # install a daemon so the script runs every 15mins or whatever, configurable in the plist
3 |
4 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
5 | cp "${SCRIPT_DIR}/welcome" /usr/local/bin/
6 | cp "${SCRIPT_DIR}/com.cohere.welcomemessage.plist" /Library/LaunchDaemons/com.cohere.welcomemessage.plist
7 | launchctl load /Library/LaunchDaemons/com.cohere.welcomemessage.plist
8 | launchctl start com.cohere.welcomemessage
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Welcome 👋👋👋 from Cohere
2 | Generate a welcome message for yourself each day using [Cohere](https://cohere.ai).
3 |
4 |
5 |
6 | ## Install
7 | 1. get an API key from [os.cohere.ai](os.cohere.ai)
8 | 2. plug that into the file `welcome` in this repo
9 | 3. `sudo ./welcome` tests it's working. should look like this
10 |
11 |
12 | 4. `sudo ./install.sh` installs this to run every 15mins (or whatever you'd like, just edit the plist file here)
13 |
14 |
--------------------------------------------------------------------------------
/com.cohere.welcomemessage.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Label
6 | com.cohere.welcomemessage
7 | ProgramArguments
8 |
9 | /bin/sh
10 | /usr/local/bin/welcome
11 |
12 | KeepAlive
13 |
14 | StartInterval
15 | 900
16 | StandardErrorPath
17 | /tmp/cohere_welcome_message.err
18 | StandardOutPath
19 | /tmp/cohere_welcome_message.out
20 |
21 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Aidan Gomez
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 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/welcome:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # this was obviously originally written for internal use at Cohere to welcome folks to
3 | # their computer each morning/afternoon, should be trivial to adjust the prompt/options
4 | # to whatever you want!
5 |
6 | STATIC=0
7 | if [ -z "$COHERE_KEY" ]; then
8 | COHERE_KEY="YOUR API KEY FROM DASHBOARD.COHERE.AI" # Should store this as an env variable in your .bashrc
9 | fi
10 |
11 | if [[ $STATIC != 0 ]]; then
12 | morning="Good morning, I hope u have a rly good day (◕‿◕✿)
13 | Good morning, I hope u slept well (◕‿◕✿)
14 | you mean a lot to me (◕‿◕✿)
15 | (づ ̄ ³ ̄)づ Good morning, I missed you!
16 | (づ ̄ ³ ̄)づ Good morning, Cohere awaits!
17 | (づ ̄ ³ ̄)づ Good morning!
18 | (。◕‿◕。) you look lovely today
19 | (。◕‿◕。) It’s gonna be a rly good day today
20 | (。◕‿◕。) did you sleep well? remem u need 6-9 hours each night!
21 | (づ。◕‿‿◕。)づ big things gonna happen today!!
22 | (づ。◕‿‿◕。)づ gm, im very proud of u
23 | (づ。◕‿‿◕。)づ gm, how’d you sleep?
24 | ༼ つ ಥ_ಥ ༽つ pls give me coffee"
25 |
26 | afternoon="༼ つ ◕_◕ ༽つ within lies great power. go forth and seek your parameters.
27 | ༼ つ ◕_◕ ༽つ today, you shall discover your true power
28 | ༼ つ ◕_◕ ༽つ behold... Caleb ▼・ᴥ・▼ <( woof )
29 | ʕ•ᴥ•ʔ co:mfy time
30 | ʕ•ᴥ•ʔ im a bear
31 | u look rly nice today (◕‿◕✿)
32 | Cheer time.. 1! 2! 3! CooHeErrE (ノ◕ヮ◕)ノ*:・゚✧
33 | (づ ̄ ³ ̄)づ I MISSED YOU SO MUCH THANK YOU FOR COMING BACKK ADFJSLDJF
34 | (づ ̄ ³ ̄)づ YOU’RE BACK!!! ADFJSLDJF
35 | COHEEEERRREEEE (。◕‿◕。)
36 | | (• ◡•)| COHERE TIME! (❍ᴥ❍ʋ)
37 | ༼ つ ಥ_ಥ ༽つ U r my hero
38 | (~˘▾˘)~ PARAMETERS ~(˘▾˘~)
39 | im baby (◕ ˬ ◕✿)"
40 |
41 | currenttime=$(date +%H:%M)
42 | if [[ "$currenttime" > "01:00" ]] && [[ "$currenttime" < "12:00" ]]; then
43 | msg=$(echo "$morning" | sort -R | head -n 1)
44 | else
45 | msg=$(echo "$afternoon" | sort -R | head -n 1)
46 | fi
47 | else
48 | msg=$(curl --location --request POST 'https://api.cohere.ai/v1/generate' \
49 | --header "Authorization: BEARER ${COHERE_KEY}" \
50 | --header 'Content-Type: application/json' \
51 | --data-raw '{
52 | "model": "command-xlarge-nightly",
53 | "prompt": "System: Below is a list of cute phrases.\n(~˘▾˘)~ PARAMETERS ~(˘▾˘~)\nhave a rly good day (◕‿◕✿)\nI hope u slept well (◕‿◕✿)\nyou mean a lot to me (◕‿◕✿)\n(づ ̄ ³ ̄)づ Cohere awaits!\n(。◕‿◕。) you look lovely today\n(。◕‿◕。) It’s gonna be a rly good day today\n(。◕‿◕。) did you sleep well? remem u need 6-9 hours each night!\n(づ。◕‿‿◕。)づ big things gonna happen today!!\n(づ。◕‿‿◕。)づ im very proud of u\n(づ。◕‿‿◕。)づ how’d you sleep?\n༼ つ ಥ_ಥ ༽つ pls give me coffee\n༼ つ ◕_◕ ༽つ within lies great power. go forth and seek your parameters.\n༼ つ ◕_◕ ༽つ today, you shall discover your true power\n༼ つ ◕_◕ ༽つ behold... Caleb ▼・ᴥ・▼ <( woof )\nʕ•ᴥ•ʔ co:mfy time\n- ʕ•ᴥ•ʔ im a bear\nu look rly nice today (◕‿◕✿)\nCheer time.. 1! 2! 3! CooHeErrE (ノ◕ヮ◕)ノ*:・゚✧\n(づ ̄ ³ ̄)づ I MISSED YOU SO MUCH THANK YOU FOR COMING BACKK ADFJSLDJF\n(づ ̄ ³ ̄)づ YOU’RE BACK!!! ADFJSLDJF\n- COHEEEERRREEEE (。◕‿◕。)\n| (• ◡•)| COHERE TIME! (❍ᴥ❍ʋ)\n༼ つ ಥ_ಥ ༽つ U r my hero\nim baby (◕ ˬ ◕✿)\nyour voice is so sweet (◕ ˬ ◕✿)\n\nUser: Write a single cute phrase, similar to the message examples provided above by the System, including a cute emoji.\nChatbot:",
54 | "max_tokens": 50,
55 | "temperature": 0.5,
56 | "k": 0,
57 | "p": 0.75,
58 | "frequency_penalty": 0,
59 | "presence_penalty": 0,
60 | "stop_sequences": [],
61 | "return_likelihoods": "NONE",
62 | "language": "en"
63 | }' | python3 -c 'import json,sys;obj=json.load(sys.stdin);print(obj["generations"][0]["text"].strip());')
64 | fi
65 |
66 | echo $msg
67 |
68 | # need to try both of these because if the first one doesn't work then the second one will and vice versa, depends on generation.
69 | defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "${msg}" || defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "'${msg}'"
70 |
--------------------------------------------------------------------------------