<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Matthew T. Villwock on Medium]]></title>
        <description><![CDATA[Stories by Matthew T. Villwock on Medium]]></description>
        <link>https://medium.com/@mtvillwock?source=rss-65292e0c0ed9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*7iqmNHpHTvZkqS3W7bnoCw.png</url>
            <title>Stories by Matthew T. Villwock on Medium</title>
            <link>https://medium.com/@mtvillwock?source=rss-65292e0c0ed9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:41:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mtvillwock/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Keeping Homebrew updated]]></title>
            <link>https://medium.com/@mtvillwock/keeping-homebrew-updated-6cf02d44a1e7?source=rss-65292e0c0ed9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cf02d44a1e7</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[cronjob]]></category>
            <dc:creator><![CDATA[Matthew T. Villwock]]></dc:creator>
            <pubDate>Thu, 23 May 2019 17:34:53 GMT</pubDate>
            <atom:updated>2020-02-15T00:19:30.252Z</atom:updated>
            <content:encoded><![CDATA[<h4>AKA: My first cron job</h4><p>One day at work I was wondering about cron jobs. I hadn’t used any so I wanted to make one that was simple, just to try it out.</p><p>I decided to write something that would update <a href="https://brew.sh/">Homebrew</a> for me daily, so that it would always be up to date. After Googling around a bit, I got to work.</p><p>This was a small task, consisting of two files.</p><p>First, I made this update-brew.sh file:</p><pre>#!/bin/bash<br>brew update &amp;&amp; brew upgrade</pre><p>This is a shell script updates and upgrade brew.</p><p>Second, I wrote a brew-update.txt file to pass to the crontab command.</p><pre>30 10 * * * ~/dev/update-brew.sh</pre><p>The first number is minutes, the second is the hour, and the three *s are for days, months, and years. The path is for the file to run at that time.</p><p>I ran crontab brew-update.txt in my terminal, followed by crontab -l to list the cron jobs running on my system:</p><pre>:&gt; crontab -l<br>30 10 * * * /Users/mvillwock/dev/update-brew.sh</pre><p>And now each day at 10:30AM, my machine updates Homebrew.</p><p>Cron jobs can be useful for anything you need to do repeatedly. What kind of tasks will <strong>you</strong> automate with a cron job?</p><h4>Resources:</h4><ul><li><a href="https://crontab-generator.org/">https://crontab-generator.org</a></li><li><a href="https://www.jefframnani.com/writing-a-good-cron-job/">https://www.jefframnani.com/writing-a-good-cron-job/</a></li><li><a href="https://www.taniarascia.com/setting-up-a-basic-cron-job-in-linux/">https://www.taniarascia.com/setting-up-a-basic-cron-job-in-linux/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cf02d44a1e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Writing a Bash script to log commit messages]]></title>
            <link>https://medium.com/@mtvillwock/writing-a-bash-script-to-log-commit-messages-68a6ff2be66e?source=rss-65292e0c0ed9------2</link>
            <guid isPermaLink="false">https://medium.com/p/68a6ff2be66e</guid>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Matthew T. Villwock]]></dc:creator>
            <pubDate>Sun, 21 Apr 2019 23:47:43 GMT</pubDate>
            <atom:updated>2019-04-21T23:47:43.423Z</atom:updated>
            <content:encoded><![CDATA[<h4>A small utility function</h4><p>In a file called pipe-commits-to-log-file.sh, add this code:</p><pre>#!/bin/bash<br># List git commits in single line format and pipe to log file<br>echo &quot;Piping commits to log file&quot;<br>git log --pretty=format:&#39;%h was %an, %ar, message: %s&#39; &gt; ./log/commits.log</pre><p>The first line uses a <a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">shebang</a> to define that the script should be interpreted by Bash. You could do the same thing replacing bash with python or ruby if you wanted to use those languages instead.</p><p>The second line is a comment, perhaps superfluous, declaring what the script does when run.</p><p>The third line is a sanity check — I like to see some sort of output when I run scripts, just to see that something happened.</p><p>The fourth line is the meaty one, using git log with some string formatting, the output of which is piped to commits.log like this:</p><pre>&gt;: sh scripts/pipe-commits-to-log-file.sh</pre><pre>&gt;: cat log/commits.log<br>8f95a64 was Matthew Villwock, 2 weeks ago, message: Update Ruby to 2.6.2<br>f53a5ff was Matthew Villwock, 2 weeks ago, message: Init commit</pre><p>I did this so that I could easily have a text file to break into bullet points without having to copy individual commits into an unordered list, but I’m sure you can find more valuable uses for it. 🤷‍♂</p><p>That’s it! Happy logging!</p><h3>Resources:</h3><ul><li><a href="https://en.wikipedia.org/wiki/Shebang_(Unix)">https://en.wikipedia.org/wiki/Shebang_(Unix)</a></li><li><a href="https://www.linux.com/learn/writing-simple-bash-script">https://www.linux.com/learn/writing-simple-bash-script</a></li><li><a href="https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-termina#229592">https://askubuntu.com/questions/229589/how-to-make-a-file-e-g-a-sh-script-executable-so-it-can-be-run-from-termina#229592</a></li><li><a href="https://stackoverflow.com/questions/10063407/git-log-output-log-file#10063456">https://stackoverflow.com/questions/10063407/git-log-output-log-file#10063456</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68a6ff2be66e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging Elasticsearch when homebrew says it is running but localhost:9200 can’t connect]]></title>
            <link>https://medium.com/@mtvillwock/debugging-elasticsearch-when-homebrew-says-it-is-running-but-localhost-9200-cant-connect-749489ca450b?source=rss-65292e0c0ed9------2</link>
            <guid isPermaLink="false">https://medium.com/p/749489ca450b</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[homebrew]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[Matthew T. Villwock]]></dc:creator>
            <pubDate>Fri, 19 Apr 2019 01:13:33 GMT</pubDate>
            <atom:updated>2019-04-19T01:13:33.693Z</atom:updated>
            <content:encoded><![CDATA[<h4>Hopefully this will save someone a little time</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4hMD3YXsF8jGgxnhsn28Tg.jpeg" /></figure><h3>Situation</h3><p>I was doing some Ruby on Rails development work on a MacBook running version 10.13.6 of MacOS. A test using the <a href="https://github.com/ankane/searchkick">Searchkick</a> gem was failing due to the following error:</p><pre>An error occurred in a `before(:suite)` hook.<br>Failure/Error: Searchkick.models.each(&amp;:reindex)</pre><pre>Faraday::ConnectionFailed:<br>  Failed to open TCP connection to localhost:9200 (Connection refused - connect(2) for &quot;localhost&quot; port 9200)</pre><h3>Action</h3><p>I tried troubleshooting on my own , doing things like:</p><ul><li>brew services stop elasticsearch and brew services start elasticsearch</li><li>brew services restart elasticsearch</li><li>uninstalling with brew uninstall elasticsearch and reinstalling brew install elasticsearch.</li></ul><p>The puzzling thing was that when I ran brew services list, my machine showed that elasticsearch was running:</p><pre>Name          Status  User      Plist<br>elasticsearch started mvillwock /Users/mvillwock/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist<br>postgresql    started mvillwock /Users/mvillwock/Library/LaunchAgents/homebrew.mxcl.postgresql.plist<br>redis         started mvillwock /Users/mvillwock/Library/LaunchAgents/homebrew.mxcl.redis.plist</pre><p>Yet running curl localhost:9200 just told me:</p><pre>curl: (7) Failed to connect to localhost port 9200: Connection refused</pre><p>I was baffled, so I turned to the Internet.</p><p>After Googling for a while, I found this <a href="https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae">gist</a> that sounded like it was the same issue. I followed the advice from this <a href="https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae#gistcomment-2878712">comment</a>, making this change:</p><pre>### /usr/local/etc/elasticsearch/jvm.options</pre><pre>#8:-Xloggc:logs/gc.log<br>8:-Xloggc:/tmp/logs_gc.log</pre><p>and was rewarded with this when I ran /usr/local/bin/elasticsearch explicitly instead of with brew as the Gist author had suggested:</p><pre>ERROR: Cluster name [elasticsearch_mvillwock] subdirectory exists in data paths [/usr/local/var/lib/elasticsearch/elasticsearch_mvillwock]. All data under these paths must be moved up one directory to paths [/usr/local/var/lib/elasticsearch]</pre><p>I double checked that directory and found that, yes indeed, that elasticsearch_mvillwock subdirectory (as well as a nodes subdirectory) was living inside the elasticsearch directory.</p><pre>:&gt; ls /usr/local/var/lib/elasticsearch/<br>elasticsearch_mvillwock nodes</pre><p>Hmm… elasticsearch_mvillwock and nodes. I tried to move the directory as suggested, but was told that the directories were identical.</p><pre>:&gt; mv /usr/local/var/lib/elasticsearch/elasticsearch_mvillwock/ /usr/local/var/lib/elasticsearch/<br>mv: /usr/local/var/lib/elasticsearch/elasticsearch_mvillwock/ and /usr/local/var/lib/elasticsearch/elasticsearch_mvillwock/ are identical</pre><p>So… I deleted the offending directories and ran the executable again.</p><pre><br>:&gt; rm -rf /usr/local/var/lib/elasticsearch/elasticsearch_mvillwock/<br>:&gt; rm -rf /usr/local/var/lib/elasticsearch/nodes/<br>:&gt; ls /usr/local/var/lib/elasticsearch/</pre><pre>:&gt; /usr/local/bin/elasticsearch</pre><pre># Logs snipped for brevity<br>[jhD3KVc] started<br>[2019-04-18T15:56:05,496][INFO ][o.e.c.m.MetaDataCreateIndexService] [jhD3KVc] [.kibana_1] creating index, cause [api], templates [], shards [1]/[1], mappings [doc]<br>[2019-04-18T15:56:05,505][INFO ][o.e.c.r.a.AllocationService] [jhD3KVc] updating number_of_replicas to [0] for indices [.kibana_1]<br>[2019-04-18T15:56:05,702][INFO ][o.e.c.r.a.AllocationService] [jhD3KVc] Cluster health status changed from [YELLOW] to [GREEN] (reason: [shards started [[.kibana_1][0]] ...]).</pre><p>Looking good! To make sure everything was working, I closed down the executable and tried restarting elasticsearch with brew, and then tested that the port was listening with curl.</p><h3>Result</h3><pre>:&gt; brew services restart elasticsearch<br>Stopping `elasticsearch`... (might take a while)<br>==&gt; Successfully stopped `elasticsearch` (label: homebrew.mxcl.elasticsearch)<br>==&gt; Successfully started `elasticsearch` (label: homebrew.mxcl.elasticsearch)</pre><pre>:&gt; brew services list<br>Name          Status  User      Plist<br>elasticsearch started mvillwock /Users/mvillwock/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist<br><br>:&gt; curl localhost:9200<br>{<br>  &quot;name&quot; : &quot;jhD3KVc&quot;,<br>  &quot;cluster_name&quot; : &quot;elasticsearch_mvillwock&quot;,<br>  &quot;cluster_uuid&quot; : &quot;UoBEx89KS-GnQoj0iP85WQ&quot;,<br>  &quot;version&quot; : {<br>    &quot;number&quot; : &quot;6.7.0&quot;,<br>    &quot;build_flavor&quot; : &quot;oss&quot;,<br>    &quot;build_type&quot; : &quot;tar&quot;,<br>    &quot;build_hash&quot; : &quot;8453f77&quot;,<br>    &quot;build_date&quot; : &quot;2019-03-21T15:32:29.844721Z&quot;,<br>    &quot;build_snapshot&quot; : false,<br>    &quot;lucene_version&quot; : &quot;7.7.0&quot;,<br>    &quot;minimum_wire_compatibility_version&quot; : &quot;5.6.0&quot;,<br>    &quot;minimum_index_compatibility_version&quot; : &quot;5.0.0&quot;<br>  },<br>  &quot;tagline&quot; : &quot;You Know, for Search&quot;<br>}</pre><p>Apparently I just needed to reference a different log in/usr/local/etc/elasticsearch/jvm.options, due to <a href="https://issues.apache.org/jira/browse/CASSANDRA-14142">this bug</a> that had been <a href="https://issues.apache.org/jira/browse/CASSANDRA-14142">previously</a> <a href="https://github.com/apache/cassandra/pull/183">reported</a>.</p><p>Such is software development. ¯\_(ツ)_/¯</p><p>Hopefully if you encounter this issue, this post will save you some time.</p><p>Really, this is just about signal boosting this <a href="https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae#gistcomment-2682310">well-written comment</a> on this Gist and the <a href="https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae#gistcomment-2878712">eventual solution</a> that helped me.</p><p>Have fun elasticsearching!</p><h3>Resources</h3><ul><li>Photo by <a href="https://unsplash.com/photos/Agx5_TLsIf4?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Fatos Bytyqi</a> on <a href="https://unsplash.com/search/photos/coding?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></li><li><a href="https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae">https://gist.github.com/jpalala/ab3c33dd9ee5a6efbdae</a></li><li><a href="https://github.com/apache/cassandra/pull/183">https://github.com/apache/cassandra/pull/183</a></li><li><a href="https://issues.apache.org/jira/browse/CASSANDRA-14142">https://issues.apache.org/jira/browse/CASSANDRA-14142</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=749489ca450b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Take it from the top (and put it at the bottom)]]></title>
            <link>https://medium.com/@mtvillwock/take-it-from-the-top-and-put-it-at-the-bottom-e52744cb649a?source=rss-65292e0c0ed9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e52744cb649a</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[styled-components]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Matthew T. Villwock]]></dc:creator>
            <pubDate>Tue, 09 Apr 2019 22:07:57 GMT</pubDate>
            <atom:updated>2019-04-11T17:57:04.797Z</atom:updated>
            <content:encoded><![CDATA[<h4>A few words on document structure via CSS-in-JS observations</h4><p>Before I get too far into this, I just want to acknowledge this is an opinion.</p><p>That said…</p><p>For the love of all that is holy…</p><p>Please put your Styled Components at the bottom of your component files.</p><p><a href="https://en.wiktionary.org/wiki/bury_the_lede#English">Don’t bury the lede.</a></p><p>When I open up a file for a React component, I want to know what that component does. Not how it looks, not what other styled.divs are being used inside of it. If I want to investigate those elements, I can do it later.</p><p>Think of styled components as you would <a href="https://www.scribendi.com/advice/what_are_footnotes.en.html">footnotes</a>. It’s like just-in-time reading comprehension for people looking at the component file.</p><p>Save everyone time.</p><p>Be consistent.</p><p>Put important things first and ancillary elements later.</p><p>Good luck, have fun, play safe, and be home by 9.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e52744cb649a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Principles in Real Life]]></title>
            <link>https://medium.com/@mtvillwock/software-principles-in-real-life-5f7bc87e61cc?source=rss-65292e0c0ed9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f7bc87e61cc</guid>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Matthew T. Villwock]]></dc:creator>
            <pubDate>Fri, 22 Apr 2016 01:11:47 GMT</pubDate>
            <atom:updated>2019-09-20T00:40:50.472Z</atom:updated>
            <content:encoded><![CDATA[<p>Limit dependencies when possible.</p><p>Don’t reinvent the wheel (or feel bad about using what other people have made).</p><p>Imperfect and usable is better than perfect and not yet usable.</p><p>You can do anything, but you can’t do everything.</p><p>Do it now. Later often becomes never, and debt compounds.</p><p>Do it later. Cross bridges when they are burning underneath you, not when you get to them.</p><p>Stand your ground.</p><p>Ask for help. Expose your ignorance. Be vulnerable and trust others to help.</p><p>Maintain your dependencies. Stay fed, get sleep, exercise. Update your packages. Check in and take care of your relationships, your home, your body, mind, emotions, and spirit.</p><p>The product is the package plus the product. Presentation without performance is useless, and performance without presentation is used less.</p><p>Follow the stack trace. Methodically seek the root cause of problems.</p><p>Double down if you’re playing with house money. The best time to plan adventures, prune dependencies, adjust relationships, develop or modify habits, and plan for contingencies is when things are going well, not when you’re facing a crisis.</p><p>Graceful error handling is essential.</p><p>Just a few thoughts. They all probably deserve anecdotes. But for now, I’m shipping this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f7bc87e61cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>