Ben's Bloghttps://blog.pyrik.dev/
Recent content on Ben's BlogHugo -- gohugo.ioben@pyrik.dev (Ben Pyrik)ben@pyrik.dev (Ben Pyrik)Sat, 11 Apr 2020 05:00:00 +0000A good API minimizes the distance between intention and resulthttps://blog.pyrik.dev/post/a-good-api-minimizes-the-distance-between-intention-and-result/
Sat, 11 Apr 2020 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/a-good-api-minimizes-the-distance-between-intention-and-result/Mapbox-gl-js has a concept called a &ldquo;style document&rdquo; (or &ldquo;MapStyle&rdquo; as I like to call it). MapStyles are JSON objects that &ldquo;define the visual appearance of a map: what data to draw, the order to draw it in, and how to style the data when drawing it&rdquo;.
Here&rsquo;s an example:
{ &#34;version&#34;: 8, &#34;name&#34;: &#34;Mapbox Streets&#34;, &#34;sprite&#34;: &#34;mapbox://sprites/mapbox/streets-v8&#34;, &#34;glyphs&#34;: &#34;mapbox://fonts/mapbox/{fontstack}/{range}.pbf&#34;, &#34;sources&#34;: {}, &#34;layers&#34;: [ { &#34;id&#34;: &#34;background&#34;, &#34;type&#34;: &#34;background&#34;, &#34;paint&#34;: { &#34;background-color&#34;: &#34;#0C1C2B&#34;, }, }, ] } A common pattern used to integrate mapbox-gl-js into a React app is to store MapStyle in a Redux store.Deep state changes with Immerhttps://blog.pyrik.dev/post/deep-state-changes-with-immer/
Tue, 10 Mar 2020 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/deep-state-changes-with-immer/One of the tedious aspects of writing reducers is handling changes to deeply nested objects. Deeply nested state is somewhat frowned upon, but I do a lot of work with Mapbox and managing MapStyle (an object with lots of map configuration objects inside it) through a reducer helps a lot with integrating a fairly imperative library (mapbox-gl-js) into a React app.
An example To allow a user to click the map and see a point appear, the click event must create a GeoJSON Point feature:Simple dual-bootinghttps://blog.pyrik.dev/post/dual-booting-is-unreliable-and-overcomplicated/
Fri, 28 Feb 2020 06:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/dual-booting-is-unreliable-and-overcomplicated/As a child, I tried to dual boot Windows and Ubuntu. After a couple days, and a couple internet guides, everything seemed to be working. A week later Windows would no longer boot. Why? I don&rsquo;t know. Extensive troubleshooting didn&rsquo;t help and eventually the data was pulled and the disk nuked.
However, I still wanted to boot Windows and Ubuntu. A software solution had failed, perhaps a hardware fix would be simpler?Building a Hackintosh with OpenCore v0.5.5https://blog.pyrik.dev/post/building-a-hackintosh-with-opencore-v0-5-5/
Sun, 09 Feb 2020 06:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/building-a-hackintosh-with-opencore-v0-5-5/I&rsquo;m a fan of MacOS; it looks nice and is generally easy to use. However, I&rsquo;m not a fan of Apple&rsquo;s desktop hardware. None of Apple&rsquo;s desktop lineup, except for the Mac Pro perhaps, have GPUs suitable for gaming.
Mac Mini: only has an iGPU iMac: rx580 (old) Mac Pro: too expensive Apple suggests using an external GPU to boost graphics performance, but this requires buying a ~$300 GPU enclosure and suffering a 5% to 30% performance penalty.Redux is React's version of global variables?https://blog.pyrik.dev/post/redux-is-react-s-version-of-global-variables/
Sun, 20 Oct 2019 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/redux-is-react-s-version-of-global-variables/I&rsquo;ve been digging into a React/Redux project at work recently. The React parts were easy to pickup, but the Redux part was a bit mysterious at first.
What is this folder of exported strings called &ldquo;actionTypes&rdquo;? What are all these &ldquo;reducers&rdquo; and why do they not seem to do anything? What is mapStateToProps and mapDispatchToProps doing at the bottom of all these components? Two things helped me understand:Python dependency resolutionhttps://blog.pyrik.dev/post/python-dependency-resolution/
Tue, 04 Jun 2019 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/python-dependency-resolution/Today pipenv install broke on the project I was working on. It worked yesterday and the day before that, but today it failed.
At first, I thought my Python or pipenv installation was broken. The project&rsquo;s integration tests ran in a Docker container, so I docker run -it &lt;image&gt; bash'd into a container and tried pipenv install. The result was the same&mdash;&ldquo;dependencies could not be resolved&rdquo;. This was a surprise&hellip;how could a Dockerized application suddenly stop working?Spotify doesn't have a playlist importerhttps://blog.pyrik.dev/post/spotify-doesn-t-have-a-playlist-importer/
Mon, 27 May 2019 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/spotify-doesn-t-have-a-playlist-importer/The podcast &ldquo;Uhh Yeah Dude&rdquo; has interesting musical intros and outros, I wanted to have all these songs in a Spotify playlist. A fan of the show had maintained such a playlist until 2016, but more recent picks were missing. What to do?
Getting and transforming the data The first step was scraping the UYD website to build a list of episodes&ndash;not too difficult! The code for this is kind of boring, but it&rsquo;s on GitHub if you&rsquo;re interested.Writing Dockerfileshttps://blog.pyrik.dev/post/writing-dockerfiles/
Fri, 22 Mar 2019 04:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/writing-dockerfiles/Why use Docker? At my last job, I developed on Windows and deployed on Linux. There were multiple production VMs running different operating systems with different versions. This made deployment annoying and tedious as certain apps would work on some machines but not others. Additionally, there was a large application that would not install on fresh machines.
Docker fixes a lot of these issues. To deploy a dockerized application, just copy it to the machine and run something like docker-compose up.Converting scanned images into a single PDFhttps://blog.pyrik.dev/post/converting-scanned-images-into-a-single-pdf/
Wed, 30 Jan 2019 05:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/converting-scanned-images-into-a-single-pdf/I had to submit a form to a government agency today and they demanded PDF format.
The document had to be signed by hand, so I couldn&rsquo;t just fill the form and resubmit. I had to print the form, fill it out, sign, and then re-scan each page. Now what? I&rsquo;ve got a directory of images, how do I convert them to PDF?
Adobe&rsquo;s dark pattern Adobe Reader looks like it has a built-in tool for converting different formats to PDF.Takashi NYChttps://blog.pyrik.dev/post/new-york-2019/
Sat, 05 Jan 2019 23:00:00 -0600ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/new-york-2019/Three days in New York City and the highlight was definitely Takashi, a Japanese restaurant specializing in beef.
&ldquo;Our menu is beef, all beef and nothing but beef!&rdquo;
Meat is served raw and cut into bite-sized chunks; each table has a personal grill, so meat can be cooked to your favourite degree of doneness. The greatest advantage of this style of restaurant is that meat always tastes hot and fresh&mdash;much nicer than eating the last bite of a lukewarm steak!Hello worldhttps://blog.pyrik.dev/post/hello-world/
Wed, 02 Jan 2019 01:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/post/hello-world/I&rsquo;ve finally had time to setup a blog. Past attempts were foiled by perfectionism, so this time I focused on making writing and publishing as painless as possible.
This blog is a static site generated by Hugo, it uses the Beautiful Hugo theme. Whenever a new commit is pushed to the repo, Netlify automatically rebuilds and redeploys the site. Forestry.io serves as a nice front-end for writing new posts (changes are committed behind the scenes).About mehttps://blog.pyrik.dev/page/about/
Mon, 01 Jan 0001 00:00:00 +0000ben@pyrik.dev (Ben Pyrik)https://blog.pyrik.dev/page/about/My name is Ben Pyrik and this is my blog.
Why not publish on my personal site? Because Jupyter Notebooks are unnecessary and a hassle for junky content like this. This website is for b-side content ;-)