<?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 Dmitry Mosquid on Medium]]></title>
        <description><![CDATA[Stories by Dmitry Mosquid on Medium]]></description>
        <link>https://medium.com/@mosquid?source=rss-a4375f68e7a0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3tX_FMvkZX44hbBY.</url>
            <title>Stories by Dmitry Mosquid on Medium</title>
            <link>https://medium.com/@mosquid?source=rss-a4375f68e7a0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 11:18:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mosquid/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[AI Ethics: How to Be a Responsible Software Engineer in the AI Era]]></title>
            <link>https://mosquid.medium.com/ai-ethics-how-to-be-a-responsible-software-engineer-in-the-ai-era-e14d36dc44c5?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14d36dc44c5</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai-coding]]></category>
            <category><![CDATA[vibe-coding]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Sat, 10 Oct 2026 16:09:45 GMT</pubDate>
            <atom:updated>2026-10-10T16:09:45.906Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dosOEJklaZcgM5HlKF3dDw.png" /></figure><h3>1. Own your agents’ work. Don’t become an obstacle</h3><p>A lot of you have this wrong. You don’t just tell your agents what to do, watch YouTube, and report when the job is done. You’re taking on some of the responsibilities of an engineering manager, and engineering managers exist for a reason.</p><p>You own the outcome. You need to care about what’s being built, the key design decisions, integration points, and success metrics.</p><p>The rule here is: own it or get replaced. If your contribution is forwarding tickets to agents and forwarding their output back, you’re renting your workstation to Claude and acting as a ticket assignment system. That’s a thin justification for your role.</p><p>Study the work. Review intermediate results. Question your agents until you understand the decisions well enough to explain or challenge them.</p><p>No bueno:</p><blockquote><em>— How did you solve problem X?<br> — It wasn’t actually me. It was Claude. I’ll have to ask.</em></blockquote><p>You don’t need to remember every implementation detail. You do need to understand the important decisions behind the work you’re delivering.</p><h3>2. I’m talking to you, not your agent</h3><p>What prompted me to write this was <a href="https://www.businessinsider.com/shopify-ceo-ai-slop-grenades-can-make-work-harder-2026-9">Tobi Lütke’s discussion of “slop grenades” on The Knowledge Project</a>: unchecked AI output you toss at your ̶e̶n̶e̶m̶y̶ colleague.</p><p>You’re getting paid to pay attention to your area of responsibility. If you’re just a throttling proxy between another human and an LLM, you’re slowing everyone down.</p><p>If I ask you a question, I don’t want the equivalent of git checkout &lt;your_branch_name&gt; &amp;&amp; claude -p &lt;my_question&gt;. I can ask Claude myself.</p><p>I asked you because I need your <strong>human</strong> take on the problem. If you respond emotionally, I’ll understand that it was a big deal. Or you might mention something that never made it into the available context.</p><p>Sure, use your agent to help prepare that answer. But keep in mind: I also have Claude and access to the codebase. I could ask the same question myself and save us both time. I’m writing to you instead because I need to hear from <strong>you</strong>.</p><h3>3. Show what your agentic setup accomplishes</h3><p>It’s tempting to share how great your harness is or how efficient your agentic setup has become. But most people don’t care about the machinery until they see what it accomplishes.</p><p>Demonstrate the results. Problems solved, money made, clients satisfied, lives saved. How many side projects you run and how many PRs you ship tells very little on its own.</p><p>I’d extract two rules:</p><ul><li><strong>Excited about your personal assistant? Explain what it improved.</strong> Your routine isn’t everyone else’s. We value different things and structure our days differently. “It works brilliantly for me” doesn’t automatically mean everyone else needs it.</li><li><strong>Your software factory is killing it? Show the result.</strong> Producing lots of code quickly isn’t enough. Build something useful, show why it matters, and give people a reason to be curious about how you did it.</li></ul><p>There’s a time and place to brag about things, sure. Present your innovations to your local AI enthusiast group. But hold off on sharing the architectural details of your personal assistant at a gathering of friends.</p><h3>4. Tokenmaxxing (the right way)</h3><p>And last but not least. <em>Perhaps the most important one, actually</em>: if your employer pays for your subscription, pay them back by making the most of your weekly token allowance. Research, refactor, experiment, analyze logs and traces.</p><p>There’s almost always useful work you’ve postponed because it would take too much time: a recurring error to investigate, an assumption to validate, an experiment to run. With agents, some of that work has become much cheaper. Don’t keep dismissing it based on what it used to cost.</p><p>Do not create more code unless absolutely necessary, though — it’s a liability. An unmonitored and unmaintained service doesn’t just consume resources someone is paying for. It can also worsen your security posture by giving malicious actors a potential entry point into your network.</p><p>But leaving half your weekly tokens unused while worthwhile work remains unexplored is a missed opportunity. It might even make sense to open a Slack channel where, on Friday afternoons, people offer their remaining capacity to help others run tasks autonomously. Whoever runs a task still owns reviewing the outcome.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14d36dc44c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I Built the Second-Best Secret Manager for AI Agents]]></title>
            <link>https://mosquid.medium.com/i-built-the-second-best-secret-manager-for-ai-agents-bcd2769aad87?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd2769aad87</guid>
            <category><![CDATA[agents]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Wed, 09 Sep 2026 19:42:08 GMT</pubDate>
            <atom:updated>2026-09-09T19:42:08.000Z</atom:updated>
            <content:encoded><![CDATA[<p>Do you share secrets with your agents? Do you paste credentials directly into the prompt window? You probably shouldn’t. There are several ways to avoid this — some good, others less so. In this article, I’ll walk through them, starting with the lazy and sloppy approaches and ending with the two best tools I’ve found. One of them is the tool I built. The other is better. I’ll explain why, give it the credit it deserves, and tell you why I knowingly built the second-best tool.</p><h3>When you share secrets</h3><p>You share them when you ask agents to look something up or do any auth-gated action.</p><pre>- What&#39;s the status of the workflow run XYZ-121?<br>- Let me pull it up<br>  ...<br>  fetch(service_url, api_key=abc123def)</pre><p>A polite agent will generate a snippet, give you a hint about where the secret needs to be placed, and wait for you to execute it.</p><pre>export API_KEY=...<br>fetch(service_url, $API_KEY)</pre><p>A less polite or desperate agent will bend the rules, even if the rules are very unambiguous: it will check your .env files, print env vars, scan through the chat transcripts, etc., trying to find the secret and run the request on your behalf.<br>This outlines our method 1 and touches on method 2.</p><h3>Method 1: Pasting secrets into the prompt window</h3><p>Most of us have done it. Some did it due to a lack of expertise, others — out of desperation or under time pressure — just pasted a secret when the agent asked for it.<br>The secret may persist in different places: in chat history, in traces; it may go to a third-party model provider and is, undoubtedly, the worst option. The good rule is — if your agent saw your secret, it’s a good idea to rotate it.</p><pre>- I don&#39;t have the API key, so here is how to check it<br>  ... lengthy instructions follow<br>- Gosh! Here is your API key, just run it yourself!</pre><h3>Method 2: Sourcing ENV files</h3><p>One way to do it slightly better is to instruct your agent not to run cat on your env files but allow it to source them:</p><pre>set -a<br>source .env<br>set +a</pre><p>This exports every variable assigned by the env file.<br>Obviously, the agent will be tempted to cat the env file and will certainly do so out of desperation. A polite agent will craft some script to loop through the lines of the file to prevent itself from looking at the part on the right-hand side of the &#39;=&#39;. But, again, impolite, rushed, or desperate agents won&#39;t be shy.</p><h3>Method 3: Tapas vault</h3><p>Here is my modest invention — <a href="https://github.com/Mosquid/tapas">Tapas</a>. It’s a tool and a skill that you can give your CLI agent, and it will be able to discover secret metadata and execute scripts on your behalf without actually “seeing” the full secret.</p><pre>- Can you check the status of the latest run?<br>- I&#39;m on it, Sir!<br>  ... tapas discover<br>  ... I&#39;ve got a few secrets here... I feel like `service_api_key` is what we need<br>  ... tapas run --ref store:personal/&lt;id&gt; -- sh -c &#39;curl &quot;$SERVICE_URL&quot; -H &quot;x-api-key: $SERVICE_API_KEY&quot;&#39;</pre><p>Thus, $SERVICE_API_KEY is set only for that child command, so a well-intentioned agent won&#39;t look at it. When tempted, the agent can run tapas preview --ref store:personal/&lt;id&gt;, which helps it grasp whether there is a value and what it looks like, approximately — for example, whether it starts with sk_. The fragment is intentionally visible to the agent, but the full secret is not.<br>If the agent needs a secret but the Tapas vault doesn&#39;t have it, it can ask you to add it to the vault. This happens outside the agentic conversation, specifically in this pretty browser window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xJ3dMhlMDhn4O-32mDVL1Q.png" /></figure><p>Once you click on <strong>Save credential</strong>, the agent will be able to use it in the next tapas run command.</p><h3>Tapas: the crux</h3><p>Tapas is not something special. Just SOPS for encryption/decryption, age for identity, and a short-lived Go HTTP server for when you need to set or preview a secret. Here is what tapas --help would tell you:</p><pre>$ tapas --help<br>Usage: tapas &lt;command&gt; [options]</pre><pre>  version  Print the installed version</pre><pre>Vault<br>  init   Create an identity and encrypted JSON vault<br>  list   Show credential metadata; never decrypts (alias: discover)<br>  add    Open a single-use browser form, save, and exit (alias: serve)<br>  preview  Show a limited credential fragment for format checking</pre><pre>Using a credential<br>  run    Run one command with credentials in its environment only</pre><pre>Use tapas &lt;command&gt; --help for options.<br>Secret values are accepted only in the browser. Full decrypted values are never<br>printed by the CLI or included in an error message.</pre><p>Again, Tapas is not about zero-knowledge, Fort Knox-level security; it’s not even the best tool in its class! But this is the right level of compromise for me.</p><h3>Method 4: Agent Vault</h3><p><a href="https://infisical.com/blog/agent-vault-the-open-source-credential-proxy-and-vault-for-agents">Agent Vault</a> by Infisical is the tool I would actually recommend. It’s much more secure by design, as it follows a credential-brokering pattern (I didn’t make this one up). Basically, it’s a proxy that can run on your machine or another host, intercepts requests to configured services from clients using the proxy, and injects the auth header: Bearer, API key, you name it.<br>I didn’t like the always-on server or the alias I needed to make to run my CLI agents (alias claude=&#39;agent-vault vault run -- claude&#39;). My agents didn&#39;t like the proxy. After analyzing traces by the end of the second day of using Agent Vault, things like export USE_PROXY=false started appearing throughout, as well as occasional certificate-related errors. I don&#39;t blame the tool, though. I blame the slightly crooked hands I&#39;ve got.</p><p>One caveat: Agent Vault’s docs call vault run a convenience wrapper, not a sandbox. A child process can bypass the proxy unless you also restrict outbound network access. Also, Infisical now calls <a href="https://infisical.com/blog/agent-proxy">Agent Proxy</a> Agent Vault&#39;s commercial-grade successor.</p><h3>Before you leave</h3><p>If you’d like to try Tapas — here’s its source code: <a href="https://github.com/Mosquid/tapas">https://github.com/Mosquid/tapas</a><br>If you don’t end up using it, it’s okay. But maybe it still deserves a star, as the second-best agent secret-management tool there is.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd2769aad87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using ChatGPT as a backend]]></title>
            <link>https://mosquid.medium.com/using-chatgpt-as-a-backend-8e675094e7b4?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e675094e7b4</guid>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Fri, 26 May 2023 18:09:15 GMT</pubDate>
            <atom:updated>2023-05-26T18:09:15.742Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*RtQKSmwe7aEto3PQrxbDRQ.jpeg" /><figcaption>The Overlord</figcaption></figure><p><em>Probably the last backend you will ever build *</em></p><p>I want to start with a small disclaimer: in this article, I am sharing ideas and tools that some beginners may find helpful. In the real-world app, you will want to use tools like <a href="https://python.langchain.com/en/latest/index.html">Langchain</a> or/and <a href="https://www.pinecone.io/">Pinecone</a>. But here we keep it simple.</p><h4>One backend to rule them all</h4><p>There are thousands of creative applications using ChatGPT under the hood and millions more on the way. Also, it is surprisingly easy to use. Like, really simple. However, the first steps can be a little counterintuitive.</p><p>I’ve helped a number of software engineers with their ChatGPT projects, and all of them initially had wrong assumptions and tended to overestimate the complexity. Let’s break it down into building blocks and talk about each one.</p><h3>Getting Started</h3><h4><strong>Completion VS Chat Completion?</strong></h4><p>OpenAI API features two pretty similar API endpoints: /completion and /chat/completion. Chat completion takes a series of messages as input, while completion takes a single string as input. The OpenAI API provides several message roles that can be used to provide context and additional instructions to the model. In this article, I’ll only focus on the /chat/completion method, as I find it a lot more useful.</p><h4><strong>Message Roles</strong></h4><p>In addition to the message content, you need to provide a role. There are three roles available:</p><ol><li><strong>System</strong>: used to calibrate the behavior of the assistant.</li><li><strong>Assistant: </strong>the role assigned to the chatbot responses. You can use the “assistant” role to “continue” a conversation or make the chat experience more stateful.</li><li><strong>User</strong>: the role assigned to messages sent by a user.</li></ol><p>The typical conversation begins with a “system” message to set a tone and perhaps a response format. Then it’s followed by the “user” message. Here as example</p><pre>const messages = [{<br>  role: &quot;assistant&quot;,<br>  content: &#39;As an AI model, you should respond with binary answers that contain only the words &quot;yes&quot; and &quot;no&quot;.&#39;<br>}, {<br>  role: &quot;user&quot;,<br>  content: &quot;Can a person fly without the use of additional tools?&quot;<br>}]</pre><h4>Temperature</h4><p>Temperature is a parameter that allows to set the desired level of entropy or randomness. The documentation is a bit controversial about the range. Some guides claim that it can be between 0 and 1 while the <a href="https://platform.openai.com/docs/api-reference/completions">official documentation</a> states that the temperature range is from 0 to 2. If you want the assistant to be more creative, you should set a higher temperature value. For a more strict and focused mode, you should choose 0.</p><h4>Tokens</h4><blockquote>Tokens are the basic unit that OpenAI GPT models (including ChatGPT) use to compute the length of a text.</blockquote><p>You can specify the number of tokens you want the model to use when generating the completion. Keep in mind that the parameter max_tokens takes into account your input as well. To learn more about the tokens you can use <a href="https://platform.openai.com/tokenizer">this tool</a>.</p><h3>GPT Overlord</h3><p>I built a small NPM package called gpt-overlord that aims to provide a simple abstraction layer on top of the OpenAI node client. With this package, you can:</p><ul><li>Specify the Response schema.</li><li>Provide additional instructions to the AI model.</li><li>Provide additional context or chat history.</li></ul><p>Let’s build a simple game where players have to name the capital of a country. We will build an API endpoint that does the following:</p><ul><li>Validates the player’s answer.</li><li>Returns the correct answer if the player gave the wrong answer.</li></ul><p>First, you need to get your OpenAI <a href="https://platform.openai.com/account/api-keys">API key</a>. Please note, I tried the free tier and it didn’t work at all for me. So consider upgrading to the paid plan.</p><p>Second, let’s add gpt-overlord to your project:</p><pre>yarn add gpt-overlord</pre><p>Now we need to create an instance of the “overlord”:</p><pre>const overlord = new GPTOverlord({<br>  apiKey: process.env.OPENAI_API_KEY,<br>  model: &quot;gpt-3.5-turbo&quot;,<br>  temperature: 0,<br>  // the format of the chat completion<br>  schema: {<br>    isCorrect: &quot;true | false&quot;,<br>    correctAnswer: &quot;..&quot;,<br>  },<br>  setupMessages: [<br>    {<br>  // describing the rules of our game<br>      content:<br>        &quot;We are playing a game. I give you the name of the country and its capital. You tell me if I am right or wrong.&quot;,<br>      role: &quot;system&quot;,<br>    },<br>  ],<br>});</pre><p>Finally, we can try to “talk” to our assistant:</p><pre>const country = &#39;Span&#39;;<br>const capital = &#39;Barcelona&#39;;<br>const response = await overlord.prompt(<br>  `{country: ${country}; capital: ${capital}}`<br>);<br><br>// response: {&quot;isCorrect&quot;:&quot;false&quot;,&quot;correctAnswer&quot;:&quot;Madrid&quot;}<br></pre><p>And we are done. Just hook it up to your API endpoint and you should be good to go. Remember I told you it is simple?</p><p>P.S. For the source code and issue, please visit the <a href="https://github.com/Mosquid/gpt-overlord">GitHub repository</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e675094e7b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Raspberry Pi WebSocket Robot]]></title>
            <link>https://mosquid.medium.com/basic-raspberry-pi-websocket-robot-4a437a4b02f7?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a437a4b02f7</guid>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Fri, 25 Nov 2022 11:46:59 GMT</pubDate>
            <atom:updated>2022-12-12T16:06:27.041Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been using Raspberry Pi as a home server for years until one day I decided to find out “what are those pins for”? I ended up reading a lot about GPIO and it felt like I must find a proper use for my retired Raspberry Pi 2 Model B. So I decided to build a robot.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FDXY2A_4OMv0%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DDXY2A_4OMv0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FDXY2A_4OMv0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/610d1a7def1973b76a94375f28207eb1/href">https://medium.com/media/610d1a7def1973b76a94375f28207eb1/href</a></iframe><h4>Before we begin</h4><ul><li>You need to have your Raspberry Pi ready with Raspbian (or any other Linux distro) on board (<a href="https://www.instructables.com/HOW-TO-INSTALL-RASPBIAN-OS-IN-YOUR-RASPBERRY-PI/"><em>guide</em></a><em>).</em></li><li>You need to have Python 3 (<a href="https://projects.raspberrypi.org/en/projects/generic-python-install-python3#linux"><em>guide</em></a><em>)</em> and Git (<a href="https://linuxize.com/post/how-to-install-git-on-raspberry-pi/"><em>guide</em></a>) installed on your RPi<em>.</em></li><li>You should be able to control your Raspberry Pi either via ssh or with a physical keyboard and screen (<a href="https://www.tomshardware.com/reviews/raspberry-pi-headless-setup-how-to,6028.html"><em>guide for the headless setup</em></a>).</li></ul><h4>Hardware</h4><ul><li><strong>Chassis. </strong>I got somewhat lucky as my local Raspberry distributor had this little guy (<a href="https://thepihut.com/products/sts-pi">STS-Pi by Pimoroni</a>) in stock. But <a href="https://www.aliexpress.com/item/32554236304.html">any other</a> dual-motor chassis will do just fine.</li><li><strong>Wiring. </strong>I built my prototype using a <a href="https://www.amazon.com/Breadboards-Solderless-Breadboard-Distribution-Connecting/dp/B07DL13RZH/ref=sr_1_1_sspa?keywords=breadboard&amp;qid=1669149993&amp;s=electronics&amp;sprefix=bread%2Celectronics%2C226&amp;sr=1-1-spons&amp;sp_csd=d2lkZ2V0TmFtZT1zcF9hdGY&amp;psc=1">breadboard</a>, jumper wires, and a highly convenient T-Shaped <a href="https://www.amazon.com/Extension-Board-Rainbow-Cable-Raspberry/dp/B01NAHTLCO">GPIO extension board</a>.</li><li><strong>L293D chip. </strong>It<strong> </strong>was an absolute game-changer for me. <a href="https://www.ebay.com/itm/142826716908?hash=item214122beec:g:Y3wAAOSwhHJbGsNF&amp;amdata=enc%3AAQAHAAAA0JKNdozMSQ0HmX3etl0FHWPUCljYCvxUwW%2BjOAiUF2WMxE4J6yzBwG4hUDTIxpmIeC%2FUgXgo5fRbQTlzdoRHPMFS81zRMcnvwZ8z4GxJ7UEZWq5fFC22DxCgQHHJV90WlDHFxIdHeSRIhbWiceqPxdJRJCwkbNwtScH45vtTwglseJW%2F1wxGxQmMw%2B9h6sgqe06%2B8lh6ocTM59AN5f0%2FbBErigiz58y7x%2FERcypuzdwRrUUu9yWLzg2hiUkfQIa2Qe0iePKn963yTKS%2FMg3iR%2BE%3D%7Ctkp%3ABk9SR8ThuemVYQ">L293D</a> is a super straightforward and very convenient motor driver. If you are new to the field, it will surprise you how much you get for less than a dollar.</li><li><strong>Power supply</strong>. Any USB power bank should work. For this example, I picked one that has two USB outputs: one for powering the Pi and another one for the motors.</li><li><strong>Camera </strong>(optional)<strong>. </strong>In my stockpiles, I found a <a href="https://www.amazon.com/Arducam-Fisheye-Camera-Raspberry-Pi/dp/B013JWEGJQ">wide-angle camera</a> for Raspberry Pi. It fit nicely on my chassis so decided to set up a simple streaming service using <a href="https://picamera.readthedocs.io/">Picamera</a>.</li><li><strong>Raspberry Pi</strong>. And, of course, the brain center of our project. Please note that older Pi’s come with no onboard WiFi module. For the 1st and 2nd generations, you are going to need a <a href="https://www.amazon.com/Adapter-LOTEKOO-RT5370-Chip-Raspberry/dp/B0BHW6T96R/ref=sr_1_1_sspa">USB dongle</a><strong>.</strong></li></ul><h4>Software</h4><ul><li><strong>Server. </strong>I made a fairly simple <a href="https://github.com/Mosquid/py-robot-websocket-server/">Python WebSocket server</a> and hooked up the message handler to the motor controller. Each message contains directional and speed parameters for both motors.</li><li><strong>Client. </strong>I made a little React app using an amazing <a href="https://github.com/elmarti/react-joystick-component">React Joystick Component</a>. My code is available <a href="https://github.com/Mosquid/react-remote-control/">here</a>. It’s also deployed to <a href="https://react-remote-control.vercel.app/">Vercel</a>. You can just enter your robot’s IP address and control it from <a href="https://react-remote-control.vercel.app/">there</a>.</li><li><strong>Video streamer. </strong>I made it a part of the server code but in fact, it’s a separate process, listening to a different port (pending refactoring). It’s basically just a rewrite of one of the recipes I found in the <a href="https://picamera.readthedocs.io/en/release-1.13/recipes1.html">Picamera documentation</a>.</li></ul><h4>Wiring diagram</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oseHRAiV7r5VULSHsPR19g.png" /><figcaption>Yeah, I know. I’ve also seen a prettier schematic</figcaption></figure><p>You need two pins per motor to control the direction of the rotation (one pin for moving forward, one for reverse). The rotation speed is controlled by the frequency of pulses. This is elegantly handled by <a href="https://gpiozero.readthedocs.io/en/stable/">gpiozero library</a>, which I use in this project. For controlling the left motor I chose GPIO pins <strong>12</strong> and <strong>13</strong>. For the right one <strong>25</strong> and <strong>21</strong>. The pins are interchangeable so if you choose to use a different combination you have to make corresponding edits in the <a href="https://github.com/Mosquid/py-robot-websocket-server/blob/main/main.py#L12">server code</a>.</p><h4>Setting up your Raspberry Pi</h4><p>Connect to your Pi via ssh and clone the WebSocket server:</p><pre>git clone https://github.com/Mosquid/py-robot-websocket-server.git</pre><p>Install the dependencies and make the server start automatically on boot:</p><pre>cd py-robot-websocket-server &amp;&amp; sh install.sh</pre><h4><strong>The controller</strong></h4><p>For the controller app, I wanted to have a proper CI/CD pipeline so that the changes I push to the main branch will be automatically deployed. Vercel is a perfect solution for that. But it has one “flaw”: <a href="https://github.com/vercel/vercel/discussions/5287#discussioncomment-95150">only HTTPS connections are allowed</a>. By default, browsers won’t let you connect to a non-secure WebSocket (ws://) from a webpage served over HTTPS. My solution was to set up a basic Nginx reverse proxy directly on my RPi. It acts as an https-to-http proxy, providing http access to my <a href="https://react-remote-control.vercel.app/">app deployed at Vercel</a>. Alternatively, you can go with <a href="https://medium.com/himinds/create-a-self-signed-certificate-for-ios-or-nodejs-for-testing-secure-websockets-3df4bc722a3f">self-signed certificates</a>.</p><p>Nginx proxy config:</p><pre>server {<br>    ...<br>    location / {<br>        proxy_pass https://react-remote-control.vercel.app/;<br>     }<br>}</pre><p>Or just clone <a href="https://github.com/Mosquid/react-remote-control">react-remote-control</a> and run it locally. It will run on port 3000 over HTTP:</p><pre>git clone https://github.com/Mosquid/react-remote-control.git<br>cd react-remote-control<br>npm install<br>npm start</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UpV23PV-ycUcna2Syfx9Vg.png" /><figcaption>`Beep` and `Lights` are a part of the React Controller v2 :)</figcaption></figure><h4>Connecting the dots</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*td1D9t7Ek22ngfBLhDMeEA.jpeg" /></figure><p>If everything is done correctly, you should have:</p><ul><li>The <a href="https://github.com/Mosquid/py-robot-websocket-server">Python WebSocket server</a> running on your Raspberry Pi.</li><li>The WebSocket server listening to port <strong>5000 </strong>(e.g. 192.168.0.1:5000). The camera broadcast is on port <strong>8000</strong>.</li><li>If you went the extra step and spent time setting up Nginx server, the frontend should be available on port <strong>80</strong> of your Raspberry Pi’s IP address.</li></ul><p>Feel free to reach out in the comments section if something isn’t clear or doesn’t work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a437a4b02f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Headless WordPress: using Contact Form 7 REST API with React]]></title>
            <link>https://mosquid.medium.com/headless-wordpress-using-contact-form-7-rest-api-with-react-e73ef052af23?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e73ef052af23</guid>
            <category><![CDATA[gatsby]]></category>
            <category><![CDATA[contact-form]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[contact-form-7]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Mon, 11 Jan 2021 09:58:20 GMT</pubDate>
            <atom:updated>2021-01-11T09:58:20.580Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*44xb0qZ6dgWQwxgjWfR01w.jpeg" /></figure><p>I started seeing more and more people choosing headless WordPress as a backend, being very creative and innovative with this rather archaic tool. In this series of articles, I want to cover what our old buddy has to offer in the heyday of the no-code (and low-code) culture.</p><p>“Headless WordPress” has been here for a while. You can even choose to use WordPress as a REST API server for your <a href="https://www.gatsbyjs.com/guides/wordpress/">Gatsby</a> site and here is a comprehensive article on <a href="https://www.smashingmagazine.com/2018/10/headless-wordpress-decoupled/">Smashing Magazine</a>, covering all the “whys” and “hows”.</p><p>In my article, I’m going to talk about WP’s capabilities in acting as a microservice, that handles form submissions from your static websites and landing pages.</p><h4>Background</h4><p>Starting with a brief overview, why the world is shifting towards static websites. <em>It’s all about performance.</em> When I built my first static landing page using Gatsby, published it, and went to <a href="https://developers.google.com/speed/pagespeed/insights/">PageSpeed Insights</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*2r4aChFykleKsPExFfclYw.png" /></figure><p>It was stunning to look at two green gauges, both for mobile and desktop performance. And all that with zero optimizations. Remembering the tremendous effort it took me when I tried to get there with my WP websites I decided to <em>“go static”</em> from now on.</p><p>But it comes with a cost. You need something to handle your form submissions, which is obviously not available out of the box with a static website. There is a <a href="https://www.twilio.com/blog/gatsby-email-contact-form-react-serverless">number</a> of <a href="https://dev.to/nh2_amine/adding-a-contact-form-to-a-gatsby-js-landing-page-using-flexyform-3bn9">solutions</a> offered by various vendors, but none of them is easy to integrate nor free.</p><p>Luckily your old WP blog will come in handy. I stumbled upon this <a href="https://medium.com/@mahesh_joshi/wordpress-contact-form-7-rest-api-endpoints-bf45907b571c">great article</a> describing how to use Contact Form 7 REST API routes. This allows you to turn your old WordPress website of any kind into a real form-handling microservice with no code required. <br>Every form you create with CF7 (Contact Form 7) gives you a convenient REST API URL automatically. Like this one:<br><strong>example.com</strong>/wp-json/contact-form-7/v1/contact-forms/<strong>123</strong>/feedback. <br>All you do is send a POST request, containing your form data. The coolest thing is that essentially you only need a single WP website to handle form submission requests from dozens of static sites and landing pages. Just create a new form for every one of those and here you go. You can manage recipients, email templates, and use any plugin from the CF7 ecosystem.</p><h4>Using WP Contact Form 7 with your Gatsby website</h4><p>Additionally, I prepared a <a href="https://github.com/Mosquid/react-form-wp-cf7">React component</a> for you to make it easy to use WP CF7 API endpoints with your Gatsby site. Let’s have an in-depth look at how to use it.</p><p>Copy <a href="https://github.com/Mosquid/react-form-wp-cf7/blob/master/cf7-form-wrapper.js">cf7-form-wrapper.js</a> to your React app src folder. Import it to your components folder and wrap your form component just like this:</p><pre>&lt;Cf7FormWrapper url=”http://example.com&quot;&gt;<br>  &lt;Form /&gt;<br>&lt;/Cf7FormWrapper&gt;</pre><p>Make sure to supply either <strong>siteUrl</strong> &amp; <strong>formId</strong> or just <strong>url </strong>of<strong> </strong>your CF7 REST endpoint in Cf7FormWrapper attributes. At this point, you can already send API requests to your WP backend. But in order to make it more responsive, you want to inform your users about all stages your contact form goes through. With that purpose, Cf7FormWrapper provides three status indicators to your Form component:</p><ol><li>isLoading</li><li>isSent</li><li>hasError</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a63cc599b8b0e911197ed94364bca63/href">https://medium.com/media/7a63cc599b8b0e911197ed94364bca63/href</a></iframe><p>You may want to use them in the UI to enhance the user experience.</p><p>The full code could be found in the <a href="https://github.com/Mosquid/react-form-wp-cf7/blob/master/README.md">README.md</a> of my React component.</p><p><a href="https://www.freepik.com/photos/birthday"><em>Birthday photo created by pressfoto — www.freepik.com</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e73ef052af23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to import products to WooCommerce from any website]]></title>
            <link>https://mosquid.medium.com/how-to-import-products-to-woocommerce-from-any-website-6ac81edded9a?source=rss-a4375f68e7a0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ac81edded9a</guid>
            <category><![CDATA[woocommerce]]></category>
            <category><![CDATA[import]]></category>
            <category><![CDATA[wordpress]]></category>
            <category><![CDATA[ecommerce]]></category>
            <dc:creator><![CDATA[Dmitry Mosquid]]></dc:creator>
            <pubDate>Sun, 15 Nov 2020 18:18:59 GMT</pubDate>
            <atom:updated>2020-11-15T18:58:38.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xKLXRSGCMSPB5vEqlKlw6g.png" /></figure><h3>How to import products to WooCommerce site from almost any online store</h3><p>I developed a WordPress plugin called <a href="https://wordpress.org/plugins/cherry-picker">Cherry Picker</a> which allows you to import products from a number of websites to your WooCommerce. Today I’m going to show you how to import products virtually from any eCommerce website out of there.</p><h4>Cherry Picker brief overview</h4><p>Cherry Picker uses a <a href="https://en.wikipedia.org/wiki/Bookmarklet">bookmarklet</a> that sits in the browser’s bookmarks bar and executed every time when you click on it while on a product page. It takes the product content (title, description, images, etc) and creates a new product out of the imported data on your website. Unlike browser extensions, bookmarklets do not have (and can not have) any background activity, which is why I like them. That’s basically it. Instead of you manually downloading images, creating categories, copy-pasting and cleaning up descriptions, Cherry Picker does it for you. The plugin supports, in its current version (1.1.0), only simple products and doesn’t import attributes. I know that it’s essential to many sellers and it will surely be added in one of the next versions.</p><h4>Adding a new website support</h4><p>As of today (November 2020), Cherry Picker does only support the following websites: Amazon, iHerb, AliExpress, and Xiaomi-Mi.com. But luckily for us, it’s relatively easily extendible. It all starts with adding a so-called “adapter”.<br>The adapter is a class that produces a JSON object with the product data. This is what the most basic adapter would look like:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea0abdb326e5b75d0d1b5fe9870cc05f/href">https://medium.com/media/ea0abdb326e5b75d0d1b5fe9870cc05f/href</a></iframe><p>The example above will not do much, so let’s make something more useful. I’ll build an adapter for <strong>gearbest.com</strong>.</p><p>We always want to start with the unique distinguisher that will tell our script that we are on a product page. Bear in mind, that our adapter code will be executed in the context of the webpage, which means we can hugely benefit if there are relevant global variables available, like this one:</p><pre>window.dataLayer = [];   <br> dataLayer.push({&quot;PAGE&quot;:&quot;goods&quot;,&quot;PIPELINE&quot;:&quot;GB&quot;,&quot;LANG&quot;:&quot;en&quot;,&quot;google_tag_params&quot;:{&quot;prodid&quot;:&quot;474585301US&quot;,&quot;pagetype&quot;:&quot;product&quot;,&quot;totalvalue&quot;:33.99,&quot;currency&quot;:&quot;USD&quot;,&quot;pcat&quot;:&quot;Consumer Electronics &gt; Smart Electronics &gt; Smart Watches&quot;,&quot;legal&quot;:1},&quot;CODE&quot;:&quot;US&quot;,&quot;goods&quot;:{&quot;websku&quot;:&quot;009400447480&quot;,&quot;sku&quot;:&quot;474585301&quot;,&quot;cat_id&quot;:&quot;11330&quot;,&quot;nav_title_2&quot;:&quot;Consumer Electronics&quot;,&quot;nav_title_3&quot;:&quot;Smart Electronics&quot;,&quot;pic&quot;:&quot;&quot;,&quot;price&quot;:33.99,&quot;shopPrice&quot;:51.09,&quot;sn&quot;:&quot;474585301US&quot;,&quot;title&quot;:&quot;...&quot;,&quot;url&quot;:&quot;https:\/\/www.gearbest.com\/goods\/pp_009400447480.html&quot;,&quot;brand_code&quot;:&quot;&quot;}});</pre><p>This piece of code will help us with a number of things, but first, we’ll use it in isProductPage function:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9993fb0d6c0db53a258c9795715a10b7/href">https://medium.com/media/9993fb0d6c0db53a258c9795715a10b7/href</a></iframe><p>The function analyzes the first object in dataLayer and returns true if the page type is “goods”.</p><p>Now we’ll proceed to get a product price, title, and category. The dataLayer will be useful for that as well:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/13d0ec391c1018f7ac6066a1f1069f70/href">https://medium.com/media/13d0ec391c1018f7ac6066a1f1069f70/href</a></iframe><p>Getting a description can be quite difficult, as it may contain excessive HTML, inline styles, and other unwanted elements. Another complication is that some products may have a custom description layout. This is exactly the case here. Fortunately, I found only two variants of description markup (although I suppose there are actually more). And luckily enough, they are fairly similar. I managed to write a unified parser, compatible with them both. In these two functions we take the text description as well as the specs table:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7c4f6492f5be9798e6a2615b7f3b2fc/href">https://medium.com/media/e7c4f6492f5be9798e6a2615b7f3b2fc/href</a></iframe><p>The final function of the adapter will return an array of product images. As you can see, I added 600_600 at the end. First and foremost, this way you are getting images without a watermark. Also, as far as I can tell, this is the biggest size available.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cb8305f224c5cf0e0e8b0b22b23cdff/href">https://medium.com/media/2cb8305f224c5cf0e0e8b0b22b23cdff/href</a></iframe><p>Here you can find the <a href="https://gist.github.com/Mosquid/ade8ab12e661bcc7016c78c1d375d4b1"><strong>full adapter code</strong></a><strong>.</strong></p><p>At this point, you only have to register your newly added adapter in your WordPress theme. Create a folder called “adapters” in your theme directory, insert the adapter file, and jump straight to the end of the functions.php and add the following:</p><pre>add_filter(&quot;cherry_picker_adapters&quot;, function($adapters) {<br>  $adapters[&#39;gearbest.com&#39;] = get_template_directory_uri() . &#39;/adapters/gearbest.js&#39;;<br>  return $adapters;<br>})</pre><p>Now update the bookmarklet and you are ready to go importing products from the website you just added.</p><p>P.S. Got problems with creating an adapter? Reach me out on Twitter (<a href="http://twitter.com/m0squid">@m0squid</a>) and I’ll try to help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ac81edded9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>