<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://the0x00.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://the0x00.dev/" rel="alternate" type="text/html" /><updated>2026-09-27T17:57:17+00:00</updated><id>https://the0x00.dev/feed.xml</id><title type="html">The 0x00</title><subtitle>Founder &amp; Principle @ Apnotic</subtitle><author><name>Peter Giacomo Lombardo</name></author><entry><title type="html">How to Set Up Rails Credentials for Multi-Region Support</title><link href="https://the0x00.dev/rails/security/How-to-setup-Rails-credentials-for-multi-region-support/" rel="alternate" type="text/html" title="How to Set Up Rails Credentials for Multi-Region Support" /><published>2026-08-13T00:00:00+00:00</published><updated>2026-08-13T00:00:00+00:00</updated><id>https://the0x00.dev/rails/security/How-to-setup-Rails-credentials-for-multi-region-support</id><content type="html" xml:base="https://the0x00.dev/rails/security/How-to-setup-Rails-credentials-for-multi-region-support/"><![CDATA[<p><a href="https://pwpush.com">Password Pusher</a> runs the same Rails app in the US and EU — <a href="https://us.pwpush.com">us.pwpush.com</a> and <a href="https://eu.pwpush.com">eu.pwpush.com</a> — both as <code class="language-plaintext highlighter-rouge">RAILS_ENV=production</code>.  The app config is shared.  The secrets are not: Stripe, storage, SMTP, encryption keys and the rest are per-region.</p>

<p>Rails credentials are organized by environment (<code class="language-plaintext highlighter-rouge">development</code>, <code class="language-plaintext highlighter-rouge">test</code>, <code class="language-plaintext highlighter-rouge">production</code>).  That doesn’t help when you have two production deployments that must not share a master key.</p>

<p>You <em>could</em> add <code class="language-plaintext highlighter-rouge">production_us</code> and <code class="language-plaintext highlighter-rouge">production_eu</code> as real Rails environments.  Then you duplicate <code class="language-plaintext highlighter-rouge">production.rb</code>, CI, and every <code class="language-plaintext highlighter-rouge">Rails.env.production?</code> check in the app.  I didn’t want that.</p>

<h1 id="the-solution">The Solution</h1>

<p>Keep <code class="language-plaintext highlighter-rouge">RAILS_ENV=production</code>.  Create extra credentials files named after the region, then tell Rails which files to load at boot.</p>

<p><code class="language-plaintext highlighter-rouge">bin/rails credentials:edit --environment NAME</code> writes files named after <code class="language-plaintext highlighter-rouge">NAME</code>.  That name does not have to be a real Rails environment — there is no <code class="language-plaintext highlighter-rouge">config/environments/production-us.rb</code>.</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bin/rails credentials:edit <span class="nt">--environment</span> production-us
bin/rails credentials:edit <span class="nt">--environment</span> production-eu
</code></pre></div></div>

<p>That creates:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>config/credentials/production-us.yml.enc
config/credentials/production-us.key
config/credentials/production-eu.yml.enc
config/credentials/production-eu.key
</code></pre></div></div>

<p>Commit the <code class="language-plaintext highlighter-rouge">.yml.enc</code> files.  Gitignore the keys:</p>

<pre><code class="language-gitignore">/config/credentials/*.key
</code></pre>

<p>Each deploy sets a region environment variable.  In Password Pusher that’s <code class="language-plaintext highlighter-rouge">PWPX_REGION</code> (<code class="language-plaintext highlighter-rouge">us</code> or <code class="language-plaintext highlighter-rouge">eu</code>).</p>

<p>In <code class="language-plaintext highlighter-rouge">config/environments/production.rb</code>:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">Rails</span><span class="p">.</span><span class="nf">application</span><span class="p">.</span><span class="nf">configure</span> <span class="k">do</span>
  <span class="k">raise</span> <span class="s2">"PWPX_REGION is not set"</span> <span class="k">if</span> <span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">blank?</span>

  <span class="n">config</span><span class="p">.</span><span class="nf">credentials</span><span class="p">.</span><span class="nf">content_path</span> <span class="o">=</span> <span class="s2">"config/credentials/production-</span><span class="si">#{</span><span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">downcase</span><span class="si">}</span><span class="s2">.yml.enc"</span>
  <span class="n">config</span><span class="p">.</span><span class="nf">credentials</span><span class="p">.</span><span class="nf">key_path</span> <span class="o">=</span> <span class="s2">"config/credentials/production-</span><span class="si">#{</span><span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">downcase</span><span class="si">}</span><span class="s2">.key"</span> <span class="k">unless</span> <span class="no">ENV</span><span class="p">.</span><span class="nf">key?</span><span class="p">(</span><span class="s2">"RAILS_MASTER_KEY"</span><span class="p">)</span>

  <span class="c1"># ...the rest of production</span>
<span class="k">end</span>
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">content_path</code> is the encrypted YAML.  <code class="language-plaintext highlighter-rouge">key_path</code> is the decryption key.  See the <a href="https://guides.rubyonrails.org/configuring.html#config-credentials-content-path">Rails guides</a>.  If you point <code class="language-plaintext highlighter-rouge">key_path</code> at the YAML file, boot will fail in a confusing way.</p>

<p>If <code class="language-plaintext highlighter-rouge">RAILS_MASTER_KEY</code> is already in the environment (Hatchbox and Kamal set this per app), skip <code class="language-plaintext highlighter-rouge">key_path</code>.  The US app gets the US key; the EU app gets the EU key.  Don’t reuse one master key across regions — that would defeat the split.</p>

<p>To edit later, keep using <code class="language-plaintext highlighter-rouge">--environment production-us</code> (or <code class="language-plaintext highlighter-rouge">production-eu</code>).  <code class="language-plaintext highlighter-rouge">RAILS_ENV=production rails credentials:edit</code> still looks at <code class="language-plaintext highlighter-rouge">production.yml.enc</code>, and the boot code above will raise if <code class="language-plaintext highlighter-rouge">PWPX_REGION</code> isn’t set.</p>

<h1 id="staging">Staging</h1>

<p>Same idea, still one <code class="language-plaintext highlighter-rouge">RAILS_ENV=staging</code>:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>bin/rails credentials:edit <span class="nt">--environment</span> staging-us
bin/rails credentials:edit <span class="nt">--environment</span> staging-eu
</code></pre></div></div>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># config/environments/staging.rb</span>
<span class="k">raise</span> <span class="s2">"PWPX_REGION is not set"</span> <span class="k">if</span> <span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">blank?</span>

<span class="n">config</span><span class="p">.</span><span class="nf">credentials</span><span class="p">.</span><span class="nf">content_path</span> <span class="o">=</span> <span class="s2">"config/credentials/staging-</span><span class="si">#{</span><span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">downcase</span><span class="si">}</span><span class="s2">.yml.enc"</span>
<span class="n">config</span><span class="p">.</span><span class="nf">credentials</span><span class="p">.</span><span class="nf">key_path</span> <span class="o">=</span> <span class="s2">"config/credentials/staging-</span><span class="si">#{</span><span class="no">ENV</span><span class="p">[</span><span class="s2">"PWPX_REGION"</span><span class="p">].</span><span class="nf">downcase</span><span class="si">}</span><span class="s2">.key"</span> <span class="k">unless</span> <span class="no">ENV</span><span class="p">.</span><span class="nf">key?</span><span class="p">(</span><span class="s2">"RAILS_MASTER_KEY"</span><span class="p">)</span>
</code></pre></div></div>

<h1 id="deploy">Deploy</h1>

<p>Each region needs:</p>

<ol>
  <li><code class="language-plaintext highlighter-rouge">RAILS_ENV=production</code> (or <code class="language-plaintext highlighter-rouge">staging</code>)</li>
  <li><code class="language-plaintext highlighter-rouge">PWPX_REGION=us</code> or <code class="language-plaintext highlighter-rouge">PWPX_REGION=eu</code></li>
  <li><code class="language-plaintext highlighter-rouge">RAILS_MASTER_KEY</code> set to <strong>that region’s</strong> key</li>
</ol>

<p>The encrypted files ship with the git checkout.  The key does not.  If the US master key leaks, EU credentials stay encrypted, and the other way around.</p>

<p>Self-hosted Password Pusher doesn’t use this path — operators already configure everything with environment variables.  For the hosted service, credentials files are easier to manage than a long list of per-host env vars.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Rails" /><category term="Security" /><summary type="html"><![CDATA[Password Pusher runs the same Rails app in the US and EU — us.pwpush.com and eu.pwpush.com — both as RAILS_ENV=production. The app config is shared. The secrets are not: Stripe, storage, SMTP, encryption keys and the rest are per-region.]]></summary></entry><entry><title type="html">Streaming Sensor Data to an Edge AI Model over MQTT with C#</title><link href="https://the0x00.dev/c%23/hivemq/Streaming-Sensor-Data-to-an-Edge-AI-Model-over-MQTT-with-C-Sharp/" rel="alternate" type="text/html" title="Streaming Sensor Data to an Edge AI Model over MQTT with C#" /><published>2026-08-13T00:00:00+00:00</published><updated>2026-08-13T00:00:00+00:00</updated><id>https://the0x00.dev/c%23/hivemq/Streaming-Sensor-Data-to-an-Edge-AI-Model-over-MQTT-with-C-Sharp</id><content type="html" xml:base="https://the0x00.dev/c%23/hivemq/Streaming-Sensor-Data-to-an-Edge-AI-Model-over-MQTT-with-C-Sharp/"><![CDATA[<p><em>This post originally appeared on the <a href="https://www.hivemq.com/blog/streaming-sensor-data-to-edge-ai-mqtt/">HiveMQ blog</a>.</em></p>

<p>Edge AI needs a data path before it needs a model. Sensors produce readings on the device or the local network, the model runs nearby, and something has to move the readings from the first to the second — quickly, and without losing them. MQTT is the natural carrier for that traffic, and on .NET the <a href="https://github.com/hivemq/hivemq-mqtt-client-dotnet">HiveMQ MQTT client</a> makes the transport part straightforward. The part that takes real thought is feeding the model at the right rate: fast enough to keep up, without dropping readings or exhausting memory when the model falls behind. This post builds that ingest path and shows how to let the model’s own throughput set the pace.</p>

<p><em>Tested against HiveMQtt v0.45.0 (July 2026).</em></p>

<h2 id="where-naive-ingest-breaks">Where naive ingest breaks</h2>

<p>A sensor stream and an inference loop run at different speeds, and that gap is the whole problem. Run the model directly inside the message handler and each reading blocks the next — the client processes one at a time and the backlog piles up behind you. Spin up a task per message instead and a burst spawns thousands of them, so the process runs out of memory before the model catches up. Neither survives contact with a real sensor.</p>

<p>What you want is bounded intake with back-pressure: a fixed ceiling on how much work is in flight, and a way to say “slow down” that reaches back toward the source. MQTT 5 gives you exactly that, and the client exposes it directly.</p>

<h2 id="let-the-model-set-the-pace">Let the model set the pace</h2>

<p>The mechanism is <a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901251">flow control</a>. A client advertises a <a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901049">Receive Maximum</a> — the number of QoS 1 and 2 messages it will accept before it has acknowledged the ones it already has. Pair that with <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/how-to/manual-ack">manual acknowledgement</a> and you get a throttle wired straight to your model: don’t acknowledge a reading until the model has consumed it, and the broker will stop sending once the in-flight count hits the ceiling.</p>

<div class="language-c# highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">using</span> <span class="nn">HiveMQtt.Client</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">HiveMQtt.Client.Options</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">HiveMQtt.MQTT5.Types</span><span class="p">;</span>

<span class="kt">var</span> <span class="n">options</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">HiveMQClientOptionsBuilder</span><span class="p">()</span>
    <span class="p">.</span><span class="nf">WithBroker</span><span class="p">(</span><span class="s">"broker.hivemq.com"</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">WithClientId</span><span class="p">(</span><span class="s">"edge-inference-01"</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">WithManualAck</span><span class="p">()</span>          <span class="c1">// we acknowledge only after the model has the reading</span>
    <span class="p">.</span><span class="nf">WithReceiveMaximum</span><span class="p">(</span><span class="m">8</span><span class="p">)</span>    <span class="c1">// at most 8 unacknowledged QoS 1 messages in flight</span>
    <span class="p">.</span><span class="nf">Build</span><span class="p">();</span>

<span class="kt">var</span> <span class="n">client</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">HiveMQClient</span><span class="p">(</span><span class="n">options</span><span class="p">);</span>

<span class="n">client</span><span class="p">.</span><span class="n">OnMessageReceived</span> <span class="p">+=</span> <span class="k">async</span> <span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="p">=&gt;</span>
<span class="p">{</span>
    <span class="kt">var</span> <span class="n">payload</span> <span class="p">=</span> <span class="n">args</span><span class="p">.</span><span class="n">PublishMessage</span><span class="p">.</span><span class="n">Payload</span> <span class="p">??</span> <span class="n">Array</span><span class="p">.</span><span class="n">Empty</span><span class="p">&lt;</span><span class="kt">byte</span><span class="p">&gt;();</span>

    <span class="kt">var</span> <span class="n">reading</span> <span class="p">=</span> <span class="n">SensorReading</span><span class="p">.</span><span class="nf">Decode</span><span class="p">(</span><span class="n">payload</span><span class="p">);</span>          <span class="c1">// your deserialization</span>
    <span class="k">await</span> <span class="n">model</span><span class="p">.</span><span class="nf">InferAsync</span><span class="p">(</span><span class="n">reading</span><span class="p">).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span> <span class="c1">// your edge model</span>

    <span class="c1">// Only now does the broker count this message as handled and send the next.</span>
    <span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">AckAsync</span><span class="p">(</span><span class="n">args</span><span class="p">).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
<span class="p">};</span>

<span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">ConnectAsync</span><span class="p">().</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
<span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">SubscribeAsync</span><span class="p">(</span><span class="s">"sensors/+/telemetry"</span><span class="p">,</span> <span class="n">QualityOfService</span><span class="p">.</span><span class="n">AtLeastOnceDelivery</span><span class="p">)</span>
            <span class="p">.</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
</code></pre></div></div>

<p><code class="language-plaintext highlighter-rouge">SensorReading.Decode</code> and <code class="language-plaintext highlighter-rouge">model.InferAsync</code> are your code — the decoder for your payload format and the call into your model. Everything around them is the client doing flow control for you. Because the acknowledgement is deferred until inference finishes, a slow model simply means fewer acknowledgements per second, which means the broker sends fewer messages per second. The pressure propagates backward on its own.</p>

<p>One behavior worth knowing: since v0.44.0 the client serializes QoS 1 and 2 <code class="language-plaintext highlighter-rouge">OnMessageReceived</code> handlers in <a href="https://github.com/hivemq/hivemq-mqtt-client-dotnet/releases/tag/v0.44.0">FIFO order</a>, so readings reach your model one at a time, in the order they arrived. For a model that processes sequentially, that ordering is exactly what you want.</p>

<h2 id="route-different-sensors-to-different-handlers">Route different sensors to different handlers</h2>

<p>A real device rarely publishes one kind of reading. When temperature and vibration need different preprocessing or different models, attach a handler per subscription instead of branching on the topic inside one big callback:</p>

<div class="language-c# highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kt">var</span> <span class="n">subscribeOptions</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">SubscribeOptionsBuilder</span><span class="p">()</span>
    <span class="p">.</span><span class="nf">WithSubscription</span><span class="p">(</span><span class="s">"sensors/+/temperature"</span><span class="p">,</span> <span class="n">QualityOfService</span><span class="p">.</span><span class="n">AtLeastOnceDelivery</span><span class="p">,</span>
        <span class="n">messageReceivedHandler</span><span class="p">:</span> <span class="n">OnTemperature</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">WithSubscription</span><span class="p">(</span><span class="s">"sensors/+/vibration"</span><span class="p">,</span> <span class="n">QualityOfService</span><span class="p">.</span><span class="n">AtLeastOnceDelivery</span><span class="p">,</span>
        <span class="n">messageReceivedHandler</span><span class="p">:</span> <span class="n">OnVibration</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">Build</span><span class="p">();</span>

<span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">SubscribeAsync</span><span class="p">(</span><span class="n">subscribeOptions</span><span class="p">).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
</code></pre></div></div>

<p>Each handler is an <code class="language-plaintext highlighter-rouge">EventHandler&lt;OnMessageReceivedEventArgs&gt;</code>, so the same manual-acknowledgement pattern applies inside each one. The <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/subscribing">wildcard</a> <code class="language-plaintext highlighter-rouge">+</code> matches any single level, so one subscription covers every device publishing that reading.</p>

<h2 id="when-you-can-afford-to-drop-qos-0-and-a-bounded-buffer">When you can afford to drop: QoS 0 and a bounded buffer</h2>

<p>Flow control only exists for QoS 1 and 2. A high-rate telemetry stream where the latest value matters more than every value is often better served by <a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901234">QoS 0</a> — at-most-once, no acknowledgements, no broker-side queue. There’s no protocol back-pressure to lean on, so bound the intake yourself and decide, explicitly, what to drop under load. A bounded channel does this cleanly:</p>

<div class="language-c# highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">using</span> <span class="nn">System.Threading.Channels</span><span class="p">;</span>

<span class="kt">var</span> <span class="n">channel</span> <span class="p">=</span> <span class="n">Channel</span><span class="p">.</span><span class="n">CreateBounded</span><span class="p">&lt;</span><span class="kt">byte</span><span class="p">[</span><span class="k">]&gt;</span><span class="p">(</span><span class="k">new</span> <span class="nf">BoundedChannelOptions</span><span class="p">(</span><span class="m">1000</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">FullMode</span> <span class="p">=</span> <span class="n">BoundedChannelFullMode</span><span class="p">.</span><span class="n">DropOldest</span><span class="p">,</span> <span class="c1">// shed the stalest reading, never block</span>
<span class="p">});</span>

<span class="n">client</span><span class="p">.</span><span class="n">OnMessageReceived</span> <span class="p">+=</span> <span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="p">=&gt;</span>
<span class="p">{</span>
    <span class="n">channel</span><span class="p">.</span><span class="n">Writer</span><span class="p">.</span><span class="nf">TryWrite</span><span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">PublishMessage</span><span class="p">.</span><span class="n">Payload</span> <span class="p">??</span> <span class="n">Array</span><span class="p">.</span><span class="n">Empty</span><span class="p">&lt;</span><span class="kt">byte</span><span class="p">&gt;());</span>
<span class="p">};</span>

<span class="c1">// A single consumer runs inference at whatever rate the model sustains.</span>
<span class="k">await</span> <span class="k">foreach</span> <span class="p">(</span><span class="kt">var</span> <span class="n">payload</span> <span class="k">in</span> <span class="n">channel</span><span class="p">.</span><span class="n">Reader</span><span class="p">.</span><span class="nf">ReadAllAsync</span><span class="p">())</span>
<span class="p">{</span>
    <span class="k">await</span> <span class="n">model</span><span class="p">.</span><span class="nf">InferAsync</span><span class="p">(</span><span class="n">SensorReading</span><span class="p">.</span><span class="nf">Decode</span><span class="p">(</span><span class="n">payload</span><span class="p">)).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<p>With <code class="language-plaintext highlighter-rouge">DropOldest</code>, a burst that outruns the model discards the oldest buffered readings rather than stalling the client or growing without bound. That is the right trade for live telemetry and the wrong trade for anything you must not lose — which is the real decision behind the <a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901234">QoS level</a> you pick. Must-process data wants QoS 1 with manual acknowledgement; lossy-but-fresh data wants QoS 0 with a bounded buffer.</p>

<h2 id="feeding-the-model">Feeding the model</h2>

<p>The client hands you <code class="language-plaintext highlighter-rouge">args.PublishMessage.Payload</code> as a <code class="language-plaintext highlighter-rouge">byte[]</code>, which is what most sensor encodings want anyway — Protobuf, CBOR, or a raw binary frame. Decode it into whatever your model expects and call your inference runtime; on .NET that is usually <a href="https://learn.microsoft.com/dotnet/machine-learning/">ML.NET</a> or the <a href="https://onnxruntime.ai/">ONNX Runtime</a>. Keep that call synchronous-per-reading in the QoS 1 path so the acknowledgement genuinely reflects that the model consumed the data. If a reading is text — JSON, say — <code class="language-plaintext highlighter-rouge">args.PublishMessage.PayloadAsString</code> saves you the decode.</p>

<h2 id="end-to-end">End to end</h2>

<p>A production edge consumer combines the pieces: a stable client ID, manual acknowledgement, a receive maximum sized to how many inferences you want in flight, and inference that gates the acknowledgement.</p>

<div class="language-c# highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">using</span> <span class="nn">HiveMQtt.Client</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">HiveMQtt.Client.Options</span><span class="p">;</span>
<span class="k">using</span> <span class="nn">HiveMQtt.MQTT5.Types</span><span class="p">;</span>

<span class="kt">var</span> <span class="n">options</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">HiveMQClientOptionsBuilder</span><span class="p">()</span>
    <span class="p">.</span><span class="nf">WithBroker</span><span class="p">(</span><span class="s">"broker.hivemq.com"</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">WithClientId</span><span class="p">(</span><span class="s">"edge-inference-01"</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">WithManualAck</span><span class="p">()</span>
    <span class="p">.</span><span class="nf">WithReceiveMaximum</span><span class="p">(</span><span class="m">8</span><span class="p">)</span>
    <span class="p">.</span><span class="nf">Build</span><span class="p">();</span>

<span class="kt">var</span> <span class="n">client</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">HiveMQClient</span><span class="p">(</span><span class="n">options</span><span class="p">);</span>

<span class="n">client</span><span class="p">.</span><span class="n">OnMessageReceived</span> <span class="p">+=</span> <span class="k">async</span> <span class="p">(</span><span class="n">sender</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="p">=&gt;</span>
<span class="p">{</span>
    <span class="k">try</span>
    <span class="p">{</span>
        <span class="kt">var</span> <span class="n">reading</span> <span class="p">=</span> <span class="n">SensorReading</span><span class="p">.</span><span class="nf">Decode</span><span class="p">(</span><span class="n">args</span><span class="p">.</span><span class="n">PublishMessage</span><span class="p">.</span><span class="n">Payload</span> <span class="p">??</span> <span class="n">Array</span><span class="p">.</span><span class="n">Empty</span><span class="p">&lt;</span><span class="kt">byte</span><span class="p">&gt;());</span>
        <span class="k">await</span> <span class="n">model</span><span class="p">.</span><span class="nf">InferAsync</span><span class="p">(</span><span class="n">reading</span><span class="p">).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
    <span class="p">}</span>
    <span class="k">finally</span>
    <span class="p">{</span>
        <span class="c1">// Acknowledge even on failure so one bad frame doesn't wedge the stream;</span>
        <span class="c1">// route the failure to your own dead-letter handling instead.</span>
        <span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">AckAsync</span><span class="p">(</span><span class="n">args</span><span class="p">).</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">ConnectAsync</span><span class="p">().</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
<span class="k">await</span> <span class="n">client</span><span class="p">.</span><span class="nf">SubscribeAsync</span><span class="p">(</span><span class="s">"sensors/+/telemetry"</span><span class="p">,</span> <span class="n">QualityOfService</span><span class="p">.</span><span class="n">AtLeastOnceDelivery</span><span class="p">)</span>
            <span class="p">.</span><span class="nf">ConfigureAwait</span><span class="p">(</span><span class="k">false</span><span class="p">);</span>
</code></pre></div></div>

<p>That consumer pulls readings only as fast as the model clears them, keeps a bounded number in flight, and never spawns unbounded work — the broker does the throttling because you told it how much you can take.</p>

<h2 id="wrapping-up">Wrapping up</h2>

<p>The trick to streaming sensor data into an edge model is to stop thinking about the transport and start thinking about the rate. Let MQTT 5 flow control and manual acknowledgement make the model’s throughput the intake rate for anything you must process, use a bounded buffer with an explicit drop policy for anything you can afford to lose, and pick the QoS level deliberately for each stream rather than defaulting it. Get that right and the same code holds up whether the model runs in microseconds or seconds.</p>

<p>If you’re wiring the HiveMQ C# client into an edge pipeline and hit a pattern this doesn’t cover, open an issue on the repo — the more real workloads we see, the better the client gets at carrying them.</p>

<h2 id="further-reading-and-implementation-resources">Further reading and implementation resources</h2>

<p><strong>The client</strong></p>

<ul>
  <li><a href="https://github.com/hivemq/hivemq-mqtt-client-dotnet">HiveMQ MQTT Client for .NET — source</a> and <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/">documentation</a></li>
  <li><a href="https://www.nuget.org/packages/HiveMQtt">Install from NuGet: HiveMQtt</a></li>
  <li><a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/subscribing">Subscribing</a> · <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/events/Examples">Events</a> · <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/how-to/manual-ack">Manual acknowledgement</a> · <a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/reference/client_options_builder">Options builder</a></li>
  <li><a href="https://hivemq.github.io/hivemq-mqtt-client-dotnet/docs/hivemqtt/how-to/message-ordering">Message ordering (FIFO QoS 1/2 handlers, v0.44.0)</a></li>
</ul>

<p><strong>The protocol</strong></p>

<ul>
  <li><a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901234">MQTT 5.0 — Quality of Service levels and protocol flows (§4.3)</a></li>
  <li><a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901251">MQTT 5.0 — Flow Control (§4.9)</a></li>
  <li><a href="https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html#_Toc3901049">MQTT 5.0 — Receive Maximum (§3.1.2.11.3)</a></li>
</ul>

<p><strong>Edge inference in .NET</strong></p>

<ul>
  <li><a href="https://learn.microsoft.com/dotnet/machine-learning/">ML.NET</a> · <a href="https://onnxruntime.ai/">ONNX Runtime</a> · <a href="https://learn.microsoft.com/dotnet/core/extensions/channels">System.Threading.Channels</a></li>
</ul>

<p><strong>A broker to test against</strong></p>

<ul>
  <li><a href="https://github.com/hivemq/hivemq-community-edition">HiveMQ Community Edition</a> — run one locally in Docker</li>
</ul>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="C#" /><category term="HiveMQ" /><summary type="html"><![CDATA[This post originally appeared on the HiveMQ blog.]]></summary></entry><entry><title type="html">OSS Password Pusher: Dropping Official MySQL/MariaDB Support &amp;amp; Future Defaults</title><link href="https://the0x00.dev/password%20pusher/OSS-Password-Pusher-Dropping-MySQL/" rel="alternate" type="text/html" title="OSS Password Pusher: Dropping Official MySQL/MariaDB Support &amp;amp; Future Defaults" /><published>2025-11-15T00:00:00+00:00</published><updated>2025-11-15T00:00:00+00:00</updated><id>https://the0x00.dev/password%20pusher/OSS-Password-Pusher-Dropping-MySQL</id><content type="html" xml:base="https://the0x00.dev/password%20pusher/OSS-Password-Pusher-Dropping-MySQL/"><![CDATA[<p>Open source Password Pusher has supported SQLite3, PostgreSQL, and MySQL databases pretty much since the project was created. For some reason, MySQL has always been the troublemaker in terms of problems and bugs, but we still did our best to happily support it throughout the years.</p>

<p>Recently, MySQL/MariaDB has caused yet <a href="https://github.com/pglombardo/PasswordPusher/issues/3774">another issue</a> that’s been blocking the v1.63.0 release. This most recent MySQL/MariaDB issue has forced us to make a change in strategy.</p>

<h2 id="current-database-support">Current Database Support</h2>

<p>Historically, Password Pusher has supported three database options:</p>
<ul>
  <li><strong>Ephemeral SQLite3</strong>: Data is lost on container restart (default for quick sharing, testing)</li>
  <li><strong>PostgreSQL</strong>: Full-featured database for production deployments</li>
  <li><strong>MySQL/MariaDB</strong>: Alternative production database option</li>
</ul>

<h2 id="why-were-dropping-mysql-support">Why We’re Dropping MySQL Support</h2>

<p>Bug <a href="https://github.com/pglombardo/PasswordPusher/issues/3774">#3774</a> has been blocking v1.63.0 for over a month. I’ve spent several days diagnosing and attempting to fix it, but MySQL continues to cause issues that slow down development and release cycles.</p>

<p>I was originally planning to drop MySQL support sometime next year, but given the time already invested in this bug and the ongoing maintenance burden, we’re making this change now in v1.63.0.</p>

<h2 id="what-this-means-for-users">What This Means for Users</h2>

<p><strong>If you’re using MySQL/MariaDB:</strong></p>
<ul>
  <li>You can stay on v1.62.x and everything will continue working</li>
  <li>From v1.63.0 forward, MySQL will most likely not work</li>
  <li>The MySQL base libraries won’t be ripped out—if you want to hack a local solution, the code is still there, but official support is being dropped</li>
</ul>

<p><strong>If you’re using PostgreSQL:</strong></p>
<ul>
  <li>No changes. PostgreSQL support continues as before.</li>
</ul>

<p><strong>If you’re using SQLite3:</strong></p>
<ul>
  <li>No changes. The SQLite3 option continues to work.</li>
</ul>

<h2 id="future-direction">Future Direction</h2>

<p>Longer term, we’ll be changing the default database to persistent SQLite3. SQLite3 has matured nicely and is now being used in many production applications. This database is embedded with the application on a mounted volume, so no separate or external database resources are needed—just the mounted volume for persistence.</p>

<p>This will allow users to run Password Pusher with a single container and a mounted volume, simplifying deployments significantly.</p>

<h2 id="summary">Summary</h2>

<ul>
  <li>MySQL/MariaDB support is being dropped in v1.63.0 going forward so we can move faster</li>
  <li>Existing MySQL installations will continue to work with v1.62.x</li>
  <li>Base MySQL/MariaDB libraries remain in v1.63.0 (for now) but there are known bugs</li>
  <li>SQLite3 will eventually become the default database, allowing single-container deployments with a mounted volume</li>
  <li>No change to PostgreSQL support</li>
</ul>

<p>Thanks all for understanding.  Over the 15 years of the project, I’ve never had to pull support for a database but at this point the problems with MySQL/MariaDB are affecting the entire community.  We have a backlog of security patches to release and it’s been blocked by the MySQL/MariaDB issues.  The change above will greatly simplify things for our limited team and ship new features faster.  Check out the new <a href="https://github.com/pglombardo/PasswordPusher/releases/tag/v1.63.0-g">Administration Center</a>!</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Password Pusher" /><summary type="html"><![CDATA[Open source Password Pusher has supported SQLite3, PostgreSQL, and MySQL databases pretty much since the project was created. For some reason, MySQL has always been the troublemaker in terms of problems and bugs, but we still did our best to happily support it throughout the years.]]></summary></entry><entry><title type="html">How to Generate a High Entropy Password in Javascript</title><link href="https://the0x00.dev/javascript/How-to-generate-a-high-entropy-password-in-Javascript/" rel="alternate" type="text/html" title="How to Generate a High Entropy Password in Javascript" /><published>2025-05-02T00:00:00+00:00</published><updated>2025-05-02T00:00:00+00:00</updated><id>https://the0x00.dev/javascript/How-to-generate-a-high-entropy-password-in-Javascript</id><content type="html" xml:base="https://the0x00.dev/javascript/How-to-generate-a-high-entropy-password-in-Javascript/"><![CDATA[<h3 id="how-to-generate-a-high-entropy-password-in-javascript">How to Generate a High Entropy Password in JavaScript</h3>

<p>Ensuring the security of our digital environments begins with the fundamentals: robust, high entropy passwords. As developers, understanding how to generate such passwords using JavaScript is crucial.</p>

<h4 id="generating-a-basic-password-in-javascript">Generating a Basic Password in JavaScript</h4>

<p>While <code class="language-plaintext highlighter-rouge">Math.random()</code> is a common tool for simple random number generation, it’s insufficient for secure password creation due to its predictability.</p>

<p><strong>Example: Basic Password Generation</strong></p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">generateBasicPassword</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">chars</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</span><span class="dl">'</span><span class="p">;</span>
  <span class="kd">let</span> <span class="nx">password</span> <span class="o">=</span> <span class="dl">''</span><span class="p">;</span>
  <span class="k">for</span> <span class="p">(</span><span class="kd">let</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">password</span> <span class="o">+=</span> <span class="nx">chars</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">floor</span><span class="p">(</span><span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">()</span> <span class="o">*</span> <span class="nx">chars</span><span class="p">.</span><span class="nx">length</span><span class="p">));</span>
  <span class="p">}</span>
  <span class="k">return</span> <span class="nx">password</span><span class="p">;</span>
<span class="p">}</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">generateBasicPassword</span><span class="p">(</span><span class="mi">12</span><span class="p">));</span> <span class="c1">// Example output: "G7e9F0xQ1ZpL"</span>
</code></pre></div></div>
<p><strong>Summary</strong>: This method is straightforward but lacks the necessary security for passwords meant to protect sensitive data.</p>

<h4 id="enhancing-randomness">Enhancing Randomness</h4>

<p>To achieve higher security, JavaScript’s <code class="language-plaintext highlighter-rouge">crypto.getRandomValues()</code> is the optimal choice, providing cryptographic strength through enhanced randomness.</p>

<p><strong>Enhanced Randomness Example</strong></p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">generateSecurePassword</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">charset</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</span><span class="dl">'</span><span class="p">;</span>
  <span class="kd">let</span> <span class="nx">password</span> <span class="o">=</span> <span class="dl">''</span><span class="p">;</span>
  <span class="kd">const</span> <span class="nx">array</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Uint32Array</span><span class="p">(</span><span class="nx">length</span><span class="p">);</span>
  <span class="nb">window</span><span class="p">.</span><span class="nx">crypto</span><span class="p">.</span><span class="nx">getRandomValues</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>
  <span class="k">for</span> <span class="p">(</span><span class="kd">let</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">password</span> <span class="o">+=</span> <span class="nx">charset</span><span class="p">[</span><span class="nx">array</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">%</span> <span class="nx">charset</span><span class="p">.</span><span class="nx">length</span><span class="p">];</span>
  <span class="p">}</span>
  <span class="k">return</span> <span class="nx">password</span><span class="p">;</span>
<span class="p">}</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">generateSecurePassword</span><span class="p">(</span><span class="mi">12</span><span class="p">));</span> <span class="c1">// More secure output</span>
</code></pre></div></div>
<p><strong>Summary</strong>: By using a cryptographically secure pseudo-random number generator, we ensure each password is both random and strong.</p>

<h4 id="selecting-character-sets">Selecting Character Sets</h4>

<p>Incorporating diverse characters, including Unicode and Cyrillic, not only increases complexity but also enhances security.</p>

<p><strong>Character Set Expansion Example</strong></p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">generateComplexPassword</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">charset</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&amp;*()_+[]{}|;:,.&lt;&gt;?~`</span><span class="dl">'</span> <span class="o">+</span>
                  <span class="dl">'</span><span class="s1">АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя</span><span class="dl">'</span><span class="p">;</span>
  <span class="kd">let</span> <span class="nx">password</span> <span class="o">=</span> <span class="dl">''</span><span class="p">;</span>
  <span class="kd">const</span> <span class="nx">array</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Uint32Array</span><span class="p">(</span><span class="nx">length</span><span class="p">);</span>
  <span class="nb">window</span><span class="p">.</span><span class="nx">crypto</span><span class="p">.</span><span class="nx">getRandomValues</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>
  <span class="k">for</span> <span class="p">(</span><span class="kd">let</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">password</span> <span class="o">+=</span> <span class="nx">charset</span><span class="p">[</span><span class="nx">array</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">%</span> <span class="nx">charset</span><span class="p">.</span><span class="nx">length</span><span class="p">];</span>
  <span class="p">}</span>
  <span class="k">return</span> <span class="nx">password</span><span class="p">;</span>
<span class="p">}</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">generateComplexPassword</span><span class="p">(</span><span class="mi">16</span><span class="p">));</span> <span class="c1">// Example with extended charset</span>
</code></pre></div></div>
<p><strong>Summary</strong>: Using a broader character set strengthens passwords by making them resistant to more sophisticated attacks.</p>

<h4 id="estimating-entropy">Estimating Entropy</h4>

<p>Understanding entropy is essential for evaluating password strength. Entropy measures unpredictability and can be approximated as follows:</p>

<p><strong>Formula for Entropy</strong></p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Entropy (in bits) = log₂(N^K)
</code></pre></div></div>
<ul>
  <li><strong>N</strong> is the size of the character set (e.g., 26 for lowercase, 52 for upper+lower, 94 for mixed with numbers and symbols).</li>
  <li><strong>K</strong> is the length of the password.</li>
</ul>

<p><strong>Example Calculation</strong>: For a 12-character password using 94 characters:</p>

<p>Entropy ≈ log₂(94¹²) ≈ 78.8 bits (very strong)</p>

<p><strong>Summary</strong>: High entropy values indicate a strong password that can withstand brute force attacks, making this calculation an essential tool for security assessment.</p>

<h4 id="reseeding-the-random-number-generator">Reseeding the Random Number Generator</h4>

<p>For environments demanding the highest security, understanding and implementing reseeding can be essential, even if JavaScript typically handles this internally.</p>

<p><strong>Reseeding Example</strong></p>
<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">function</span> <span class="nx">reseedAndGeneratePassword</span><span class="p">(</span><span class="nx">length</span><span class="p">)</span> <span class="p">{</span>
  <span class="kd">const</span> <span class="nx">charset</span> <span class="o">=</span> <span class="dl">'</span><span class="s1">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789</span><span class="dl">'</span><span class="p">;</span>
  <span class="kd">let</span> <span class="nx">password</span> <span class="o">=</span> <span class="dl">''</span><span class="p">;</span>
  <span class="kd">const</span> <span class="nx">array</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Uint32Array</span><span class="p">(</span><span class="nx">length</span><span class="p">);</span>
  <span class="nb">window</span><span class="p">.</span><span class="nx">crypto</span><span class="p">.</span><span class="nx">getRandomValues</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>
  <span class="k">for</span> <span class="p">(</span><span class="kd">let</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">length</span><span class="p">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="nx">password</span> <span class="o">+=</span> <span class="nx">charset</span><span class="p">[</span><span class="nx">array</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">%</span> <span class="nx">charset</span><span class="p">.</span><span class="nx">length</span><span class="p">];</span>
  <span class="p">}</span>
  <span class="k">return</span> <span class="nx">password</span><span class="p">;</span>
<span class="p">}</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">reseedAndGeneratePassword</span><span class="p">(</span><span class="mi">12</span><span class="p">));</span> <span class="c1">// Example showing reseeding effect</span>
</code></pre></div></div>
<p><strong>Summary</strong>: Reseeding ensures that even with multiple password generations, each remains unique and secure.</p>

<h4 id="conclusion">Conclusion</h4>

<p>As developers, mastering these techniques for generating high entropy passwords is not just beneficial—it’s essential. Utilizing JavaScript’s advanced features, understanding the calculation of entropy, and applying a wide range of character sets ensure that our passwords remain robust against threats, safeguarding our applications and users’ data.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Javascript" /><summary type="html"><![CDATA[How to Generate a High Entropy Password in JavaScript]]></summary></entry><entry><title type="html">How to Scramble a String in Ruby</title><link href="https://the0x00.dev/ruby/How-to-scramble-a-string-in-Ruby/" rel="alternate" type="text/html" title="How to Scramble a String in Ruby" /><published>2025-05-02T00:00:00+00:00</published><updated>2025-05-02T00:00:00+00:00</updated><id>https://the0x00.dev/ruby/How-to-scramble-a-string-in-Ruby</id><content type="html" xml:base="https://the0x00.dev/ruby/How-to-scramble-a-string-in-Ruby/"><![CDATA[<p>To randomly scramble a string in Ruby, you can use the <code class="language-plaintext highlighter-rouge">chars</code> method to split the string into an array of characters, the <code class="language-plaintext highlighter-rouge">shuffle</code> method to randomly shuffle the array, and the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the array back into a string.</p>

<p>Here’s an example of how you can randomly scramble a string in Ruby:</p>

<ol>
  <li>
    <p>First, you use the <code class="language-plaintext highlighter-rouge">chars</code> method to split the string into an array of characters. Here’s an example:</p>

    <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">str</span> <span class="o">=</span> <span class="s2">"Hello, World!"</span>
<span class="n">chars</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">chars</span>

<span class="nb">puts</span> <span class="n">chars</span><span class="p">.</span><span class="nf">inspect</span>
<span class="c1"># Output: ["H", "e", "l", "l", "o", ",", " ", "W", "o", "r", "l", "d", "!"]</span>
</code></pre></div>    </div>

    <p>This code will split the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> into an array of characters, stored in the <code class="language-plaintext highlighter-rouge">chars</code> variable.</p>
  </li>
  <li>
    <p>Next, you use the <code class="language-plaintext highlighter-rouge">shuffle</code> method to randomly shuffle the array of characters:</p>

    <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">chars</span> <span class="o">=</span> <span class="n">chars</span><span class="p">.</span><span class="nf">shuffle</span>

<span class="nb">puts</span> <span class="n">chars</span><span class="p">.</span><span class="nf">inspect</span>
<span class="c1"># Output: ["!", "d", "l", "r", "o", "W", " ", ",", "o", "l", "e", "l", "H"]</span>
</code></pre></div>    </div>

    <p>This code will randomly shuffle the array of characters.</p>
  </li>
  <li>
    <p>After shuffling the array of characters, you use the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the array back into a string:</p>

    <div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">scrambled</span> <span class="o">=</span> <span class="n">chars</span><span class="p">.</span><span class="nf">join</span>

<span class="nb">puts</span> <span class="n">scrambled</span>
<span class="c1"># Output: ",llderolW!oH "</span>
</code></pre></div>    </div>

    <p>This code will concatenate the array of characters back into a string and store it in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>
  </li>
</ol>

<p>Here’s the complete example of how you can randomly scramble a string in Ruby:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">str</span> <span class="o">=</span> <span class="s2">"Hello, World!"</span>
<span class="n">chars</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">chars</span><span class="p">.</span><span class="nf">shuffle</span>
<span class="n">scrambled</span> <span class="o">=</span> <span class="n">chars</span><span class="p">.</span><span class="nf">join</span>
<span class="nb">puts</span> <span class="n">scrambled</span> <span class="c1"># Output: "Hldr W!ool,el"</span>
</code></pre></div></div>

<p>This code will randomly scramble the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> and store the scrambled string in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>

<h2 id="but-can-you-provide-a-seed-to-the-random-number-generator">But Can You Provide a Seed to the Random Number Generator?</h2>

<p>Yes, Ruby allows you to seed the random number generator to produce consistent results. This can be particularly useful in testing or when you need reproducibility:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">srand</span> <span class="mi">1234</span> <span class="c1"># Seed the random number generator</span>
<span class="n">scrambled</span> <span class="o">=</span> <span class="n">str</span><span class="p">.</span><span class="nf">chars</span><span class="p">.</span><span class="nf">shuffle</span><span class="p">.</span><span class="nf">join</span>
<span class="nb">puts</span> <span class="n">scrambled</span> <span class="c1"># The output will be consistent with the seed</span>
</code></pre></div></div>

<p>In this example, <code class="language-plaintext highlighter-rouge">srand</code> is used to set the seed for Ruby’s random number generator. This means that each time you run the code with the same seed, the output will be the same.</p>

<h3 id="why-use-a-seed">Why Use a Seed?</h3>

<p>Using a seed is critical when you require deterministic behavior from your random processes. By seeding your random number generator, you ensure that the same sequence of "random" numbers is generated each time, which is invaluable for debugging or when your application needs predictable outcomes.</p>

<hr />

<p>This method is not just a programming exercise but is applicable in practical scenarios like password obfuscation and ensuring the integrity of randomized algorithms. Adapt this technique for other programming languages or environments as necessary.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Ruby" /><summary type="html"><![CDATA[To randomly scramble a string in Ruby, you can use the chars method to split the string into an array of characters, the shuffle method to randomly shuffle the array, and the join method to concatenate the array back into a string.]]></summary></entry><entry><title type="html">How to NOT Get Screwed as a Software Engineer</title><link href="https://the0x00.dev/startups/How-To-NOT-Get-Screwed-As-A-Software-Engineer/" rel="alternate" type="text/html" title="How to NOT Get Screwed as a Software Engineer" /><published>2024-09-13T00:00:00+00:00</published><updated>2024-09-13T00:00:00+00:00</updated><id>https://the0x00.dev/startups/How-To-NOT-Get-Screwed-As-A-Software-Engineer</id><content type="html" xml:base="https://the0x00.dev/startups/How-To-NOT-Get-Screwed-As-A-Software-Engineer/"><![CDATA[<p>This is a great episode from the crew at YC.  It would have been nice to hear some real horror stories though but still great situational examples.  Worth the watch for sure.  Learn this stuff early on in your career.</p>

<iframe style="border-radius:12px" src="https://open.spotify.com/embed/episode/0Jx329FNjSFtIjl9ieGvgB/video?utm_source=generator" width="624" height="351" frameborder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>

<p><a href="https://open.spotify.com/episode/0Jx329FNjSFtIjl9ieGvgB?si=e18ad89c6c8244ca">This is the direct link</a> to Spotify if you prefer.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Startups" /><summary type="html"><![CDATA[This is a great episode from the crew at YC. It would have been nice to hear some real horror stories though but still great situational examples. Worth the watch for sure. Learn this stuff early on in your career.]]></summary></entry><entry><title type="html">How to Scramble a String in Python</title><link href="https://the0x00.dev/python/How-to-scramble-a-string-in-Python/" rel="alternate" type="text/html" title="How to Scramble a String in Python" /><published>2024-08-12T00:00:00+00:00</published><updated>2024-08-12T00:00:00+00:00</updated><id>https://the0x00.dev/python/How-to-scramble-a-string-in-Python</id><content type="html" xml:base="https://the0x00.dev/python/How-to-scramble-a-string-in-Python/"><![CDATA[<p>To randomly scramble a string in Python, you can use the <code class="language-plaintext highlighter-rouge">list</code> function to convert the string into a list of characters, the <code class="language-plaintext highlighter-rouge">random.shuffle</code> method to shuffle the list, and the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the list back into a string.</p>

<p>Here’s an example of how you can randomly scramble a string in Python:</p>

<ol>
  <li>
    <p>First, you convert the string into a list of characters using the <code class="language-plaintext highlighter-rouge">list</code> function. Here’s an example:</p>

    <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">random</span>

<span class="nb">str</span> <span class="o">=</span> <span class="s">"Hello, World!"</span>
<span class="n">chars</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span>

<span class="k">print</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>
<span class="c1"># Output: ['H', 'e', 'l', 'l', 'o', ',', ' ', 'W', 'o', 'r', 'l', 'd', '!']
</span></code></pre></div>    </div>

    <p>This code will convert the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> into a list of characters, stored in the <code class="language-plaintext highlighter-rouge">chars</code> variable.</p>
  </li>
  <li>
    <p>Next, you use the <code class="language-plaintext highlighter-rouge">random.shuffle</code> method to shuffle the list of characters:</p>

    <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">random</span><span class="p">.</span><span class="n">shuffle</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>

<span class="k">print</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>
<span class="c1"># Output: ['!', 'l', 'l', 'o', 'W', 'r', 'd', ' ', 'H', ',', 'o', 'e', 'l']
</span></code></pre></div>    </div>

    <p>This code will randomly shuffle the list of characters.</p>
  </li>
  <li>
    <p>After shuffling the list of characters, you use the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the list back into a string:</p>

    <div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">scrambled</span> <span class="o">=</span> <span class="s">''</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>

<span class="k">print</span><span class="p">(</span><span class="n">scrambled</span><span class="p">)</span>
<span class="c1"># Output: "!lloWrd Hol,e"
</span></code></pre></div>    </div>

    <p>This code will concatenate the list of characters back into a string and store it in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>
  </li>
</ol>

<p>Here’s the complete example of how you can randomly scramble a string in Python:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">random</span>

<span class="nb">str</span> <span class="o">=</span> <span class="s">"Hello, World!"</span>
<span class="n">chars</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">str</span><span class="p">)</span>
<span class="n">random</span><span class="p">.</span><span class="n">shuffle</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>
<span class="n">scrambled</span> <span class="o">=</span> <span class="s">''</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">chars</span><span class="p">)</span>
<span class="k">print</span><span class="p">(</span><span class="n">scrambled</span><span class="p">)</span>  <span class="c1"># Output: "!lloWrd Hol,e"
</span></code></pre></div></div>

<p>This code will randomly scramble the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> and store the scrambled string in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>

<h2 id="but-can-you-provide-a-seed-to-the-random-number-generator">But Can You Provide a Seed to the Random Number Generator?</h2>

<p>Yes, Python’s <code class="language-plaintext highlighter-rouge">random</code> module allows you to seed the random number generator to produce consistent results. This is particularly useful in testing or when you need reproducibility:</p>

<div class="language-python highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kn">import</span> <span class="nn">random</span>

<span class="n">random</span><span class="p">.</span><span class="n">seed</span><span class="p">(</span><span class="mi">1234</span><span class="p">)</span>  <span class="c1"># Seed the random number generator
</span><span class="n">scrambled</span> <span class="o">=</span> <span class="s">''</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">random</span><span class="p">.</span><span class="n">sample</span><span class="p">(</span><span class="nb">str</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="nb">str</span><span class="p">)))</span>
<span class="k">print</span><span class="p">(</span><span class="n">scrambled</span><span class="p">)</span>  <span class="c1"># The output will be consistent with the seed
</span></code></pre></div></div>

<p>In this example, <code class="language-plaintext highlighter-rouge">random.seed</code> is used to set the seed for Python’s random number generator. This ensures that each time you run the code with the same seed, the output will be the same.</p>

<h3 id="why-use-a-seed">Why Use a Seed?</h3>

<p>Using a seed is crucial when you require deterministic behavior from your random processes. By seeding your random number generator, you ensure that the same sequence of "random" numbers is generated each time, which is invaluable for debugging or when your application needs predictable outcomes.</p>

<hr />

<p>This process is not just an excellent programming exercise but also has practical applications in scenarios like password obfuscation and securing randomized algorithms. Customize this technique for other languages or environments as needed.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Python" /><summary type="html"><![CDATA[To randomly scramble a string in Python, you can use the list function to convert the string into a list of characters, the random.shuffle method to shuffle the list, and the join method to concatenate the list back into a string.]]></summary></entry><entry><title type="html">How to Scramble a String in Javascript</title><link href="https://the0x00.dev/javascript/How-to-scramble-a-string-in-Javascript/" rel="alternate" type="text/html" title="How to Scramble a String in Javascript" /><published>2024-02-28T00:00:00+00:00</published><updated>2024-02-28T00:00:00+00:00</updated><id>https://the0x00.dev/javascript/How-to-scramble-a-string-in-Javascript</id><content type="html" xml:base="https://the0x00.dev/javascript/How-to-scramble-a-string-in-Javascript/"><![CDATA[<p>To randomly scramble a string in JavaScript, you can use the <code class="language-plaintext highlighter-rouge">split</code> method to split the string into an array of characters, the <code class="language-plaintext highlighter-rouge">sort</code> method to randomly shuffle the array, and the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the array back into a string.</p>

<p>Here’s an example of how you can randomly scramble a string in JavaScript:</p>

<ol>
  <li>First, you can use the <code class="language-plaintext highlighter-rouge">split</code> method to split the string into an array of characters. The <code class="language-plaintext highlighter-rouge">split</code> method takes a delimiter as an argument, and it will split the string at each occurrence of the delimiter. Here’s an example of how you can use the <code class="language-plaintext highlighter-rouge">split</code> method to split a string into an array of characters:</li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">str</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello, World!</span><span class="dl">"</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">chars</span> <span class="o">=</span> <span class="nx">str</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="dl">""</span><span class="p">);</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">chars</span><span class="p">);</span>
<span class="c1">// Output: ["H", "e", "l", "l", "o", ",", " ", "W", "o", "r", "l", "d", "!"]</span>
</code></pre></div></div>

<p>This code will split the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> into an array of characters, and will store the array in the <code class="language-plaintext highlighter-rouge">chars</code> variable.</p>

<ol>
  <li>Next, you can use the <code class="language-plaintext highlighter-rouge">sort</code> method to randomly shuffle the array of characters. The <code class="language-plaintext highlighter-rouge">sort</code> method takes a comparison function as an argument, and it will sort the array using the comparison function. Here’s an example of how you can use the <code class="language-plaintext highlighter-rouge">sort</code> method to randomly shuffle an array of characters:</li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nx">chars</span><span class="p">.</span><span class="nx">sort</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">());</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">chars</span><span class="p">);</span>
<span class="c1">// Output: ["!", "!", " ", "d", "l", "l", "o", "r", " ", "W", "H"]</span>
</code></pre></div></div>

<p>This code will randomly shuffle the array of characters using the <code class="language-plaintext highlighter-rouge">sort</code> method and a comparison function that returns a random value between 0 and 1.</p>

<ol>
  <li>After you have randomly shuffled the array of characters, you can use the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate the array back into a string. The <code class="language-plaintext highlighter-rouge">join</code> method takes a delimiter as an argument, and it will join the elements of the array using the delimiter. Here’s an example of how you can use the <code class="language-plaintext highlighter-rouge">join</code> method to concatenate an array of characters back into a string:</li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">scrambled</span> <span class="o">=</span> <span class="nx">chars</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">""</span><span class="p">);</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">scrambled</span><span class="p">);</span>
<span class="c1">// Output: "!dll o!r W H"</span>
</code></pre></div></div>

<p>This code will concatenate the array of characters back into a string using the <code class="language-plaintext highlighter-rouge">join</code> method, and will store the scrambled string in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>

<p>Here’s the complete example of how you can randomly scramble a string in JavaScript:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">str</span> <span class="o">=</span> <span class="dl">"</span><span class="s2">Hello, World!</span><span class="dl">"</span><span class="p">;</span>
<span class="kd">const</span> <span class="nx">chars</span> <span class="o">=</span> <span class="nx">str</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="dl">""</span><span class="p">);</span>
<span class="nx">chars</span><span class="p">.</span><span class="nx">sort</span><span class="p">(()</span> <span class="o">=&gt;</span> <span class="mf">0.5</span> <span class="o">-</span> <span class="nb">Math</span><span class="p">.</span><span class="nx">random</span><span class="p">());</span>
<span class="kd">const</span> <span class="nx">scrambled</span> <span class="o">=</span> <span class="nx">chars</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="dl">""</span><span class="p">);</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">scrambled</span><span class="p">);</span> <span class="c1">// Output: "!dll o!r W H"</span>
</code></pre></div></div>

<p>This code will randomly scramble the string <code class="language-plaintext highlighter-rouge">"Hello, World!"</code> and will store the scrambled string in the <code class="language-plaintext highlighter-rouge">scrambled</code> variable.</p>

<p>Note: The <code class="language-plaintext highlighter-rouge">split</code> and <code class="language-plaintext highlighter-rouge">join</code> methods are part of the <code class="language-plaintext highlighter-rouge">String.prototype</code>, and they are available in JavaScript. The <code class="language-plaintext highlighter-rouge">sort</code> method is part of the <code class="language-plaintext highlighter-rouge">Array.prototype</code>, and it is available in JavaScript arrays. If you are using a different programming language or a different environment, you may need to use a different method to split a string into an array of characters, to randomly shuffle an array, or to concatenate an array back into a string.</p>

<p>Also, if you are using a different programming language or a different environment, you may need to use a different method to randomly shuffle an array. For example, in some programming languages, such as Python or Ruby, you can use the <code class="language-plaintext highlighter-rouge">random.shuffle</code> method to randomly shuffle an array. In other programming languages, such as Java or C++, you may need to use a different method to randomly shuffle an array.</p>

<p>Additionally, if you are using a different programming language or a different environment, you may need to use a different method to generate a random value between 0 and 1. For example, in some programming languages, such as Python or Ruby, you can use the <code class="language-plaintext highlighter-rouge">random.random</code> method to generate a random float between 0 and 1. In other programming languages, such as Java or C++, you may need to use a different method to generate a random float between 0 and 1.</p>

<h2 id="but-can-you-provide-a-seed-to-the-random-number-generator">But can you provide a seed to the random number generator?</h2>

<p>In JavaScript, you can use the <code class="language-plaintext highlighter-rouge">Math.random</code> function to generate a random number between 0 (inclusive) and 1 (exclusive). However, the <code class="language-plaintext highlighter-rouge">Math.random</code> function does not provide a seed for the random number generator.</p>

<p>If you need to generate a sequence of random numbers with a specific seed, you can use the <code class="language-plaintext highlighter-rouge">crypto</code> library, which is available in most modern web browsers. The <code class="language-plaintext highlighter-rouge">crypto</code> library provides a <code class="language-plaintext highlighter-rouge">getRandomValues</code> method, which generates a sequence of random values based on a seed.</p>

<p>Here’s an example of how you can use the <code class="language-plaintext highlighter-rouge">crypto</code> library to generate a sequence of random numbers with a specific seed in JavaScript:</p>

<ol>
  <li>First, you can use the <code class="language-plaintext highlighter-rouge">crypto.getRandomValues</code> method to generate a sequence of random values. The <code class="language-plaintext highlighter-rouge">crypto.getRandomValues</code> method takes an array as an argument, and it will fill the array with random values. Here’s an example of how you can use the <code class="language-plaintext highlighter-rouge">crypto.getRandomValues</code> method to generate a sequence of random values:</li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">array</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Uint32Array</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span>
<span class="nx">crypto</span><span class="p">.</span><span class="nx">getRandomValues</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>
<span class="c1">// Output: [1234567890, 123456789, 12345678, 1234567, 123456, 12345, 1234, 123, 12, 1]</span>
</code></pre></div></div>

<p>This code will generate a sequence of 10 random values using the <code class="language-plaintext highlighter-rouge">crypto.getRandomValues</code> method, and will store the sequence in the <code class="language-plaintext highlighter-rouge">array</code> variable.</p>

<ol>
  <li>After you have generated a sequence of random values, you can use the values as you need. For example, you can use the values to generate a sequence of random numbers between 0 and 1. Here’s an example of how you can use the values to generate a sequence of random numbers between 0 and 1:</li>
</ol>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">randoms</span> <span class="o">=</span> <span class="nx">array</span><span class="p">.</span><span class="nx">map</span><span class="p">(</span><span class="nx">value</span> <span class="o">=&gt;</span> <span class="nx">value</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">32</span><span class="p">));</span>

<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">randoms</span><span class="p">);</span>
<span class="c1">// Output: [0.3141592653589793, 0.314159265358979, 0.3141592653589784, 0.3141592653589785, 0.31415926535897856, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785]</span>
</code></pre></div></div>

<p>This code will generate a sequence of 10 random numbers between 0 and 1 using the <code class="language-plaintext highlighter-rouge">map</code> method and the sequence of random values.</p>

<p>Here’s the complete example of how you can generate a sequence of random numbers with a specific seed in JavaScript:</p>

<div class="language-javascript highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">const</span> <span class="nx">array</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">Uint32Array</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span>
<span class="nx">crypto</span><span class="p">.</span><span class="nx">getRandomValues</span><span class="p">(</span><span class="nx">array</span><span class="p">);</span>
<span class="kd">const</span> <span class="nx">randoms</span> <span class="o">=</span> <span class="nx">array</span><span class="p">.</span><span class="nx">map</span><span class="p">(</span><span class="nx">value</span> <span class="o">=&gt;</span> <span class="nx">value</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">&lt;&lt;</span> <span class="mi">32</span><span class="p">));</span>
<span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">randoms</span><span class="p">);</span> <span class="c1">// Output: [0.3141592653589793, 0.314159265358979, 0.3141592653589784, 0.3141592653589785, 0.31415926535897856, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785, 0.3141592653589785]</span>
</code></pre></div></div>

<p>This code will generate a sequence of 10 random numbers between 0 and 1 using the <code class="language-plaintext highlighter-rouge">crypto</code> library and the <code class="language-plaintext highlighter-rouge">crypto.getRandomValues</code> method.</p>

<p>Note: The <code class="language-plaintext highlighter-rouge">crypto</code> library is available in most modern web browsers, but it may not be available in all environments or in all web browsers. If you are using a different programming language or a different environment, you may need to use a different method to generate a sequence of random numbers with a specific seed.</p>

<p>Also, if you are using a different programming language or a different environment, you may need to use a different method to generate a sequence of random numbers with a specific seed. For example, in some programming languages, such as Python or Ruby, you can use the <code class="language-plaintext highlighter-rouge">random.seed</code> method to set the seed for the random number generator. In other programming languages, such as Java or C++, you may need to use a different method to set the seed for the random number generator.</p>

<p>This has been a useful exercise in generated content.  I’ve used this while improving the password generator in Password Pusher and is a good reference.</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Javascript" /><summary type="html"><![CDATA[To randomly scramble a string in JavaScript, you can use the split method to split the string into an array of characters, the sort method to randomly shuffle the array, and the join method to concatenate the array back into a string.]]></summary></entry><entry><title type="html">Password Pusher: 185,000 Monthly Active Users</title><link href="https://the0x00.dev/password%20pusher/Password-Pusher-Hits-185K-MAU/" rel="alternate" type="text/html" title="Password Pusher: 185,000 Monthly Active Users" /><published>2024-02-23T00:00:00+00:00</published><updated>2024-02-23T00:00:00+00:00</updated><id>https://the0x00.dev/password%20pusher/Password-Pusher-Hits-185K-MAU</id><content type="html" xml:base="https://the0x00.dev/password%20pusher/Password-Pusher-Hits-185K-MAU/"><![CDATA[<p>Slow and steady <a href="https://pwpush.com">pwpush.com</a> usage has been organically growing since 2011 with no advertisements and no corporate backing.  Just myself and a great community of intelligent security minded people.</p>

<p><img src="/assets/images/posts/2024/pwpush-jan-2024-185k.png" alt="" /></p>

<p>That community has been a big help in supporting the project, contributing ideas, fixes and community help.</p>

<p>With that feedback and inspiration I’ve added logins, file uploads, passphrase lockdowns, audit logs and more.  See some of the feature screenshots in <a href="https://twitter.com/pwpush/status/1492083610261901312">this X thread</a>.</p>

<p>Now to hit 185,000 users in January 2024 is just crazy.</p>

<p>And to top it off, that doesn’t include the uncounted number of JSON API users and hundreds(?) of self-hosted instances out in the wild and in private intranets.</p>

<p>Here are two Google Analytics screenshots to illustrate:</p>

<h3 id="2011---2023-end-of-ga3-before-ga4-transition">2011 - 2023 (end of GA3 before GA4 Transition)</h3>

<p><img src="/assets/images/posts/2024/pwpush-ga-2011-2023.png" alt="" /></p>

<h3 id="january-2024">January 2024</h3>

<p><img src="/assets/images/posts/2024/pwpush-jan-2024-185k.png" alt="" /></p>

<h3 id="some-other-stats">Some Other Stats</h3>

<p>In that time since 2011, we now are up to 2,173 commits, 1500 pull requests and 1600 Github stars in the <a href="https://github.com/pglombardo/PasswordPusher">Github Repository</a>.</p>

<p><a href="https://hub.docker.com/u/pglombardo">The Docker containers</a> have over 50 million downloads.</p>

<h3 id="feedback">Feedback</h3>

<p>And to top it all off, I’m humbled to receive messages and feedback like this more than a few times a year (which I really appreciate):</p>

<h4 id="a-recent-dm">A recent DM</h4>

<p><img src="/assets/images/posts/2024/pwpush-2024-feedback.png" alt="" /></p>

<h4 id="a-reddit-thread">A Reddit thread</h4>

<p><img src="/assets/images/posts/2024/pwpush-reddit--thread-2024.png" alt="" /></p>

<p>So a big thanks to the community - it’s the community support, feedback and ideas which makes building this project fun.</p>

<p>Now go and star the <a href="https://github.com/pglombardo/PasswordPusher">Github repository</a> and post about Password Pusher on social media.  :-)</p>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Password Pusher" /><summary type="html"><![CDATA[Slow and steady pwpush.com usage has been organically growing since 2011 with no advertisements and no corporate backing. Just myself and a great community of intelligent security minded people.]]></summary></entry><entry><title type="html">Advice: Don’t Buy the WLKata Mirobot Robotic Arm</title><link href="https://the0x00.dev/robotics/Dont-Buy-The-WLKata-Mirobot/" rel="alternate" type="text/html" title="Advice: Don’t Buy the WLKata Mirobot Robotic Arm" /><published>2023-06-08T00:00:00+00:00</published><updated>2023-06-08T00:00:00+00:00</updated><id>https://the0x00.dev/robotics/Dont-Buy-The-WLKata-Mirobot</id><content type="html" xml:base="https://the0x00.dev/robotics/Dont-Buy-The-WLKata-Mirobot/"><![CDATA[<p>An impressive piece of hardware and design but unfortunately the decisions and actions that this Chinese company has taken makes this product unusable for anything beyond a display piece for the shelf.</p>

<p><img src="/assets/images/posts/2021/wlkata-mirobot.jpeg" alt="" /></p>

<p>For the current price tag of ~€1700 and the headaches it will bring, it’s far from worth it.</p>

<p>Instead of making this a post an endless list of complaints about WLKata, I’ll just list the major points to be aware of and resources that you can research further for yourself.  I hope to save at least some people from the guaranteed headaches that will come when you discover when getting into the details of the product.</p>

<h1 id="the-problems-with-wlkata-and-the-mirobot">The Problems with WLKata and the Mirobot</h1>

<p>The crux of the problem is not the robotic arm itself, but instead the WLKata product decisions and how the company has treated it’s community of users.</p>

<p>These are the points that you should be aware of before buying a Mirobot.</p>

<h2 id="once-open-now-closed-firmware">Once Open, Now Closed Firmware</h2>

<p>Here is a FAQ from the original Kickstater project:</p>

<p><img src="/assets/images/posts/2023/kickstarter-wlkata-firmware.png" alt="" /></p>

<p>In the Kickstarter project, the company promised to make their firmware opensource and it was for a short while but that is no longer the case.</p>

<p>The firmware is currently closed source and you have only an API and a glimmer of hope that it will work (it often doesn’t).</p>

<p>This absolutely kills community development when trying to develop software, tools and libraries for the arm.  Developers are left with an API that works sometimes with no recourse in working around problems in the firmware.</p>

<h2 id="valuable-community-forum-taken-offline-without-explanation">Valuable Community Forum Taken Offline without Explanation</h2>

<p>The WLKata <a href="https://www.facebook.com/wlkatarobotics/posts/669632290511594/">official discussion forum</a> (previously hosted at <code class="language-plaintext highlighter-rouge">http://discuz.wlkata.com/</code>) has been shut down and is no longer responsive.</p>

<p>This was an excellent source of information.  It was a place for community users to share discoveries and work-arounds.</p>

<p>I suspect that the company lost patience with the forum as large amount of negative feedback was being posted when they decided to close their firmware but this this just speculation.</p>

<p>In any case, the forum went dark one day long ago without explanation and all of it’s valuable threads are gone.</p>

<h2 id="opensource-behavior">Opensource Behavior</h2>

<p>The company allegedly forked the community created Python library for the Mirobot, bundled it in their product without contributing back or mentioning the source as required by the opensource license. The <code class="language-plaintext highlighter-rouge">mirobot-py</code> author <a href="https://github.com/rirze/mirobot-py/issues/23#issuecomment-1572466514">shared his experience</a> with WLKata and the Mirobot.</p>

<h2 id="all-kickstarter-and-models-before-2021-cant-be-updated">All Kickstarter and Models before 2021 Can’t Be Updated</h2>

<p>This is a screenshot from the <a href="https://document.wlkata.com/?doc=/wlkata-mirobot-user-manual-platinum/32-appendix-ii-mirobot-firmware-update-tutorial/">WLKata product documentation</a> as of June 2023:</p>

<p><img src="/assets/images/posts/2023/wlkata-firmware-notice.png" alt="" /></p>

<p>All models before January 1, 2021 are no longer supported and cannot be updated.</p>

<p>This includes everyone who supported the project in Kickstarter and everyone who paid the full post Kickstarter price tag (€2500).</p>

<p>What’s worse is that this is completely unnecessary.  If the hardware and firmware were opensource, the community could work out the upgrade path for these older models quickly.</p>

<h2 id="mac-support-dropped-for-their-gui-development-environment">Mac Support Dropped for their GUI Development Environment</h2>

<p>Mac/OSX support for WLKata studio has been dropped.  This is their GUI based development environment for the arm.  Windows and Ubuntu are still supported</p>

<h1 id="the-solution-that-wont-happen">The Solution (That Won’t Happen)</h1>

<p>Despite all of the negative points above, WLKata could fix this immediately by:</p>

<ul>
  <li>Completely opensourcing their hardware &amp; specifications</li>
  <li>Opensourcing their firmware in it’s entirety</li>
  <li>Start working with the community instead of against it</li>
  <li>Enabling the community to serve itself instead of having WLKata as a unresponsive software bug chokepoint</li>
</ul>

<p>If they were to do this, they would attract a much larger (and happier) community and in turn sell far more hardware.</p>

<p>But in my experience this won’t happen.  This would take a fundamental philosophy change in the company.  I’ve never seen this happen ever in a company.  In the corporate world, past performance does indicate future performance.  How they’ve acted in the past is unfortunately most likely how they will continue to operate.</p>

<h1 id="summary">Summary</h1>

<p>There is more to be aware of but these are the major points and are all deal breakers in my opinion.</p>

<p>Robotics is hard enough on it’s own without having to deal with closed source proprietary bugs and largely unsupported products that you have no recourse for.</p>

<p>I hope someone finds this post useful and helps you to make a better informed purchase decision.</p>

<p>If the Robotics community wants to accelerate it’s productivity and innovations, we need opensource hardware, firmware and companies that understand this.</p>

<p>If you have any experience with the WLKata Robotic arm and would like to share, please comment <a href="https://github.com/rirze/mirobot-py/issues/23">in this Github issue in the mirobot-py Python Library</a>.</p>

<p>If you would like to make an addition or modification to this article, <a href="https://github.com/pglombardo/pglombardo.github.io/issues/new">create an issue here</a>.</p>

<h1 id="links--resources">Links &amp; Resources</h1>

<ul>
  <li><a href="https://www.wlkata.com">WLKata Company Website</a></li>
  <li><a href="https://www.facebook.com/wlkatarobotics/">Facebook Page</a></li>
  <li><a href="https://www.kickstarter.com/projects/mirobot/mirobot-6-axis-mini-industrial-robot-arm/comments">Kickstarter Comment Forum</a></li>
  <li><a href="https://www.reddit.com/r/mirobot/">Mirobot on Reddit</a></li>
  <li><a href="https://github.com/rirze/mirobot-py">mirobot-py Python Library</a></li>
</ul>]]></content><author><name>Peter Giacomo Lombardo</name></author><category term="Robotics" /><summary type="html"><![CDATA[An impressive piece of hardware and design but unfortunately the decisions and actions that this Chinese company has taken makes this product unusable for anything beyond a display piece for the shelf.]]></summary></entry></feed>