{ "author": { "name": "Tom Paton", "url": "https://tompaton.com/" }, "description": "Tom's blog.", "favicon": "https://tompaton.com/favicon.ico", "feed_url": "https://tompaton.com/blog/tags/code.json", "home_page_url": "https://tompaton.com/blog/tags/code", "items": [ { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/tompaton.com/pages/mastermind.html" } ], "content_text": "A little Mastermind game and puzzle solver (play against the computer or use it to cheat against a human) I wrote using SolidJS.", "date_published": "2022-06-13T21:01:49+10:00", "external_url": "https://tompaton.com/pages/mastermind.html", "id": "https://tompaton.com/blog/2022/06/13/bookmark-mastermind-solver", "tags": [ "bookmarks", "code", "puzzles" ], "title": "Mastermind Solver", "url": "https://tompaton.com/blog/2022/06/13/bookmark-mastermind-solver" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/pypi.org/project/PyMutator/0.1/index.html" } ], "content_text": "I made a Python package! It's simple function to do SolidJS style updating of nested Python objects. Mostly just something to get my feet wet with PyPI etc.", "date_published": "2022-06-12T21:15:44+10:00", "external_url": "https://pypi.org/project/PyMutator/0.1/", "id": "https://tompaton.com/blog/2022/06/12/bookmark-pymutator", "tags": [ "bookmarks", "code" ], "title": "PyMutator", "url": "https://tompaton.com/blog/2022/06/12/bookmark-pymutator" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.solidjs.com/index.html" } ], "content_text": "Simple and slick JavaScript UI framework.", "date_published": "2022-05-06T22:04:10+10:00", "external_url": "https://www.solidjs.com/", "id": "https://tompaton.com/blog/2022/05/06/bookmark-solidjs", "tags": [ "bookmarks", "tools", "code", "javascript" ], "title": "SolidJS", "url": "https://tompaton.com/blog/2022/05/06/bookmark-solidjs" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.youtube.com/watch?v=pTr1uLQTJNE.html" } ], "content_text": "Very cool stuff.", "date_published": "2021-01-20T21:38:21+11:00", "external_url": "https://www.youtube.com/watch?v=pTr1uLQTJNE", "id": "https://tompaton.com/blog/2021/01/20/bookmark-simon-willison-instant-serverless-apis-powered-by-sqlite-pycon-2019", "tags": [ "bookmarks", "video", "visualisation", "code" ], "title": "Simon Willison - Instant serverless APIs, powered by SQLite - PyCon 2019", "url": "https://tompaton.com/blog/2021/01/20/bookmark-simon-willison-instant-serverless-apis-powered-by-sqlite-pycon-2019" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/omar.website/tabfs/index.html" } ], "content_text": "A browser extension that mounts your browser tabs as a filesystem on your computer.", "date_published": "2021-01-04T22:33:56+11:00", "external_url": "https://omar.website/tabfs/", "id": "https://tompaton.com/blog/2021/01/04/bookmark-tabfs", "tags": [ "bookmarks", "code" ], "title": "TabFS", "url": "https://tompaton.com/blog/2021/01/04/bookmark-tabfs" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/github.com/tomnomnom/gron.html" } ], "content_text": "This is a very nifty little tool. I like it.", "date_published": "2020-11-18T16:32:11+11:00", "external_url": "https://github.com/tomnomnom/gron", "id": "https://tompaton.com/blog/2020/11/18/bookmark-gron-make-json-greppable", "tags": [ "bookmarks", "code", "tools" ], "title": "gron - Make JSON greppable!", "url": "https://tompaton.com/blog/2020/11/18/bookmark-gron-make-json-greppable" }, { "_thumb": { "image": "https://tompaton.com/blog/content/2020/01/05/bookmark-gallery-of-ggridges-examples/thumb.jpeg" }, "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/cran.r-project.org/web/packages/ggridges/vignettes/gallery.html" } ], "content_text": "Useful chart style, seasonal temperature chart is cool. The \"Evolution of movie lengths over time\" examples is fascinating too.", "date_published": "2020-01-05T21:32:41+11:00", "external_url": "https://cran.r-project.org/web/packages/ggridges/vignettes/gallery.html", "id": "https://tompaton.com/blog/2020/01/05/bookmark-gallery-of-ggridges-examples", "image": "https://tompaton.com/blog/content/2020/01/05/bookmark-gallery-of-ggridges-examples/image.jpeg", "tags": [ "bookmarks", "tools", "visualisation", "code" ], "title": "Gallery of ggridges examples", "url": "https://tompaton.com/blog/2020/01/05/bookmark-gallery-of-ggridges-examples" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.youtube.com/watch?v=tzwTnG4ZcM8.html" } ], "content_text": "A bit like wingsuit flying or longboard downhill runs: Impressive achievement, but not something that should be copied!", "date_published": "2019-12-15T22:22:48+11:00", "external_url": "https://www.youtube.com/watch?v=tzwTnG4ZcM8", "id": "https://tompaton.com/blog/2019/12/15/bookmark-generating-fractals-with-sql-queries", "tags": [ "bookmarks", "video", "code" ], "title": "Generating Fractals\u2026 With SQL Queries!!!", "url": "https://tompaton.com/blog/2019/12/15/bookmark-generating-fractals-with-sql-queries" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.youtube.com/watch?v=7Wwrv490rK4.html" } ], "content_text": "https://www.youtube.com/watch?v=7Wwrv490rK4", "date_published": "2019-12-04T22:35:52+11:00", "external_url": "https://www.youtube.com/watch?v=7Wwrv490rK4", "id": "https://tompaton.com/blog/2019/12/04/bookmark-clean-architectures-in-python", "tags": [ "bookmarks", "video", "code" ], "title": "Clean Architectures in Python", "url": "https://tompaton.com/blog/2019/12/04/bookmark-clean-architectures-in-python" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.youtube.com/watch?v=ff4fgQxPaO0.html" } ], "content_text": "This is good to know.", "date_published": "2019-11-30T22:01:34+11:00", "external_url": "https://www.youtube.com/watch?v=ff4fgQxPaO0", "id": "https://tompaton.com/blog/2019/11/30/bookmark-faster-apps-with-json-parse-chrome-dev-summit-2019", "tags": [ "bookmarks", "video", "code" ], "title": "Faster apps with JSON.parse (Chrome Dev Summit 2019)", "url": "https://tompaton.com/blog/2019/11/30/bookmark-faster-apps-with-json-parse-chrome-dev-summit-2019" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/medium.com/@DavidKPiano/the-facetime-bug-and-the-dangers-of-implicit-state-machines-a5f0f61bdaa2.html" } ], "content_text": "https://medium.com/@DavidKPiano/the-facetime-bug-and-the-dangers-of-implicit-state-machines-a5f0f61bdaa2", "date_published": "2019-10-31T13:52:08+11:00", "external_url": "https://medium.com/@DavidKPiano/the-facetime-bug-and-the-dangers-of-implicit-state-machines-a5f0f61bdaa2", "id": "https://tompaton.com/blog/2019/10/31/bookmark-the-facetime-bug-and-the-dangers-of-implicit-state-machines", "tags": [ "bookmarks", "code" ], "title": "The FaceTime Bug and the Dangers of Implicit State Machines", "url": "https://tompaton.com/blog/2019/10/31/bookmark-the-facetime-bug-and-the-dangers-of-implicit-state-machines" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/tobyschachman.com/Shadershop/index.html" } ], "content_text": "This is pretty amazing - I want direct manipulation for everything...", "date_published": "2019-09-25T16:11:24+10:00", "external_url": "http://tobyschachman.com/Shadershop/", "id": "https://tompaton.com/blog/2019/09/25/bookmark-shadershop", "tags": [ "bookmarks", "visualisation", "tools", "code" ], "title": "Shadershop", "url": "https://tompaton.com/blog/2019/09/25/bookmark-shadershop" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/www.youtube.com/watch?v=XOcWAMCyu5w.html" } ], "content_html": "
A promising JavaScript framework: svelte.dev
", "date_published": "2019-05-02T23:02:01+10:00", "external_url": "https://www.youtube.com/watch?v=XOcWAMCyu5w", "id": "https://tompaton.com/blog/2019/05/02/bookmark-rich-harris-svelte-rethinking-reactivity", "tags": [ "bookmarks", "video", "code" ], "title": "Rich Harris: Svelte - Rethinking Reactivity", "url": "https://tompaton.com/blog/2019/05/02/bookmark-rich-harris-svelte-rethinking-reactivity" }, { "_thumb": { "image": "https://tompaton.com/blog/content/2018/03/13/org-mode-formatting-improvements/thumb.png" }, "content_html": "\n org-mode
is so much better with some rich formatting. It really\n makes it appealing as a text format with embedded and actionable code —\n whether that is as a source file for literate-programming or just some notes\n with code snippets.\n
\n I've added the following to my .emacs
, based on\n Org as a Word Processor:\n
\n;; org-mode formatting improvements\n\n(require 'org-bullets)\n(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))\n(add-hook 'org-mode-hook (lambda () (whitespace-mode -1)))\n\n(setq org-hide-emphasis-markers t)\n\n(let* ((variable-tuple (cond ((x-list-fonts \"Source Sans Pro\") '(:font \"Source Sans Pro\"))\n ((x-list-fonts \"Lucida Grande\") '(:font \"Lucida Grande\"))\n ((x-list-fonts \"Verdana\") '(:font \"Verdana\"))\n ((x-family-fonts \"Sans Serif\") '(:family \"Sans Serif\"))\n (nil (warn \"Cannot find a Sans Serif Font. Install Source Sans Pro.\"))))\n (base-font-color (face-foreground 'default nil 'default))\n (headline `(:inherit default :weight bold :foreground ,base-font-color)))\n\n (custom-theme-set-faces 'user\n `(org-level-8 ((t (,@headline ,@variable-tuple))))\n `(org-level-7 ((t (,@headline ,@variable-tuple))))\n `(org-level-6 ((t (,@headline ,@variable-tuple))))\n `(org-level-5 ((t (,@headline ,@variable-tuple))))\n `(org-level-4 ((t (,@headline ,@variable-tuple :height 1.1))))\n `(org-level-3 ((t (,@headline ,@variable-tuple :height 1.25))))\n `(org-level-2 ((t (,@headline ,@variable-tuple :height 1.5))))\n `(org-level-1 ((t (,@headline ,@variable-tuple :height 1.75))))\n `(org-document-title ((t (,@headline ,@variable-tuple :height 1.5 :underline nil))))))\n
\n\n\n And then I start the .org files with the following parameters:\n
\n\n#+STARTUP: indent\n#+STARTUP: odd\n#+STARTUP: hidestars\n#+STARTUP: showall\n#+TITLE: document title\n
\n",
"date_published": "2018-03-13T21:27:28+11:00",
"id": "https://tompaton.com/blog/2018/03/13/org-mode-formatting-improvements",
"image": "https://tompaton.com/blog/content/2018/03/13/org-mode-formatting-improvements/image.png",
"tags": [
"posts",
"code",
"emacs"
],
"title": "Org-mode formatting improvements",
"url": "https://tompaton.com/blog/2018/03/13/org-mode-formatting-improvements"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/www.howardism.org/Technical/Emacs/orgmode-wordprocessor.html"
}
],
"content_text": "Some nice info on how to get emacs' org-mode looking nice (well, for a plain text format at least).",
"date_published": "2018-03-13T14:21:50+11:00",
"external_url": "http://www.howardism.org/Technical/Emacs/orgmode-wordprocessor.html",
"id": "https://tompaton.com/blog/2018/03/13/bookmark-howardism-org-as-a-word-processor",
"tags": [
"bookmarks",
"emacs",
"code"
],
"title": "Howardism: Org as a Word Processor",
"url": "https://tompaton.com/blog/2018/03/13/bookmark-howardism-org-as-a-word-processor"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/github.com/ChrisKnott/Eel.html"
}
],
"content_text": "Eel - A little Python library for making simple Electron-like HTML/JS GUI apps",
"date_published": "2018-01-12T14:02:31+11:00",
"external_url": "https://github.com/ChrisKnott/Eel",
"id": "https://tompaton.com/blog/2018/01/12/bookmark-eel-python-library-for-simple-offline-html-js-gui-apps",
"tags": [
"bookmarks",
"python",
"code"
],
"title": "Eel",
"url": "https://tompaton.com/blog/2018/01/12/bookmark-eel-python-library-for-simple-offline-html-js-gui-apps"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/gist.github.com/tompaton/5ce35be866efb91def8c9a86c7add5e4.html"
}
],
"content_html": "I recently updated my podcast pre-processing script to Python 3.6 & the multiprocessing.Pool
module and then a few days later realized the whole thing would be much better as a simple Makefile
The goal is to:
\nSource:
\n\n\n\nPrerequisites:
\n\n I made a\n little script\n that uses\n Selenium\n to create a single page containing all the new posts from my Facebook friends.\n
\n\n This lets me see everything that is posted without having to seek it out and\n wade through the ads and other things Facebook is trying to recommend to me.\n
\n\n The output is currently very rough, but it'll do for now - in particular, it\n just screenshots the post, rather than trying to extract the content and\n re-render it.\n
\n", "date_published": "2017-08-16T13:25:21+10:00", "id": "https://tompaton.com/blog/2017/08/16/getting-new-posts-from-friends-on-facebook-with-selenium", "tags": [ "posts", "python", "code" ], "title": "Getting new posts from friends on Facebook with Selenium", "url": "https://tompaton.com/blog/2017/08/16/getting-new-posts-from-friends-on-facebook-with-selenium" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/selenium-python.readthedocs.io/index.html" } ], "content_text": "See also https://sites.google.com/a/chromium.org/chromedriver/", "date_published": "2017-08-12T22:29:17+10:00", "external_url": "http://selenium-python.readthedocs.io/", "id": "https://tompaton.com/blog/2017/08/12/bookmark-selenium-python-bindings-2-documentation", "tags": [ "bookmarks", "python", "code" ], "title": "Selenium Python Bindings 2 documentation", "url": "https://tompaton.com/blog/2017/08/12/bookmark-selenium-python-bindings-2-documentation" }, { "attachments": [ { "mime_type": "text/x.cached.html", "title": "cached", "url": "cached/developers.google.com/web/updates/2017/04/headless-chrome.html" } ], "content_text": "Browser automation got a lot easier withchrome --headless
.",
"date_published": "2017-07-29T22:04:18+10:00",
"external_url": "https://developers.google.com/web/updates/2017/04/headless-chrome",
"id": "https://tompaton.com/blog/2017/07/29/bookmark-getting-started-with-headless-chrome",
"tags": [
"bookmarks",
"code"
],
"title": "Getting Started with Headless Chrome",
"url": "https://tompaton.com/blog/2017/07/29/bookmark-getting-started-with-headless-chrome"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/docs.python.org/3.5/library/argparse.html"
}
],
"content_text": "Easily add user-friendly command-line arguments.",
"date_published": "2017-06-04T22:56:40+10:00",
"external_url": "https://docs.python.org/3.5/library/argparse.html",
"id": "https://tompaton.com/blog/2017/06/04/bookmark-python-argparse-module",
"tags": [
"bookmarks",
"python",
"code"
],
"title": "Python argparse module",
"url": "https://tompaton.com/blog/2017/06/04/bookmark-python-argparse-module"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/getskeleton.com/index.html"
}
],
"content_text": "Lightweight CSS grid and typography",
"date_published": "2017-06-02T21:00:00+10:00",
"external_url": "http://getskeleton.com/",
"id": "https://tompaton.com/blog/2017/06/02/bookmark-skeleton-css",
"tags": [
"bookmarks",
"code"
],
"title": "Skeleton CSS",
"url": "https://tompaton.com/blog/2017/06/02/bookmark-skeleton-css"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/jsonfeed.org/version/1.html"
}
],
"content_text": "JSON version of RSS/Atom",
"date_published": "2017-06-02T21:00:00+10:00",
"external_url": "https://jsonfeed.org/version/1",
"id": "https://tompaton.com/blog/2017/06/02/bookmark-json-feed",
"tags": [
"bookmarks",
"code"
],
"title": "JSON Feed",
"url": "https://tompaton.com/blog/2017/06/02/bookmark-json-feed"
},
{
"attachments": [
{
"mime_type": "text/x.cached.html",
"title": "cached",
"url": "cached/docs.makotemplates.org/en/latest/syntax.html"
}
],
"content_text": "Lightweight Python template engine",
"date_published": "2017-06-02T21:00:00+10:00",
"external_url": "http://docs.makotemplates.org/en/latest/syntax.html",
"id": "https://tompaton.com/blog/2017/06/02/bookmark-mako-template-syntax",
"tags": [
"bookmarks",
"code",
"python"
],
"title": "Mako template syntax",
"url": "https://tompaton.com/blog/2017/06/02/bookmark-mako-template-syntax"
},
{
"content_html": "After implementing my bot in Python, I thought I'd try porting it to other languages as an opportunity to learn a bit of Go and Rust.
\nBoth Go and Rust are statically typed and compile to a single self-contained binary, which is appealing as there is no need to maintain a virtualenv and install dependencies on the server.
\nThe parsing code for \"rain\" messages is a good starting point to compare the bots. Each is using a \"parser combinator\" library to parse the messages.
\n\nQuick thoughts: Python & Go are both pretty sane. There's almost certainly a better way in Rust, but I found it considerably harder.
\nThe tests are stored in different places in each version so the total line count is not comparable, and the Rust version includes \"ignore case\" code that is built into Python's parser combinators, and that I added into a fork of the Go parser library.
\n", "date_published": "2017-06-01T21:00:00+10:00", "id": "https://tompaton.com/blog/2017/06/01/bot-comparison", "tags": [ "posts", "code", "@multipolygon" ], "title": "Python, Go and Rust bot comparison", "url": "https://tompaton.com/blog/2017/06/01/bot-comparison" } ], "title": "tompaton.com/blog - Posts tagged with code", "user_comment": "This feed allows you to read the posts from this site in any feed reader that supports the JSON Feed format. To add this feed to your reader, copy the following URL \u2014 https://tompaton.com/blog/feed.json \u2014 and add it your reader.", "version": "https://jsonfeed.org/version/1" }