<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Joel&#39;s Blog</title>
    <link>https://ajoellee.com/</link>
    <description>Recent content on Joel&#39;s Blog</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <copyright>Copyright © 2020, Joel Lee.</copyright>
    <lastBuildDate>Sun, 08 Nov 2026 22:43:23 +0100</lastBuildDate>
    <atom:link href="https://ajoellee.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Recurse Center Week One</title>
      <link>https://ajoellee.com/blog/2026-11-08-recurse-center-week-one/</link>
      <pubDate>Sun, 08 Nov 2026 22:43:23 +0100</pubDate>
      <guid>https://ajoellee.com/blog/2026-11-08-recurse-center-week-one/</guid>
      <description>&lt;h1 id=&#34;recurse-center---week-one&#34;&gt;Recurse Center - Week One&lt;/h1&gt;&#xA;&lt;p&gt;I started my first week at Recurse Center. The overall goal for the retreat is to understand the Large Language Model Serving Stack. The first week was not as productive as I would have liked but there was no shortage of creativity from the batch. The week opened with a set of pair programming sessions where we paired on &lt;a href=&#34;https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life&#34;&gt;Conway&amp;rsquo;s Game of Life&lt;/a&gt;. The range of implementations included: a shader implementation, a Haskell implementation, a red versus blue implementation and more.&lt;/p&gt;&#xA;&lt;p&gt;For the second half I spent time looking through a GPU Mode lecture on Metal programming and the &lt;a href=&#34;https://mesozoic-egg.github.io/tinygrad-notes/&#34;&gt;tinygrad notes&lt;/a&gt;. I also tried to obtain an overview of Metal, the GPU programming framework for Apple. During the week I stumbled upon a set of &lt;a href=&#34;https://github.com/abeleinin/Metal-Puzzles&#34;&gt;puzzles&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The starting task was to compile a Metal Kernel, which required installing Xcode and generating code which is reminiscent of C++.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;#include &amp;lt;metal_stdlib&amp;gt;&#xA;using namespace metal;&#xA;&#xA;kernel void add_arrays(device const float* a   [[buffer(0)]],&#xA;                       device const float* b   [[buffer(1)]],&#xA;                       device float* out       [[buffer(2)]],&#xA;                       uint id [[thread_position_in_grid]]) {&#xA;    out[id] = a[id] + b[id];&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The accompanying starter code was more intimidating at first glance.&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;import Metal&#xA;import Foundation&#xA;&#xA;let n = 1_000_000&#xA;let device = MTLCreateSystemDefaultDevice()!&#xA;let queue = device.makeCommandQueue()!&#xA;&#xA;// Load the kernel. Compiling from source at runtime avoids library-bundling issues in a command line tool.&#xA;let path = &amp;#34;&amp;lt;path&amp;gt;&amp;#34;   // change this&#xA;let source = try String(contentsOfFile: path, encoding: .utf8)&#xA;let library = try device.makeLibrary(source: source, options: nil)&#xA;let function = library.makeFunction(name: &amp;#34;add_arrays&amp;#34;)!&#xA;let pipeline = try device.makeComputePipelineState(function: function)&#xA;&#xA;// Data&#xA;let a = [Float](repeating: 1.0, count: n)&#xA;let b = [Float](repeating: 2.0, count: n)&#xA;let size = n * MemoryLayout&amp;lt;Float&amp;gt;.stride&#xA;let bufA = device.makeBuffer(bytes: a, length: size, options: .storageModeShared)!&#xA;let bufB = device.makeBuffer(bytes: b, length: size, options: .storageModeShared)!&#xA;let bufOut = device.makeBuffer(length: size, options: .storageModeShared)!&#xA;&#xA;// Encode and run&#xA;let cmd = queue.makeCommandBuffer()!&#xA;let enc = cmd.makeComputeCommandEncoder()!&#xA;enc.setComputePipelineState(pipeline)&#xA;enc.setBuffer(bufA, offset: 0, index: 0)&#xA;enc.setBuffer(bufB, offset: 0, index: 1)&#xA;enc.setBuffer(bufOut, offset: 0, index: 2)&#xA;&#xA;let threadsPerGroup = MTLSize(width: min(pipeline.maxTotalThreadsPerThreadgroup, 256), height: 1, depth: 1)&#xA;enc.dispatchThreads(MTLSize(width: n, height: 1, depth: 1), threadsPerThreadgroup: threadsPerGroup)&#xA;enc.endEncoding()&#xA;cmd.commit()&#xA;cmd.waitUntilCompleted()&#xA;&#xA;// Check the result&#xA;let result = bufOut.contents().bindMemory(to: Float.self, capacity: n)&#xA;print(result[0], result[n - 1])   // expect 3.0 3.0&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After a second reading, it&amp;rsquo;s actually not too far from CUDA and digestible with time. I spent time working on the Metal puzzles (I&amp;rsquo;m using a Mac).&lt;/p&gt;&#xA;&lt;p&gt;The next step is to complete the puzzles and figure out the rough structure of the Metal Intermediate representation and how it interfaces with a compiler like tinygrad. Hopefully, I can return the following week with a post that is heavier on content.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Avocados So Far: What I know about exporting avocados from Rwanda to Singapore</title>
      <link>https://ajoellee.com/blog/avocados-so-far/</link>
      <pubDate>Sat, 29 Mar 2025 22:32:05 +0200</pubDate>
      <guid>https://ajoellee.com/blog/avocados-so-far/</guid>
      <description>&lt;h2 id=&#34;sourcing&#34;&gt;Sourcing&lt;/h2&gt;&#xA;&lt;p&gt;Avocados are available from a cooperative, a social enterprise, or directly with farmers. In most cases, working with cooperatives is recommended as as it is hard to communicate with multiple farmers and it is also hard to secure a stable supply. Additionally, there’s extra legwork required to ensure to comply with the regulatory quality requirements such as fertiliser content. Examples of suppliers here would be One Acre Fund and Go Green.&lt;/p&gt;&#xA;&lt;h2 id=&#34;movement&#34;&gt;Movement&lt;/h2&gt;&#xA;&lt;p&gt;At present, there are two primary options: to move the avocados by truck and take a ship to Dar Es Salaam or Mombasa and the alternative which is to forward by Air.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Air&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Air routes to Singapore require at least one stopover with Dubai, India, Ethiopia, Kenya, or Turkey being common stopping points. Cargo quotations are seasonal and depend on type of good but for agricultural goods it is about $1.60-$2/kg to Europe and about $2 to Dubai.&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Sea Route&lt;/strong&gt;&lt;/p&gt;&#xA;&lt;p&gt;Inland haulage cost is about 3500-4000 USD per reefer container, which makes for a cost of about $3.5/km. While the haulage cost is high, the 0.6USD/kg cost via sea route represents a significant cost reduction.&lt;/p&gt;&#xA;&lt;h2 id=&#34;client-acquisition&#34;&gt;Client acquisition&lt;/h2&gt;&#xA;&lt;p&gt;You need an export contract from a consignee (client) in Singapore before you can ship out any avocados. &lt;/p&gt;&#xA;&lt;p&gt;On the Singapore side you need to either hire a declarant or pass the declarant exam and obtain a license from Singapore Customs Authority&lt;/p&gt;&#xA;&lt;h2 id=&#34;additional-considerations&#34;&gt;Additional Considerations&lt;/h2&gt;&#xA;&lt;p&gt;In addition, you’ll need to file the following documentation&lt;/p&gt;&#xA;&lt;p&gt;You need:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;A phytosanitary certificate - ensures that you’re not accidentally exporting any pests.  This check is done by a person from the environmental agency, NAEB. This cost about $50 - $100&lt;/li&gt;&#xA;&lt;li&gt;Certificate of origin -  primarily for coffee / tea and not needed for avocados.&lt;/li&gt;&#xA;&lt;li&gt;Pallet Cost - $5-10 you can find it&lt;/li&gt;&#xA;&lt;li&gt;Declaration Cost - $100&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;The most common formats are C20 - C24 avocados which correspond to 20 avocados to 24 avocados per carton. The cartons weigh about 4kg.&lt;/p&gt;&#xA;&lt;p&gt;You need to determine the appropriate HS code which gives an indication of how much tax one should pay on the good. For avocados this is either 0804.40.00 or 0813.50.40 via the customs search tool. In some cases it’s possible to choose between HS codes if there is ambiguous interpretation but in this case the food authority specifies that we should use 0804.40.00 so we go with that.&lt;/p&gt;&#xA;&lt;p&gt;Since avocados are classified as fruits / vegetables, you’ll need a license which you can obtain after passing the declarants exam and registering. As an agricultural good, you’ll need to find the exact pesticide requirements. You’ll need to comply with the requirements set out by the food authority. To my understanding, compliance with US FDA standards is usually sufficient.&lt;/p&gt;&#xA;&lt;h2 id=&#34;options-to-reduce-costs&#34;&gt;Options to Reduce Costs&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Process the avocados into guacamole or oil&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Tricky as you to my understanding you need a plant for this&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Look for alternatives to bring down haulage cost.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Food Service customers who may have more flexibility in terms of method of transport.&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;If you’re interested in collaborating, please reach out via joel[at]&lt;a href=&#34;http://joellee.org&#34;&gt;joellee.org&lt;/a&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;[RRA Export procedures ](&lt;a href=&#34;https://www.rra.gov.rw/en/customs-services/exporters/export-procedures%5D(https://www.rra.gov.rw/en/customs-services/exporters/export-procedures)&#34;&gt;https://www.rra.gov.rw/en/customs-services/exporters/export-procedures](https://www.rra.gov.rw/en/customs-services/exporters/export-procedures)&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Duration of shipment from Rwanda to Singapore:  &lt;a href=&#34;https://www.fluentcargo.com/routes/mombasa-ke/singapore-sg&#34;&gt;https://www.fluentcargo.com/routes/mombasa-ke/singapore-sg&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Rwanda’s market share of avocado exports: &lt;a href=&#34;https://www.worldstopexports.com/avocados-exports-by-country/&#34;&gt;https://www.worldstopexports.com/avocados-exports-by-country/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;NAEB export requirements:  &lt;a href=&#34;https://www.naeb.gov.rw/rwanda-fresh/for-exporters&#34;&gt;https://www.naeb.gov.rw/rwanda-fresh/for-exporters&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Singapore HS Code: &lt;a href=&#34;https://www.customs.gov.sg/businesses/harmonized-system-hs-classification-of-goods/find-my-code/&#34;&gt;https://www.customs.gov.sg/businesses/harmonized-system-hs-classification-of-goods/find-my-code/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Singapore Food Authority HS Code Classification:  &lt;a href=&#34;https://www.sfa.gov.sg/docs/default-source/tools-and-resources/product-codes/product-code-for-fresh-fruits-and-vegetables.pdf&#34;&gt;https://www.sfa.gov.sg/docs/default-source/tools-and-resources/product-codes/product-code-for-fresh-fruits-and-vegetables.pdf&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;SFA license: &lt;a href=&#34;https://www.gobusiness.gov.sg/browse-all-licences/singapore-food-agency-(sfa)/licence-for-import-transhipment-of-fresh-fruits-and-vegetables&#34;&gt;https://www.gobusiness.gov.sg/browse-all-licences/singapore-food-agency-(sfa)/licence-for-import-transhipment-of-fresh-fruits-and-vegetables&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Pesticide requirements: &lt;a href=&#34;https://www.sfa.gov.sg/tools-and-resources/pesticides-search&#34;&gt;https://www.sfa.gov.sg/tools-and-resources/pesticides-search&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Avocado export numbers: &lt;a href=&#34;https://www.naeb.gov.rw/1/updates/news-detail/itc-enhances-rwandan-avocado-exports&#34;&gt;https://www.naeb.gov.rw/1/updates/news-detail/itc-enhances-rwandan-avocado-exports&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;SFA Food requirements: &lt;a href=&#34;https://www.sfa.gov.sg/food-import-export/commercial-imports/import-requirements-for-food-food-products#fresh-fruits--vegetables-3&#34;&gt;https://www.sfa.gov.sg/food-import-export/commercial-imports/import-requirements-for-food-food-products#fresh-fruits&amp;ndash;vegetables-3&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Market report on avocados: &lt;a href=&#34;https://www.sfa.gov.sg/food-import-export/commercial-imports/import-requirements-for-food-food-products#fresh-fruits--vegetables-3&#34;&gt;https://www.sfa.gov.sg/food-import-export/commercial-imports/import-requirements-for-food-food-products#fresh-fruits&amp;ndash;vegetables-3&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</description>
    </item>
    <item>
      <title>How to Deploy ComfyUI On Modal with an API</title>
      <link>https://ajoellee.com/blog/comfyui-with-modal/</link>
      <pubDate>Thu, 27 Mar 2025 23:28:53 +0200</pubDate>
      <guid>https://ajoellee.com/blog/comfyui-with-modal/</guid>
      <description>&lt;h1 id=&#34;deploying-comfyui-on-modal-as-an-api&#34;&gt;Deploying ComfyUI on Modal as an API&lt;/h1&gt;&#xA;&lt;p&gt;Let&amp;rsquo;s explore how to deploy ComfyUI on Modal as well as the pitfalls involved. &lt;a href=&#34;https://modal.com/&#34;&gt;Modal&lt;/a&gt; is an infrustructure platform which allows you to deploy custom AI models at scale. It is similar to platforms like &lt;a href=&#34;https://fal.ai&#34;&gt;fal.ai&lt;/a&gt; and &lt;a href=&#34;http://replicate.com/&#34;&gt;Replicate&lt;/a&gt;. &lt;a href=&#34;https://www.comfy.org/&#34;&gt;ComfyUI&lt;/a&gt; on the other hand is a node-based interface for Stable Diffusion and other Generative Workflows. It is used to compose generative workflows which you can then deploy to the cloud.&lt;/p&gt;&#xA;&lt;p&gt;We will use the &lt;a href=&#34;https://github.com/tolgaouz/modal-comfy-worker&#34;&gt;Modal Comfy Worker&lt;/a&gt; community repository by &lt;code&gt;Tolga&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;h2 id=&#34;components-of-modal-comfy-worker&#34;&gt;Components of Modal Comfy Worker&lt;/h2&gt;&#xA;&lt;p&gt;Modal Comfy Worker consists of &lt;code&gt;snapshot.json&lt;/code&gt; , &lt;code&gt;prompt.json&lt;/code&gt;, and &lt;code&gt;workflow.py&lt;/code&gt;. &lt;code&gt;prompt.json&lt;/code&gt; contains the ComfyUI workflow while &lt;code&gt;snapshot.json&lt;/code&gt; mirrors &lt;a href=&#34;https://github.com/ltdrdata/ComfyUI-Manager?tab=readme-ov-file#snapshot-manager&#34;&gt;snapshots in ComfyUI manager&lt;/a&gt; and lists all custom nodes involved in the workflow. &lt;code&gt;workflow.py&lt;/code&gt; is the entrypoint for Modal - Modal will run &lt;code&gt;workflow.py&lt;/code&gt; to start all containers involved. We will cover how to configure each of the three files.&lt;/p&gt;&#xA;&lt;h3 id=&#34;modifying-promptjson&#34;&gt;Modifying Prompt.json&lt;/h3&gt;&#xA;&lt;p&gt;Export ComfyUI as an API using the Desktop Application or similar. End the workflow with a &lt;code&gt;SaveImageWebSocket&lt;/code&gt;node. This signals to &lt;code&gt;workflow.py&lt;/code&gt; to return the image in the API response as a base64 string as opposed to saving it in the file system. Here&amp;rsquo;s how to add the &lt;code&gt;SaveImageWebSocket&lt;/code&gt; node.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ajoellee.com/img/comfy-save-image-websocket.png&#34; alt=&#34;Save Image WebSocket&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Check that all custom nodes are installed and export the workflow via the UI interface.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ajoellee.com/img/comfy-api-export-workflow.png&#34; alt=&#34;Comfy Export Workflow&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Check the JSON to ensure all custom nodes are exported.&lt;/p&gt;&#xA;&lt;h3 id=&#34;customizing-snapshotjson&#34;&gt;Customizing Snapshot.json&lt;/h3&gt;&#xA;&lt;p&gt;Use the ComfyUI Manager&amp;rsquo;s Node Info option to help find the appropriate Github repository to use in snapshot.json&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ajoellee.com/img/comfyui-node-manager.png&#34; alt=&#34;ComfyUI Node Manager&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Here’s an example of  snapshot.json with a breakdown of what each field does:&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ajoellee.com/img/comfy-snapshot-breakdown.png&#34; alt=&#34;Snapshot breakdown&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;Ensure that the Github hash of a node used has a matching Github release. The file_custom_nodes field allows you to add a node manually without having to reference a git repository in comfy. This is rarely needed. On the other hand, pips is used by comfyui-manager to reliably install the correct package versions for all the custom nodes. Say if we needed to run huggingface 0.26.0 on all nodes.&lt;/p&gt;&#xA;&lt;h2 id=&#34;disabling-the-ui&#34;&gt;Disabling the UI&lt;/h2&gt;&#xA;&lt;p&gt;Manage the UI in the &lt;code&gt;workflow.py&lt;/code&gt; file. You can comment this section to disable the UI.&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://ajoellee.com/img/comfyui-disable-ui.png&#34; alt=&#34;Disable Comfy UI&#34;&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h2&gt;&#xA;&lt;h3 id=&#34;issues-faced&#34;&gt;Issues faced&lt;/h3&gt;&#xA;&lt;p&gt;When troubleshooting the workflow, I faced the following issues:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Weights and paths exported with forward slash&#xA;a. &lt;code&gt;controlnets\controlnets&lt;/code&gt; was exported rather than &lt;code&gt;controlnets/controlnets&lt;/code&gt; with Linux Separator&lt;/li&gt;&#xA;&lt;li&gt;Custom nodes were not installed on the UI and consequently not exported in the prompt.json&lt;/li&gt;&#xA;&lt;li&gt;Not all &lt;code&gt;prompt.json&lt;/code&gt; fields are populated after export. For instance, you need to populate LoraLoaderFromURL&lt;/li&gt;&#xA;&lt;li&gt;The &lt;a href=&#34;https://github.com/glifxyz/ComfyUI-GlifNodes&#34;&gt;&lt;code&gt;ComfyUI-GlifNode&lt;/code&gt;&lt;/a&gt; custom node was using an outdated Huggingface dependency.&#xA;a. There was a breaking change which &lt;a href=&#34;https://github.com/easydiffusion/easydiffusion/issues/1851&#34;&gt;removed cache_download in v0.26.0&lt;/a&gt; so needed to downgrade to v0.25.0&lt;/li&gt;&#xA;&lt;li&gt;For installation of the Comfy UI IP Adapter Node there was an implicit requirement to download weights and place them in &lt;a href=&#34;https://github.com/cubiq/ComfyUI_IPAdapter_plus/blob/main/utils.py#L22&#34;&gt;specific directories&lt;/a&gt;. It was not possible to directlly download via &lt;code&gt;models_to_download&lt;/code&gt; in &lt;code&gt;workflow.py&lt;/code&gt; as the node expects the weights to have a name of &lt;code&gt;CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors&lt;/code&gt; while the default name on Huggingface was &lt;a href=&#34;https://huggingface.co/laion/CLIP-ViT-H-14-laion2B-s32B-b79K/tree/main&#34;&gt;models.safetensors&lt;/a&gt;. I could not find a way to rename so I had to download and the weights and rename theme before running &lt;code&gt;uv run modal volume put &amp;lt;volume&amp;gt; &amp;lt;weights&amp;gt;&lt;/code&gt; where needed.&lt;/li&gt;&#xA;&lt;li&gt;There was a need to manually add images used in the workflow.&#xA;a. Modify  &lt;code&gt;lib/image.py&lt;/code&gt; to include the local file:&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;+        .add_local_file(local_image_path, &amp;#34;/root/ComfyUI/input/lady.png&amp;#34;, copy=True)&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;pre&gt;&lt;code&gt;    2. Then  modify workflow.py to accept the image:&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;- image = get_comfy_image(&#xA;      local_snapshot_path=local_snapshot_path,&#xA;     local_prompt_path=local_prompt_path,&#xA;+    local_image_path=local_image_path,&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&#34;deployment&#34;&gt;Deployment&lt;/h2&gt;&#xA;&lt;p&gt;Configure a github secret: &lt;code&gt;uv run modal secret create github-secret GITHUB_TOKEN=&amp;lt;your_github_token&amp;gt;&lt;/code&gt;  so that ComfyUI can pull the custom nodes from Github as needed. You’ll need to use uv so that python library dependencies are installed. Modal executes the entrypoint script during the build process so we’ll need to have the libraries used by the entrypoint, &lt;code&gt;workflow.py&lt;/code&gt;, installed. Run &lt;code&gt;uv run modal deploy workflow&lt;/code&gt; to deploy.&lt;/p&gt;&#xA;&lt;h3 id=&#34;testing-the-flow&#34;&gt;Testing the flow&lt;/h3&gt;&#xA;&lt;p&gt;Test the flow by making a request to the &lt;code&gt;/infer_sync&lt;/code&gt; endpoint&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;curl  -X POST https://myapp--comfy-worker-asgi-app.modal.run/infer_sync -H &amp;#34;Content-Type: application/json&amp;#34; -d &amp;#39;{&amp;#34;prompt&amp;#34;: &amp;#34;A dog sitting on a char in the middle of a fire with a positive expression saying everything is fine&amp;#34;}’&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You should receive a base64 image as a response under the output_image field&lt;/p&gt;&#xA;&lt;p&gt;We thank Togla for creating the repository and &lt;a href=&#34;https://brushless.ai&#34;&gt;Brushless.ai&lt;/a&gt; for sponsoring this work.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>How to start an Informatics Olympiad Program</title>
      <link>https://ajoellee.com/blog/2024-10-13-how-to-start-an-informatics-olympiad-program/</link>
      <pubDate>Sun, 13 Oct 2024 21:11:58 +0200</pubDate>
      <guid>https://ajoellee.com/blog/2024-10-13-how-to-start-an-informatics-olympiad-program/</guid>
      <description>&lt;h2 id=&#34;how-to-start-an-informatics-olympiad-program&#34;&gt;How to start an Informatics Olympiad Program&lt;/h2&gt;&#xA;&lt;ol start=&#34;0&#34;&gt;&#xA;&lt;li&gt;Find students and train them. Maybe from Math or Physics Olympiad.&lt;/li&gt;&#xA;&lt;li&gt;Source for funding. Maybe this happens before 0.&lt;/li&gt;&#xA;&lt;li&gt;Run a National Contest and maybe camp to select five students.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.bebraschallenge.org/&#34;&gt;Bebras Competition&lt;/a&gt; doesn&amp;rsquo;t require students to already know how to code&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;ol start=&#34;3&#34;&gt;&#xA;&lt;li&gt;Send an observer to the International Olympiad for Informatics a year before you send a team.&lt;/li&gt;&#xA;&lt;li&gt;Send a team of four members, one deputy, one team leader.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Use &lt;a href=&#34;https://cpbook.net/&#34;&gt;Competitive Programming 4&lt;/a&gt; for training together with Kattis. Or &lt;a href=&#34;https://usaco.guide/&#34;&gt;USACO Guide&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;It may be worthwhile to reach out to trading firms and / or existing IOI sponsors&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;h2 id=&#34;approach-for-team-rwanda&#34;&gt;Approach for Team Rwanda&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;There was an existing Math Olympiad&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://ngoportal.org/gtn-excellence-in-coaching-and-leadership-excl-program-2024/&#34;&gt;GTN Grant&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Training done via &lt;a href=&#34;https://cses.fi/book/book.pdf&#34;&gt;Competitive Programming Handbook&lt;/a&gt; during in person sessions from 2 p.m. - 5 p.m. on Saturdays&lt;/li&gt;&#xA;&lt;li&gt;Observer sent to IOI 2024 in Egypt&lt;/li&gt;&#xA;&lt;li&gt;Selection camp was held over the course of eight days with a mix of selection tests. We used &lt;a href=&#34;https://cms-dev.github.io/&#34;&gt;Contest Management System&lt;/a&gt; for holding contests&lt;/li&gt;&#xA;&lt;li&gt;Students set both an AI test for &lt;a href=&#34;https://ioai-official.org/&#34;&gt;IOAI&lt;/a&gt; and an informatics test for IOI. Two separate teams were selected there and sent to camp under two separate tracks. Students were not allowed to decide on their track this year.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Arun, the founder of Math Olympiads in Rwanda and African Olympiad Academy is writing a blogpost about Olympiads, which I suspect will be more illuminating than the sketch notes above.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>How to configure React PDF Higlighter For Next.js 13</title>
      <link>https://ajoellee.com/blog/2023-07-16-react-pdf-highlighter-with-nextjs-13/</link>
      <pubDate>Sun, 16 Jul 2023 10:03:03 +0200</pubDate>
      <guid>https://ajoellee.com/blog/2023-07-16-react-pdf-highlighter-with-nextjs-13/</guid>
      <description>&lt;h1 id=&#34;what-is-react-pdf-highlighter&#34;&gt;What is React PDF Highlighter?&lt;/h1&gt;&#xA;&lt;p&gt;As the name suggests, React PDF Highlighter is a way to create and annotate PDFs. Unfortunately, at time of writing there isn&amp;rsquo;t support for React 18 and Next.js 13 in &lt;code&gt;main&lt;/code&gt;.There&amp;rsquo;s an &lt;a href=&#34;https://github.com/agentcooper/react-pdf-highlighter/pull/232&#34;&gt;active PR up&lt;/a&gt; at time of writing (courtesy &lt;code&gt;joebutler2&lt;/code&gt;) but it&amp;rsquo;s still being reviewed.I thought I&amp;rsquo;d detail the process I took to get an example up and running in case it&amp;rsquo;s useful for anyone else out there. For context, I am on an M2 Silicon Macbook Air.&lt;/p&gt;&#xA;&lt;h2 id=&#34;installing-from-github-registry&#34;&gt;Installing From Github Registry&lt;/h2&gt;&#xA;&lt;p&gt;Follow &lt;a href=&#34;https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry&#34;&gt;this guide&lt;/a&gt; in order to set up Github registry&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;npm login --scope=credolabs --auth-type=legacy --registry=https://npm.pkg.github.com&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You will be prompted for your Github username and a Github token. To obtain the Github token go to &lt;code&gt;Settings &amp;gt; Developer Setings &amp;gt; Personal Access Tokens&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;You can confirm that setup was successful by checking &lt;code&gt;~/.npmrc&lt;/code&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;adding-the-package&#34;&gt;Adding the package&lt;/h2&gt;&#xA;&lt;p&gt;Thereafter, chuck this line into your &lt;code&gt;package.json&lt;/code&gt;:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;&amp;#34;@credolabs/react-pdf-highlighter&amp;#34;: &amp;#34;5.6.7&amp;#34;&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and then run &lt;code&gt;npm install&lt;/code&gt; or equivalent for the package manager you are using.&lt;/p&gt;&#xA;&lt;h2 id=&#34;canvas-error&#34;&gt;Canvas error&lt;/h2&gt;&#xA;&lt;p&gt;If you run &lt;code&gt;npm run dev&lt;/code&gt; thereafter you might get an error about the lack of a &lt;code&gt;canvas&lt;/code&gt; package. Installing &lt;code&gt;canvas&lt;/code&gt; will give you another error about an invalid symbol. You can run the magic snippet &lt;a href=&#34;https://github.com/Automattic/node-canvas/blob/master/Readme.md&#34;&gt;obtained from this source&lt;/a&gt;&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;brew install pkg-config cairo pango libpng jpeg giflib librsvg&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;and try installing again - this should hopefully resolve this issue.&lt;/p&gt;&#xA;&lt;p&gt;Thereafter head to your &lt;code&gt;next.config.js&lt;/code&gt; and slot this in:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;modules.exports = {&#xA;     webpack: (config) =&amp;gt; { config.externals.push({ sharp: &amp;#39;commonjs sharp&amp;#39;, canvas: &amp;#39;commonjs canvas&amp;#39; }); return config }&#xA;     ...&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&#34;getting-a-basic-example-up-and-running&#34;&gt;Getting a basic example up and running&lt;/h3&gt;&#xA;&lt;p&gt;Edit &lt;code&gt;page.tsx&lt;/code&gt; and chuck &lt;code&gt;examples/src/App.tsx&lt;/code&gt; in. Do the following:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Substitute all references to &lt;code&gt;/react-pdf-highlighter&lt;/code&gt; to import from &lt;code&gt;@credolabs/react-pdf-highlighter&lt;/code&gt; instead.&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;code&gt;“use client”&lt;/code&gt; at the top of &lt;code&gt;App.tsx&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Go to test_highlights file and dump it into &lt;code&gt;App.tsx&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Install &lt;code&gt;jsdom&lt;/code&gt; if you run into errors about &lt;code&gt;window&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Copy &lt;code&gt;App.css&lt;/code&gt; from the &lt;code&gt;examples&lt;/code&gt; into  &lt;code&gt;app/style/App.css&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Move over &lt;code&gt;examples/Sidebar.tsx&lt;/code&gt; into &lt;code&gt;app/Sidebar.tsx&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Delete the &lt;code&gt;Spinner&lt;/code&gt; component or copy it over from &lt;code&gt;examples&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;At this point there might be some warnings about &lt;code&gt;window&lt;/code&gt; but you should generally be good to go. Hope this helps in some way and feel free to comment if you run into any issues&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
