{"id":1745,"date":"2005-11-07T12:00:23","date_gmt":"2005-11-07T20:00:23","guid":{"rendered":"http:\/\/www.ogre.nu\/wp\/?p=1745"},"modified":"2005-11-13T22:31:42","modified_gmt":"2005-11-14T06:31:42","slug":"test","status":"publish","type":"post","link":"https:\/\/bendwavy.org\/wp\/?p=1745","title":{"rendered":"i shot an arrow into the air"},"content":{"rendered":"<p>My bookmarks file has 4539 entries, most of which I intend to look at &#8220;someday&#8221;.  So I&#8217;ve written a little utility (two lines of code, plus scaffolding) that other Unix users may find useful, provided that your favorite browser keeps bookmarks in a textfile (as the Mozilla family does).  Once an hour it picks a bookmark at random and opens it in my default browser.  My <i>crontab<\/i> contains this entry:<\/p>\n<blockquote><p>\n01 * * * * sh ~anton\/bin\/bookcron\n<\/p><\/blockquote>\n<p>meaning: at :01 of every hour, run the following shell script:<\/p>\n<blockquote><p>\ncd ~anton<br \/>\ncat Library\/App*\/Firefox\/Profiles\/*\/bookmarks.html | grep -o &#8220;http[^\\&#8221;]*&#8221; | python bcp\n<\/p><\/blockquote>\n<p>which extracts any links from any bookmarks files and feeds them to this Python program:<\/p>\n<blockquote><p>\nimport os<br \/>\nimport sys<br \/>\nimport random<br \/>\nos.system(&#8220;open %s&#8221; % random.choice(sys.stdin.readlines()).replace(&#8216;&amp;&#8217;,&#8217;\\\\&amp;&#8217;) )\n<\/p><\/blockquote>\n<p>The function <i>random.choice<\/i> picks a random entry from the list.  The command <i>open<\/i> does the right thing on MacOS X, but for other Unices you&#8217;ll probably need to replace it with the browser name.  The <i>replace()<\/i> prevents silly things that would otherwise happen when a shell command contains an ampersand.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My bookmarks file has 4539 entries, most of which I intend to look at &#8220;someday&#8221;. So I&#8217;ve written a little utility (two lines of code, plus scaffolding) that other Unix users may find useful, provided that your favorite browser keeps &hellip; <a href=\"https:\/\/bendwavy.org\/wp\/?p=1745\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1745","post","type-post","status-publish","format-standard","hentry","category-neep-neep"],"_links":{"self":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1745"}],"version-history":[{"count":0,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1745\/revisions"}],"wp:attachment":[{"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bendwavy.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}