-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathopen-productive
More file actions
executable file
·49 lines (43 loc) · 1.3 KB
/
open-productive
File metadata and controls
executable file
·49 lines (43 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env ruby --disable-gems
omphalos = File.expand_path("~/src/omphalos")
binary = File.expand_path("~/src/omphalos/target/debug/omphalos")
instapaper_only = ARGV.delete("-i")
# re-hydrate instapaper urls async
system("cd #{omphalos} && nohup #{binary} instapaper_list > \
/tmp/instapaper_urls_$$ && \
mv /tmp/instapaper_urls_$$ /tmp/instapaper_urls &")
urls = []
loop do
begin
urls = File.read("/tmp/instapaper_urls").split("\n").shuffle
break
rescue Errno::ENOENT # first time, file isn't present yet.. wait
sleep 0.05
end
end
def open_url(url)
# firefox_path = "/Applications/Firefox.app/Contents/MacOS/firefox"
# system("#{firefox_path} --new-tab #{url}")
system("open #{url}")
end
if instapaper_only
open_url(urls.first)
else
random = Kernel.rand
case random
when (0.0...0.1)
open_url "https://readwise.io/tags/next"
when (0.1..0.15)
open_url "https://dynalist.io/d/wrc4IfhJ7EzU5yIK6bNz1kYR"
when (0.15...0.2)
open_url "things:///show?query=Zettelkasten to Readwise"
when (0.2...0.25)
open_url "https://memoryleague.com/#!/train"
when (0.25...0.30)
open_url "https://ourworldindata.org/charts"
# when (0.25..0.35)
# open_url "https://www.gjopen.com/questions?filter=following"
when (0.25..1.0)
open_url(urls.first)
end
end