Last active
July 19, 2023 14:05
-
-
Save LevitatingBusinessMan/5977867a040d825f46bf2735ec911f9b to your computer and use it in GitHub Desktop.
Synonym of the day
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'net/http' | |
body = Net::HTTP.get(URI("https://www.thesaurus.com/e/synonym-of-the-day/")) | |
r = /<a.*href="https:\/\/www\.thesaurus\.com\/browse\/.+".*>(\S+)<\/a>\s*is another word for\s*<a.*href="https:\/\/www\.thesaurus\.com\/browse\/.+".*>\s*(\S+)\s*<\/a>\s*<\/h2>/ | |
firstword, secondword = r.match(body).captures | |
system("{ | |
ACTION=$(dunstify --action='open,Goto thesaurus' '#{firstword} is a synonym of #{secondword}' 'Synonym of the day') | |
if [[ $ACTION == 'open' ]]; then | |
xdg-open 'https://www.thesaurus.com/e/synonym-of-the-day/' | |
fi | |
} &") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Give synonym of the day message | |
[Service] | |
Type=forking | |
ExecStart=/home/rein/scripts/synonym.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Give a daily synonym of the day message | |
[Timer] | |
OnCalendar=*-*-* 8:00:00 | |
Persistent=true | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment