<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.5">Jekyll</generator><link href="https://garykrause.dev/feed.xml" rel="self" type="application/atom+xml" /><link href="https://garykrause.dev/" rel="alternate" type="text/html" /><updated>2024-05-21T10:22:26+00:00</updated><id>https://garykrause.dev/feed.xml</id><title type="html">Gary in Binary</title><subtitle>A personal blog website with random musings.</subtitle><entry><title type="html">Paying For Electricity In Sats</title><link href="https://garykrause.dev/2023/01/09/Paying-For-Electricity-In-Sats.html" rel="alternate" type="text/html" title="Paying For Electricity In Sats" /><published>2023-01-09T00:00:00+00:00</published><updated>2023-01-09T00:00:00+00:00</updated><id>https://garykrause.dev/2023/01/09/Paying-For-Electricity-In-Sats</id><content type="html" xml:base="https://garykrause.dev/2023/01/09/Paying-For-Electricity-In-Sats.html"><![CDATA[<h2 id="what-happens-when-you-can-pay-for-electricity-in-sats">What happens when you can pay for electricity in sats?</h2>

<p>For what it’s worth, I neither run a bitcoin mining company nor an electric company nor an exchange, but let’s do some thinking.</p>

<p>How does new bitcoin enter the market? Mining. So I would assume that miners have purchase agreements with OTC desk and/or exchanges. This in-flow sets the fiat price.</p>

<p>Why would a miner sell bitcoin? To cover operational expenses aka OPEX. The most prevelant and obvious being electricity costs. I’m sure there are many other reasons but let’s assume electricity is the primary OPEX line item for a miner and the miner otherwise wants to hodl forever.</p>

<p>What happens when they can pay for electricity in sats? One of their fiat denominated line items becomes a sat denominated line item. The flow of bitcoin is now into power generator hands. (BTW, <a href="https://www.synota.io">Synota</a> is doing this)</p>

<p>Do power generators exchange these for fiat? Maybe. If a mining company makes up a large percentage of that generators revenue, then it’s likely that they will convert to fiat to cover their own fiat denominated OPEX line items.</p>

<p>But what if the miners are a small percentage of revenue? What if the power generator is orange pilled and they make enough fiat from other customers to cover expenses and can hodl their sats?</p>

<p>Now the flow of bitcoin into the market for sale has decreased. If demand remains constant or goes up and supply goes down…🤔</p>

<p>I’m sure the actual impact will vary but it’s an interesting thought nonetheless.</p>

<p>What did I miss? Hit me up on Twitter (link in the top right).</p>]]></content><author><name></name></author><summary type="html"><![CDATA[What happens when you can pay for electricity in sats?]]></summary></entry><entry><title type="html">Rust Option Vs Result</title><link href="https://garykrause.dev/2022/12/23/Rust-Option-vs-Result.html" rel="alternate" type="text/html" title="Rust Option Vs Result" /><published>2022-12-23T00:00:00+00:00</published><updated>2022-12-23T00:00:00+00:00</updated><id>https://garykrause.dev/2022/12/23/Rust-Option-vs-Result</id><content type="html" xml:base="https://garykrause.dev/2022/12/23/Rust-Option-vs-Result.html"><![CDATA[<p>From the <a href="https://doc.rust-lang.org/std/result/index.html">Result module docs</a>.</p>

<blockquote>
  <p>Functions return Result whenever errors are expected and recoverable. In the std crate, Result is most prominently used for I/O.</p>
</blockquote>

<p>Compared to <a href="https://doc.rust-lang.org/std/option/index.html">Option</a> (much more here but I tried ot grab the TLDR line).</p>

<blockquote>
  <p>Type ‘Option’ represents an optional value</p>
</blockquote>

<p>Coming from other languages, I akin <code class="language-plaintext highlighter-rouge">Option</code> to the <code class="language-plaintext highlighter-rouge">null</code> of Rust, but much better because Rust’s compiler “forces” you to explicitly handle a case where there is no value (<code class="language-plaintext highlighter-rouge">None</code>) AND the happy path where there is a value <code class="language-plaintext highlighter-rouge">Some(T)</code>. I put “forces” because you can easily just <code class="language-plaintext highlighter-rouge">.unwrap()</code> the <code class="language-plaintext highlighter-rouge">Option</code> and the code ‘Just Works’. This can be when you’re rapidly prototyping and don’t want to handle the <code class="language-plaintext highlighter-rouge">None</code> at the moment. Or your code has some checks where you’re certain there’s a value there (maybe you used <code class="language-plaintext highlighter-rouge">if option.is_some() {...</code> and you’re in the postive case.</p>

<p>For <code class="language-plaintext highlighter-rouge">Result</code>, I would akin returning a result to throwing an exception, except it’s the return type of a function. Again, the compiler will “force” you to handle both scenarios: <code class="language-plaintext highlighter-rouge">Ok(T)</code> and <code class="language-plaintext highlighter-rouge">Err(E)</code>. The <code class="language-plaintext highlighter-rouge">Result</code>’s module doc linked above actually has the following example, that I think is pretty neat combining the two (comments mine):</p>

<div class="language-rs highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nd">#[derive(Debug)]</span>
<span class="k">enum</span> <span class="n">Version</span> <span class="p">{</span> <span class="n">Version1</span><span class="p">,</span> <span class="n">Version2</span> <span class="p">}</span>

<span class="k">fn</span> <span class="nf">parse_version</span><span class="p">(</span><span class="n">header</span><span class="p">:</span> <span class="o">&amp;</span><span class="p">[</span><span class="nb">u8</span><span class="p">])</span> <span class="k">-&gt;</span> <span class="nb">Result</span><span class="o">&lt;</span><span class="n">Version</span><span class="p">,</span> <span class="o">&amp;</span><span class="k">'static</span> <span class="nb">str</span><span class="o">&gt;</span> <span class="p">{</span>
    <span class="k">match</span> <span class="n">header</span><span class="nf">.get</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// this match is to enumerate all arms of the scenario</span>
        <span class="nb">None</span> <span class="k">=&gt;</span> <span class="nf">Err</span><span class="p">(</span><span class="s">"invalid header length"</span><span class="p">),</span> <span class="c1">// we received a "null" so "throw" one type of error</span>
        <span class="nf">Some</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">1</span><span class="p">)</span> <span class="k">=&gt;</span> <span class="nf">Ok</span><span class="p">(</span><span class="nn">Version</span><span class="p">::</span><span class="n">Version1</span><span class="p">),</span> 
        <span class="nf">Some</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">2</span><span class="p">)</span> <span class="k">=&gt;</span> <span class="nf">Ok</span><span class="p">(</span><span class="nn">Version</span><span class="p">::</span><span class="n">Version2</span><span class="p">),</span>
        <span class="nf">Some</span><span class="p">(</span><span class="n">_</span><span class="p">)</span> <span class="k">=&gt;</span> <span class="nf">Err</span><span class="p">(</span><span class="s">"invalid version"</span><span class="p">),</span> <span class="c1">// The underscore is the default case. Here the value wasn't as expected, so again "throw" an error</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="k">let</span> <span class="n">version</span> <span class="o">=</span> <span class="nf">parse_version</span><span class="p">(</span><span class="o">&amp;</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">]);</span>
<span class="k">match</span> <span class="n">version</span> <span class="p">{</span> 
    <span class="nf">Ok</span><span class="p">(</span><span class="n">v</span><span class="p">)</span> <span class="k">=&gt;</span> <span class="nd">println!</span><span class="p">(</span><span class="s">"working with version: {v:?}"</span><span class="p">),</span>
    <span class="nf">Err</span><span class="p">(</span><span class="n">e</span><span class="p">)</span> <span class="k">=&gt;</span> <span class="nd">println!</span><span class="p">(</span><span class="s">"error parsing header: {e:?}"</span><span class="p">),</span>
<span class="p">}</span>
</code></pre></div></div>

<p>In the above the <code class="language-plaintext highlighter-rouge">.get()</code> method returns an <code class="language-plaintext highlighter-rouge">Option</code> which we then pattern match and return a <code class="language-plaintext highlighter-rouge">Result</code>. The <code class="language-plaintext highlighter-rouge">parse_version</code> method might fail so it returns a <code class="language-plaintext highlighter-rouge">Result</code>, whereas <code class="language-plaintext highlighter-rouge">.get(0)</code> might be called on an empty array or have an invalid value returned.</p>

<p>(thnx to <a href="https://twitter.com/cryptoquick/">Hunter Beast</a> for some pondering on this last paragraph)</p>

<blockquote>
  <p>In short, Result is a representation of fallibility, whether something can fail, and Option is a representation of nullibility, whether something can be null. A Result is for when you call a method and if it fails, Result::Error is returned, and Result::Ok is for when it succeeds. Option is for when you know a value might not be present, and to handle that in a similar way, except this time, using Option::Some and Option::None.</p>
</blockquote>

<p>Hope this is as clear as mud.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[From the Result module docs.]]></summary></entry><entry><title type="html">Ftx Killed Bitcoin</title><link href="https://garykrause.dev/2022/11/23/FTX-Killed-Bitcoin.html" rel="alternate" type="text/html" title="Ftx Killed Bitcoin" /><published>2022-11-23T00:00:00+00:00</published><updated>2022-11-23T00:00:00+00:00</updated><id>https://garykrause.dev/2022/11/23/FTX-Killed-Bitcoin</id><content type="html" xml:base="https://garykrause.dev/2022/11/23/FTX-Killed-Bitcoin.html"><![CDATA[<p><strong>DISCLAIMER: THE AUTHOR OF THIS ARTICLE IS A TOXIC BITCOIN MAXIMALIST, IF YOU DO NOT LIKE THAT, I SUGGEST YOU READ <a href="https://dergigi.com/2022/11/19/dear-crypto-fiat-bros/">THIS ARTICLE</a> INSTEAD.</strong></p>

<hr />

<p>Recently, FTX, the world’s (formerly) third-largest crypto exchange, declared bankruptcy. I won’t be recounting the entirety of the events that unfolded (since they’re way too complicated), but I will link to some resources (<a href="https://twitter.com/mrjasonchoi/status/1592502785873825794?s=20&amp;t=uBuLE2X2ZQb5ZpMLqK3rcg">here</a> and <a href="https://threadreaderapp.com/thread/1592502785873825794.html">here</a>) that do for the reader’s convenience as I summarize the events.</p>

<p>The story seemingly started a while back, but the trigger for the fallout could be attributed to <a href="https://twitter.com/cz_binance/status/1589283421704290306?s=20&amp;t=OufDRTjzi2A4_LH3WkdQsQ">one Tweet from CZ of Binance saying Binance</a> would be liquidating all of their held FTT token (FTT is FTX’s exchange token). This triggered a bank run on FTX and caused massive losses for them. This resulted in a cascade of contagion as other lenders and holders of FTT bags were taking losses and being margin called on leverage (this happens when the collateral you put up for a loan devalues below the value of the loan). In the ensuing fallout, several other exchanges and crypto institutes paused transactions and withdrawals as the mess unfolded; some <a href="https://www.wsj.com/articles/blockfi-prepares-for-potential-bankruptcy-as-crypto-contagion-spreads-11668534824">indicated preparations for bankruptcy</a>. As the world watched crypto contagion unfold again this year (the Luna/Terra collapse was the previous event), other strange things began occurring at FTX: funds started leaving FTX and were being mixed and sent elsewhere. While this summary barely scratches the surface of the whole story involving FTX, <a href="https://unusualwhales.com/news/ukraine-government-partnered-with-ftx-for-crypto-to-fiat-donations">Ukraine</a>, <a href="https://www.opensecrets.org/elections-overview/biggest-donors">the Democratic Party</a>, and <a href="https://www.reuters.com/legal/ftx-founder-bankman-fried-sued-us-court-over-yield-bearing-crypto-accounts-2022-11-16/">Tom Brady</a>, the author believes that the second and third-order effects are still being played out. One of these effects is the death of Bitcoin.</p>

<hr />

<p><img src="/images/frustratedGrimReaper.png" alt="frustrated grim reaper because bitcoin won't die" /></p>

<hr />

<p>Just kidding. Bitcoin didn’t die, again.</p>

<p>Bitcoin has been <a href="https://99bitcoins.com/bitcoin-obituaries/">pronounced dead over 400 times</a> but still holds the highest market cap of any digital crypto asset with the widest adoption and usage. The rest of this article will begin to outline the difference between Bitcoin and crypto but is far from a complete guide.</p>

<p>To start, one of the biggest differences is the lack of central identity or control for Bitcoin. There is no Bitcoin CEO or Bitcoin marketing team. There are just thousands, maybe millions, of individuals voluntarily participating in the network. There is no one for Congress to call to a session to question about Bitcoin. There is no regulatory body that can crack down on Bitcoin. The State can only attack Bitcoin-related companies and entities, which unfortunately happens in many countries around the world. For instance, in 2021, China banned crypto and Bitcoin. This took their geographic location from being number 2 in the world for mining power to 0. China is again one of the top regions for Bitcoin mining by hash power. This censorship resistance is a feature of Bitcoin that many in the Western world have a hard time appreciating.</p>

<h2 id="the-price">The Price!</h2>
<p>The price went way down… again. Price volatility is another common complaint for Bitcoin but it’s hard to price something with an ever-moving measuring stick (aka the US dollar). With the recent FTX collapse, many impacted companies had to resort to selling assets to cover losses and fill balance sheet holes. What is one of the highest valued and most salable asset these companies were holding? Bitcoin. So as Bitcoin was being sold off to cover over-leveraged positions, the price tanked. It dropped from around the $20k range to ~$16k. Pretty big drop, but relative to what? Some of the crypto tokens caught in this FTX blow-up went to 0 or near 0. The venture capital fund Sequoia’s investment into FTX went to 0 with little recourse to recover, as <a href="https://www.visualcapitalist.com/ftx-leaked-balance-sheet-visualized/">FTX’s balance sheet was full of liabilities, but severely lacking assets</a>. Even with the drawdown in price, a Bitcoin hodler that simply bought and held sats (<a href="https://www.coindesk.com/learn/what-is-a-satoshi-understanding-the-smallest-unit-of-bitcoin/">satoshis</a>) performed better than someone gambling on FTX’s success. This is a common pattern when comparing crypto assets to Bitcoin. Self-custodial Bitcoin is an asset that isn’t anyone else’s liability and lacks counter-party risk. Third parties might influence the perceived value of self-custodial bitcoin but cannot take it from you (except for the $15 wrench attack, but humans are always the least secure part of a system).</p>

<h2 id="utility">Utility</h2>
<p>“Bitcoin doesn’t really do anything, it’s so boring and not useful.” This is true, but boring money is good money. And the one thing it set out to do is be the hardest money known to man outside the control of the State. Separation of Money and State. Bitcoin does this very well. It does not have a lot of wizbang features like many crypto tokens do, but that’s OK, it just needs to be money. Albeit, censorship-resistant, definitively scarce, engineered, permissionless, decentralized, borderless, divisible, programmable money. There are many awesome and novel use cases for crypto, as with any other new technology projects, and crypto will likely solve some challenging problems, but those problems pale in comparison to the effect of sound money on the human race. As a Libertarian, you likely already have a basic understanding of how our current monetary system is broken, as viewed through an Austrian Economics lens. Now imagine a world where the money isn’t broken. Where the incentives align with net producers and not with parasitic politicians and Deep State bureaucrats. Imagine the road to wealth just involves providing goods or services to others in a voluntary system and then saving anything in excess of your needs and wants. Imagine those savings didn’t have to be handed over to a financial professional to read the tea leaves of technical analysis charts to determine the best way for your portfolio to beat inflation and/or everyone else’s portfolio. Your savings just naturally grow in value over time without having liabilities outside your control. You work your butt off to accumulate 1% of the total Bitcoin (21 million fixed cap, guaranteed by cryptographic math) and that percentage never changes unless you will it to do so.</p>

<p><a href="https://youtu.be/hEyAAgxc9_Y?t=3301">When our whole lives are measured in money</a>, it’s hard to ignore the importance of sound money. As it stands today, the author believes Bitcoin is the soundest money humans have known. But don’t trust the author, it would be against the Bitcoin ethos.</p>

<p>Don’t trust, verify.</p>

<p>Thank you for reading.</p>

<p>For more mediocre takes on Bitcoin and other topics, feel free to follow me on Twitter <a href="https://twitter.com/garyKrause_">@garyKrause_</a>.</p>

<p>This post was originally publsihed in a newsletter from the <a href="lpnova.org">Libertarian Party of Northern Virginia</a> and can be found in it’s original (poorly spelled before Grammarly form) <a href="https://mcusercontent.com/b8a3e1fbc6c6842725c46ff44/files/75087144-2aa6-861c-d48b-14cfc165da3e/FTX_WTF_.pdf?mc_cid=ef697bb8bd">here</a>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[DISCLAIMER: THE AUTHOR OF THIS ARTICLE IS A TOXIC BITCOIN MAXIMALIST, IF YOU DO NOT LIKE THAT, I SUGGEST YOU READ THIS ARTICLE INSTEAD.]]></summary></entry><entry><title type="html">Ruleslawyer</title><link href="https://garykrause.dev/2020/07/22/RulesLawyer.html" rel="alternate" type="text/html" title="Ruleslawyer" /><published>2020-07-22T00:00:00+00:00</published><updated>2020-07-22T00:00:00+00:00</updated><id>https://garykrause.dev/2020/07/22/RulesLawyer</id><content type="html" xml:base="https://garykrause.dev/2020/07/22/RulesLawyer.html"><![CDATA[<p>What a journey! My 30th birthday has come and went and I don’t have an app in the iOS App Store. Starting out I was very optimistic and began with Xamarin given my C# learnings and background. That went well enough until I came to the UI. I couldn’t quick grasp how to componentize the UI so I could reuse bits and pieces and not just have a massive XML file that was my UI code. So I started poking around at other cross platform frameworks to use and came across React Native. Spending some time on PluralSight, I found the React concepts to be easy to digest and the best part was… TypeScript support! I could keep my strongly typed habits while using a flexible framework and language.</p>

<p>Rules Lawyer itself will be an app that allows players of the Pathfinder Roleplaying game to track their character sheets from a mobile device. I am firstly targeting the iOS platform because at the time of this writing an App for this doesn’t exist. There’s a phenomenal Android app called Pathbuilder but he has yet to release an iOS version, and from my understanding, does not plan to.</p>

<p>To see the current ugly UI of the app, checkout <a href="https://youtu.be/O2T0DRBZMg4">https://youtu.be/O2T0DRBZMg4</a></p>]]></content><author><name></name></author><summary type="html"><![CDATA[What a journey! My 30th birthday has come and went and I don’t have an app in the iOS App Store. Starting out I was very optimistic and began with Xamarin given my C# learnings and background. That went well enough until I came to the UI. I couldn’t quick grasp how to componentize the UI so I could reuse bits and pieces and not just have a massive XML file that was my UI code. So I started poking around at other cross platform frameworks to use and came across React Native. Spending some time on PluralSight, I found the React concepts to be easy to digest and the best part was… TypeScript support! I could keep my strongly typed habits while using a flexible framework and language.]]></summary></entry><entry><title type="html">Podcast Rotation</title><link href="https://garykrause.dev/2019/10/18/Podcast-Rotation.html" rel="alternate" type="text/html" title="Podcast Rotation" /><published>2019-10-18T00:00:00+00:00</published><updated>2019-10-18T00:00:00+00:00</updated><id>https://garykrause.dev/2019/10/18/Podcast-Rotation</id><content type="html" xml:base="https://garykrause.dev/2019/10/18/Podcast-Rotation.html"><![CDATA[<p>I’ve been recommending podcasts a lot to people wanting to learn software so I’m going to attempt to list my dev rotation here with a brief summary of what I get from the show.</p>

<p>I’ll put heavy rotation on top (I have more but these are key for learning dev, IMHO):</p>

<ul>
  <li>Coding Blocks: These guys are awesome! They do book reviews of some key software texts and talk in general about dev work. They’re enteratining and knowledgable with a great Slack community to boot.</li>
  <li>Techmeme Ride Home: Great for tech news. Daily 10-20min chunks of straight tech headlines and news. Longer episodes on the weekends. Good way to become more “in the know”.</li>
  <li>Merge Conflict: Awesome banter between two devs on random topics from current tech events to hardware hackings. Very entertaining.</li>
  <li>The 6 Figure Developer: Excellent topics and good variety outside of just .NET. They focus on the business side of things as well and end every show with a question to the guest “Give a tip to those just starting out.”</li>
  <li>The Cynical Developer: Good variety/topics and some really good “being a developer” advice and topics. Variable lenght of audio.</li>
  <li>.NET Rocks: Good music and great topics surrounding the MSFT/.NET ecosystem. Good variety.</li>
  <li>MS Dev Show: It’s the MSFT Dev Show, I want to work int he .NET world and understand it. Duh! Good guests and topics.</li>
  <li>Weekly Dev Tips: Good bite sized audio about lots of dev topics.</li>
</ul>

<p>The more I’ve thought about it, the more podcasts seem to be the key to my current success. I put them on anytime I’ve got downtime (driving, working out, cleaning, taking the trash out, etc.). ‘ve got entertainment podcasts (Glass Cannon Podcast, Campaign Notes Podcast, Rocks and Runelords) but my main interest in beginning podcasts ws to learn about development. When I first started listening, I had no idea what anyone was saying but I was learning context. As time went on I began hearing the same words and phrases over and over again. I would take a word or phrase or two and research what they meant if I was unable to understand from the context given. Now I find that I understand more than ever when I speak with other devs and read blogs/tutorials.</p>

<p>It’s so awesome that this free resource is out there for the taking and I highly recommend a good podcast lineup to anyone aspiring to do anything. Immersion is how I learned Chinese, and it’s how I learned software dev. Immerse yourself in something until things start to make sense.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[I’ve been recommending podcasts a lot to people wanting to learn software so I’m going to attempt to list my dev rotation here with a brief summary of what I get from the show.]]></summary></entry><entry><title type="html">Open Ctf</title><link href="https://garykrause.dev/2019/07/30/Open-CTF.html" rel="alternate" type="text/html" title="Open Ctf" /><published>2019-07-30T00:00:00+00:00</published><updated>2019-07-30T00:00:00+00:00</updated><id>https://garykrause.dev/2019/07/30/Open-CTF</id><content type="html" xml:base="https://garykrause.dev/2019/07/30/Open-CTF.html"><![CDATA[<p>Worked on a ManTech CTF found via the VetSec chat I’m part of. Write up <a href="https://github.com/garyray-k/hackemandstackem">here.</a></p>]]></content><author><name></name></author><summary type="html"><![CDATA[Worked on a ManTech CTF found via the VetSec chat I’m part of. Write up here.]]></summary></entry><entry><title type="html">A Lot Of Sgo</title><link href="https://garykrause.dev/2019/07/22/A-lot-of-SGO.html" rel="alternate" type="text/html" title="A Lot Of Sgo" /><published>2019-07-22T00:00:00+00:00</published><updated>2019-07-22T00:00:00+00:00</updated><id>https://garykrause.dev/2019/07/22/A-lot-of-SGO</id><content type="html" xml:base="https://garykrause.dev/2019/07/22/A-lot-of-SGO.html"><![CDATA[<h2 id="sgo-stuff-going-on">SGO (stuff going on)</h2>

<p>I’ve been interning at <a href="https://sixgen.io">SIXGEN</a> for the past two months or so and things are going great.</p>

<p>The first few weeks, I was asked to research <a href="https://blog.cloudflare.com/esni/">Encrypted Server Name Indicator</a> and how it could be used in pentesting combined with C2 software. It was awesome to learn about, but way too new for my current skill level in C code and dissecting/understanding it. I did manage to take a <a href="https://github.com/sftcd/openssl">custom Openssl</a> and convert it to a <a href="https://medium.com/dtoebe/embed-other-binaries-in-golang-binary-3f613314884c">byte array in Go</a> and then compile. However, the byte array still relied on custom libraries that needed to be pre-installed so hit a dead end for now. Maybe once the protocol evolves or I learn C and then learn the openssl library, I’ll revisit.</p>

<p>I was also sent to a <a href="https://www.blackbagtech.com/">BlackBag Tech</a> course where I learned the tool for two days. Awesome deep dive into forensics.</p>

<p>More recently, I’ve been working on a Ruby on Rails project. I started out getting my feet wet with helping one of the other devs combine three models into one and create a hierarchical structure within the unified model. Good learning to get back into the feel for RoR. Then I took a ticket of my own…. Thinking it would be easy, I grabbed a PDF generation ticket. Googled PDF gems and landed on <a href="http://prawnpdf.org/api-docs/2.0/">Prawn</a> which is fairly simple to use after reviewing the docs.</p>

<p>Little did I know the PDF is generated from the central object in our app. The object touches almost everything in the database somehow. And the relationships aren’t straight forward and the naming doesn’t necessarily match up with what the customer uses… needless to say, I’m understanding the reason <a href="https://en.wikipedia.org/wiki/Domain-driven_design&quot;">DDD</a> is so helpful. Luckily, this has really helped flesh out issues and flesh out my understanding of RoR and relational databases. It’s also hammered home the usefulness of writing tests. You can’t easily create a specifically formatted PDF all at once from a massive object. It’s been a slow process of breaking down the parts and understanding each piece, then plugging that piece into the overarching shell to spit out something pretty.</p>

<p>As for my list, I finished reading about Kali but other things got waylaid in the move/new internship. Currently I’m focused on writing Pathfinder 2nd Edition rules in C#/.NET and beginning to study for <a href="https://www.offensive-security.com/information-security-certifications/oscp-offensive-security-certified-professional/&quot;">OSCP</a>.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[SGO (stuff going on)]]></summary></entry><entry><title type="html">Javascript30 Complete</title><link href="https://garykrause.dev/2019/05/19/JavaScript30-Complete.html" rel="alternate" type="text/html" title="Javascript30 Complete" /><published>2019-05-19T00:00:00+00:00</published><updated>2019-05-19T00:00:00+00:00</updated><id>https://garykrause.dev/2019/05/19/JavaScript30-Complete</id><content type="html" xml:base="https://garykrause.dev/2019/05/19/JavaScript30-Complete.html"><![CDATA[<p>I’m about two weeks out from my internship with <a href="https://sixgen.io">SIXGEN</a> and super excited to start working and learning in the civilian world.</p>

<p>Just wrapped up Wes Bos’s <a href="https://javascript30.com/">Javascript 30</a> course. Learned some good fundamentals (I think), but really learned a lot more about how CSS works and it’s interaction with JS.</p>

<p>Time to add another goal <strong>Make my site pretty</strong>. I think with the basics in JS30, I could make my site a bit more than what it currently is. I’m glad I was able to finish this within 30 days (even with a week long cruise to the Bahamas).</p>

<p>Other random thoughts:</p>
<ul>
  <li>
    <p>Kali Linux Revealed has a lot of good basic Linux stuff in it. I’ve cleared up a bit more on the file system layout with Linux and learned that you can setup a custom auto-install for Debian based Linux. Can’t say that I have a use case now for a custom auto-install but it’s good to know. - I had issues with running Kali-Live on my MSI because it has an NVIDIA card in it. Learned that you can throw Kali some extra options at the boot menu to modify the boot. When you get to the boot menu, you can press ‘e’ and it give you the commands being run to boot. To enable boot on my MSI, I had to change ‘splash’ to ‘nouveau.modeset=0’. From my understanding, this has something to do with the power drawn by the GPU on boot. Either way it works, which has allowed me to turn an external 1TB SSD (using Kali-Live with persistence) into my portable Kali SSD. The goal will be setting up a Dev environment on it, but first I need to lock it down and configure it a bit more.</p>
  </li>
  <li>Write a YNAB App for MagicMirror (Node.js/Electron)</li>
  <li>LearnRubyTheHardWay using only keyboard - in progress</li>
  <li>Finish Reading Clean Code by Bob Martin - in progress</li>
  <li>Finish Reading Kali Linux Revealed</li>
  <li>Work on OperationCode security audit</li>
  <li>Work on FactionC2 Module</li>
  <li>Create my RadonTestManager in Ruby on Rails</li>
  <li>~~Setup old tower as home media server</li>
  <li>~~JavaScript30 (JS/HTML/CSS)</li>
  <li>~~Resolve URL validation issue for Operation Code</li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[I’m about two weeks out from my internship with SIXGEN and super excited to start working and learning in the civilian world.]]></summary></entry><entry><title type="html">Ruby Minitest And Running Bash In Docker</title><link href="https://garykrause.dev/2019/05/04/Ruby-MiniTest-and-Running-Bash-in-Docker.html" rel="alternate" type="text/html" title="Ruby Minitest And Running Bash In Docker" /><published>2019-05-04T00:00:00+00:00</published><updated>2019-05-04T00:00:00+00:00</updated><id>https://garykrause.dev/2019/05/04/Ruby-MiniTest-and-Running-Bash-in-Docker</id><content type="html" xml:base="https://garykrause.dev/2019/05/04/Ruby-MiniTest-and-Running-Bash-in-Docker.html"><![CDATA[<p>Took on a Ruby issue from <a href="https://github.com/OperationCode/operationcode_backend">Operation Code’s Backend</a> to do some url validation when creating/updating a listing in their Code Schools. The validation part was simple enough using some Regular Expression for the ‘format’ part of the model validation and ensuring the school was using HTTPS. The tricky part came when I had to go clean up the tests. The individual test I wrote for the validation worked fine but not a few other tests were broken from the change. Turns out, the FactoryGirl Faker they were using to mock data for testing was generating HTTP urls. Tests were throwing errors every time they created a new mock code school to test against. This was good, because that meant my validation was working, but then I had to go learn how to update the FactoryGirl so it would spit out HTTPS.</p>

<p>Before figuring out the FactoryGirl stuff, I wanted to see what was going on in the tests. However, in the Makefile for <code class="language-plaintext highlighter-rouge">make test</code>, it was using <code class="language-plaintext highlighter-rouge">docker-compose run ${RAILS_CONTAINER} bash -xc 'export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare &amp;&amp; bundle exec rake test &amp;&amp; bundle exec rubocop'</code>.</p>

<p>Let’s break that down a bit:</p>

<ul>
  <li><code class="language-plaintext highlighter-rouge">docker-compose run ${RAILS_CONTAINER}</code> <em>bash -xc ‘export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare &amp;&amp; bundle exec rake test &amp;&amp; bundle exec rubocop’</em>
    <ul>
      <li>This tells docker that we’re about to run a command in a new specified container</li>
    </ul>
  </li>
  <li><em>docker-compose run ${RAILS_CONTAINER}</em> <code class="language-plaintext highlighter-rouge">bash -xc</code> <em>‘export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare &amp;&amp; bundle exec rake test &amp;&amp; bundle exec rubocop’</em>
    <ul>
      <li>This allows you to run a bash command. The <code class="language-plaintext highlighter-rouge">x</code> switch tells it to output every command broken up by <code class="language-plaintext highlighter-rouge">&amp;&amp;</code> on it’s own line and generally makes it cleaner (IMHO). The <code class="language-plaintext highlighter-rouge">c</code> switch tells bash that we’re going to give it a string that is the command to be run.</li>
    </ul>
  </li>
  <li><em>docker-compose run ${RAILS_CONTAINER} bash -xc</em> <code class="language-plaintext highlighter-rouge">'export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare</code> <em>&amp;&amp; bundle exec rake test &amp;&amp; bundle exec rubocop’</em>
    <ul>
      <li>The first command sets an environment variable so Rails knows we’re testing. The next rakes the DB with test data to make sure we have something to test against in the upcoming command.<br /></li>
    </ul>
  </li>
  <li><em>docker-compose run ${RAILS_CONTAINER} bash -xc ‘export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare &amp;&amp;</em> <code class="language-plaintext highlighter-rouge">bundle exec rake test</code> <em>&amp;&amp; bundle exec rubocop’</em>
    <ul>
      <li>Now we get to the actual test running. This is where I was hung up for a while trying to figure out verbose output to see which tests were throwing errors. I could have just searched the tests for <code class="language-plaintext highlighter-rouge">create(:code_school)</code> but that didn’t dawn on me right away and I wanted to figure this bit out. First I tried <code class="language-plaintext highlighter-rouge">bundle exec rake test --verbose</code> to no avail.</li>
    </ul>
  </li>
  <li>Then I dug into a number of things:
    <ul>
      <li>Wanted to ensure each bash command was run as I thought, thus the <code class="language-plaintext highlighter-rouge">-x</code> switch for bash. Understanding <code class="language-plaintext highlighter-rouge">docker-compose run</code> was also good to make sure things went well.</li>
      <li>Next I looked into MiniTest and how to make the <code class="language-plaintext highlighter-rouge">test</code> command verbose. But that led no where.</li>
      <li>It was actually the combination of <code class="language-plaintext highlighter-rouge">rake test</code> that was causing the hangout. It needed some special syntax to enable verbose output. Also along that line fo thinking, I researched how to run only one specific test file instead of the whole thing (<code class="language-plaintext highlighter-rouge">bundle exec rake test TEST=test/controllers/api/v1/code_schools_controller_test.rb</code>).</li>
    </ul>
  </li>
  <li><em>docker-compose run ${RAILS_CONTAINER} bash -xc ‘export RAILS_ENV=test &amp;&amp; bundle exec rake db:test:prepare &amp;&amp; bundle exec rake test &amp;&amp;</em><code class="language-plaintext highlighter-rouge">bundle exec rubocop</code>’
    <ul>
      <li>This last little bit is just making sure that all the code formatting is consistent across the project. Very nice to have for someone working on this for the first time.&lt;/b&gt;&lt;/li&gt;</li>
    </ul>
  </li>
</ul>

<p>All said and done, it was about 18 lines of code and I wrote my first test, which failed, then passed, but broke other things, but then passed everything. As of this writing, the <a href="https://github.com/OperationCode/operationcode_backend/pull/509">PR</a> is approved and just awaiting merge. Fingers crossed and time to move onto the next project.</p>

<p>As it stands right now my goals/ideas to work towards are:&lt;/p&gt;</p>

<ul>
  <li><del>Resolve URL validation issue for Operation Code</del></li>
  <li>Setup old tower as home media server</li>
  <li>JavaScript30 (JS/HTML/CSS) - in progress still</li>
  <li>LearnRubyTheHardWay using only keyboard - in progress</li>
  <li>Finish Reading Clean Code by Bob Martin - in progress</li>
  <li>Work on FactionC2 Module</li>
  <li>Write a YNAB App for MagicMirror (Node.js/Electron)</li>
  <li>Port my RadonTestManager to Ruby on Rails</li>
</ul>]]></content><author><name></name></author><summary type="html"><![CDATA[Took on a Ruby issue from Operation Code’s Backend to do some url validation when creating/updating a listing in their Code Schools. The validation part was simple enough using some Regular Expression for the ‘format’ part of the model validation and ensuring the school was using HTTPS. The tricky part came when I had to go clean up the tests. The individual test I wrote for the validation worked fine but not a few other tests were broken from the change. Turns out, the FactoryGirl Faker they were using to mock data for testing was generating HTTP urls. Tests were throwing errors every time they created a new mock code school to test against. This was good, because that meant my validation was working, but then I had to go learn how to update the FactoryGirl so it would spit out HTTPS.]]></summary></entry><entry><title type="html">Javascript30 And Problem Solving</title><link href="https://garykrause.dev/2019/04/22/JavaScript30-and-Problem-Solving.html" rel="alternate" type="text/html" title="Javascript30 And Problem Solving" /><published>2019-04-22T00:00:00+00:00</published><updated>2019-04-22T00:00:00+00:00</updated><id>https://garykrause.dev/2019/04/22/JavaScript30-and-Problem-Solving</id><content type="html" xml:base="https://garykrause.dev/2019/04/22/JavaScript30-and-Problem-Solving.html"><![CDATA[<p>On a recommendation from some Slack friends I started Wes Bos’s <a href="https://www.javascript30.com&quot;">JavaScript30</a> course. As of today, I’ve completed 5 of the 30 courses and I’m feeling much better about Javascript. Having went through the <a href="https://watchandcode.com/">watchandcode</a> videos, these videos feel familiar and aren’t too hard to follow along with. JS30 is also diving into CSS (something I’ve avoided learning) in an easy way. I decided to start on some more JS since I’ll be working with Node.js in my upcoming internship.</p>

<p>As it stands right now my goals to work towards are:</p>

<ul>
  <li>JavaScript30 (JS/HTML/CSS)</li>
  <li>Write a YNAB App for MagicMirror (Node.js/Electron)</li>
  <li>Finish Reading Clean Code by Bob Martin</li>
  <li>Port my RadonTestManager to Ruby on Rails</li>
</ul>

<p>On to the topic of problem solving.</p>

<p>I think when encountering problems, the best solution doesn’t have to be knowing the answer, but rather knowing where to find the answer. Knowing the answer definitely helps, especially when time is of the essence, but most of the time an immediate answer is not needed. In today’s interconnected world, the answer is probably sitting in your pocket a browser click away. By using the right search engine and search string, one can usually find the answers they seek. This doesn’t always apply to abstract or conceptual problems, but I think when seeking technical answers, it is crucial. This way of thinking also helps in retaining “answers” but essentially creating an index for your brain. You only keep the information in there that can get you to the answer, not the answer itself. This has been extremely useful as I hop around to different programming languages. I don’t need to remember the exact syntax for an “if” statement in Python, Ruby, C#, JS, etc. if I can just give it a quick Google. Same thing with some of the Object Oriented Programming concepts such as Inheritance. This does become hard though when beginning with a new framework that has unique syntax or structuring that’s not similar to anything else. The idea that comes to mind currently is React. It’s JS but seems (to me at this point in time) to have a very unique way of doing things that isn’t exactly intuitive coming from another language or framework, so will require a bit more digging/learning before I can learn the right questions to ask to get the job done. One last thing on problem solving: there is always a solution, it’s just not might be within your control.</p>]]></content><author><name></name></author><summary type="html"><![CDATA[On a recommendation from some Slack friends I started Wes Bos’s JavaScript30 course. As of today, I’ve completed 5 of the 30 courses and I’m feeling much better about Javascript. Having went through the watchandcode videos, these videos feel familiar and aren’t too hard to follow along with. JS30 is also diving into CSS (something I’ve avoided learning) in an easy way. I decided to start on some more JS since I’ll be working with Node.js in my upcoming internship.]]></summary></entry></feed>