<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kief H. Shemul on Medium]]></title>
        <description><![CDATA[Stories by Kief H. Shemul on Medium]]></description>
        <link>https://medium.com/@theshemul?source=rss-833aefe7e65d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*e7sbCLf7DzK95Zdru273cw.jpeg</url>
            <title>Stories by Kief H. Shemul on Medium</title>
            <link>https://medium.com/@theshemul?source=rss-833aefe7e65d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 07:34:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@theshemul/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Make Golang program for Router]]></title>
            <link>https://medium.com/@theshemul/make-golang-program-for-router-39bf18529b18?source=rss-833aefe7e65d------2</link>
            <guid isPermaLink="false">https://medium.com/p/39bf18529b18</guid>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[router]]></category>
            <category><![CDATA[xiaomi]]></category>
            <category><![CDATA[openwrt]]></category>
            <dc:creator><![CDATA[Kief H. Shemul]]></dc:creator>
            <pubDate>Tue, 22 Sep 2020 19:27:24 GMT</pubDate>
            <atom:updated>2020-09-23T03:49:02.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y0G8Afnv4I1--1hod8hgEw.jpeg" /></figure><p>So a couple of months ago I bought a new router for my home. It’s a <a href="https://www.mi.com/mea/mi-router-3/">Xiaomi Mi 3</a>. I’ve been using this as my room AP to make the wifi signal better. Recently, I was studying on <a href="https://en.wikipedia.org/wiki/Captive_portal">captive portal</a> for some reason. And as I’m a big fan of <a href="https://openwrt.org/">OpenWrt</a> and it’s family, So I was looking for the right firmware for my router that let me allow to port Golang program. As of now, I didn’t find any official workable openwrt firmware for this router. Please comment below if you found any! So I had to go through other custom firmware like Padvan.<br>In this article, I will cover how anyone can port Golang program to a Linux supported router.</p><h3>Device Info</h3><p>After everything is done, the router now is a mini Linux server and I can SSH onto it. Here are some information of the device.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yB0JUgaQSBSKd01wS1HD6Q.png" /></figure><p>Look , I’ve now linux server and has MIPS architecture with MediaTek MT7620 SoC processor also it has 128 megabyte of memory in it.</p><pre>/home/root # cat /proc/meminfo | grep “MemTotal”<br>MemTotal: 126364 kB</pre><h3>Lets try a Golang Helloworld in the router</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac192fe0328bf1a0abaa42224e091a23/href">https://medium.com/media/ac192fe0328bf1a0abaa42224e091a23/href</a></iframe><p>Lets build the above code for Mips compatible Arch. <a href="https://www.mips.com/?do-download=the-mips32-24ke-core-family-high-performance-risc-cores-with-dsp-enhancements">Core spec of Mips</a></p><pre>GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -o app</pre><p>lets SCP the file into the router</p><pre>$ scp app root@192.168.3.1:/media/AiDisk_a1/</pre><p>you might ended up with lack of available space in your router so it would be better if you port a external flash drive. for me it’s a pendrive of 16GB and mounted in /media/AiDisk_a1</p><h3>Finally</h3><pre>$ ./app<br>hello from the router</pre><h3>Courtesy</h3><p><a href="https://stackoverflow.com/questions/43208366/golang-cross-compiling-for-mips">Golang. Cross Compiling for MIPS</a></p><p><a href="https://zyfdegh.github.io/post/202002-go-compile-for-mips/">https://zyfdegh.github.io/post/202002-go-compile-for-mips/</a></p><p><a href="https://stackoverflow.com/questions/55878437/writing-and-compiling-program-for-openwrt/60161561#60161561">Writing and Compiling Program For OpenWrt</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39bf18529b18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Task orchestration in Go Machinery.]]></title>
            <link>https://medium.com/swlh/task-orchestration-in-go-machinery-66a0ddcda548?source=rss-833aefe7e65d------2</link>
            <guid isPermaLink="false">https://medium.com/p/66a0ddcda548</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[machinery]]></category>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[task-queues]]></category>
            <dc:creator><![CDATA[Kief H. Shemul]]></dc:creator>
            <pubDate>Sat, 13 Jun 2020 18:24:27 GMT</pubDate>
            <atom:updated>2020-06-18T16:28:54.639Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*AHSs62onFIEZsiCAvNtvwA.png" /></figure><p>Machinery is an asynchronous task queue/job queue based on distributed message passing. tasks/jobs are executed concurrently either by many workers on many servers or multiple worker processes on a single server using Golang’s goroutines. This uses distributed message passing so you can distribute tasks across many servers which allows you to scale horizontally</p><p>It is comparable in nature to task orchestration in Celery which is an outstanding Python library, in spite of the fact that Machinery has been planned from scale up and considering Golang’s qualities.</p><p>In order to illustrate better let’s implement task queuing in machinery in a real-world example.</p><p>we will build a web server that will accept a email , subject and body messages from client and enqueue the task to worker process ( aka machinery). And worker will consume the queue and send email asynchronously.</p><h3>init the project</h3><p>In this project we’ll use go module to manage dependencies. so let’s init go mod</p><pre>go mod init github.com/&lt;you&gt;/go-machinery-example</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15128b764c1b36ddfdb543f20793b648/href">https://medium.com/media/15128b764c1b36ddfdb543f20793b648/href</a></iframe><h3>Let’s start with a basic CLI app.</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f161c49d359952053bfb44bd804e042f/href">https://medium.com/media/f161c49d359952053bfb44bd804e042f/href</a></iframe><p>Lets implement server.StartServer and worker.StartWorker but before that we need to implement utils.GetMachineryServer() function to get the taskserver instance</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42fbfc8d6a89d79156f0a28faca505ec/href">https://medium.com/media/42fbfc8d6a89d79156f0a28faca505ec/href</a></iframe><p>we used Redis as our Broker and ResultBackend it’s actually the intermediate state where server and worker will exchange message or the task. you might also notice tasks.SendMail which registered with the taskserver. this is the actual task we will be dealing with.</p><h3>Let’s make the task</h3><p>in tasks.task.go we defined some functions to work with the task. Here DecodeToTask function decodes the base64 string to a payload struct. finally SendMail function to send a email. previously we already registered SendMail with machinery.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/915ce99913e4bd092ab2a108b0cd6b86/href">https://medium.com/media/915ce99913e4bd092ab2a108b0cd6b86/href</a></iframe><h3>Run the server</h3><p>in server.StartServer() we added a Http handler to accept a task from client that is just a json object of email,subject and body. And pass to taskserver through a task <em>signature</em>. that’s all , our task has been enqueued to the worker. worker will pick the task ASAP (if no delay settings)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6917d6b18ef16c738a65a79256de5940/href">https://medium.com/media/6917d6b18ef16c738a65a79256de5940/href</a></iframe><h3>Run the worker</h3><p>in the worker side we simply recall GetMachineryServer to get the sametaskserver instance. To init a worker we need an unique tag and concurrency limit. here it’s 10</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13a1ff23e40bf1bbdee7ed0355187e35/href">https://medium.com/media/13a1ff23e40bf1bbdee7ed0355187e35/href</a></iframe><h3>Finally, the usages !</h3><pre>go run main.go server<br>go run main.go worker</pre><p>…</p><pre>curl --request POST &#39;localhost:5000/send_task&#39; --header &#39;Content-Type: application/json&#39; --data-raw &#39;{&quot;email&quot;: &quot;anyone@gmail.com&quot;,&quot;subject&quot;: &quot;Hi&quot;,&quot;body&quot;: </pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aBmyIx1P7jUIfO3SNGKWqg.png" /><figcaption>worker logs</figcaption></figure><h3>Codebase</h3><p>to get the complete code <a href="https://github.com/shemul/go-machinery">https://github.com/shemul/go-machinery</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=66a0ddcda548" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/task-orchestration-in-go-machinery-66a0ddcda548">Task orchestration in Go Machinery.</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>