{
    "version": "https://jsonfeed.org/version/1",
    "title": "Tyler Cipriani: blog",
    "home_page_url": "https://tylercipriani.com/blog/",
    "feed_url": "https://tylercipriani.com/blog/index.json",
    "items": [
        {

    "id": "https://tylercipriani.com/blog/2026/05/28/chuwi-minibook-x/",

    "title": "Chuwi Minibook&#xA0;X: the netbook we deserve",
    "url": "https://tylercipriani.com/blog/2026/05/28/chuwi-minibook-x/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2026-05-28T00:05:21Z",
    "date_modified": "2026-05-31T22:55:48Z",


    "content_html": "<style>\n.title {text-wrap:balance;}\n#content > p:first-child {text-wrap:balance;}\n.gallery {\n  display:flex;\n  justify-content:center;\n}\nfigure a:link,\nfigure a:visited,\nfigure a:hover,\nfigure a:active {color:inherit; text-decoration: underline;}\n</style>\n<p>Netbooks are dead, but the Chuwi Minibook X scratches the same\nitch.</p>\n<p>The Minibook X is a 10.5″ x86_64 sub-ultrabook with 16GB RAM, a 512GB\nNVMe drive, and only one majorly annyoing Linux quirk.</p>\n<p>I needed a knock-around laptop, so I bought myself a Minibook for my\nbirthday last year. The more I tote it around, the more fun I’m having\nwith this ridiculous little computer.</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 70vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 70vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/58/ec9d31f64e7d203a6d40603d8ec352/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 70vw\"\n           alt=\"Chuwi Minibook X, KDE lock screen\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Chuwi Minibook X</figcaption>\n  </a>\n</figure>\n<section id=\"quick-specs\" class=\"level2\">\n<h2>Quick specs</h2>\n<p>Much like the netbooks of yore, the Minibook is a budget machine. But\nit’s 2026, so even budget machines pack more oomph than I need from a\nutility laptop.</p>\n<ul>\n<li>CPU 4-core/4-thread 3.6GHz Intel N150 Twin Lake</li>\n<li>16 GB RAM – LPDDR5-6400 – soldered 😿</li>\n<li>512GB NVMe – upgradable</li>\n<li>10.51” IPS 2K 16:10 screen</li>\n<li>28.88Wh Li-Ion battery</li>\n<li>Weight: 911g</li>\n<li>Ports: 2×USB-C (1×PD charging)</li>\n<li>Cost: $350</li>\n</ul>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/a1/cbe8bd56a1085ab2e3c7a6388bed5f/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 50vw\"\n           alt=\"Chuwi Minibook with back cover removed, exposing battery and NVMe drive\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Chuwi Minibook Guts</figcaption>\n  </a>\n</figure>\n<p>One oddity is that the Minibook comes bundled with a 12V/2A USB-C\ncharger. I chucked the charger; I worried I’d fry some 5V SoC someday.\nThe Minibook works fine with a PD charger.</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\" srcset=\"https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/small.avif 240w,\n                                        https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/medium.avif 640w\"\n              sizes=\"(max-width: 54em) 70vw, 20vw\">\n      <source type=\"image/webp\" srcset=\"https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/small.webp 240w,\n                                        https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/medium.webp 640w\"\n              sizes=\"(max-width: 54em) 70vw, 20vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/18/7a50ffe3248627bddf4ca435c047a5/medium.jpg 640w\"\n           sizes=\"(max-width: 54em) 70vw, 20vw\"\n           alt=\"Minibook X using a PD Charger at 20V\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Minibook X using a PD Charger at 20V</figcaption>\n  </a>\n</figure>\n<p>I’d assume the 12V charger was a cost-saving choice, but it also\ncreates some weird possibilities for DC/off-grid setups.</p>\n</section>\n<section id=\"linux-and-weirdness-sideways-panels-and-kernel-parameters\"\nclass=\"level2\">\n<h2>Linux and weirdness: sideways panels and kernel parameters</h2>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2026-05-17_cstross-chuwi-minibook.png\" alt=\"Charlie Stross, one of my favorite SciFi authors, recommended the Chuwi Minibook X on Mastodon\">\n<figcaption aria-hidden=\"true\">\n  <a class=\"citation\" data-cites=\"@cstross\" href=\"https://wandering.shop/@cstross\">Charlie Stross</a>, a favorite SciFi author, talks up the Chuwi Minibook X on <a href=\"https://wandering.shop/@cstross/113279670998603629\">Mastodon</a></figcaption>\n</figcaption>\n</figure>\n<p>The fediverse told me that Minibook runs Linux “boringly well,” which\nwas <em>almost</em> true.</p>\n<p>I tried Debian, then jumped to NixOS for kicks.</p>\n<p>What works:</p>\n<ul>\n<li>Camera/Microphone/Speakers</li>\n<li>Touchscreen</li>\n<li>Sleep/Suspend</li>\n<li>Hibernate</li>\n<li>Keyboard backlight</li>\n<li>USB-C HDMI</li>\n<li>Bluetooth (non-free blobs – Intel)</li>\n<li>Wi-Fi 6 (non-free blobs – Intel)</li>\n</ul>\n<p>But on first boot, the screen orientation is 270° clockwise:</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/fd/618ab5184903c7a8a69428d4df70e0/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 50vw\"\n           alt=\"Tails setup screen rotated\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n  </a>\n  <figcaption aria-hidden=\"true\">Linux setup screen rotated 270°.</figcaption>\n</figure>\n<p>The Chuwi’s screen is a panel from a cheap tablet; the screen\nrotation issue is a hardware problem (the screen is mounted sideways).\nTo fix the screen’s rotation, I had to tweak screen orientation at every\nsoftware layer. Fixing this problem was a journey:</p>\n<ol type=\"1\">\n<li>Bootloader – Switched from <code>systemd-boot</code> to\n<code>grub</code>, carrying some <a\nhref=\"https://github.com/iggyZiggy/chuwi-grub-rotation-nix-patch\">unmerged\nGRUB rotation patches</a> on top.</li>\n<li>Initrd – Tell the Intel display driver about the panel orientation\nvia a kernel parameter, and force the Intel driver to load in the\ninitramfs. On NixOS:\n<code>boot.kernelParams = [\"video=DSI-1:panel_orientation=right_side_up\"];</code>\nand <code>boot.initrd.kernelModules = [\"i915\"];</code> (see Kernel docs\nfor <a href=\"https://docs.kernel.org/fb/modedb.html\">modedb default\nvideo mode support</a>)</li>\n<li>Desktop environment – For X11, good ole\n<code>xrandr --output DSI-1 --rotate right</code>. Wayland picked this\nup from the DRM connector. This one was easy.</li>\n<li>Framebuffer – Ensure all TTYs have the proper orientation by adding\n<code>fbcon=rotate:1</code> to kernel parameters\n<code>boot.kernelParams = [\"fbcon=rotate:1\"];</code> (see Kernel docs\nfor <a\nhref=\"https://docs.kernel.org/fb/fbcon.html#c-boot-options\">framebuffer\nconsole boot options</a>)</li>\n</ol>\n<p>Behold, the final result in all its glory:</p>\n<figure>\n<video autoplay loop muted loading=\"lazy\"><source src=\"https://photos.tylercipriani.com/2026-05-31_chuwi-boot-smol.mp4\" type=\"video/mp4\"></video>\n<figcaption>Non-rotated system boot. Zero Cool\'s bootscreen courtesy of <a href=\"https://github.com/mainframed/Hackers-Plymouth\"><code>mainframed/Hackers-Plymouth</code></a></figcaption>\n</figure>\n</section>\n<section id=\"size-weight-and-build\" class=\"level2\">\n<h2>Size, weight, and build</h2>\n<p>This computer is mind-bogglingly small. The build is sturdy and\ntotable; it’ll hold up to a backpack jostling.</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/20/2a52c0ab8facc8cb6d6bb6f81fe137/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 50vw\"\n           alt=\"Chuwi Minibook X with banana for scale\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Chuwi Minibook X with \"banana\" for scale</figcaption>\n  </a>\n</figure>\n<p>The laptop’s case is MacBook-esque: aluminum and good-looking. The\nMacBook Air’s dimensions dwarf the Chuwi’s, but the two laptops are\nabout the same thickness.</p>\n<figure class=\"gallery\">\n  <a href=\"https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 25vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 25vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/47/64546616494468e5901dc5289f0de7/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 25vw\"\n           alt=\"Chuwi Minibook X alongside Macbook Air\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Chuwi Minibook X alongside the Macbook Air</figcaption>\n  </a>\n  <a href=\"https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 25vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 25vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/fc/9571e3d8763d1f635423a00a5ad549/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 25vw\"\n           alt=\"Chuwi Minibook X with banana for scale\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Chuwi Minibook atop the Macbook Air</figcaption>\n  </a>\n</figure>\n<blockquote>\n<p>A notebook that weighs more than a kilo is simply not a good\nthing</p>\n<p>– <a\nhref=\"https://techcrunch.com/2012/04/19/an-interview-with-millenium-technology-prize-finalist-linus-torvalds/\">Linus\nTorvalds</a></p>\n</blockquote>\n<p>The Minibook weighs in just shy of a kilo at 912 grams.</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/43/3dd984db05dddda91ec2f1e4691652/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 50vw\"\n           alt=\"Chuwi Minibook X weights 912g\"\n           loading=\"lazy\"\n           decoding=\"async\"\n           style=\"filter: brightness(0.9);\"><!-- hard to read scale in darkmode -->\n    </picture>\n    <figcaption aria-hidden=\"true\">My Minibook X weighs 912g</figcaption>\n  </a>\n</figure>\n</section>\n<section id=\"perf-thermals-and-power\" class=\"level2\">\n<h2>Perf, thermals, and power</h2>\n<p>tl;dr: you get what you pay for. But battery life and cooling are\nbetter than I’d have guessed.</p>\n<p>The Minibook X was never going to compile the Linux kernel in record\ntime. But the performance matches the specs, it stays cool, and it has\nenough battery life to run a movie marathon.</p>\n<p>Numbers:</p>\n<ul>\n<li>Geekbench6 (a fun side-quest to get running on NixOS), better than I\n<a href=\"https://browser.geekbench.com/search?q=n150\">expected</a>.\n<ul>\n<li>Single-core: 1295</li>\n<li>Multi-core: 3332</li>\n</ul></li>\n<li>Wi-Fi 6 speed: 424 Mbps, more than enough to stream a 4K movie.</li>\n<li>Power\n<ul>\n<li>Idle: 3.8W</li>\n<li>During benchmark: ~15W</li>\n</ul></li>\n</ul>\n<p>Battery: When I left the 1995 classic film “Hackers” looping in VLC,\nthe battery lasted about 6 hours.</p>\n<p>Heat: Running <code>stress-ng</code> for 10 minutes, the hottest part\nof the laptop chassis remained below 90°F (32°C):</p>\n<figure>\n  <a href=\"https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/xlarge.jpg\">\n    <picture>\n      <source type=\"image/avif\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/small.avif 240w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/medium.avif 640w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/large.avif 1024w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/larger.avif 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <source type=\"image/webp\"\n              srcset=\"https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/small.webp 240w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/medium.webp 640w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/large.webp 1024w,\n                      https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/larger.webp 1200w\"\n              sizes=\"(max-width: 54em) 85vw, 50vw\">\n      <img src=\"https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/medium.jpg\"\n           srcset=\"https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/small.jpg 240w,\n                   https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/medium.jpg 640w,\n                   https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/large.jpg 1024w,\n                   https://photos.tylercipriani.com/thumbs/e1/ece6929d3378c0b9bff4e42c4f687d/larger.jpg 1200w\"\n           sizes=\"(max-width: 54em) 85vw, 50vw\"\n           alt=\"Chuwi Minibook X running stress-ng on thermal camera. Thermal camera reads 88.4°F\"\n           loading=\"lazy\"\n           decoding=\"async\">\n    </picture>\n    <figcaption aria-hidden=\"true\">Thermal camera view of Chuwi Minibook X running <code>stress-ng</code></figcaption>\n  </a>\n</figure>\n</section>\n<section id=\"what-i-dislike\" class=\"level2\">\n<h2>What I dislike</h2>\n<p>There’s so much to dislike about this laptop:</p>\n<ul>\n<li>Screen is terrible – 2K? 50Hz refresh rate? Why!?</li>\n<li>Keyboard is terrible – it only registers keystrokes when you hit the\nexact center of each key.</li>\n<li>Touchpad is terrible – It’s a diving board-style, without physical\nbuttons.</li>\n<li>Sound is meh – I can hear the tinny laptop speaker fine, but it’s\nunderwhelming. I’ve never tried tweaking it in Pipewire, though; it’s\npossible it could be better.</li>\n</ul>\n<p>But “terrible” is in comparison to the nicest modern laptops in\nexistence. Everything I listed here works fine. I’m honestly blown away\nwhen I tune my expectations to the sub-$400 laptop range.</p>\n</section>\n<section id=\"verdict\" class=\"level2\">\n<h2>Verdict</h2>\n<p>In <a\nhref=\"https://en.wikipedia.org/wiki/The_Death_and_Life_of_Great_American_Cities\"><em>The\nDeath and Life of Great American Cities</em></a>, Jane Jacobs wrote,\n“new ideas require old buildings”: cheap spaces let people try risky\nideas.</p>\n<p>The Chuwi Minibook X is an old building.</p>\n<p>I can brick the Minibook and have a normal Monday on my serious work\nlaptop. Nothing has to work, which makes it perfect to try out new Linux\ndesktop stuff:</p>\n<ul>\n<li>NixOS – I’ve been using Debian for 15 years+, figured I’d try\njoining the NixOS cult for a while.</li>\n<li>RiverWM – I’m on a quest to find the Wayland version of XMonad; <a\nhref=\"https://github.com/riverwm/river\">River</a> is pretty close.</li>\n<li>KDE Plasma – I’ve used a tiling window manager for over a decade.\nWhat’s it like to use a desktop that Just Works™?</li>\n<li>Steam – Never been much into games, but I decided to give Steam a\ntry since, well, why not?</li>\n</ul>\n<p>Cheap, weird computers like the Chuwi make it safe to play. And\nplaying with computers is still fun.</p>\n<figure>\n<video autoplay loop muted loading=\"lazy\"><source src=\"https://photos.tylercipriani.com/2026-05-19_chuwi-melatonin-smol.mp4\" type=\"video/mp4\"></video>\n<figcaption>Playing <a href=\"https://store.steampowered.com/app/1585220/Melatonin/\">Melatonin</a> on Steam on the Chuwi</figcaption>\n</figure>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2026/04/24/on-the-software-supply-chain-doom-spiral/",

    "title": "GitHub Actions is a trap",
    "url": "https://tylercipriani.com/blog/2026/04/24/on-the-software-supply-chain-doom-spiral/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2026-04-24T20:54:04Z",
    "date_modified": "2026-05-22T23:58:08Z",


    "content_html": "<style>.title {text-wrap:balance;} #content > p:first-child {text-wrap:balance;}</style>\n<p>Hackers are pwning packages at an exhausting clip, and GitHub Actions\nfeatures in every postmortem.</p>\n<p>In late February, a hackerbot AI<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a> yoinked the release key\nfor a single project. Within a month, fifty-ish other projects had cred\nstealers. Each infected repo swiped credentials for the next.</p>\n<p>This spate of supply-chain hacks started from a GitHub Actions trap;\na simple, bad default with a five-year-old proposed fix.</p>\n<section id=\"github-actions-and-consequences\" class=\"level2\">\n<h2>GitHub Actions and consequences</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/6f/f8ccb8fabb7987a2a2f8ae17e45d4f/large.jpg\"\nalt=\"Admiral Ackbar warning about the trap in GitHub Actions\" />\n<figcaption aria-hidden=\"true\">Admiral Ackbar warning about the trap in\nGitHub Actions</figcaption>\n</figure>\n<p>Trivy is an open-source security scanner. But if you used Trivy in\nlate March, you had a bad time.</p>\n<p>On March 19th, hackers pushed a version of Trivy that tried to\nsmuggle secrets from anywhere it ran. Trivy cited a “misconfiguration”\nin their continuous integration (CI) system, GitHub Actions.</p>\n<p>But the exploit was less a misconfiguration and more a GitHub Actions\ntrap.</p>\n<p>Here’s a simplified version of how Trivy got pwnd<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a>:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode yaml\"><code class=\"sourceCode yaml\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># INSECURE. DO NOT USE.</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">on</span><span class=\"kw\">:</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">  pull_request_target</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">jobs</span><span class=\"kw\">:</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">  </span><span class=\"fu\">check</span><span class=\"kw\">:</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">    </span><span class=\"fu\">steps</span><span class=\"kw\">:</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">      </span><span class=\"kw\">-</span><span class=\"at\"> </span><span class=\"fu\">uses</span><span class=\"kw\">:</span><span class=\"at\"> action/checkout@deadbeefdeadbeefdeadbeefdeadbeefdeadbeef</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">        </span><span class=\"fu\">with</span><span class=\"kw\">:</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">          </span><span class=\"fu\">ref</span><span class=\"kw\">:</span><span class=\"at\"> refs/pull/${{ github.event.pull_request.number }}/merge</span></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">      </span><span class=\"kw\">-</span><span class=\"at\"> </span><span class=\"fu\">uses</span><span class=\"kw\">:</span><span class=\"at\"> ./.github/actions/setup-go</span></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"at\">      </span><span class=\"kw\">-</span><span class=\"at\"> </span><span class=\"fu\">uses</span><span class=\"kw\">:</span><span class=\"at\"> some/go-static-analysis@c0ffeec0ffeec0ffeec0ffeec0ffeec0ffeec0ff</span></span></code></pre></div>\n<p>At first glance, this code looks fine:</p>\n<ul>\n<li>No secrets referenced.</li>\n<li>Third-party actions pinned to an immutable hash.</li>\n<li>Check out a pull request. Perform some static analysis.</li>\n</ul>\n<p>But this code is a verbatim antipattern from a 2021 GitHub blog post\ntitled “<a\nhref=\"https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/\">preventing\npwn requests</a>”:</p>\n<blockquote>\n<p>if the <code>pull_request_target</code> workflow only […] runs\nuntrusted code but doesn’t reference any secrets, is it still\nvulnerable?</p>\n<p>Yes it is</p>\n<p>– <a\nhref=\"https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/\">GitHub\nSecurity Lab</a></p>\n</blockquote>\n<p>The problem is <code>pull_request_target</code>:</p>\n<ul>\n<li><code>pull_request_target</code> – plunks a nice, juicy\n<code>GITHUB_TOKEN</code> into the environment.</li>\n<li><code>actions/checkout</code> – takes an optional parameter\n<code>persist-credentials</code>, which removes secrets if set to\n<code>false</code>. But the default for the parameter is\n<code>true</code>.</li>\n</ul>\n<p>Setting the <code>persist-credentials</code> parameter to\n<code>false</code> has been an open issue in GitHub Actions <a\nhref=\"https://github.com/actions/checkout/issues/485\">since\n2021</a>.</p>\n</section>\n<section id=\"your-home-is-a-crime-scene\" class=\"level2\">\n<h2>Your <code>$HOME</code> is a crime scene</h2>\n<p>Once hackers had Trivy’s keys, they published a new version of Trivy\nto steal more keys.</p>\n<p>LiteLLM used Trivy in their CI. The same CI they used to publish code\nto PyPI, the Python software registry. When LiteLLM’s CI ran the\ncompromised Trivy, hackers nabbed their publishing key.</p>\n<p>And on March 24th, when Callum McMahon fired up his IDE, his MacBook\nfroze. And that’s how he discovered <a\nhref=\"https://futuresearch.ai/blog/no-prompt-injection-required/\">the\nLiteLLM hijack</a>.</p>\n<p>McMahon’s MacBook was flailing at bad code that hackers snuck into\nLiteLLM. And the bad code trying to steal credentials:</p>\n<ul>\n<li><code>~/.netrc</code></li>\n<li><code>~/.aws/credentials</code></li>\n<li><code>~/.config/gcloud</code></li>\n<li><code>~/.config/gh</code></li>\n<li><code>~/.azure</code></li>\n<li><code>~/.docker/config.json</code></li>\n<li><code>~/.npmrc</code></li>\n<li><code>~/.git-credentials</code></li>\n<li><code>~/.kube/</code></li>\n</ul>\n<p>Files that are typically strewn around <code>$HOME</code>\ndirectories, full of tokens and keys, often unencrypted.</p>\n</section>\n<section id=\"ai-and-the-supply-chain-doom-spiral\" class=\"level2\">\n<h2>AI and the supply chain doom spiral</h2>\n<p>We’ve dealt with problems like unencrypted credentials, unpinned\ndependencies, and CI footguns forever.</p>\n<p>But AI has accelerated <em>everything</em>, including repeating\nsecurity mistakes.</p>\n<p>On the day of the Trivy compromise, I asked Claude, “how do I scan\ndocker registry images for security vulnerabilities?”</p>\n<p>The reply, in part:</p>\n<pre><code>CI/CD Integration Example (GitHub Actions with Trivy)\n\n    - name: Scan image for vulnerabilities\n      uses: aquasecurity/trivy-action@master</code></pre>\n<p>Broken in two ways:</p>\n<ol type=\"1\">\n<li>Unpinned references – <code>master</code> is a reference that\nchanges all the time. If hackers zombify the repo, I’d be the first\nvictim.</li>\n<li>Active vulnerability – No mention whatsoever of the <a\nhref=\"https://nvd.nist.gov/vuln/detail/CVE-2026-33634\">CVE</a> posted\nthat day. I never asked, so Claude never checked.</li>\n</ol>\n<p>Meanwhile, Vercel’s CEO has attributed his company’s recent data\nbreach to a hacker that was “<a\nhref=\"https://nitter.net/rauchg/status/2045995362499076169\">accelerated\nby AI</a>.” And Anthropic’s latest hype tour includes <a\nhref=\"https://www.theguardian.com/technology/2026/apr/10/us-summoned-bank-bosses-to-discuss-cyber-risks-posed-by-anthropic-latest-ai-model\">briefing\nthe US Federal Reserve Chair</a> about vulnerabilities unearthed by\ntheir frontier model.</p>\n<p>Bad guys with LLMs get superpowers. Good guys with LLMs fall prey to\nmid-2010’s CI problems.</p>\n<p>And the same tool that can root out <a\nhref=\"https://red.anthropic.com/2026/mythos-preview/#ftnt_ref4\">27-year-old\nsecurity problems in OpenBSD</a>, will still tell you to pin your GitHub\nactions to <code>@master</code>.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Or somone calling themselves\n<code>hackerbot-claw</code>, at any rate.<a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>My GitHub Actions example is a\nsimpler verison of the action removed in <a\nhref=\"https://github.com/aquasecurity/trivy/pull/10259\">aquasecurity/trivy\n#10259</a>.<a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2025/08/15/git-lfs/",

    "title": "The future of large files in Git is Git",
    "url": "https://tylercipriani.com/blog/2025/08/15/git-lfs/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2025-08-15T19:55:33Z",
    "date_modified": "2025-08-15T20:05:00Z",


    "content_html": "<style>.title {text-wrap:balance;} #content > p:first-child {text-wrap:balance;}</style>\n<p>If Git had a nemesis, it’d be large files.</p>\n<p>Large files bloat Git’s storage, slow down <code>git clone</code>,\nand wreak havoc on Git forges.</p>\n<p>In 2015, GitHub released Git LFS—a Git extension that hacked around\nproblems with large files. But Git LFS added new complications and\nstorage costs.</p>\n<p>Meanwhile, the Git project has been quietly working on large files.\nAnd while LFS ain’t dead yet, the latest Git release shows the path\ntowards a future where LFS is, finally, obsolete.</p>\n<section\nid=\"what-you-can-do-today-replace-git-lfs-with-git-partial-clone\"\nclass=\"level2\">\n<h2>What you can do today: replace Git LFS with Git partial clone</h2>\n<p>Git LFS works by storing large files outside your repo.</p>\n<p>When you clone a project via LFS, you get the repo’s history and\nsmall files, but skip large files. Instead, Git LFS downloads only the\nlarge files you need for your working copy.</p>\n<p>In 2017, the Git project introduced <strong>partial clones</strong>\nthat provide the same benefits as Git LFS:</p>\n<blockquote>\n<p>Partial clone allows us to avoid downloading [large binary assets]\n<em>in advance</em> during clone and fetch operations and thereby reduce\ndownload times and disk usage.</p>\n<p>– Partial Clone Design Notes, <a\nhref=\"https://git-scm.com/docs/partial-clone\">git-scm.com</a></p>\n</blockquote>\n<p>Git’s partial clone and LFS both make for:</p>\n<ol type=\"1\">\n<li><strong>Small checkouts</strong> – On clone, you get the latest copy\nof big files instead of <strong>every</strong> copy.</li>\n<li><strong>Fast clones</strong> – Because you avoid downloading large\nfiles, each clone is fast.</li>\n<li><strong>Quick setup</strong> – Unlike shallow clones, you get the\nentire history of the project—you can get to work right away.</li>\n</ol>\n<p><strong>What is a partial clone?</strong></p>\n<p>A Git partial clone is a clone with a <code>--filter</code>.</p>\n<p>For example, to avoid downloading files bigger than 100KB, you’d\nuse:</p>\n<pre><code>git clone --filter=&#39;blobs:size=100k&#39; &lt;repo&gt;</code></pre>\n<p>Later, Git will lazily download any files over 100KB you need for\nyour checkout.</p>\n<p>By default, if I <code>git clone</code> a repo with many revisions of\na noisome 25 MB PNG file, then cloning is slow and the checkout is\nobnoxiously large:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> time git clone https://github.com/thcipriani/noise-over-git</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Cloning</span> into <span class=\"st\">&#39;/tmp/noise-over-git&#39;</span>...</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">...</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Receiving</span> objects: 100% <span class=\"er\">(</span><span class=\"ex\">153/153</span><span class=\"kw\">)</span><span class=\"ex\">,</span> 1.19 GiB</span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">real</span>    3m49.052s</span></code></pre></div>\n<p>Almost four minutes to check out a single 25MB file!</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> du <span class=\"at\">--max-depth</span><span class=\"op\">=</span>0 <span class=\"at\">--human-readable</span> noise-over-git/.</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1.3G</span>    noise-over-git/.</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ^ 🤬</span></code></pre></div>\n<p>And 50 revisions of that single 25MB file eat 1.3GB of space.</p>\n<p>But a partial clone side-steps these problems:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git config <span class=\"at\">--global</span> alias.pclone <span class=\"st\">&#39;clone --filter=blob:limit=100k&#39;</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> time git pclone https://github.com/thcipriani/noise-over-git</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Cloning</span> into <span class=\"st\">&#39;/tmp/noise-over-git&#39;</span>...</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">...</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Receiving</span> objects: 100% <span class=\"er\">(</span><span class=\"ex\">1/1</span><span class=\"kw\">)</span><span class=\"ex\">,</span> 24.03 MiB</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">real</span>    0m6.132s</span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> du <span class=\"at\">--max-depth</span><span class=\"op\">=</span>0 <span class=\"at\">--human-readable</span> noise-over-git/.</span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">49M</span>     noise-over-git/</span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ^ 😻 <span class=\"er\">(</span><span class=\"ex\">the</span> same size as a git lfs checkout<span class=\"kw\">)</span></span></code></pre></div>\n<p>My filter made cloning 97% faster (3m 49s → 6s), and it reduced my\ncheckout size by 96% (1.3GB → 49M)!</p>\n<p>But there are still some caveats here.</p>\n<p>If you run a command that needs data you filtered out, Git will need\nto make a trip to the server to get it. So, commands like\n<code>git diff</code>, <code>git blame</code>, and\n<code>git checkout</code> will require a trip to your Git host to\nrun.</p>\n<p>But, for large files, this is the same behavior as Git LFS.</p>\n<p>Plus, I can’t remember the last time I ran <code>git blame</code> on\na PNG 🙃.</p>\n</section>\n<section id=\"why-go-to-the-trouble-whats-wrong-with-git-lfs\"\nclass=\"level2\">\n<h2>Why go to the trouble? What’s wrong with Git LFS?</h2>\n<p>Git LFS foists Git’s problems with large files onto users.</p>\n<p>And the problems are significant:</p>\n<ul>\n<li><strong>🖕 High vendor lock-in</strong> – When GitHub wrote Git LFS,\nthe other large file systems—Git Fat, Git Annex, and Git Media—were\nagnostic about the server-side. But GitHub locked users to their\nproprietary server implementation and charged folks to use it.<a\nhref=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></li>\n<li><strong>💸 Costly</strong> – GitHub won because it let users host\nrepositories for free. But Git LFS started as a paid product. Nowadays,\nthere’s a free tier, but you’re dependent on the whims of GitHub to set\npricing. Today, a 50GB repo on GitHub will cost $40/year for storage. In\ncontrast, storing 50GB on Amazon’s S3 standard storage is $13/year.</li>\n<li><strong>😰 Hard to undo</strong> – Once you’ve moved to Git LFS,\nit’s impossible to undo the move without rewriting history.</li>\n<li><strong>🌀 Ongoing set-up costs</strong> – All your collaborators\nneed to install Git LFS. Without Git LFS installed, your collaborators\nwill get confusing, metadata-filled text files instead of the large\nfiles they expect.</li>\n</ul>\n</section>\n<section id=\"the-future-git-large-object-promisors\" class=\"level2\">\n<h2>The future: Git large object promisors</h2>\n<p>Large files create problems for Git forges, too.</p>\n<p>GitHub and GitLab put limits on file size<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a>\nbecause big files cost more money to host. Git LFS keeps server-side\ncosts low by offloading large files to CDNs.</p>\n<p>But the Git project has a new solution.</p>\n<p>Earlier this year, Git merged a new feature: <strong>large object\npromisers</strong>. Large object promisors aim to provide the same\nserver-side benefits as LFS, minus the hassle to users.</p>\n<blockquote>\n<p>This effort aims to especially improve things on the server side, and\nespecially for large blobs that are already compressed in a binary\nformat.</p>\n<p>This effort aims to provide an alternative to Git LFS</p>\n<p>– Large Object Promisors, <a\nhref=\"https://git-scm.com/docs/large-object-promisors\">git-scm.com</a></p>\n</blockquote>\n<p><strong>What is a large object promisor?</strong></p>\n<p>Large object promisors are special Git remotes that only house large\nfiles.</p>\n<p>In the bright, shiny future, large object promisors will work like\nthis:</p>\n<ol type=\"1\">\n<li>You push a large file to your Git host.</li>\n<li>In the background, your Git host offloads that large file to a large\nobject promisor.</li>\n<li>When you clone, the Git host tells your Git client about the\npromisor.</li>\n<li>Your client will clone from the Git host, and automagically nab\nlarge files from the promisor remote.</li>\n</ol>\n<p>But we’re still a ways off from that bright, shiny future.</p>\n<p>Git large object promisors are still a work in progress. Pieces of\nlarge object promisors merged to Git in <a\nhref=\"https://lore.kernel.org/git/xmqqfrjfilc8.fsf@gitster.g/\">March of\n2025</a>. But there’s <a\nhref=\"https://gitlab.com/groups/gitlab-org/-/epics/9094\">more to do</a>\nand <a href=\"https://gitlab.com/groups/gitlab-org/-/epics/15972\">open\nquestions</a> yet to answer.</p>\n<p>And so, for today, you’re stuck with Git LFS for giant files. But\nonce large object promisors see broad adoption, maybe GitHub will let\nyou push files bigger than 100MB.</p>\n</section>\n<section id=\"the-future-of-large-files-in-git-is-git.\" class=\"level2\">\n<h2>The future of large files in Git is Git.</h2>\n<p>The Git project is thinking hard about large files, so you don’t have\nto.</p>\n<p>Today, we’re stuck with Git LFS.</p>\n<p>But soon, the only obstacle for large files in Git will be your\nhalf-remembered, ominous hunch that it’s a bad idea to stow your MP3\nlibrary in Git.</p>\n<hr style=\"margin-top: 3em;\" />\n<div style=\"margin: 1em auto;\">\n<p>Edited by <a href=\"https://refactoringenglish.com/\">Refactoring\nEnglish</a></p>\n</div>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Later, other Git forges made their <a\nhref=\"https://about.gitlab.com/blog/towards-a-production-quality-open-source-git-lfs-server/\">own\nLFS servers</a>. Today, you can push to multiple Git forges or use an\nLFS transfer agent, but all this makes set up harder for contributors.\nYou’re pretty much locked-in unless you put in extra effort to get\nunlocked.<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>File size limits: <a\nhref=\"https://docs.github.com/en/repositories/working-with-files/managing-large-files/about-large-files-on-github\">100MB\nfor GitHub</a>, <a\nhref=\"https://docs.gitlab.com/user/gitlab_com/#account-and-limit-settings\">100MB\nfor GitLab.com</a><a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2025/05/21/git-commits/",

    "title": "Per-project git commit templates",
    "url": "https://tylercipriani.com/blog/2025/05/21/git-commits/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2025-05-21T19:22:45Z",
    "date_modified": "2025-06-02T23:05:20Z",


    "content_html": "<blockquote>\n<p>People should try to compare the quality of the kernel git logs with\nsome other projects, and cry themselves to sleep.</p>\n<p>– Linus Torvalds</p>\n</blockquote>\n<p>I’ll never remember your project’s commit guidelines.</p>\n<p>Every project insists on something different:</p>\n<ul>\n<li><a\nhref=\"https://www.conventionalcommits.org/en/v1.0.0/\">Conventional\ncommits</a></li>\n<li><a\nhref=\"https://zeromq.org/how-to-contribute/#write-good-commit-messages\">Problem/Solution\nformat</a></li>\n<li><a href=\"https://gitmoji.dev/\">Gitmoji</a></li>\n<li>The twisty maze of <a\nhref=\"https://docs.kernel.org/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by\">trailers\nin the Linux Kernel</a></li>\n</ul>\n<p>But <a\nhref=\"https://git-scm.com/docs/git-config#Documentation/git-config.txt-codecommittemplatecode\">git\ncommit templates</a> help. Commit templates provide a scaffold for\ncommit messages, offering documentation where you need it: inside the\neditor where you’re writing your commit message.</p>\n<section id=\"what-is-a-git-commit-template\" class=\"level2\">\n<h2>What is a git commit template?</h2>\n<p>When you type <code>git commit</code>, git pops open your text\neditor<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>. Git can pre-fill your editor with a\ncommit template—it’s like a form you fill out.</p>\n<p>Creating a commit template is simple.</p>\n<ul>\n<li>Create a plaintext file – mine lives at\n<code>~/.config/git/message.txt</code></li>\n<li>Tell git to use it:</li>\n</ul>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> config <span class=\"at\">--global</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    commit.template <span class=\"st\">&#39;~/.config/git/message.txt&#39;</span></span></code></pre></div>\n<p><a\nhref=\"https://gist.github.com/thcipriani/5e79a11b69b66a493249bac1439bfe02\">My\ndefault template</a> packs everything I know about writing a commit.</p>\n</section>\n<section id=\"project-specific-templates-with-includeif\" class=\"level2\">\n<h2>Project-specific templates with <code>IncludeIf</code></h2>\n<p>The real magic of commit templates is you can have different\ntemplates for each project.</p>\n<p>Different projects can use different templates with git’s\n<code>includeIf</code> configuration setting.<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a></p>\n<p>Large projects, such as <a\nhref=\"https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/SubmittingPatches?id=4e8a2372f9255a1464ef488ed925455f53fbdaa1\">the\nLinux kernel</a>, <a\nhref=\"https://git-scm.com/docs/SubmittingPatches#describe-changes\">git</a>,\nand <a\nhref=\"https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines\">MediaWiki</a>,\nhave their own commit guidelines.</p>\n<p>For Wikimedia work, I stow git repos in\n<code>~/Projects/Wikimedia</code> and at the bottom of my global git\nconfig (<code>~/.config/git/config</code>) I have:</p>\n<pre><code>[includeIf &quot;gitdir:~/Projects/Wikimedia/**&quot;]\n    path = ~/.config/git/config.wikimedia</code></pre>\n<p>In <code>config.wikimedia</code>, I point to my Wikimedia-specific\ncommit template. I also override other git config settings like my\n<code>user.email</code> or <code>core.hooksPath</code>.</p>\n</section>\n<section id=\"an-example-my-global-template\" class=\"level2\">\n<h2>An example: my global template</h2>\n<p>My default commit template contains three sections:</p>\n<ol type=\"1\">\n<li>Subject – 50 characters or less, capitalized, no end\npunctuation.</li>\n<li>Body – Wrap at 72 characters with a blank line separating it from\nthe subject.</li>\n<li>Trailers – Standard formats with a blank line separating them from\nthe body.</li>\n</ol>\n<p>In each section, I added pointers for both format<a href=\"https://tylercipriani.com/blog/#fn3\"\nclass=\"footnote-ref\" id=\"fnref3\" role=\"doc-noteref\"><sup>3</sup></a> and\ncontent.</p>\n<p>For the header, the guidance is quick:</p>\n<pre><code>\n# 50ch. wide ----------------------------- SUBJECT\n#                                                |\n#     &quot;If applied, this commit will...&quot;          |\n#                                                |\n#     Change / Add / Fix                         |\n#     Remove / Update / Document                 |\n#                                                |\n# ------- ↓ LEAVE BLANK LINE ↓ ---------- /SUBJECT\n</code></pre>\n<p>For the body, I remind myself to answer basic questions:</p>\n<pre><code># 72ch. wide ------------------------------------------------------ BODY\n#                                                                      |\n#     - Why should this change be made?                                |\n#       - What problem are you solving?                                |\n#       - Why this solution?                                           |\n#     - What&#39;s wrong with the current code?                            |\n#     - Are there other ways to do it?                                 |\n#     - How can the reviewer confirm it works?                         |\n#                                                                      |</code></pre>\n<p>And that’s it, except for git trailers.</p>\n</section>\n<section id=\"the-twisty-maze-of-git-trailers\" class=\"level2\">\n<h2>The twisty maze of git trailers</h2>\n<p>My template has a section for trailers used by the projects I work\non.</p>\n<pre><code>#     TRAILERS                                                         |\n#     --------                                                         |\n#     (optional) Uncomment as needed.                                  |\n#     Leave a blank line before the trailers.                          |\n#                                                                      |\n# Bug: #xxxx\n# Acked-by: Example User &lt;user@example.com&gt;\n# Cc: Example User &lt;user@example.com&gt;\n# Co-Authored-by: Example User &lt;user@example.com&gt;\n# Requested-by: Example User &lt;user@example.com&gt;\n# Reported-by: Example User &lt;user@example.com&gt;\n# Reviewed-by: Example User &lt;user@example.com&gt;\n# Suggested-by: Example User &lt;user@example.com&gt;\n# Tested-by: Example User &lt;user@example.com&gt;\n# Thanks: Example User &lt;user@example.com&gt;</code></pre>\n<p>These trailers serve as useful breadcrumbs of documentation. Git can\nparse them using standard commands.</p>\n<p>For example, if I wanted a tab-separated list of commits and their\nrelated tasks, I could find <code>Bug</code> trailers using\n<code>git log</code>:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> TAB=%x09</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> BUG_TRAILER=<span class=\"st\">&#39;%(trailers:key=Bug,valueonly=true,separator=%x2C )&#39;</span></span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> SHORT_HASH=%h</span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> SUBJ=%s</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> FORMAT=<span class=\"st\">&quot;</span><span class=\"va\">${SHORT_HASH}${TAB}${BUG_TRAILER}${TAB}${SUBJ}</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git log <span class=\"at\">--topo-order</span> <span class=\"at\">--no-merges</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"at\">--format</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$FORMAT</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb6-8\"><a href=\"https://tylercipriani.com/blog/#cb6-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">d2b09deb12f</span>     T359762 Rewrite Kurdish <span class=\"er\">(</span><span class=\"ex\">ku</span><span class=\"kw\">)</span> <span class=\"ex\">Latin</span> to Arabic converter</span>\n<span id=\"cb6-9\"><a href=\"https://tylercipriani.com/blog/#cb6-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">28123a6a262</span>     T332865 tests: Remove non-static fallback in HookRunnerTestBase</span>\n<span id=\"cb6-10\"><a href=\"https://tylercipriani.com/blog/#cb6-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">4e919a307a4</span>     T328919 tests: Remove unused argument from data provider in PageUpdaterTest</span>\n<span id=\"cb6-11\"><a href=\"https://tylercipriani.com/blog/#cb6-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">bedd0f685f9</span>             objectcache: Improve <span class=\"kw\">`</span><span class=\"fu\">RESTBagOStuff::handleError()</span><span class=\"kw\">`</span></span>\n<span id=\"cb6-12\"><a href=\"https://tylercipriani.com/blog/#cb6-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">2182a0c4490</span>     T393219 tests: Remove two data provider in RestStructureTest</span></code></pre></div>\n</section>\n<section id=\"stop-remembering-commit-message-guidelines\" class=\"level2\">\n<h2>Stop remembering commit message guidelines</h2>\n<p>Git commit templates free your brain from remembering what to write,\nallowing you to focus on the story you need to tell.</p>\n<p>Save your brain for what it’s good at.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Starting with\n<code>core.editor</code> in your git config, <code>$VISUAL</code> or\n<code>$EDITOR</code> in your shell, finally falling back to\n<code>vi</code>.<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>You could also set it inside a repo’s\n<code>.git/config</code>, <code>includeIf</code> is useful if you have\nmultiple repos with the same standards under one directory.<a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p>All cribbed from <a\nhref=\"https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html\">Tim\nPope</a><a href=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2025/03/05/boox-go-10-3-review/",

    "title": "Boox Go 10.3, two months in",
    "url": "https://tylercipriani.com/blog/2025/03/05/boox-go-10-3-review/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2025-03-05T03:41:36Z",
    "date_modified": "2025-03-13T23:11:42Z",


    "content_html": "<blockquote>\n<p>[The] Linux kernel uses GPLv2, and if you distribute GPLv2 code, you\nhave to provide a copy of the source (and modifications) <em>once\nsomeone asks for it</em>. And now I’m asking nicely for you to do so\n🙂</p>\n<p>– Joga, <a\nhref=\"https://archive.is/HP2Qk\">bbs.onyx-international.com</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/01/0c363d3da2755ee421a393d908b697/large.jpg\"\nalt=\"Boox in split screen, typewriter mode\" />\n<figcaption aria-hidden=\"true\">Boox in split screen, typewriter\nmode</figcaption>\n</figure>\n<p>In January, I bought a Boox Go 10.3—a 10.3-inch, 300-ppi, e-ink\nAndroid tablet.</p>\n<p>After two months, I use the Boox daily—it’s replaced my planner,\nnotebook, countless PDF print-offs, and the good parts of my phone.</p>\n<p>But Boox’s parent company, Onyx, is sketchy.</p>\n<p>I’m conflicted. The Boox Go is a beautiful, capable tablet that I use\nevery day, but I recommend avoiding as long as Onyx continues to\ndisregard the rights of its users.</p>\n<section id=\"how-im-using-my-boox\" class=\"level2\">\n<h2>How I’m using my Boox</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/f3/63eee65c63696d95c13156cd9f67ab/large.jpg\"\nalt=\"My e-ink floor desk\" />\n<figcaption aria-hidden=\"true\">My e-ink floor desk</figcaption>\n</figure>\n<p>Each morning, I plop down in front of my <a\nhref=\"https://www.amazon.com/MagicHold-Rotating-Height-Adjusting-13-15-6/dp/B01MG1EWPQ?th=1\">MagicHold</a>\nlaptop stand and journal on my Boox with Obsidian.</p>\n<p>I use Syncthing to back up my planner and sync my <a\nhref=\"https://www.zotero.org/\">Zotero</a> library between my Boox and\nlaptop.</p>\n<p>In the evening, I review my <a\nhref=\"https://mirzakhani.io/products/zen-planner-2025\">PDF planner</a>\nand plot for tomorrow.</p>\n<p>I use these apps:</p>\n<ul>\n<li><strong>Obsidian</strong> – a markdown editor that syncs between all\nmy devices with no fuss for $8/mo.</li>\n<li><strong>Syncthing</strong> – I love Syncthing—it’s an encrypted,\ncontinuous file sync-er without a centralized server.</li>\n<li><strong>Meditation apps</strong><a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a> – Guided meditation away\nfrom the blue light glow of my phone or computer is better.</li>\n</ul>\n<p>Before buying the Boox, I considered a reMarkable.</p>\n<p>The <a\nhref=\"https://remarkable.com/store/remarkable-paper/pro\">reMarkable\nPaper Pro</a> has a beautiful color screen with a frontlight, a nice\npen, and a “<a\nhref=\"https://remarkable.com/store/remarkable-2/type-folio\">type\nfolio</a>,” plus it’s <a\nhref=\"https://www.calmtech.institute/products\">certified by the Calm\nTech Institute</a>.</p>\n<p>But the reMarkable is a distraction-free e-ink tablet. Meanwhile, I\nneed <em>distraction-lite</em>.</p>\n</section>\n<section id=\"what-i-like\" class=\"level2\">\n<h2>What I like</h2>\n<ul>\n<li><strong>Calm(ish) technology</strong> – The Boox is an intentional\ndevice. Browsing the internet, reading emails, and watching videos is\nhard, but that’s good.</li>\n<li><strong>Apps</strong> – Google Play works out of the box. I can\ninstall F-Droid and change my launcher without difficulty.</li>\n<li><strong>Split screen</strong> – The built-in launcher has a split\nscreen feature. I use it to open a PDF side-by-side with a notes\ndoc.</li>\n<li><strong>Reading</strong> – The screen is a 300ppi Carta 1200, making\ntext crisp and clear.</li>\n</ul>\n</section>\n<section id=\"what-i-dislike\" class=\"level2\">\n<h2>What I dislike</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/10/733dfc26554fb3363483cf306f2d5a/large.jpg\"\nalt=\"I filmed myself typing at 240fps, each frame is 4.17ms. Boox’s typing latency is between 150ms and 275ms at the fastest refresh rate inside Obsidian.\" />\n<figcaption aria-hidden=\"true\">I filmed myself typing at 240fps, each\nframe is 4.17ms. Boox’s typing latency is between 150ms and 275ms at the\nfastest refresh rate inside Obsidian.</figcaption>\n</figure>\n<ul>\n<li><strong>Typing</strong> – Typing latency is noticeable.\n<ul>\n<li>At Boox’s highest refresh rate, after hitting a key, text takes\nbetween 150ms to 275ms to appear.</li>\n<li>I can still type, though it’s distracting at times.</li>\n</ul></li>\n</ul>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/67/b6fd836c59e5ecd6aa429d5fda4ab6/large.jpg\"\nalt=\"The horror of the default pen\" />\n<figcaption aria-hidden=\"true\">The horror of the default\npen</figcaption>\n</figure>\n<ul>\n<li><strong>Accessories</strong>\n<ul>\n<li><strong>Pen</strong> – The default pen looks like a child’s\nwhiteboard marker and feels cheap. I replaced it with the <a\nhref=\"https://www.amazon.com/Amazon-Kindle-Scribe-Premium-Improved/dp/B0D2FBN1W8/\">Kindle\nScribe Premium pen</a>, and the writing experience is vastly\nimproved.</li>\n<li><strong>Cover</strong> – It’s impossible to find a nice cover. I’m\nusing a $15 cover that I’m encasing in stickers.</li>\n</ul></li>\n<li><strong>Tool switching</strong> – Swapping between apps is slow and\nclunky. I blame Android and the current limitations of e-ink more than\nBoox.</li>\n<li><strong>No frontlight</strong> – The Boox’s lack of frontlight\nprevents me from reading more with it. I knew this when I bought my\nBoox, but devices with frontlights seem to make other compromises.</li>\n</ul>\n<p><strong>Onyx</strong></p>\n<p>The Chinese company behind Boox, Onyx International, Inc., runs the\nservers where the Boox routes telemetry. I block this traffic with <a\nhref=\"https://pi-hole.net/\">Pi-Hole</a><a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2025-03-04_boox-telemetry.png\"\nalt=\"pihole-ing whatever telemetry Boox collects\" />\n<figcaption aria-hidden=\"true\">pihole-ing whatever telemetry Boox\ncollects</figcaption>\n</figure>\n<p>I inspected this traffic via <a href=\"https://mitmproxy.org/\">Mitm\nproxy</a>—most traffic was benign, though I never opted into sending any\ntelemetry (nor am I logged in to a Boox account). But it’s also an\nAndroid device, so it’s feeding telemetry into Google’s gaping maw,\ntoo.</p>\n<p>Worse, <a href=\"https://archive.is/HP2Qk\">Onyx is flouting the terms\nof the GNU Public License</a>, declining to release Linux kernel\nmodifications to users. This is anathema to me—<a\nhref=\"https://www.gnu.org/licenses/gpl-violation.en.html\">GPL\nviolations</a> are tantamount to theft.</p>\n<p>Onyx’s disregard for user rights makes me regret buying the Boox.</p>\n</section>\n<section id=\"verdict\" class=\"level2\">\n<h2>Verdict</h2>\n<p>I’ll continue to use the Boox and feel bad about it. I hope my\ndigging in this post will help the next person.</p>\n<p>Unfortunately, the e-ink tablet market is too niche to support the\nkind of solarpunk future I’d always imagined.</p>\n<p>But there’s an opportunity for an open, Linux-based tablet to\ndominate e-ink. Linux is playing catch-up on phones with PostmarketOS.\nMeanwhile, the best e-ink tablets have to offer are old, unupdateable\nversions of Android, like the OS on the Boox.</p>\n<p>In the future, I’d love to pay a license- and privacy-respecting\ncompany for beautiful, calm technology and recommend their product to\neveryone. But today is not the future.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>I go back and forth between “Waking\nUp” and “Calm”<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>Using <a\nhref=\"https://github.com/JordanEJ/Onyx-Boox-Blocklist\">github.com/JordanEJ/Onyx-Boox-Blocklist</a><a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/10/24/plain-text-accounting/",

    "title": "Eventually consistent plain text accounting",
    "url": "https://tylercipriani.com/blog/2024/10/24/plain-text-accounting/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2024-10-24T00:37:44Z",
    "date_modified": "2024-11-13T02:16:50Z",


    "content_html": "<style>.title { text-wrap: balance }</style>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2024-11-08_expenses.png\"\nalt=\"Spending for October, generated by piping hledger → R\" />\n<figcaption aria-hidden=\"true\">Spending for October, generated by piping\nhledger → R</figcaption>\n</figure>\n<p>Over the past six months, I’ve tracked my money with <a\nhref=\"https://hledger.org/\"><code>hledger</code></a>—a plain text\ndouble-entry accounting system written in Haskell. It’s been\nsurprisingly painless.</p>\n<p>My previous attempts to pick up <em>real</em> accounting tools\nfloundered. Hosted tools are privacy nightmares, and my stint with <a\nhref=\"https://gnucash.org/\">GnuCash</a> didn’t last.</p>\n<p>But after stumbling on Dmitry Astapov’s “<a\nhref=\"https://github.com/adept/full-fledged-hledger/wiki/\">Full-fledged\n<code>hledger</code></a>” wiki<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>, it\nclicked—<strong>eventually consistent</strong> accounting. Instead of\nmodeling your money all at once, take it one hacking session at a\ntime.</p>\n<blockquote>\n<p>It should be easy to work towards eventual consistency. […] I should\nbe able to [add financial records] bit by little bit, leaving things\nhalf-done, and picking them up later with little (mental) effort.</p>\n<p>– Dmitry Astapov, Full-Fledged Hledger</p>\n</blockquote>\n<section id=\"principles-of-my-system\" class=\"level2\">\n<h2>Principles of my system</h2>\n<p>I’ve cobbled together a system based on these principles:</p>\n<ul>\n<li><strong>Avoid manual entry</strong> – Avoid typing in each\ntransaction. Instead, rely on CSVs from the bank.</li>\n<li><strong>CSVs as truth</strong> – CSVs are the only things that\nmatter. Everything else can be blown away and rebuilt anytime.</li>\n<li><strong>Embrace version control</strong> – Keep everything under\nversion control in Git for easy comparison and safe\nexperimentation.</li>\n</ul>\n</section>\n<section id=\"learn-hledger-in-five-minutes\" class=\"level2\">\n<h2>Learn <code>hledger</code> in five minutes</h2>\n<p><code>hledger</code> concepts are heady, but its use is simple. I\ndivide the core concepts into two categories:</p>\n<ul>\n<li>Stuff <code>hledger</code> cares about:\n<ul>\n<li><strong>Transactions</strong> – how <code>hledger</code> moves money\nbetween accounts.</li>\n<li><strong>Journal files</strong> – files full of transactions</li>\n</ul></li>\n<li>Stuff I care about:\n<ul>\n<li><strong>Rules files</strong> – how I set up accounts, import CSVs,\nand move money between accounts.</li>\n<li><strong>Reports</strong> – help me see where my money is going and\nif I messed up my rules.</li>\n</ul></li>\n</ul>\n<p><strong>Transactions</strong> move money between accounts:</p>\n<pre><code>2024-01-01 Payday\n    income:work      $-100.00\n    assets:checking   $100.00</code></pre>\n<p>This transaction shows that on Jan 1, 2024, money moved from\n<code>income:work</code> into <code>assets:checking</code>—Payday.</p>\n<p>The sum of each transaction should be $0. Money comes from somewhere,\nand the same amount goes somewhere else—double-entry accounting. This is\npowerful technology—it makes mistakes impossible to ignore.</p>\n<p><strong>Journal files</strong> are text files containing one or more\ntransactions:</p>\n<pre><code>2024-01-01 Payday\n    income:work              $-100.00\n    assets:checking           $100.00\n2024-01-02 QUANSHENG UVK5\n    assets:checking          $-29.34\n    expenses:fun:radio        $29.34</code></pre>\n<p><strong>Rules files</strong> transform CSVs into journal files via\nregex matching.</p>\n<p>Here’s a CSV from my bank:</p>\n<pre><code>Transaction Date,Description,Category,Type,Amount,Memo\n09/01/2024,DEPOSIT Paycheck,Payment,Payment,1000.00,\n09/04/2024,PizzaPals Pizza,Food &amp; Drink,Sale,-42.31,\n09/03/2024,Amazon.com*XXXXXXXXY,Shopping,Sale,-35.56,\n09/03/2024,OBSIDIAN.MD,Shopping,Sale,-10.00,\n09/02/2024,Amazon web services,Personal,Sale,-17.89,</code></pre>\n<p>And here’s a <code>checking.rules</code> to transform that CSV into a\njournal file so I can use it with <code>hledger</code>:</p>\n<pre><code># checking.rules\n# --------------\n# Map CSV fields → hledger fields[0]\nfields date,description,category,type,amount,memo,_\n# `account1`: the account for the whole CSV.[1]\naccount1    assets:checking\naccount2    expenses:unknown\nskip 1\n\ndate-format %m/%d/%Y\ncurrency $\n\nif %type Payment\n    account2 income:unknown\nif %category Food &amp; Drink\n    account2 expenses:food:dining\n\n# [0]: &lt;https://hledger.org/hledger.html#field-names&gt;\n# [1]: &lt;https://hledger.org/hledger.html#account-field&gt;</code></pre>\n<p>With these two files (<code>checking.rules</code> and\n<code>2024-09_checking.csv</code>), I can make the CSV into a\njournal:</p>\n<pre><code>$ &gt; 2024-09_checking.journal \\\n    hledger print \\\n    --rules-file checking.rules \\\n    -f 2024-09_checking.csv\n$ head 2024-09_checking.journal\n2024-09-01 DEPOSIT Paycheck\n    assets:checking        $1000.00\n    income:unknown        $-1000.00\n\n2024-09-02 Amazon web services\n    assets:checking          $-17.89\n    expenses:unknown          $17.89</code></pre>\n<p><strong>Reports</strong> are interesting ways to view transactions\nbetween accounts.</p>\n<p>There are registers, balance sheets, and income statements:</p>\n<pre><code>$ hledger incomestatement \\\n    --depth=2 \\\n    --file=2024-09_bank.journal\n\nRevenues:\n               $1000.00 income:unknown\n-----------------------\n               $1000.00\n\n\nExpenses:\n                 $42.31 expenses:food\n                 $63.45 expenses:unknown\n-----------------------\n                $105.76\n-----------------------\nNet:            $894.24</code></pre>\n<p>At the beginning of September, I spent <code>$105.76</code> and made\n<code>$1000</code>, leaving me with <code>$894.24</code>.</p>\n<p>But a good chunk is going to the default expense account,\n<code>expenses:unknown</code>. I can use the\n<code>hleger aregister</code> to see what those transactions are:</p>\n<pre><code>$ hledger areg expenses:unknown \\\n    --file=2024-09_checking.journal \\\n    -O csv | \\\n  csvcut -c description,change | \\\n  csvlook\n| description              | change |\n| ------------------------ | ------ |\n| OBSIDIAN.MD              |  10.00 |\n| Amazon web services      |  17.89 |\n| Amazon.com*XXXXXXXXY     |  35.56 |\nl</code></pre>\n<p>Then, I can add some more rules to my\n<code>checking.rules</code>:</p>\n<pre><code>if OBSIDIAN.MD\n    account2 expenses:personal:subscriptions\nif Amazon web services\n    account2 expenses:personal:web:hosting\nif Amazon.com\n    account2 expenses:personal:shopping:amazon</code></pre>\n<p>Now, I can reprocess my data to get a better picture of my\nspending:</p>\n<pre><code>$ &gt; 2024-09_bank.journal \\\n    hledger print \\\n    --rules-file bank.rules \\\n    -f 2024-09_bank.csv\n$ hledger bal expenses \\\n    --depth=3 \\\n    --percent \\\n    -f 2024-09_checking2.journal\n              30.0 %  expenses:food:dining\n              33.6 %  expenses:personal:shopping\n               9.5 %  expenses:personal:subscriptions\n              16.9 %  expenses:personal:web\n--------------------\n             100.0 %</code></pre>\n<p>For the Amazon.com purchase, I lumped it into the\n<code>expenses:personal:shopping</code> account. But I could dig\ndeeper—download <a\nhref=\"https://www.amazon.com/hz/privacy-central/data-requests/preview.html\">my\norder history from Amazon</a> and categorize that spending.</p>\n<p>This is the power of working bit-by-bit—the data guides you to the\nnext, deeper rabbit hole.</p>\n</section>\n<section id=\"goals-and-non-goals\" class=\"level2\">\n<h2>Goals and non-goals</h2>\n<p>Why am I doing this? For years, I maintained a monthly spreadsheet of\naccount balances. I had a balance sheet. But I still had questions.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2024-11-04_hledger-gnuplot-avg.png\"\nalt=\"Spending over six months, generated by piping hledger → gnuplot\" />\n<figcaption aria-hidden=\"true\">Spending over six months, generated by\npiping hledger → gnuplot</figcaption>\n</figure>\n<p>Before diving into accounting software, these were my goals:</p>\n<ul>\n<li><strong>Granular understanding of my spending</strong> – The big\none. This is where my monthly spreadsheet fell short. I knew I had money\nin the bank—I kept my monthly balance sheet. I budgeted up-front the %\nof my income I was saving. But I had no idea where my <em>other\nmoney</em> was going.</li>\n<li><strong>Data privacy</strong> – I’m unwilling to hand the keys to my\naccounts to YNAB or Mint.</li>\n<li><strong>Increased value over time</strong> – The more time I put in,\nthe more value I want to get out—this is what you get from professional\ntools built for nerds. While I wished for low-effort setup, I wanted the\ntool to be able to grow to more uses over time.</li>\n</ul>\n<p><strong>Non-goals</strong>—these are the parts I never cared\nabout:</p>\n<ul>\n<li><strong>Investment tracking</strong> – For now, I left this out of\nscope. Between monthly balances in my spreadsheet and online investing\ntools’ ability to drill down, I was fine.<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a></li>\n<li><strong>Taxes</strong> – Folks smarter than me help me understand my\nyearly taxes.<a href=\"https://tylercipriani.com/blog/#fn3\" class=\"footnote-ref\" id=\"fnref3\"\nrole=\"doc-noteref\"><sup>3</sup></a></li>\n<li><strong>Shared system</strong> – I may want to share reports from\nthis system, but no one will have to work in it except me.</li>\n<li><strong>Cash</strong> – Cash transactions are unimportant to me. I\nwithdraw money from the ATM sometimes. It evaporates.</li>\n</ul>\n<p><code>hledger</code> can track all these things. My setup is flexible\nenough to support them someday. But that’s unimportant to me right\nnow.</p>\n</section>\n<section id=\"monthly-maintenance\" class=\"level2\">\n<h2>Monthly maintenance</h2>\n<p>I spend about an hour a month checking in on my money Which frees me\nto spend time making fancy charts—an activity I <a\nhref=\"https://gist.github.com/thcipriani/9cd0a0e1e6d42fe27483d0a84b7de33d\">perversely\nenjoy</a>.</p>\n<figure>\n<img\nsrc=\"http://photos.tylercipriani.com/2024-11-12_hledger-gnuplot-cashflow.png\"\nalt=\"Income vs. Expense, generated by piping hledger → gnuplot\" />\n<figcaption aria-hidden=\"true\">Income vs. Expense, generated by piping\nhledger → gnuplot</figcaption>\n</figure>\n<p>Here’s my setup:</p>\n<pre><code>$ tree ~/Documents/ledger\n.\n├── export\n│   ├── 2024-balance-sheet.txt\n│   └── 2024-income-statement.txt\n├── import\n│   ├── in\n│   │   ├── amazon\n│   │   │   └── order-history.csv\n│   │   ├── credit\n│   │   │   ├── 2024-01-01_2024-02-01.csv\n│   │   │   ├── ...\n│   │   │   └── 2024-10-01_2024-11-01.csv\n│   │   └── debit\n│   │       ├── 2024-01-01_2024-02-01.csv\n│   │       ├── ...\n│   │       └── 2024-10-01_2024-11-01.csv\n│   └── journal\n│       ├── amazon\n│       │   └── order-history.journal\n│       ├── credit\n│       │   ├── 2024-01-01_2024-02-01.journal\n│       │   ├── ...\n│       │   └── 2024-10-01_2024-11-01.journal\n│       └── debit\n│           ├── 2024-01-01_2024-02-01.journal\n│           ├── ...\n│           └── 2024-10-01_2024-11-01.journal\n├── rules\n│   ├── amazon\n│   │   └── journal.rules\n│   ├── credit\n│   │   └── journal.rules\n│   ├── debit\n│   │   └── journal.rules\n│   └── common.rules\n├── 2024.journal\n├── Makefile\n└── README</code></pre>\n<p>Process:</p>\n<ol type=\"1\">\n<li><strong>Import</strong> – download a CSV for the month from each\naccount and plop it into\n<code>import/in/&lt;account&gt;/&lt;dates&gt;.csv</code></li>\n<li><strong>Make</strong> – run <code>make</code></li>\n<li><strong>Squint</strong> – Look at <code>git diff</code>; if it looks\ngood, <code>git add . &amp;&amp; git commit -m \"💸\"</code> otherwise\nreview <code>hledger areg</code> to see details.</li>\n</ol>\n<p>The <code>Makefile</code> generates everything under\n<code>import/journal</code>:</p>\n<ul>\n<li>journal files from my CSVs using their corresponding rules.</li>\n<li>reports in the <code>export</code> folder</li>\n</ul>\n<p>I include all the journal files in the <code>2024.journal</code> with\nthe line: <code>include ./import/journal/*/*.journal</code></p>\n<p>Here’s the <code>Makefile</code>:</p>\n<div class=\"sourceCode\" id=\"cb11\"><pre\nclass=\"sourceCode Makefile\"><code class=\"sourceCode makefile\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">SHELL </span><span class=\"ch\">:=</span><span class=\"st\"> /bin/bash</span></span>\n<span id=\"cb11-2\"><a href=\"https://tylercipriani.com/blog/#cb11-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">RAW_CSV </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">wildcard</span><span class=\"st\"> import/in/**/*.csv</span><span class=\"ch\">)</span></span>\n<span id=\"cb11-3\"><a href=\"https://tylercipriani.com/blog/#cb11-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">JOURNALS </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">foreach</span><span class=\"st\"> file</span><span class=\"kw\">,</span><span class=\"ch\">$(</span><span class=\"dt\">RAW_CSV</span><span class=\"ch\">)</span><span class=\"kw\">,</span><span class=\"ch\">$(</span><span class=\"kw\">subst</span><span class=\"st\"> /in/</span><span class=\"kw\">,</span><span class=\"st\">/journal/</span><span class=\"kw\">,</span><span class=\"ch\">$(</span><span class=\"kw\">patsubst</span><span class=\"st\"> %.csv</span><span class=\"kw\">,</span><span class=\"st\">%.journal</span><span class=\"kw\">,</span><span class=\"ch\">$(</span><span class=\"dt\">file</span><span class=\"ch\">))))</span></span>\n<span id=\"cb11-4\"><a href=\"https://tylercipriani.com/blog/#cb11-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb11-5\"><a href=\"https://tylercipriani.com/blog/#cb11-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ot\">.PHONY:</span><span class=\"dt\"> all</span></span>\n<span id=\"cb11-6\"><a href=\"https://tylercipriani.com/blog/#cb11-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">all:</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">JOURNALS</span><span class=\"ch\">)</span></span>\n<span id=\"cb11-7\"><a href=\"https://tylercipriani.com/blog/#cb11-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    hledger is -f 2024.journal &gt; export/2024-income-statement.txt</span>\n<span id=\"cb11-8\"><a href=\"https://tylercipriani.com/blog/#cb11-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    hledger bs -f 2024.journal &gt; export/2024-balance-sheet.txt</span>\n<span id=\"cb11-9\"><a href=\"https://tylercipriani.com/blog/#cb11-9\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb11-10\"><a href=\"https://tylercipriani.com/blog/#cb11-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ot\">.PHONY</span> <span class=\"er\">clean</span></span>\n<span id=\"cb11-11\"><a href=\"https://tylercipriani.com/blog/#cb11-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">clean:</span></span>\n<span id=\"cb11-12\"><a href=\"https://tylercipriani.com/blog/#cb11-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>        rm -rf import/journal/**/*.journal</span>\n<span id=\"cb11-13\"><a href=\"https://tylercipriani.com/blog/#cb11-13\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb11-14\"><a href=\"https://tylercipriani.com/blog/#cb11-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">import/journal/%.journal:</span><span class=\"dt\"> import/in/%.csv</span></span>\n<span id=\"cb11-15\"><a href=\"https://tylercipriani.com/blog/#cb11-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ch\">@</span><span class=\"fu\">echo </span><span class=\"st\">&quot;Processing csv </span><span class=\"ch\">$&lt;</span><span class=\"st\"> to </span><span class=\"ch\">$@</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb11-16\"><a href=\"https://tylercipriani.com/blog/#cb11-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ch\">@</span><span class=\"fu\">echo </span><span class=\"st\">&quot;---&quot;</span></span>\n<span id=\"cb11-17\"><a href=\"https://tylercipriani.com/blog/#cb11-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ch\">@</span><span class=\"fu\">mkdir -p </span><span class=\"ch\">$(</span><span class=\"kw\">shell</span><span class=\"st\"> dirname </span><span class=\"ch\">$@)</span></span>\n<span id=\"cb11-18\"><a href=\"https://tylercipriani.com/blog/#cb11-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ch\">@</span><span class=\"fu\">hledger print --rules-file rules/</span><span class=\"ch\">$(</span><span class=\"kw\">shell</span><span class=\"st\"> basename </span><span class=\"ch\">$$</span><span class=\"st\">(dirname </span><span class=\"ch\">$&lt;)</span><span class=\"fu\">)/journal.rules -f </span><span class=\"st\">&quot;</span><span class=\"ch\">$&lt;</span><span class=\"st\">&quot;</span><span class=\"fu\"> &gt; </span><span class=\"st\">&quot;</span><span class=\"ch\">$@</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>If I find anything amiss (e.g., if my balances are different than\nwhat the bank tells me), I look at <code>hleger areg</code>. I may tweak\nmy rules or my CSVs and then I run\n<code>make clean &amp;&amp; make</code> and try again.</p>\n<p>Simple, plain text accounting made simple.</p>\n<p>And if I ever want to dig deeper, <code>hledger</code>’s <a\nhref=\"https://hledger.org/1.40/hledger.html\">docs</a> have more to\nteach. But for now, the balance of effort vs. reward is perfect.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>while reading a blog post from <a\nhref=\"https://jmtd.net/log/hledger_1yr/\">Jonathan Dowland</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>Note, this is covered by <a\nhref=\"https://github.com/adept/full-fledged-hledger/wiki/Investments-easy-approach\">full-fledged\nhledger – Investements</a><a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p>Also covered in <a\nhref=\"https://github.com/adept/full-fledged-hledger/wiki/Tax-returns\">full-fledged\nhledger – Tax returns</a><a href=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/09/29/subliminal-git-commits/",

    "title": "Git commit hashes that spark joy",
    "url": "https://tylercipriani.com/blog/2024/09/29/subliminal-git-commits/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-09-29T17:04:34Z",
    "date_modified": "2025-10-26T21:02:10Z",


    "content_html": "<style>.title {text-wrap:balance;} #content > p:first-child {text-wrap:balance;}</style>\n<p>We’ve all seen Git commit hashes—the hard-to-remember hexadecimal\nstrings that refer to Git commits.</p>\n<p>But it’s rare to see Git commit hashes spark joy:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git log <span class=\"at\">--oneline</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">deadbeef</span> <span class=\"er\">(</span><span class=\"ex\">HEAD</span> <span class=\"at\">-</span><span class=\"op\">&gt;</span> main<span class=\"kw\">)</span> <span class=\"ex\">Dead</span> beef is beef. Live beef is cow. 🥁</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">c0ffeeee</span> Late night debugging ☕</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">defacedd</span> Fix vandalism</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">facade00</span> Provide simple interface class</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">c0deca11</span> Add function call</span></code></pre></div>\n<p>Creating memorable Git hashes is hard. Git creates hashes with SHA-1\nor SHA-2, which are one-way functions—there’s no way to predict a\nhash.</p>\n<p>So, to spread joy with Git history, we need to:</p>\n<ol type=\"1\">\n<li>Brute-force funny Git commit hashes.</li>\n<li>Keep Git usable – Git commit messages and metadata should stay\nusable by humans and machines.</li>\n<li>Be fast – I need to find commit hashes quickly, without churning\nforever for a bit of silly fun.</li>\n</ol>\n<section id=\"what-can-i-spell-with-a-git-commit\" class=\"level2\">\n<h2>What can I spell with a git commit?</h2>\n<figure>\n    <img src=\"https://photos.tylercipriani.com/2024-09-29_insulting-sha1-collisions.jpg\" alt=\"O’RLY Insulting SHA-1 Collisions. (Copyright 2024 DenITDao via orlybooks)\">\n    <figcaption aria-hidden=\"true\">\n        <p>\n        O’RLY Insulting SHA-1 Collisions.<br />\n        (Copyright 2024 <a href=\"https://x.com/DChurchyn\">DenITDao</a> via <a href=\"https://orlybooks.com/\">orlybooks</a>)\n        </p>\n    </figcaption>\n</figure>\n<p>With hexadecimal we can spell any word containing the set of letters\n<code>{A, B, C, D, E, F}</code>—<code>DEADBEEF</code> (a classic) or\n<code>ABBABABE</code> (for <em>Mama Mia</em> aficionados).</p>\n<p>This is because hexadecimal is a base-16 numbering system—a single\n“digit” represents 16 numbers:</p>\n<pre><code>Base-10: 0  1  2  3  4  5  6  7  8  9 10 11 12 13 16 15\nBase-16: 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f</code></pre>\n<p>Git hashes use lowercase letters and the numbers 0–9. Some numbers\nlook like lowercase letters, which expands our palette of\nwords—substituting <code>0</code> for <code>O</code>, <code>1</code> for\n<code>l</code>, and <code>5</code> for <code>s</code>.</p>\n<p>I created a <a\nhref=\"https://gist.github.com/thcipriani/8f16f00f1c3f68e96d8c7e85c56f2900\">script</a>\nthat scours word lists for valid words and phrases.</p>\n<p>With my script, I found some masterpieces: <code>dadb0d</code> (dad\nbod), <code>bada55</code> (bad ass), <code>0ff1oad</code> (offload),\n<code>0ddba11</code> (oddball), and the famous last words:\n<code>fee155afe</code> (feels safe).</p>\n</section>\n<section id=\"what-is-a-git-commit-hash\" class=\"level2\">\n<h2>What is a Git commit hash?</h2>\n<p>Git commit hashes are no mystery.</p>\n<p>A Git commit object is a compressed file that looks like:</p>\n<pre class=\"shell\"><code>$ &lt; .git/objects/b8/da4201321b5d73297c353a36e09492d6abcdf2 zlib-flate -uncompress | cat -v\ncommit 195^@tree 66dd8a515582fba80ca1e1137a6763f3759ebd65\nauthor Tyler Cipriani &lt;REDACTED&gt; 1760808267 -0600\ncommitter Tyler Cipriani &lt;REDACTED&gt; 1760812806 -0600\n\nInitial commit</code></pre>\n<p>Decompressing a Git commit object using\n<code>zlib-flate -uncompress</code> gives you the complete formatted\ncommit object. Commit objects use the format:</p>\n<pre><code>commit [Length of commit message in bytes]\\0[Commit message]`</code></pre>\n<p>The commit message includes:</p>\n<ul>\n<li>Pointers to other Git objects (parent commits, trees, or other\ncommits)</li>\n<li>Author name, email, author time</li>\n<li>Committer name, email, commit time</li>\n<li>The commit message</li>\n</ul>\n<p>Git stores commits as zlib-compressed files under\n<code>.git/objects</code><a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>. Each filename is the SHA-1 (or\nSHA-2) of the object’s decompressed contents:</p>\n<pre><code>$ &lt; .git/objects/b8/da4201321b5d73297c353a36e09492d6abcdf2 zlib-flate -uncompress | sha1sum\nb8da4201321b5d73297c353a36e09492d6abcdf2  -</code></pre>\n</section>\n<section id=\"recreate-a-git-commit-hash-with-bash\" class=\"level2\">\n<h2>Recreate a Git commit hash with Bash</h2>\n<p>Before I can make funny Git commit hashes, I need generate valid\nones.</p>\n<pre><code>$ mkdir /tmp/git-repo &amp;&amp; cd /tmp/git-repo\n$ git init\nInitialized empty Git repository in /tmp/git-repo/.git/\n$ echo &gt; README.md &amp;&amp; git add README.md &amp;&amp; git commit -m &#39;Initial commit&#39;\n[main (root-commit) 68ec0dd] Initial commit\n 1 file changed, 1 insertion(+)\n  create mode 100644 README.md\n$ git log --oneline\n68ec0dd (HEAD -&gt; main) Initial commit</code></pre>\n<p>I created a Git repo with an empty <code>README.md</code> and one\ncommit. The commit’s hash is <code>68ec0dd</code>.</p>\n<pre><code>$ git cat-file -p 68ec0dd &gt; commit-msg\n$ COMMIT_SIZE_BYTES=&quot;$(wc -c &lt; commit-msg)&quot;\n$ printf &#39;commit %d\\0&#39; &quot;$COMMIT_SIZE_BYTES&quot; | \\\n    cat - commit-msg | \\\n    sha1sum\n68ec0dd6dead532f18082b72beeb73bd828ee8fc  -</code></pre>\n<p>Here I recreate the commit hash <code>68ec0dd</code>.</p>\n<ul>\n<li><code>git cat-file</code> – get the commit message</li>\n<li><code>wc -c</code> – get the commit message length in bytes</li>\n<li><code>printf \'commit %d\\0%s\'</code> – print a formatted Git commit\nobject, complete with the commit message and length</li>\n<li><code>sha1sum</code> – get the hash of the commit object</li>\n</ul>\n</section>\n<section id=\"brute-forcing-git-commit-hashes-naïve-attempt\"\nclass=\"level2\">\n<h2>Brute-forcing Git commit hashes, naïve attempt</h2>\n<p>My initial modest goal is:</p>\n<ol type=\"1\">\n<li>Make a commit with a hash that starts <code>00</code>.</li>\n<li>Leave our code, author, and committer untouched.</li>\n<li>Keep the commit message the same, at least for humans.</li>\n</ol>\n<p>To change the hash, I’ll need to change the hash input—the commit\nmessage. Modifying a commit message invisibly to users will be\ntricky.</p>\n<p>Git pretty-prints commit messages when you run <code>git log</code>.\nPretty printing trims any trailing <code>isspace()</code>\ncharacters:</p>\n<ul>\n<li>SPACE - <code>\\u0020</code></li>\n<li>TAB - <code>\\u0009</code></li>\n</ul>\n<p>No one will see trailing spaces, but trailing spaces will change the\ncommit hash.</p>\n<p>To brute-force a Git commit hash, I’ll tweak the commit message in a\nloop, adding a random combination of space and tab characters until the\ncommit hash starts with <code>00</code>:</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># git-hash-fiddler.sh</span></span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ~~~~~~~~~~~~~~~~~~~</span></span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> cat-file <span class=\"at\">-p</span> HEAD <span class=\"op\">&gt;</span> commit-msg</span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">CALC_HASH()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">COMMIT_SIZE_BYTES</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"fu\">wc</span> <span class=\"at\">-c</span> <span class=\"op\">&lt;</span> commit-msg<span class=\"va\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">printf</span> <span class=\"st\">&#39;commit %d\\0&#39;</span> <span class=\"st\">&quot;</span><span class=\"va\">$COMMIT_SIZE_BYTES</span><span class=\"st\">&quot;</span> <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"fu\">cat</span> <span class=\"at\">-</span> commit-msg <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb8-9\"><a href=\"https://tylercipriani.com/blog/#cb8-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"fu\">sha1sum</span> <span class=\"kw\">|</span> <span class=\"fu\">awk</span> <span class=\"st\">&#39;{print $1}&#39;</span></span>\n<span id=\"cb8-10\"><a href=\"https://tylercipriani.com/blog/#cb8-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb8-11\"><a href=\"https://tylercipriani.com/blog/#cb8-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">CURRENT_HASH</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"ex\">CALC_HASH</span><span class=\"va\">)</span></span>\n<span id=\"cb8-12\"><a href=\"https://tylercipriani.com/blog/#cb8-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">SPACE_CHARS</span><span class=\"op\">=</span><span class=\"st\">$&#39;\\u0020\\u0009&#39;</span></span>\n<span id=\"cb8-13\"><a href=\"https://tylercipriani.com/blog/#cb8-13\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-14\"><a href=\"https://tylercipriani.com/blog/#cb8-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Check if the commit hash starts with 00</span></span>\n<span id=\"cb8-15\"><a href=\"https://tylercipriani.com/blog/#cb8-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">while</span> <span class=\"kw\">[[</span> <span class=\"ot\">!</span> <span class=\"st\">&quot;</span><span class=\"va\">$CURRENT_HASH</span><span class=\"st\">&quot;</span> <span class=\"ot\">=~</span> <span class=\"pp\">^</span><span class=\"ss\">00</span> <span class=\"kw\">]];</span> <span class=\"cf\">do</span></span>\n<span id=\"cb8-16\"><a href=\"https://tylercipriani.com/blog/#cb8-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">grep</span> <span class=\"at\">-o</span> . <span class=\"op\">&lt;&lt;&lt;</span> <span class=\"st\">&quot;</span><span class=\"va\">$SPACE_CHARS</span><span class=\"st\">&quot;</span> <span class=\"kw\">|</span> <span class=\"fu\">shuf</span> <span class=\"at\">-n1</span> <span class=\"op\">&gt;&gt;</span> commit-msg</span>\n<span id=\"cb8-17\"><a href=\"https://tylercipriani.com/blog/#cb8-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">CURRENT_HASH</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"ex\">CALC_HASH</span><span class=\"va\">)</span></span>\n<span id=\"cb8-18\"><a href=\"https://tylercipriani.com/blog/#cb8-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">done</span></span>\n<span id=\"cb8-19\"><a href=\"https://tylercipriani.com/blog/#cb8-19\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-20\"><a href=\"https://tylercipriani.com/blog/#cb8-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Add the modified commit to the git object store</span></span>\n<span id=\"cb8-21\"><a href=\"https://tylercipriani.com/blog/#cb8-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&lt;</span> commit-msg <span class=\"fu\">git</span> hash-object <span class=\"at\">-w</span> <span class=\"at\">-t</span> commit <span class=\"at\">--stdin</span></span>\n<span id=\"cb8-22\"><a href=\"https://tylercipriani.com/blog/#cb8-22\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-23\"><a href=\"https://tylercipriani.com/blog/#cb8-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Update the current commit</span></span>\n<span id=\"cb8-24\"><a href=\"https://tylercipriani.com/blog/#cb8-24\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> update-ref HEAD <span class=\"st\">&quot;</span><span class=\"va\">$CURRENT_HASH</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>First, I get the current commit. Then, in the <code>while</code>\nloop, I append a random space character to the commit and compute the\nhash until the hash starts with <code>00</code>.</p>\n<p>Once I find a commit that has a hash starting <code>00</code>, I use\n<code>git hash-object</code> to create a new Git commit object. Finally,\nI call <code>git update-ref</code> to point <code>HEAD</code> to my new\ncommit hash.</p>\n<pre><code>$ git log --oneline\n68ec0dd (HEAD -&gt; main) Initial commit\n$ time bash git-fiddler.sh\n00ba5924057452af287a2be151061f973862b811\n\nreal    0m2.618s\nuser    0m3.130s\nsys     0m1.430s\n$ git log --oneline -1\n00ba592 (HEAD -&gt; main) Initial commit  </code></pre>\n<p>It took about two seconds to brute-force a Git commit hash starting\nwith <code>00</code>.</p>\n<p>Not bad.</p>\n<p>Let’s go big. Let’s try for five leading <code>0</code>s:</p>\n<pre><code>$ time bash git-fiddler.sh\n00000a2195aa3d9e85bc5b70e70807e23f2f64fb\n\nreal    118m37.577s\nuser    133m54.613s\nsys     72m51.337s</code></pre>\n<p>Finding a commit hash starting with <code>00000</code> took\n<strong>two hours</strong> with my silly Bash script.</p>\n<p>I may need to optimize.</p>\n</section>\n<section\nid=\"brute-forcing-git-commit-hashes-before-the-heat-death-of-the-universe\"\nclass=\"level2\">\n<h2>Brute-forcing Git commit hashes (before the heat death of the\nuniverse)</h2>\n<p>Fortunately, user <code>not-an-aardvark</code> created a tool for\nthat—<a\nhref=\"https://github.com/not-an-aardvark/lucky-commit\">lucky-commit</a>.</p>\n<p><code>lucky_commit</code> does the same thing as our Bash script; it\nadds combinations of <code>TAB</code> and <code>SPACE</code> characters\nuntil it finds the Git hash with a prefix you specify.</p>\n<p>But, unlike my Bash script, it’s fast:</p>\n<pre><code>$ time lucky_commit 00000\n\nreal    0m0.103s\nuser    0m0.323s\nsys     0m0.037s\n$ git log --oneline -1\n00000e9 (HEAD -&gt; main) Initial commit        </code></pre>\n<p>Finding a Git commit hash starting with <code>00000</code> takes\n100ms (as opposed to <strong>two hours</strong> with my Bash\nscript).</p>\n<p><code>lucky_commit</code> speeds up Git commit hashes in two\nways:</p>\n<ul>\n<li><strong>Does less work</strong> – Both SHA-1 and SHA-2 break commit\nmessages in 64-byte chunks and then perform operations on those chunks\none at a time. Each chunk affects subsequent chunks. By pre-computing\nthe hash state before appending a fixed-length amount of padding,\n<code>lucky_commit</code> does a fraction of the bit twiddling of our\nshell script.</li>\n<li><strong>Uses more CPU</strong> – Adding a fixed-length (48-bit)\namount of padding to a commit using only two characters\n(<code>TAB</code> and <code>SPACE</code>), you have 2<sup>48</sup>\nvariations (281 trillion possibilities). And you can split hashing into\nthreads, doing more work in parallel.</li>\n<li><strong>Moves to the GPU</strong> – If you have a GPU, you can do\neven more hashing operations in parallel. This is an option in\n<code>lucky_commit</code>.</li>\n</ul>\n</section>\n<section id=\"use-git-hooks-to-spread-joy\" class=\"level2\">\n<h2>Use Git hooks to spread joy</h2>\n<p>All that’s left to do is to make all my commits <code>bada55</code>\nby abusing Git hooks.</p>\n<pre><code>$ cat &gt; .git/hooks/post-commit &amp;&amp; chmod +x .git/hooks/post-commit\n#!/usr/bin/env bash\nWORDS=(\n    babb1e    # BABBLE\n    bada55    # BADASS\n    badc0de   # BADCODE: not even sorry.\n    c0ffee    # COFFEE\n    0ddba11   # ODDBALL\n    5adface   # 😿\n)\nlucky_commit &quot;${WORDS[RANDOM%${#WORDS[*]}]}&quot;\nprintf &#39;✨ %s ✨\\n&#39; &quot;$(git log --one line -1)&quot;</code></pre>\n<p>With the <code>post-commit</code> hook above, after I commit,\n<code>lucky_commit</code> fiddles with my commit message until my commit\nhash is a random prefix from the list.</p>\n<p>Fast, automated Git joy:</p>\n<pre><code>$ git commit --amend --no-edit\n✨ 0ddba116 Initial commit ✨\n[main bd256a9] Initial commit\n Date: Mon Oct 20 17:58:32 2025 -0600\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n$ git commit --amend --no-edit\n✨ badc0de9 Initial commit ✨\n[main facd923] Initial commit\n Date: Mon Oct 20 17:58:32 2025 -0600\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md\n$ git commit --amend --no-edit\n✨ babb1e6 Initial commit ✨\n[main 441ec61] Initial commit\n Date: Mon Oct 20 17:58:32 2025 -0600\n 1 file changed, 1 insertion(+)\n create mode 100644 README.md</code></pre>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Git also stores compressed objects\nunder <code>.git/objects/pack</code>, but most objects start their lives\nas loose files.<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/08/31/the-pull-request/",

    "title": "GitHub&#x27;s Legacy of Terrible Code Review",
    "url": "https://tylercipriani.com/blog/2024/08/31/the-pull-request/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-08-31T22:59:46Z",
    "date_modified": "2025-04-13T18:32:44Z",


    "content_html": "<p>GitHub has always been a great code host. But GitHub’s code review\nsystem was an afterthought. Even now, Pull Requests still lag\nbehind.</p>\n<style>.title {text-wrap:balance;} #content > p:first-child {text-wrap:balance;}</style>\n<blockquote>\n<p>Oh yeah, there’s pull requests now</p>\n<p>– GitHub blog, <a\nhref=\"https://web.archive.org/web/20081119104228/http://github.com/blog/3-oh-yeah-there-s-pull-requests-now\">Sat,\n23 Feb 2008</a></p>\n</blockquote>\n<p>When GitHub launched, it had no code review.</p>\n<p>GitHub’s Pull Request model—<a\nhref=\"https://docs.github.com/en/get-started/using-github/github-flow\">“GitHub\nflow”</a>—was never designed. It emerged.</p>\n<p>But over time Pull Requests became the default way to collaborate via\nGit, and we’re all still suffering the consequences.</p>\n<section id=\"first-generation-pull-requests\" class=\"level2\">\n<h2>First-generation Pull Requests</h2>\n<p>GitHub never used git’s built-in <a\nhref=\"https://git-scm.com/docs/git-request-pull\"><code>git request-pull</code></a>.</p>\n<p>According to Linus Torvalds—Git’s creator—GitHub “<a\nhref=\"https://github.com/torvalds/linux/pull/17#issuecomment-5654674\">decided\nto replace it with their own totally inferior version</a>.”</p>\n<p>When <a\nhref=\"https://web.archive.org/web/20080303043315/http://github.com/guides/pull-requests\">the\nPull Request debuted in 2008</a> it worked like this:</p>\n<ol type=\"1\">\n<li>Create a fork and click “Pull Request.”</li>\n<li>Send a message to <em>someone</em><a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>\nwith a link to your fork, asking them to merge it.</li>\n</ol>\n<p>But while <code>git request-pull</code> generates a nicely formatted\nmessage with a diff stat and changelog, GitHub hamstrung Pull\nRequests.</p>\n<p>GitHub provided only a small, empty\n<code>&lt;textarea&gt;</code>—Pull Requests were little more than\nunstructured emails to other GitHub users.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2025-04-13_chacon-github-pull-request.png\" alt=\"@chacon, Tue, 13 Aug 2024\">\n<figcaption aria-hidden=\"true\">\n    <a href=\"https://x.com/chacon\" class=\"citation\" data-cites=\"@chacon\">@chacon</a>,\n    <a href=\"https://x.com/chacon/status/1823418993627017238\">Tue, 13 Aug 2024</a></figcaption>\n</figcaption>\n</figure>\n<p>And Pull Requests still lacked any way to see changes via the\nweb.</p>\n</section>\n<section id=\"code-review-discussion-code\" class=\"level2\">\n<h2>“Code Review = Discussion + Code”?</h2>\n<p>It took two years for GitHub to show the <code>git diff</code>\nbetween two repos on GitHub.</p>\n<p>In 2010, “<a\nhref=\"https://web.archive.org/web/20100720060404/http://github.com/blog/683-cross-repository-compare-view\">cross\nrepository compare view</a>” coupled with an <a\nhref=\"https://en.wikipedia.org/wiki/Thread_(online_communication)\">unthreaded</a>\ncomments section and became Pull Requests 2.0<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2024-08-31_github-pull-request-docs.png\"\nalt=\"GitHub Pull Requests circa 2010. This is from the official documentation on GitHub.\" />\n<figcaption aria-hidden=\"true\">GitHub Pull Requests circa 2010. This is\nfrom the official documentation on GitHub.</figcaption>\n</figure>\n<p>Of course, the code and the comments were still on two different\npages. It took another year before you could comment <em>in</em> the\ncode.</p>\n</section>\n<section id=\"inline-code-comments\" class=\"level2\">\n<h2>Inline code comments</h2>\n<p>In 2011, <code>rtomayko</code> made the first inline comment on a\nchange, writing, <a\nhref=\"https://github.com/mojombo/proxymachine/pull/9/files#r45\">in\nfull</a>: “<code>+1</code>”.</p>\n<p>Inline code review was far from a revelation. Guido van Rossum’s <a\nhref=\"https://www.youtube.com/watch?v=sMql3Di4Kgc\">Mondrian</a>—his 20%\nproject at Google—had inline code comments by 2006. And there was an\nopen-source version of Mondrian on the public web by <a\nhref=\"https://codereview.appspot.com/10269/diff/1/5#newcode37\">2008</a>.</p>\n<p>The Linux Kernel (using <a\nhref=\"https://git-scm.com/docs/git-format-patch\">git format-patch</a>)\nhad code comments since 2005.</p>\n</section>\n<section id=\"githubs-code-review-is-still-behind.\" class=\"level2\">\n<h2>GitHub’s code review is still behind.</h2>\n<p>In 2008, GitHub’s developers created a new kind of code review.</p>\n<p>But key features were missing. GitHub slowly tacked on these\nfeatures:</p>\n<ul>\n<li>2010: <a\nhref=\"https://web.archive.org/web/20100720060404/http://github.com/blog/683-cross-repository-compare-view\">Compare\nview</a></li>\n<li>2011: <a\nhref=\"https://github.blog/news-insights/product-news/ignore-white-space-in-code-review/\">Ignore\nwhitespace changes</a></li>\n<li>2016: <a\nhref=\"https://web.archive.org/web/20160922130716/https://github.com/blog/2259-mission-report-github-universe\">“Approve”,\n“Request changes”, and “Start a review”</a></li>\n<li>2017: <a\nhref=\"https://github.blog/news-insights/product-news/introducing-code-owners/\">Required\nreview</a></li>\n<li>2019: <a\nhref=\"https://twitter.com/natfriedman/status/1179097330097643521\">Multiline\ncomments</a></li>\n<li>2023: <a\nhref=\"https://github.blog/news-insights/product-news/github-merge-queue-is-generally-available/\">Merge\nqueues</a></li>\n</ul>\n<p>Now, it’s 2024. And here’s a biased list of what I think is\n<em>still</em> missing:</p>\n<ul>\n<li><strong>Commit review</strong> – Ability to comment on the commit\nmessage.</li>\n<li><strong>Your turn</strong> – Like Gerrit’s <a\nhref=\"https://gerrit-review.googlesource.com/Documentation/user-attention-set.html\">attention\nsets</a> – Microsoft recently did a study on a system called <a\nhref=\"https://www.michaelagreiler.com/code-review-reminder/\"><em>Nudge</em></a>\nwhich was a similar idea, it yielded good results, reducing review\ncompletion time 60%.</li>\n<li><strong>User-defined review labels</strong> – “Approve”/“Request\nchanges” is so limited—instead of using a complicated system of tags to\nmark changes ready for design approval, technical writing approval,\nstyle approval, and code approval—let repo owners figure out what\napprovals make sense for their project.</li>\n<li><strong>Hide bot comments</strong> – Allow me to hide bot comments\nso I can see the human comments.</li>\n<li><strong>Push to pull</strong> – Push to a special remote to create a\npull request using my commit:\n<code>git push origin &lt;branch&gt;:refs/pull-request/&lt;target-branch&gt;</code>.</li>\n<li><strong>Review in notes</strong> – Annotate commits with metadata in\na special\n<a href=\"https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/\">git\nnote</a> <code>refs/notes/review</code>.</li>\n<li><strong>Stacked diffs</strong> – Just come on. You have infinite\nmoney.</li>\n</ul>\n<p>And at this point I made <a\nhref=\"https://gerrit.googlesource.com/gerrit\">Gerrit</a>, but with more\nbranches.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>“Someone” was a person chosen by you\nfrom a checklist of the people who had also forked this repository at\nsome point.<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>“Code Review = Discussion + Code.”\nwas the headline of a blog post GitHub wrote circa 2010 introducing <a\nhref=\"https://github.blog/news-insights/the-library/pull-requests-2-0/\">Pull\nRequests 2.0</a><a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/07/31/git-as-a-password-prompt/",

    "title": "Git the stupid password store",
    "url": "https://tylercipriani.com/blog/2024/07/31/git-as-a-password-prompt/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-07-31T23:19:17Z",
    "date_modified": "2024-08-03T18:51:40Z",


    "content_html": "<style>.title {text-wrap:balance;}</style>\n<blockquote>\n<p>GIT - the stupid content tracker</p>\n<p>– Linus Torvalds, <a\nhref=\"https://kernel.googlesource.com/pub/scm/git/git/+/e83c5163316f89bfbde7d9ab23ca2e25604af290/README#2\">Initial\nrevision of “git”, the information manager from hell</a></p>\n</blockquote>\n<p>After years of code review with stacked diffs<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>,\nI’ve been using GitLab merge requests at work.</p>\n<p>Merge requests frustrated me until helpful folks pointed me toward <a\nhref=\"https://github.com/yaoyuannnn/gerritlab\">GerritLab</a>, a small\nPython tool for making stacked merge requests in GitLab—exactly what I\nwas looking for.</p>\n<p>But to talk to GitLab, GerritLab required a cleartext token in my\n<code>~/.gitconfig</code>. I wanted to stow my token in a password\nvault, so I crafted a change for GerritLab that used <a\nhref=\"https://mirrors.edge.kernel.org/pub/software/scm/git/docs/gitcredentials.html\">gitcredentials(7)</a>.</p>\n<p>Like most git features, <code>git credentials</code> are obscure,\nbyzantine, and incredibly useful. It works like this:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> subprocess, json</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>INPUT <span class=\"op\">=</span> <span class=\"st\">&quot;&quot;&quot;</span><span class=\"ch\">\\</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">protocol=https</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">host=example.com</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">username=thcipriani</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>git_credentials_fill <span class=\"op\">=</span> subprocess.run(</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>    [<span class=\"st\">&quot;git&quot;</span>, <span class=\"st\">&quot;credential&quot;</span>, <span class=\"st\">&quot;fill&quot;</span>],</span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">input</span><span class=\"op\">=</span>INPUT,</span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    text<span class=\"op\">=</span><span class=\"va\">True</span>,</span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>    stdout<span class=\"op\">=</span>subprocess.PIPE,</span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>)</span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>git_credentials <span class=\"op\">=</span> {</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>    key: value <span class=\"cf\">for</span> line <span class=\"kw\">in</span> git_credentials_fill.stdout.splitlines()</span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">if</span> <span class=\"st\">&#39;=&#39;</span> <span class=\"kw\">in</span> line</span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">for</span> key, value <span class=\"kw\">in</span> [line.split(<span class=\"st\">&#39;=&#39;</span>, <span class=\"dv\">1</span>)]</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>}</span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">print</span>(json.dumps(git_credentials, indent<span class=\"op\">=</span><span class=\"dv\">4</span>))</span></code></pre></div>\n<p>Which looks like this when you run it:</p>\n<pre><code>$ ./example-git-creds.py\nPassword for &#39;https://thcipriani@example.com&#39;:\n{\n    &quot;protocol&quot;: &quot;https&quot;,\n    &quot;host&quot;: &quot;example.com&quot;,\n    &quot;username&quot;: &quot;thcipriani&quot;,\n    &quot;password&quot;: &quot;hunter2&quot;\n}</code></pre>\n<p>The magic here is the shell command\n<code>git credentials fill</code>, which:</p>\n<ol type=\"1\">\n<li>Accepts a protocol, username, and host on standard input.</li>\n<li>Delegates to a “git credential helper” (<a\nhref=\"https://github.com/git/git/blob/master/contrib/credential/libsecret/git-credential-libsecret.c\"><code>git-credential-libsecret</code></a>\nin my case). A credential helper is an executable that retrieves\npasswords from the OS or another program that provides secure\nstorage.</li>\n<li>My git credential helper checks for credentials matching\n<code>https://thcipriani@example.com</code> and finds none.</li>\n<li>Since my credential helper comes up empty, git prompts me for my\npassword.</li>\n<li>Git sends <code>&lt;key&gt;=&lt;value&gt;\\n</code> pairs to standard\noutput for each of the keys <code>protocol</code>, <code>host</code>,\n<code>username</code>, and <code>password</code>.</li>\n</ol>\n<p>To stow the password for later, I can use\n<code>git credential approve</code>.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>subprocess.run(</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    [<span class=\"st\">&quot;git&quot;</span>, <span class=\"st\">&quot;credential&quot;</span>, <span class=\"st\">&quot;approve&quot;</span>],</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">input</span><span class=\"op\">=</span>git_credentials_fill.stdout,</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    text<span class=\"op\">=</span><span class=\"va\">True</span></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>)</span></code></pre></div>\n<p>If I do that, the next time I run the script, git finds the password\nwithout prompting:</p>\n<pre><code>$ ./example-git-creds.py\n{\n    &quot;protocol&quot;: &quot;https&quot;,\n    &quot;host&quot;: &quot;example.com&quot;,\n    &quot;username&quot;: &quot;thcipriani&quot;,\n    &quot;password&quot;: &quot;hunter2&quot;\n}</code></pre>\n<section id=\"git-credentials-purpose\" class=\"level2\">\n<h2>Git credential’s purpose</h2>\n<p>The problem git credentials solve is this:</p>\n<ul>\n<li>With git over ssh, you use your keys.</li>\n<li>With git over https, you type a password. Over and over and\nover.</li>\n</ul>\n<p>Beleaguered git maintainers solved this dilemma with the <a\nhref=\"https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage\">credential\nstorage system</a>—git credentials.</p>\n<p>With the right configuration, git will stop asking for your password\nwhen you push to an https remote.</p>\n<p>Instead, git credentials retrieve and send auth info to remotes.</p>\n</section>\n<section id=\"the-maze-of-options\" class=\"level2\">\n<h2>The maze of options</h2>\n<p>My mind initially refused to learn git credentials due to its <a\nhref=\"https://en.wikipedia.org/wiki/Twisty_little_maze_of_passages?redirect=no\">twisty\nlittle maze of terms that all sound alike</a>:</p>\n<ul>\n<li><code>git credential fill</code>: how you invoke a user’s configured\ngit credential helper</li>\n<li><code>git credential approve</code>: how you save git credentials\n(if this is supported by the user’s git credential helper)</li>\n<li><code>git credential.helper</code>: the git config that points to a\nscript that poops out usernames and passwords. These helper scripts are\noften named <code>git-credential-&lt;something&gt;</code>.</li>\n<li><code>git-credential-cache</code>: a specific, built-in git\ncredential helper that caches credentials in memory for a while.</li>\n<li><code>git-credential-store</code>: STOP. DON’T TOUCH. This is a\nspecific, built-in git credential helper that <strong>stores credentials\nin cleartext in your home directory</strong>. Whomp whomp.</li>\n<li><code>git-credential-manager</code>: a specific and confusingly\nnamed git credential helper from Microsoft®. If you’re on Linux or Mac,\nfeel free to ignore it.</li>\n</ul>\n<p>But once I mapped the terms, I only needed to pick a git credential\nhelper.</p>\n</section>\n<section id=\"configuring-good-credential-helpers\" class=\"level2\">\n<h2>Configuring good credential helpers</h2>\n<p>The built-in <code>git-credential-store</code> is a bad credential\nhelper—it saves your passwords in cleartext in\n<code>~/.git-credentials</code>.<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\"\nid=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a></p>\n<p>If you’re on a Mac, you’re in luck<a href=\"https://tylercipriani.com/blog/#fn3\" class=\"footnote-ref\"\nid=\"fnref3\" role=\"doc-noteref\"><sup>3</sup></a>—one command points git\ncredentials to your keychain:</p>\n<pre><code>git config --global credential.helper osxkeychain</code></pre>\n<p>Third-party developers have contributed helpers for popular password\nstores:</p>\n<ul>\n<li><a\nhref=\"https://github.com/ethrgeist/git-credential-1password\">1Password</a></li>\n<li><a href=\"https://github.com/languitar/pass-git-helper\">pass</a>: the\nstandard <a href=\"https://www.passwordstore.org/\">Unix password\nmanager</a></li>\n<li><a\nhref=\"https://github.com/hickford/git-credential-oauth\">OAuth</a></li>\n<li>Git’s documentation contains a <a\nhref=\"https://git-scm.com/doc/credential-helpers\">list of\ncredential-helpers</a>, too</li>\n</ul>\n<p>Meanwhile, Linux and Windows have standard options. Git’s source repo\nincludes helpers for these options in the <a\nhref=\"https://github.com/git/git/tree/master/contrib/credential\">contrib\ndirectory</a>.</p>\n<p>On Linux, you can use <a\nhref=\"https://github.com/GNOME/libsecret?tab=readme-ov-file#libsecret\">libsecret</a>.\nHere’s how I configured it on Debian:</p>\n<pre><code>sudo apt install libsecret-1-0 libsecret-1-dev\ncd /usr/share/doc/git/contrib/credential/libsecret/\nsudo make\nsudo mv git-credential-libsecret /usr/local/bin/\ngit config --global credential.helper libsecret</code></pre>\n<p>On Windows, you can use the confusingly named <a\nhref=\"https://github.com/git-ecosystem/git-credential-manager\">git\ncredential manager</a>. I have no idea how to do this, and I refuse to\nlearn.</p>\n<p>Now, if you clone a repo over https, you can push over https without\npain<a href=\"https://tylercipriani.com/blog/#fn4\" class=\"footnote-ref\" id=\"fnref4\"\nrole=\"doc-noteref\"><sup>4</sup></a>. Plus, now you have a handy password\nlibrary for shell scripts:</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">input</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"dt\">\\</span></span>\n<span id=\"cb7-4\"><a href=\"https://tylercipriani.com/blog/#cb7-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">protocol=https</span></span>\n<span id=\"cb7-5\"><a href=\"https://tylercipriani.com/blog/#cb7-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">host=example.com</span></span>\n<span id=\"cb7-6\"><a href=\"https://tylercipriani.com/blog/#cb7-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">user=thcipriani</span></span>\n<span id=\"cb7-7\"><a href=\"https://tylercipriani.com/blog/#cb7-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb7-8\"><a href=\"https://tylercipriani.com/blog/#cb7-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">&quot;</span></span>\n<span id=\"cb7-9\"><a href=\"https://tylercipriani.com/blog/#cb7-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">eval</span> <span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"bu\">echo</span> <span class=\"st\">&quot;</span><span class=\"va\">$input</span><span class=\"st\">&quot;</span> <span class=\"kw\">|</span> <span class=\"fu\">git</span> credential fill<span class=\"va\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb7-10\"><a href=\"https://tylercipriani.com/blog/#cb7-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb7-11\"><a href=\"https://tylercipriani.com/blog/#cb7-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">echo</span> <span class=\"st\">&quot;The password is: </span><span class=\"va\">$password</span><span class=\"st\">&quot;</span></span></code></pre></div>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>“<a\nhref=\"https://jg.gg/2018/09/29/stacked-diffs-versus-pull-requests/\">stacked\ndiffs</a>” or “<a href=\"https://www.stacking.dev/\">stacked\npull-requests</a>”—there’s no universal term.<a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>git-credential-store is <a\nhref=\"https://en.wikipedia.org/wiki/Long-term_nuclear_waste_warning_messages#Message\">not\na git credential helper of honor</a>. No highly-esteemed passwords\nshould be stored with it. This message is a warning about danger. The\ndanger is still present, in your time, as it was in ours.<a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p>I think. I only have Linux computers\nto test this on, sorry <code>;_;</code><a href=\"https://tylercipriani.com/blog/#fnref3\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn4\" role=\"doc-endnote\"><p>Or the <a\nhref=\"https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtpushInsteadOf\">config\noption</a> <code>pushInsteadOf</code>, which is what I actually do.<a\nhref=\"https://tylercipriani.com/blog/#fnref4\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/05/31/hexadecimal-sucks/",

    "title": "Hexadecimal Sucks",
    "url": "https://tylercipriani.com/blog/2024/05/31/hexadecimal-sucks/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-05-31T20:11:33Z",
    "date_modified": "2024-05-31T23:28:26Z",


    "content_html": "<blockquote>\n<p>Humans do no operate on hexadecimal symbols effectively […] there are\nexceptions.</p>\n<p>– Dan Kaminsky</p>\n</blockquote>\n<p>When <a\nhref=\"https://marc.info/?l=openbsd-cvs&amp;m=121321826818823&amp;w=2\">SSH\nadded ASCII art fingerprints</a> (AKA, randomart), the author credited a\ntalk by <a href=\"https://en.wikipedia.org/wiki/Dan_Kaminsky\">Dan\nKaminsky</a>.</p>\n<p>As a refresher, randomart looks like this:</p>\n<pre><code>$ ssh-keygen -lv -f ~/.ssh/id_ed25519.pub\n256 SHA256:XrvNnhQuG1ObprgdtPiqIGXUAsHT71SKh9/WAcAKoS0 thcipriani@foo.bar (ED25519)\n+--[ED25519 256]--+\n| .++ ...         |\n| o+.... o        |\n|E .oo=.o .       |\n| . .+.=   .      |\n|    o= .S.o.o    |\n|   o  o.o+.= +   |\n|  . .  .o B *    |\n|   . .   + &amp; .   |\n|      ..+o*.=    |\n+----[SHA256]-----+</code></pre>\n<p>Ben Cox describes the algorithm for generating random art on <a\nhref=\"https://blog.benjojo.co.uk/post/ssh-randomart-how-does-it-work-art\">his\nblog</a>. Here’s a slo-mo version of the algorithm in action:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/thumbs/slime-bishop.gif\" alt=\"ASCII art ssh fingerprints slo-mo algorithm\"><figcaption>ASCII art ssh fingerprints slo-mo algorithm</figcaption>\n</figure>\n<p>But in <a\nhref=\"https://www.youtube.com/watch?v=QT2hOyK2qv4&amp;list=WL&amp;t=599s\">Dan’s\ntalk</a>, he never mentions anything about ASCII art.</p>\n<p>Instead, his talk was about <strong>exploiting our brain’s hardware\nacceleration</strong> to make it easier for us to recognize SSH\nfingerprints.</p>\n<p>The talk is worth watching, but I’ll attempt a summary.</p>\n<section id=\"whats-the-problem\" class=\"level2\">\n<h2>What’s the problem?</h2>\n<p>We’ll never memorize\n<code>SHA256:XrvNnhQuG1ObprgdtPiqIGXUAsHT71SKh9/WAcAKoS0</code>—hexadecimal\nand base64 were built to encode large amounts of information rather than\nbe easy to remember.</p>\n<p>But that’s ok for SSH keys because there are different kinds of\nmemory:</p>\n<ul>\n<li><strong>Rejection</strong>: I’ve never seen that before!</li>\n<li><strong>Recognition</strong>: I know it’s that one—not the other\none.</li>\n<li><strong>Recollection</strong>: rote recall, like a phone number or\naddress.</li>\n</ul>\n<p>For SSH you’ll use <strong>recognition</strong>—do you recognize this\nkey? Of course, SSH keys are still a problem because our working memory\nis too small to recognize such long strings of letters and numbers.</p>\n<p>Hacks abound to shore up our paltry working memory—what Dan called\n“brain hardware acceleration.”</p>\n<p>Randomart attempts to tap into our hardware acceleration for pattern\nrecognition—the <a\nhref=\"https://en.wikipedia.org/wiki/Baddeley&#39;s_model_of_working_memory#Visuo-spatial_working_memory\">visiuo-spacial\nsketchpad</a>, where we store pictures.</p>\n<p>Dan’s idea tapped into a different aspect of hardware acceleration,\none often cited by memory competition champions: <a\nhref=\"https://en.wikipedia.org/wiki/Chunking_(psychology)\">chunking</a>.</p>\n</section>\n<section id=\"memory-chunking-and-sha256\" class=\"level2\">\n<h2>Memory chunking and sha256</h2>\n<p>The web service <a href=\"https://what3words.com/\">what3words</a> maps\nevery three cubic meters (3m²) on Earth to three words.</p>\n<p>The White House’s Oval Office is <a\nhref=\"https://what3words.com/curve.empty.buzz\">///curve.empty.buzz</a>.</p>\n<p>Three words encode the same information as latitude and\nlongitude—<code>38.89</code>, <code>-77.03</code>—chunking the\ninformation to be small enough to fit in our working memory.</p>\n<p>The mapping of locations to words uses a list of 40 thousand common\nEnglish words, so each word encodes 15.29 bits of information—45.9 bits\nof information, identifying 64 trillion unique places.</p>\n<p>Meanwhile sha256 is 256 bits of information: ~116 quindecillion\nunique combinations.</p>\n<pre><code>                                                                64000000000000 # 64 trillion (what3words)\n115792089237316195423570985008687907853269984665640564039457584007913129639936 # 116 (ish) quindecillion (sha256)</code></pre>\n<p>For SHA256, we need more than three words or a dictionary larger than\n40,000 words.</p>\n<p>Dan’s insight was we can identify SSH fingerprints using pairs of\nhuman names—couples.</p>\n<p>The math works like this<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>:</p>\n<ul>\n<li>131,072 first names: 17 bits per name (×2)</li>\n<li>524,288 last names: 19 bits per name</li>\n<li>2,048 cities: 11 bits per city</li>\n<li>17+17+19+11 = 64 bits</li>\n</ul>\n<p>With 64 bits per couple, you could uniquely identify 116\nquindecillion items with four couples.</p>\n<p>Turning this:</p>\n<pre><code>$ ssh foo.bar\nThe authenticity of host &#39;foo.bar&#39; can&#39;t be established.\nED25519 key fingerprint is SHA256:XrvNnhQuG1ObprgdtPiqIGXUAsHT71SKh9/WAcAKoS0.\nAre you sure you want to continue connecting\n(yes/no/[fingerprint])?</code></pre>\n<p>Into this<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a>:</p>\n<pre><code>$ ssh foo.bar\nThe authenticity of host &#39;foo.bar&#39; can&#39;t be established.\nSHA256:XrvNnhQuG1ObprgdtPiqIGXUAsHT71SKh9/WAcAKoS0\nKey Data:\n    Svasse and Tainen Jesudasson from Fort Wayne, Indiana, United States\n    Illma and Sibeth Primack from Itārsi, Madhya Pradesh, India\n    Maarja and Nisim Balyeat from Mukilteo, Washington, United States\n    Hsu-Heng and Rasim Haozi from Manali, Tamil Nadu, India\nAre you sure you want to continue connecting\n(yes/no/[fingerprint])?</code></pre>\n<p>With enough exposure, building recognition for these names and places\nshould be possible—at least more possible than memorizing host keys.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>I’ve modified this from the original\ntalk, in 2006 we were using md5 fingerprints of 160-bits. Now we’re\nusing 256-bit fingerprints, so we needed to encode even more\ninformation, but the idea still works.<a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>A (very) rough code implementation is\n<a href=\"https://github.com/thcipriani/ssh-keygen-couples\">on my\ngithub</a>.<a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/04/30/remote-desk/",

    "title": "My Remote Desk, 2024",
    "url": "https://tylercipriani.com/blog/2024/04/30/remote-desk/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2024-05-01T02:56:59Z",
    "date_modified": "2024-05-01T04:56:25Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/0d/1ab772e1c80c8a9df4a9e66905def7/large.jpg\"\nalt=\"My desk as of 2024-04-30\" />\n<figcaption aria-hidden=\"true\">My desk as of 2024-04-30</figcaption>\n</figure>\n<p>Remote companies have to work harder at everything.</p>\n<p>The effort goes beyond “remote-friendly”—you need <strong>remote\nculture</strong>.</p>\n<p>But once you have a remote culture, it’s hard to imagine going back.\nAfter nine years of working remotely, the only thing I miss about\nworking in person is seeing people’s messy desks.</p>\n<section id=\"why-desks-matter\" class=\"level2\">\n<h2>Why desks matter</h2>\n<p>Loneliness is a problem for remote workers—video chats are a terrible\nsubstitute for happy hour.</p>\n<p>Plus, in person, you get to see people’s desks—it’s fun—it’s how you\nget to know people.</p>\n<p>And I know other people think it’s fun, too: we remoties share our\npictures of our workspaces all the time. Everyone should share their\nworkspaces (here’s mine circa\n<a href=\"https://tylercipriani.com/blog/2016/11/07/my-remote-desk/\">2016</a>).</p>\n</section>\n<section id=\"my-desk\" class=\"level2\">\n<h2>My desk</h2>\n<p>This is my messy office as of today. (No cleaning and no judgments 🥹\nallowed when sharing your workspace.)</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/6f/7965534a0321cf2fc526fe7394236b/large.jpg\"\nalt=\"My office as of 2024-04-30\" />\n<figcaption aria-hidden=\"true\">My office as of 2024-04-30</figcaption>\n</figure>\n<p>Some things of note in this picture in no particular order:</p>\n<ul>\n<li>The desk and stuff on it\n<ul>\n<li>Ikea Markus chair and Trotten standing desk</li>\n<li>My laptop—<a href=\"https://tylercipriani.com/blog/2024/01/22/framework-13-amd-diy/\">Framework 13\nAMD</a></li>\n<li><a href=\"https://vortexgear.store/products/race-3-micro-usb\">Vortex\nRace 3 Keyboard</a> with Cherry MX clear switches</li>\n<li>Logitech ERGO rollerball mouse</li>\n<li><a\nhref=\"https://ugmonk.com/blogs/journal/analog-the-simplest-productivity-system\">Ugmonk\nanalog</a> – the most straightforward productivity system I’ve\nfound.</li>\n<li><a href=\"https://fieldnotesbrand.com/products/expedition\">Field\nnotes expedition edition</a> – “I’m not writing it down to remember it\nlater, I’m writing it down to remember it now.”</li>\n<li><a\nhref=\"https://www.madebyendless.com/collections/endless-recorder-notebook/products/recorder-notebook-infinite-space-regalia-paper\">Endless\nrecorder notebook</a> – this notebook is slowly supplanting my\nLeuchtturm1917.</li>\n<li>Micron 08 pens</li>\n<li><a href=\"https://www.elgato.com/us/en/p/wave-mic-arm\">Elgato wave\nmic arm</a> with a cheapo Amazon Basics microphone. When you spend all\nday in meetings, it’s important to sound good.</li>\n<li>Nikon D610 with 24–70mm f/2.8 lens for video calls\n<ul>\n<li>The camera sits atop a <a\nhref=\"https://www.manfrotto.com/global/photo-variable-friction-arm-with-bracket-244/\">Manfrotto\n244 Variable Friction Magic Arm</a> attached to the desk via <a\nhref=\"https://www.manfrotto.com/global/super-photo-clamp-without-stud-aluminium-035/\">Manfrotto\nsuper clamp</a> – see how many magic arms you spot on the <a\nhref=\"https://www.google.com/maps/space/iss/@29.5602853,-95.0853914,2a,75y,223h,93t/data=!3m6!1e1!3m4!1szChzPIAn4RIAAAQvxgbyEg!2e0!7i10000!8i5000\">International\nSpace Station</a> (answer: bunches)</li>\n</ul></li>\n<li>The small red things in the foreground are <a\nhref=\"https://en.wikipedia.org/wiki/Juice_jacking#Mitigation_by_Hardware\">USB\ndata blockers</a>—USB adapters with the data lines removed. I usually\nkeep these in my travel bag.</li>\n<li>The white cube is an <a\nhref=\"https://www.amazon.com/gp/product/B07Q128V6W/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">ODISTAR\nDesktop Vacuum Cleaner</a>.</li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B07ZNF656F/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;th=1\">dretec\ntimer</a>, for when I have the will to pomodoro.</li>\n<li><a href=\"https://tylercipriani.com/blog/2022/05/28/on-the-proper-use-of-post-its/\">Post-Its®</a>.\nSo many Post-Its.</li>\n</ul></li>\n<li>On the shelf\n<ul>\n<li><a href=\"https://en.wikipedia.org/wiki/Perplexus\">Perplexus maze\nball</a> held in place by a <a\nhref=\"https://www.sparkfun.com/products/11784\">third-hand kit for\nsoldering</a></li>\n<li>My trusty ThinkPad X230</li>\n<li>Lots of old notebooks and thank you cards</li>\n<li>On the top shelf are some posters and essential reminders: “DON’T\nBECOME BITTER AND JADED” and “DON’T LET ADULTHOOD CORRUPT YOU.”</li>\n</ul></li>\n<li>My overflowing homelab rack\n<ul>\n<li>Startech 6U wall mount</li>\n<li><a\nhref=\"https://mikrotik.com/product/RB750r2#fndtn-specifications\">Mikrotik\nhEX RB750Gr3 5-port Ethernet Gigabit Router</a></li>\n<li><a href=\"https://store.ui.com/us/en/products/es-16-150w\">Ubiquiti\nedgeswitch 16</a></li>\n<li>Synology DS212—yes, from 2012(!), it’s still kicking thanks to 2×6TB\nWestern Digital Red NAS HDDs.</li>\n<li><a href=\"https://www.gigabyte.com/Mini-PcBarebone\">Gigabyte mini\nPC</a> – 16GB RAM, 1TB NVMe, balancing precariously atop the Synology.\nThe PC runs a handful of VMs: PiHole, HomeAssistant, Grafana, and\nPrometheus.</li>\n<li>2×Raspberry Pi 3B+s doing not much of anything</li>\n<li>CyberPower CPS1215RMS Rackmount Surge Protector</li>\n<li>$6 clamp work light with a $60 hue bulb bouncing light off a Neewer\n43 in. reflector to light my video calls</li>\n</ul></li>\n<li>On the floor\n<ul>\n<li>Home Depot homer bucket, storing my <a\nhref=\"https://www.weaverarborist.com/products/arborist-throw-weight\">Weaver\narborist throw weight and line</a> which is crucial for my job as an\nengineering manager.</li>\n<li>A trash can with a lot of dryer sheets</li>\n<li>An old dog bed</li>\n</ul></li>\n</ul>\n<p>None of these are affiliate links since no one would want to be\naffiliated with this mess.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/03/31/eclipse/",

    "title": "My eclipse photography plan",
    "url": "https://tylercipriani.com/blog/2024/03/31/eclipse/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2024-03-31T20:32:54Z",
    "date_modified": "2024-04-01T14:37:26Z",


    "content_html": "<style>.title {text-wrap:balance;}</style>\n<figure>\n<img src=\"https://photos.tylercipriani.com/thumbs/f2/8ccc3b93f55e0ae6249f72675b851c/large.jpg\" alt=\"2017 solar eclipse—obscuration 93.8%\">\n<figcaption aria-hidden=\"true\">\n2017 solar eclipse—obscuration 93.8% (<a href=\"https://photos.tylercipriani.com/thumbs/f2/8ccc3b93f55e0ae6249f72675b851c/\">view original</a>)</figcaption>\n</figure>\n<p>In 2017, I opted to skip the crowds and the drive and settle for a\n94% solar eclipse. I fully regret that decision.</p>\n<p>Weather permitting, I’ll be photographing the full solar eclipse from\nthe path of totality next Monday. While I’ve amassed a ton of gear, the\nmain resource I’ve dumped into this project is time—time planning,\npracticing, and hacking.</p>\n<p>After investing all that time, here’s my plan.</p>\n<section id=\"why\" class=\"level2\">\n<h2>Why</h2>\n<p>I’m never going to produce an eclipse photo comparable to the work of\n<a\nhref=\"http://www.zam.fme.vutbr.cz/~druck/eclipse/Ecl2017u/Mi/Mitchell_800mm/0-info.htm\">Miloslav\nDruckmüller</a>—so why bother with photography at all?</p>\n<p>Photography is my hobby, and what’s a hobby without a challenge?\nSure, the siren song of cool gear is part of it—I do love gear—but it\nalso takes planning, hacking, and editing skills to create a great\npicture.</p>\n<p>I got to spend time rooting around inside <a\nhref=\"https://github.com/gphoto/libgphoto2/issues/966\">libgphoto2</a>,\nbreaking out the soldering iron to jury-rig a custom ESP32-based release\ncable, and practicing every move I’ll make on eclipse day. For me, this\nis fun.</p>\n<p>Your mileage may vary.</p>\n</section>\n<section id=\"gear\" class=\"level2\">\n<h2>Gear</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/c4/c94f1af86d382eddbd121034a17140/large.jpg\"\nalt=\"My 2024 eclipse setup\" />\n<figcaption aria-hidden=\"true\">My 2024 eclipse setup</figcaption>\n</figure>\n<p>Here is my gear checklist for this year:</p>\n<p><strong>Imaging</strong>:</p>\n<ol type=\"1\">\n<li><a\nhref=\"https://electronics.sony.com/imaging/interchangeable-lens-cameras/all-interchangeable-lens-cameras/p/ilce7rm3-b\">Sony\nA7rIII</a></li>\n<li><a\nhref=\"https://electronics.sony.com/imaging/lenses/all-e-mount/p/sel100400gm\">Sony\n100–400mm f4.5–5.6 GM telephoto lens</a></li>\n<li><a\nhref=\"https://electronics.sony.com/imaging/lenses/all-e-mount/p/sel14tc\">Sony\nFE1.4× teleconverter</a></li>\n</ol>\n<p>The lens and teleconverter give me an effective focal length of\n560mm. The 1.4µm pixel pitch of the A7rIII means I’ll cover 1.7 <a\nhref=\"https://skyandtelescope.org/astronomy-blogs/imaging-foundations-richard-wright/understanding-field-of-view-pixel-scale/\">arc-seconds\nper pixel</a> at my focal length—right in the sweet spot (below two,\nabove one).</p>\n<p>Here’s what a cropped image of the solar disk looks like on this\nsetup:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/a2/ca4163e0e63c535dd19323767985e1/large.jpg\"\nalt=\"Solar disk (cropped)\" />\n<figcaption aria-hidden=\"true\">Solar disk (cropped)</figcaption>\n</figure>\n<p>You can compare this photo to an image taken <a\nhref=\"https://soho.nascom.nasa.gov/data/synoptic/sunspots_earth/sunspots_1024_20240330.jpg\">yesterday</a>\nby the Solar &amp; Heliospheric Observatory (<a\nhref=\"https://soho.nascom.nasa.gov/home.html\">SOHO</a>) spacecraft—both\nshow sunspots AR3617 and AR3619. I’m gratified that a picture from my\nbackyard shows the same details as one from outer space.</p>\n<p><strong>Other essentials</strong></p>\n<ol type=\"1\">\n<li><a\nhref=\"https://shop.m5stack.com/products/stick-c?variant=43982750843137\">M5StickC\nESP32-PICO</a> – I’m using this as an intervalometer. I’ve programmed it\nwith the <a href=\"https://github.com/frank26080115/alpha-fairy\">Alpha\nFairy</a> firmware and will control it using <a\nhref=\"https://gist.github.com/thcipriani/c914393c5f9381838dcb84757072fe61\">pyserial</a>.\nI soldered together a <a\nhref=\"https://github.com/frank26080115/alpha-fairy/blob/main/doc/Shutter-Release-Cable-Connector.md\">release\ncable</a> that I’ll use to control the shutter.</li>\n<li><a\nhref=\"https://www.amazon.com/iOptron-SkyGuider-Camera-Mount-Package/dp/B07199QMR6\">iOptron\nSkyGuider Pro</a> – This is an <a\nhref=\"https://en.wikipedia.org/wiki/Astrophotography#Equipment_setups\">tracking\nmount</a>. It cancels out the motion of the Earth so the sun appears in\nthe same spot in the frame (if I polar align right).</li>\n<li><a\nhref=\"https://thousandoaksoptical.com/shop/solar-filters/threaded-camera-filters/\">Thousand\nOaks 77mm threaded RF-film solar filter</a> – for use pre-totality. I\nbought this for the 2017 eclipse. This prevents the sun from <a\nhref=\"https://www.lensrentals.com/blog/2017/09/rental-camera-gear-destroyed-by-the-solar-eclipse-of-2017/\">destroying\nmy lens and camera</a>.</li>\n<li><a\nhref=\"https://www.manfrotto.com/au-en/xume-77mm-lens-adapter-mfxla77/\">Manfrotto\nXUME 77mm lens adapter</a> – secures the solar filter to my lens via a\nmagnet, letting me pull it off instantly rather than fiddling with\nunscrewing a filter.</li>\n</ol>\n</section>\n<section id=\"software\" class=\"level2\">\n<h2>Software</h2>\n<ul>\n<li><strong>Planning</strong> – <a\nhref=\"https://www.photopills.com/articles/solar-eclipse-photography-guide\">PhotoPills</a>\nhelped me plan where to be and where to look.</li>\n<li><strong>Polar alignment</strong> – I’ll use <a\nhref=\"https://skeye.rocks/apps/skeye/index.html\">SkEye</a> for daytime\npolar alignment, pointing my tracking mount downwards towards <a\nhref=\"https://skyandtelescope.org/observing/daylight-polar-alignment/\">σ-Octantis</a>,\nwhich will align my tracker with the motion of the Earth.</li>\n<li><strong>Weather/Clouds</strong> – <a\nhref=\"https://www.ventusky.com/\">VentuSky</a> shows real-time <a\nhref=\"https://www.star.nesdis.noaa.gov/goes/\">GOES</a> satellite imagery\nand lets you browse weather prediction models. <a\nhref=\"https://www.skippysky.com.au/NorthAmerica/\">SkippySky</a> shows\nreal-time total cloud cover, seeing, and transparency (and also shows\nthe eclipse path). <a href=\"https://www.cleardarksky.com/csk/\">Clear\nDark Sky</a> is the classic astronomer’s forecast tool.</li>\n</ul>\n</section>\n<section id=\"my-plan\" class=\"level2\">\n<h2>My plan</h2>\n<p>I’m pegging all my images to f/8, ISO 100, and only adjusting shutter\nspeed.</p>\n<p>I’ll be bracketing five photos, each three stops of light away from\neach other (±3EV). I’ll adjust my base shutter speed twice.</p>\n<p>Pre-totality, I’ll do 1/100 second shutter speed. This should cover\nme for full-disk images, right up through <a\nhref=\"https://en.wikipedia.org/wiki/Baily%27s_beads\">Baily’s\nbeads</a>:</p>\n<ul>\n<li>1/100”</li>\n<li>1/800”</li>\n<li>1/13”</li>\n<li>1/6400”</li>\n<li>0.6”</li>\n</ul>\n<p>After totality, I’ll move the shutter speed to 1/15 of a second. Fast\nenough to ensure I get at least one clear shot and slow enough to get\n<a href=\"https://en.wikipedia.org/wiki/Earthlight_(astronomy)\">earthshine</a>\nif all goes to plan with my polar alignment:</p>\n<ul>\n<li>1/15”</li>\n<li>1/125”</li>\n<li>1/2”</li>\n<li>1/1000”</li>\n<li>4”</li>\n</ul>\n<p>If it all falls apart? Well. I’ll be in Austin—a great place to while\naway the time longing for clear skies.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/02/25/bash-history/",

    "title": "Eternal shell history &#x1F422;",
    "url": "https://tylercipriani.com/blog/2024/02/25/bash-history/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-02-25T19:31:17Z",
    "date_modified": "2024-03-02T21:50:17Z",


    "content_html": "<figure>\n    <img src=\"https://imgs.xkcd.com/comics/tar.png\" title=\"I don\'t know what\'s worse--the fact that after 15 years of using tar I still can\'t keep the flags straight, or that after 15 years of technological advancement I\'m still mucking with tar flags that were 15 years old when I started.\" alt=\"Tar, XKCD 1168 by Randall Monroe Licensed: CC-by-NC 2.5\">\n    <figcaption aria-hidden=\"true\">\n        <a href=\"https://xkcd.com/1168/\">XKCD #1168</a> by Randall Munroe (Licensed: <a href=\"https://creativecommons.org/licenses/by-nc/2.5/\">CC-By-NC 2.5</a>)\n    </figcaption>\n</figure>\n<p>I’ve never been able to trust <code>~/.bash_history</code>.\nRegardless of my configuration, I was forever searching for that one\ngnarly <a\nhref=\"https://jqlang.github.io/jq/manual/#advanced-features\">jq\nfilter</a> that had somehow disappeared. Then, I found a better way.</p>\n<p>Over the past eight years, I’ve hoarded ¾ million lines of bash\nhistory:</p>\n<pre><code>$ wc -l &lt; ~/.muh_history\n763075</code></pre>\n<p>This accounts for every shell command I’ve run since 2016—all saved\nto a 102MB file: <code>~/.muh_history</code>.</p>\n<pre><code>$ ls -lh ~/.muh_history\n-rw------- 1 thcipriani thcipriani 102M Feb 27 21:23 /home/thcipriani/.muh_history</code></pre>\n<p>It’s a perfect, searchable archive of my work.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2024-02-27_hist-smoller.gif\" alt=\"hist a command to search ~/.muh_history\">\n<figcaption aria-hidden=\"true\">\n<a href=\"https://gist.github.com/thcipriani/6de5841f15a4808a4e01ddda42b2d41e\">hist</a> is a command I wrote to search <code>~/.muh_history</code>.\n</figcaption>\n</figure>\n<p>I’ve come to rely on <code>~/.muh_history</code> to take notes for me\nwhile I focus on solving problems. I trust this system, because it’s so\nsimple.</p>\n<section id=\"simple-history-via-prompt-command\" class=\"level2\">\n<h2>🛟 Simple history via prompt command</h2>\n<p>To save my history, I exploit the bash <code>PROMPT_COMMAND</code>\nvariable.</p>\n<p>Bash will execute anything you assign to <code>PROMPT_COMMAND</code>\nbefore showing your prompt:</p>\n<pre><code>$ export PROMPT_COMMAND=&#39;fortune &amp;&amp; echo 🥳&#39;\nQ:  Do you know what the death rate around here is?\nA:  One per person.\n🥳\n$</code></pre>\n<p>You can use this variable to write the output of\n<code>history 1</code> to a file:</p>\n<pre><code>$ export PROMPT_COMMAND=&#39;history 1 &gt;&gt; ~/.muh-history.test&#39;\n$ fortune\nCaution: breathing may be hazardous to your health.\n$ cat ~/.muh-history.test\n6851  2024-02-25 18:44:30-0700 export PROMPT_COMMAND=&#39;history 1 &gt;&gt; ~/.test-history&#39;\n6852  2024-02-25 18:44:35-0700 fortune</code></pre>\n<p>I started doing this in 2015<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>, but the <a\nhref=\"https://gist.github.com/thcipriani/8d098f4fc54b5699845a512dd2805253\">more\nmetadata</a> I added—bash process ID, current directory, user—the more\npowerful my history became.</p>\n<p>Today, my history file looks like this:</p>\n<pre><code>$ tail -1 ~/.muh-history\n847008 /home/thcipriani thcipriani 2024-02-27T15:52:16-0700 echo &#39;Weeee!&#39; | figlet | lolcat</code></pre>\n<p>Now, I can crawl these bits of metadata to look at my history in\ninteresting ways. For example:</p>\n<ul>\n<li>Trace the history of a single shell session.</li>\n<li>Show commands within a time range.</li>\n<li>Search for commands run in the current directory.</li>\n</ul>\n</section>\n<section id=\"problems-and-tradeoffs-of-.muh_history\" class=\"level2\">\n<h2>🧐 Problems and tradeoffs of <code>~/.muh_history</code></h2>\n<p>My eternal shell history has been working well for eight years. But\nevery solution has tradeoffs and problems:</p>\n<ul>\n<li><strong>One machine</strong> – This works on one machine. If you\nneed history saved across more than one machine, <a\nhref=\"https://atuin.sh/\">Atuin</a> seems like what you want (though I’ve\nnever tried it).</li>\n<li><strong>Local security</strong> – This stores any command you run,\nincluding those with woopsied passwords. The\n<code>HISTCONTROL=ignorespace</code> setting helps—it makes\n<code>history</code> ignore commands that start with a space.</li>\n<li><strong>Bash only</strong> – I use the default Linux shell for most\noperating systems: bash. Nicer shells can do the same things as\n<code>PROMPT_COMMAND</code> and <code>history</code> (e.g., zsh’s\n<code>preexec</code>, fish’s <code>fish_preexec</code>).</li>\n<li><strong>Too simplistic</strong> – <a\nhref=\"https://github.com/cantino/mcfly\">McFly</a> and Atuin seem like\nrobust, active alternatives. And both use <code>PROMPT_COMMAND</code>\nunder the hood. Maybe I’d start there if I were starting today, but\n<code>~/.muh_history</code> pre-dates both projects.</li>\n<li><strong>Remote security</strong> – It would be Bad™ to install this\non a remote machine unless you’re the admin of that machine. <a\nhref=\"https://xkcd.com/705/\">Never cross a sysadmin</a>.</li>\n</ul>\n</section>\n<section id=\"flailing-at-bashs-built-in-history\" class=\"level2\">\n<h2>⚠️ Flailing at bash’s built-in history</h2>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2024-02-27_michaelhoffman-bash_history.png\" alt=\"@michaelhoffman.bsky.social, Wed, 02 Sep 2015\">\n<figcaption aria-hidden=\"true\">\n    <a href=\"https://twitter.com/michaelhoffman\" class=\"citation\" data-cites=\"@michaelhoffman.bsky.social\">@michaelhoffman.bsky.social</a>,\n    <a href=\"https://twitter.com/michaelhoffman/status/639178145673932800\">Wed, 02 Sep 2015</a></figcaption>\n</figcaption>\n</figure>\n<p>Goals of <code>~/.muh_history</code>:</p>\n<ol type=\"1\">\n<li><strong>Eternal</strong> – I want the option of keeping history\nforever.</li>\n<li><strong>History builtin commands</strong> – “↑” and\n<code>ctrl-r</code> should work in the default way.</li>\n<li><strong>History builtin depth</strong> – I want a few weeks of\nhistory available to <code>ctrl-r</code>.</li>\n<li><strong>Instant startup</strong> – Minimize lag when starting new\nbash sessions.</li>\n<li><strong>No logrotate</strong> – Avoid logrotate, systemd timers, and\ncronjobs to manage history—nothing to troubleshoot or maintain.</li>\n</ol>\n<p>And the hacks I’ve seen to juice bash’s built-in\n<code>~/.bash_history</code> fail at least one of these:</p>\n<ul>\n<li><code>HIST(FILE)SIZE=&lt;huge number&gt;</code><a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a> –\nOn startup, bash loads a <code>HISTSIZE</code> amount of\n<code>HISTFILE</code> into memory—this could cause <a\nhref=\"https://mywiki.wooledge.org/BashFAQ/088#Archiving_History_Files\">lag\nduring bash startup</a> unless you logrotate regularly. And there’s a\nrisk of losing commands if/when your sessions crash.</li>\n<li><code>unset HIST(FILE)SIZE</code>/<code>HIS(FILE)SIZE=-1</code> –\nThis should make <code>HIST(FILE)SIZE</code> infinite, so the same\ncaveats apply as using a huge number. Plus, this has a history of <a\nhref=\"https://lists.gnu.org/archive/html/bug-bash/2009-02/msg00108.html\">failing</a>\nin some instances.</li>\n<li><code>HISTFILE=~/.history/$(date -I)</code> – For the first bash\nsession you start in the morning <code>ctrl-r</code> will give you\nnothing.</li>\n<li><code>PROMPT_COMMAND=\'history -a &amp;&amp; history -r\'</code> –\nBefore showing your prompt, write your in-memory history to\n<code>HISTFILE</code> and re-read it into memory. This mixes up the\nhistory of different sessions, so hitting “↑” may show history from a\ndifferent session.</li>\n</ul>\n<p>Other pitfalls:</p>\n<ol type=\"1\">\n<li><strong>Write on exit</strong> – when you <code>exit</code> a\nsession, bash dumps <code>HISTSIZE</code> lines of your command history\ninto <code>~/.bash_history</code>. If your session crashes: all gone.\nThis makes <code>HIST(FILE)SIZE</code> unappealing to me.</li>\n<li><strong>Append vs. overwrite</strong> – if your shell initialization\nfiles skip setting <code>histappend</code>, bash will overwrite\n<code>~/.bash_history</code> rather than append your session history on\n<code>exit</code>.</li>\n<li><strong>Small defaults</strong> – bash stores your 500 most recent\ncommands in your session history and 500 commands from old sessions in\n<code>~/.bash_history</code>.</li>\n</ol>\n<p>I’ve set some sensible defaults and ignored clever ideas. Here are my\nsettings:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># append to history vs. overwrite</span></span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">shopt</span> <span class=\"at\">-s</span> histappend</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ignore commands starting with space; ignore duplicates</span></span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">HISTCONTROL</span><span class=\"op\">=</span>ignoredups:ignorespace</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Up the history in memory: 500 → 10,000</span></span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">HISTSIZE</span><span class=\"op\">=</span>10000</span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Up the history on disk: 500 → 20,000</span></span>\n<span id=\"cb6-8\"><a href=\"https://tylercipriani.com/blog/#cb6-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">HISTFILESIZE</span><span class=\"op\">=</span>20000</span>\n<span id=\"cb6-9\"><a href=\"https://tylercipriani.com/blog/#cb6-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># RFC 3339 format; e.g., 2024-02-27T15:52:16-0700</span></span>\n<span id=\"cb6-10\"><a href=\"https://tylercipriani.com/blog/#cb6-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">HISTTIMEFORMAT</span><span class=\"op\">=</span><span class=\"st\">&#39;%FT%T%z &#39;</span></span></code></pre></div>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>When I read the wonderful, shorter\nversion of this article: Andy Teijelo Pérez’s <a\nhref=\"https://web.archive.org/web/20140706222414/https://debian-administration.org/article/543/Bash_eternal_history\">Bash\neternal history</a><a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>I <a\nhref=\"https://gist.github.com/thcipriani/1d574b4b1e19b1ee6fcc3d6a2e77c7aa\">scraped\nof GitHub for HISTSIZE=</a>. It’s all over the place. Max:\n10,000,000,000,000,000; 25 percentile: 1,000; 75th percentile: 100,000;\nmedian: 10,000. I set mine at the median. Works fine.<a href=\"https://tylercipriani.com/blog/#fnref2\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2024/01/22/framework-13-amd-diy/",

    "title": "Framework DIY 13 AMD review &#x2699;&#xFE0F;",
    "url": "https://tylercipriani.com/blog/2024/01/22/framework-13-amd-diy/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-01-22T00:14:18Z",
    "date_modified": "2024-01-31T20:57:42Z",


    "content_html": "<style>.title {text-wrap:balance;}</style>\n<figure>\n<img src=\"https://photos.tylercipriani.com/thumbs/e8/d3093252b85712ca0048f8cd066809/large.jpg\" alt=\"Framework Laptop DIY 13 AMD with ethernet dongle and screwdriver\">\n<figcaption aria-hidden=\"true\">\nFramework Laptop DIY 13 AMD with ethernet dongle and screwdriver\n</figure>\n<p>The laptop industry is <a\nhref=\"https://cheapskatesguide.org/articles/computer-recycling.html\">a\ntragedy</a>.</p>\n<p>Meanwhile, <a href=\"https://frame.work\">Framework</a> built something\ndifferent—<a\nhref=\"https://www.ifixit.com/Device/Framework_Laptop\">repairable</a>, <a\nhref=\"https://frame.work/linux\">Linux-ready</a> laptops that respect\nusers. <strong>Framework is a rare company worth your\nsupport.</strong><a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></p>\n<p>So, this month, I bought their 13.5″, AMD-powered laptop—the <a\nhref=\"https://frame.work/products/laptop-diy-13-gen-intel\">Framework 13\nAMD</a>.</p>\n<p>But I’ve seen mixed reviews from other Linux users. I like the\nFramework ethos—I hope I like their laptops, too.</p>\n<section id=\"diy-hardware-and-assembly\" class=\"level2\">\n<h2>🛠️ DIY Hardware and assembly</h2>\n<p>Framework offers two editions of its laptops:</p>\n<ol type=\"1\">\n<li><strong>Pre-built</strong> – Fully assembled, complete with a\nuseless (to me) Windows™ install.</li>\n<li><strong>DIY</strong> – Do it yourself (DIY). Some assembly\nrequired—BYO-OS.</li>\n</ol>\n<p>I opted for the DIY edition—a misnomer, given assembly took five\nminutes.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/f7/0a458073f29d91e434cbe1457ddd54/large.jpg\"\nalt=\"Framework DIY—little assembly required (NVMe, RAM, keyboard, bezel: that’s it)\" />\n<figcaption aria-hidden=\"true\">Framework DIY—little assembly required\n(NVMe, RAM, keyboard, bezel: that’s it)</figcaption>\n</figure>\n<ul>\n<li><strong>CPU 8-core/16-thread 5.1Gz AMD</strong> (AMD Ryzen™ 7 7840U)\n<ul>\n<li>AMD Radeon 780M integrated GPU (works fine with <code>amdgpu</code>\ndriver)</li>\n<li>Ryzen AI Neural Processing Unit (NPU) (AMD released an <a\nhref=\"https://github.com/amd/xdna-driver\">xdna driver</a> last week. I\nhave yet to try it.)</li>\n</ul></li>\n<li><strong>64 GB RAM</strong> – DDR5-5600</li>\n<li><strong>2TB NVMe</strong></li>\n<li>13.5” (diagonal) <strong>matte</strong> (🥳) screen</li>\n</ul>\n<p>This is a powerful machine.</p>\n</section>\n<section id=\"weight\" class=\"level2\">\n<h2>🏋️ Weight</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/79/d55b690580002863b510edcdd88d06/large.jpg\"\nalt=\"Framework 13 weighing in at 1,323Kg, about the same as the 2011 Macbook Air\" />\n<figcaption aria-hidden=\"true\">Framework 13 weighing in at 1,323Kg,\nabout the same as the 2011 Macbook Air</figcaption>\n</figure>\n<blockquote>\n<p>A notebook that weighs more than a kilo is simply not a good\nthing</p>\n<p>– <a\nhref=\"https://techcrunch.com/2012/04/19/an-interview-with-millenium-technology-prize-finalist-linus-torvalds/\">Linus\nTorvalds</a></p>\n</blockquote>\n<p>The Framework weighs more than a kilo.</p>\n<p>Fully assembled (stickers and all), my new laptop tips the scales at\n1,323g.</p>\n<p>It’s 100g lighter than my x220 but 100g heavier than my partner’s M2\nMacbook Air.</p>\n<p>The Framework weighs as much as the 2011 Macbook Air—a sure sign\ninnovation has stopped in this space.</p>\n</section>\n<section id=\"portsdongles\" class=\"level2\">\n<h2>🔌 Ports/dongles</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/17/2f23e5d59424482d9b097181a68e45/large.jpg\"\nalt=\"Ports on the ThinkPad vs Framework—sadly absent: PCMCIA card slot\" />\n<figcaption aria-hidden=\"true\">Ports on the ThinkPad vs Framework—sadly\nabsent: PCMCIA card slot</figcaption>\n</figure>\n<p>I’m torn.</p>\n<p>I can arrange my laptop’s USB, power, and ethernet ports however I\nwant them.</p>\n<p>And folks in the Framework community are cooking up <a\nhref=\"https://www.printables.com/model/467332-framework-laptop-cupholder-expansion-card/files\">new</a>\n<a\nhref=\"https://community.frame.work/t/snack-sd-cards-notes-appitizers-cash-and-keepsakes-a-drawer-expansion-card/5757\">ideas</a>.</p>\n<p>But these are dongles. Brilliant dongles, but dongles nonetheless—I\nhave to tote them on my travels and keep track of them all.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/fa/503ceb9eb657340053f0fcbf1a5594/large.jpg\"\nalt=\"A dongle by any other name…\" />\n<figcaption aria-hidden=\"true\">A dongle by any other name…</figcaption>\n</figure>\n<p>Now, I need a little pouch for my adorable dongles.</p>\n</section>\n<section id=\"battery-life\" class=\"level2\">\n<h2>🪫 Battery life</h2>\n<p>Folks flagged short battery life as a problem for these machines—<a\nhref=\"https://anarc.at/hardware/laptop/framework-12th-gen/#battery-life\">especially\nthe Intel version</a>. Is that true for the AMD version?</p>\n<p>To test this, I simulated some strenuous web surfing—clicking\nWikipedia links faster than is humanly possible.<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a></p>\n<p>Results:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Time to battery empty</th>\n<th>Brightness</th>\n<th>Delay between page clicks</th>\n<th>Avg CPU Percentage</th>\n<th>Avg Watts</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td><strong>02:20:21</strong> ❗</td>\n<td>100%</td>\n<td>0s</td>\n<td>13.8%</td>\n<td>23.4</td>\n</tr>\n<tr class=\"even\">\n<td><strong>02:55:07</strong> ❗</td>\n<td>0%</td>\n<td>0s</td>\n<td>13.8%</td>\n<td>19.8</td>\n</tr>\n<tr class=\"odd\">\n<td><strong>12:57:57</strong> 😅</td>\n<td>0%</td>\n<td>10s</td>\n<td>1.1%</td>\n<td>4.1</td>\n</tr>\n</tbody>\n</table>\n<p>As long as I’m not slamming through every page of Wikipedia, the\nbattery would get me through most work days.</p>\n<p>During the workday, I use between 5 and 10 watts.<a href=\"https://tylercipriani.com/blog/#fn3\"\nclass=\"footnote-ref\" id=\"fnref3\" role=\"doc-noteref\"><sup>3</sup></a>\nWhile that might not give me 13 hours, it beats my ThinkPad X220’s\n1.5-hour battery life.</p>\n</section>\n<section id=\"linux-setup\" class=\"level2\">\n<h2>Linux setup</h2>\n<p>Linux veterans relayed <a href=\"https://ruscur.au/framework/\">painful\nexperiences</a> running their OS on older Framework models.</p>\n<p>But my experience was (mostly) jank-free.</p>\n<p><strong>Ubuntu 22.04</strong></p>\n<p>I installed Ubuntu first, since it’s the sole Linux distribution\nFramework’s website listed as “Stable.”</p>\n<p>And <strong>Ubuntu 22.04 ran flawlessly.</strong></p>\n<p>Chalk this up to the detailed <a\nhref=\"https://guides.frame.work/Guide/Ubuntu+22.04+LTS+Installation+on+the+Framework+Laptop+13/109\">Framework\nUbuntu setup guide</a>, with its giant gob of copy-pasta commands—much\nlaudable, painstaking effort has gone into making this experience\nperfect.</p>\n<p><strong>Debian Bookworm</strong></p>\n<p>I perused the <a\nhref=\"https://wiki.debian.org/InstallingDebianOn/FrameWork\">Debian\nWiki’s Framework pages</a> and the <a\nhref=\"https://d-i.debian.org/manual/en.amd64/index.html\">Debian Install\nGuide</a> as references to install Debian Bookworm.</p>\n<p>Audio, wifi, bluetooth, touchpad, webcam, and every button worked out\nof the box.</p>\n<p>Then I closed the lid, but nothing happened. Sleep failed.</p>\n<p>Problems with <a\nhref=\"https://www.kernel.org/doc/html/v4.15/admin-guide/pm/sleep-states.html\">s2idle</a>\non AMD machines are common. Problems are so common that Freedesktop\ncobbled together a script with cute emojis to help troubleshoot: <a\nhref=\"https://gitlab.freedesktop.org/drm/amd/-/blob/master/scripts/amd_s2idle.py\">amd_s2idle.py</a>.</p>\n<p>Framework user forums pointed me to the\n<code>firmware-amd-graphics</code> Debian package <a\nhref=\"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1053856\">bug\n1053856</a>.</p>\n<p>After firmware fiddling and an hour+ tweaking Xmonad for the high-dpi\n(2256x1504) display: all’s well.</p>\n</section>\n<section id=\"i-hate-computers-but-this-one-is-pretty-good.\"\nclass=\"level2\">\n<h2>I hate computers, but this one is pretty good.</h2>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2024-01-19_frameworkputer-fosstodon-2024-01-05.png\" alt=\"@FramworkPuter, 2024-01-19\">\n<figcaption aria-hidden=\"true\">\n<a href=\"https://fosstodon.org/@frameworkcomputer\" class=\"citation\" data-cites=\"frameworkcomputer@fosstodon.org\">@frameworkcomputer</a>,\n<a href=\"https://fosstodon.org/@frameworkcomputer/111704815625908663\">Fri, 05 Jan 2024</a></figcaption>\n</figure>\n<p>What I like:</p>\n<ul>\n<li>Repairable – I hoard a closet of old ThinkPads because I know\nthey’ll end up at the dump otherwise.</li>\n<li>Hardware camera/mic switch + RFKill – Hardware switches beat camera\ncovers any day. And a laptop that respects its users’ privacy is\nlovely.</li>\n<li>Reference designs – While it’s not open hardware, Framework releases\n<a href=\"https://github.com/frameworkComputer\">reference designs</a>\nunder a Creative Commons license.</li>\n<li>Matte screen – Why are shiny screens an option? Who wants that?</li>\n</ul>\n<p>What I dislike:</p>\n<ul>\n<li>Keyboard – It’s mushy. Plus, the button under <code>[/?]</code> is\n<code>[←]</code>, which is breaking my brain. I’m used to it being right\nCTRL (which I use as <a\nhref=\"https://en.wikipedia.org/wiki/AltGr_key\">AltGr</a>).</li>\n<li>Brightness – Even at 0% brightness, the screen is too bright.\nThere’s probably something I can do here.</li>\n<li>HDMI requires back slots – HDMI expansion card plugged into the\nfront left expansion slot failed. Moving to one of the back slots\nworks.</li>\n<li>3:2 aspect ratio – Why? It’s an outre choice. I’m having a bad time\nmirroring to 16:9 displays. Plus, horizontal screen space is great for\ntiling window managers.</li>\n<li>Trackpad – I still like buttons. The trackpad is good, but I’m a\nluddite—ThinkPads spoil you.</li>\n<li>Keyboard backlight – Speaking of ThinkPads, why have we abandoned\nthe <a\nhref=\"https://www.thinkwiki.org/wiki/ThinkLight\">ThinkLight</a>?</li>\n</ul>\n</section>\n<section id=\"verdict\" class=\"level2\">\n<h2>🏛️ Verdict</h2>\n<p>In a barren industry where planned obsolescence is the norm,\nFramework produces nice hardware for a fair price.</p>\n<p>The Framework AMD 13 is a powerful, modern laptop capable of running\nLinux. And all the buttons seem to do what they’re supposed to.</p>\n<p>I look forward to the day when I can <a\nhref=\"https://twitter.com/depthsofwiki/status/1735800801455419697\">Ship-of-Theseus</a>\nthe guts of this beast to get an even beefier boxen. It sure beats\nthrowing it on the pile of ThinkPads collecting dust in my closet.</p>\n<hr />\n<blockquote>\n<p><strong>EDIT</strong> <small>2024-01-31T13:53:30-07:00</small>:\nBefore, this article referred to the Framework AMD 13 as the “13th\ngeneration.” Commentors pointed out that that was incorrect. The 13th\ngeneration Framework laptops refer to the 13th generation of the Intel\nCPUs, not the Framework hardware.</p>\n</blockquote>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Man, I hope this comment ages well.<a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>I <a\nhref=\"https://github.com/thcipriani/getting-to-philosophy-battery-test\">scripted</a>\nthe “<a\nhref=\"https://en.wikipedia.org/wiki/Wikipedia:Getting_to_Philosophy\">Getting\nto Philosophy</a>” Wikipedia game for the <a\nhref=\"https://pageviews.wmcloud.org\">top 400 Wikipedia Articles of\n2023</a><a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p>Unless I do something silly like\nattend a zoom meeting.<a href=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/12/31/git-contrib/",

    "title": "Treats from git&#x27;s contrib tools&#x1F36D;",
    "url": "https://tylercipriani.com/blog/2023/12/31/git-contrib/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2024-01-01T00:03:06Z",
    "date_modified": "2024-02-09T22:18:16Z",


    "content_html": "<style>.title { text-wrap: balance }</style>\n<blockquote>\n<p>The intention is to keep interesting tools around git here, maybe\neven experimental ones</p>\n<p>Junio C Hamano, <a\nhref=\"https://github.com/git/git/blob/425e7f0532bcc420f7a8315e3e9702a44d1c1e73/contrib/README\">git/contrib/README</a></p>\n</blockquote>\n<p>Git’s source repo includes a “<a\nhref=\"https://github.com/git/git/tree/bec916039422e5b67c996e0180148fc5d30b0324/contrib\">contrib</a>”\ndirectory containing tools that extend git.</p>\n<p>But these tools are hidden from most users. And they require extra\nsteps to install. So they’re less well-known than they should be.</p>\n<p>These are the tools I’ve found useful.</p>\n<section id=\"diff-highlight\" class=\"level2\">\n<h2>diff-highlight</h2>\n<p><code>diff-highlight</code> makes <code>git diff</code> easier to\nread, making subtle changes stand out.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-12-31_git-diff-highlight.png\"\nalt=\"Standard git diff (top) vs. diff-highlight (bottom)\" />\n<figcaption aria-hidden=\"true\">Standard <code>git diff</code> (top)\nvs. <code>diff-highlight</code> (bottom)</figcaption>\n</figure>\n<p>Git <a\nhref=\"https://github.com/git/git/tree/0c977dbc8180892af42d7ab9235fd3e51d6c4078/contrib/diff-highlight\">diff-highlight</a>’s\nauthor described it as “a simple and stupid script for highlighting\ndiffering parts of lines in a unified diff.”</p>\n<p>Try it out with:</p>\n<pre><code>git log -p --color | /usr/share/doc/git/contrib/diff-highlight/diff-highlight</code></pre>\n<p>If you like what you see, make it your pager with this oneliner:</p>\n<pre><code>git config --global core.pager &#39;/usr/share/doc/git/contrib/diff-highlight/diff-highlight | less&#39;</code></pre>\n</section>\n<section id=\"git-prompt.sh\" class=\"level2\">\n<h2>git-prompt.sh</h2>\n<p><a\nhref=\"https://github.com/git/git/blob/4ca12e10e6fbda68adcb32e78497dc261e94734d/contrib/completion/git-prompt.sh\">git-prompt.sh</a>\nmakes information from <code>git status</code> accessible at a\nglance.</p>\n<p>For the basics, it’s easy<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>:</p>\n<ol type=\"1\">\n<li>Source <code>git-prompt.sh</code> from your shell init file.</li>\n<li>Add the magic incantation somewhere in your prompt (e.g.,\n<code>PS1=\'\\u@\\h $(__git_ps1 \" (%s)\")\\$ \'</code>).</li>\n<li>Tweak with environment variables until you get a prompt that works\nfor you.</li>\n</ol>\n<p>Here’s my config:</p>\n<pre><code>GIT_PS1_SHOWUNTRACKEDFILES=1\nGIT_PS1_SHOWDIRTYSTATE=1\nGIT_PS1_SHOWUPSTREAM=&quot;auto verbose&quot;\n. ~/bin/git-prompt.sh\nPS1=&#39;\\u@\\h $(__git_ps1 &quot; (%s)&quot;)\\$ &#39;</code></pre>\n<p>Inside a repo on <code>main</code> in a clean worktree, this\nshows:</p>\n<pre><code>me@💻 (main|u=)$</code></pre>\n<p>If you make a big mess, the prompt makes it impossible to miss:</p>\n<pre><code>me@💻  (main *+%|u+1-1)$\n         │   │││ │ │ │\n         │   │││ │ │ └── count: changes behind upstream (-1)\n         │   │││ │ └──── count: changes ahead of upstream (+1)\n         │   │││ └────── indicator: upstream set (u)\n         │   ││└──────── indicator: untracked file (%)\n         │   │└───────── indicator: staged, uncommitted change indicator (+)\n         │   └────────── indicator: unstaged change (*)\n         └────────────── info: current branch name</code></pre>\n<p>A git-aware shell prompt solves a multitude of woes. My prompt has\nsaved me from countless sticky git situations.</p>\n</section>\n<section id=\"subtree\" class=\"level2\">\n<h2>subtree</h2>\n<p><a href=\"https://git-scm.com/book/en/v2/Git-Tools-Submodules\">git\nsubmodule</a> allows you to include other git repos within your repo.\nBut anyone who’s used it can tell you: it gets confusing fast.</p>\n<p><a\nhref=\"https://github.com/git/git/tree/47c39c28bc1a0001e4341ae70629adcb10f425cc/contrib/subtree\">git\nsubtree</a> eases <code>git submodule</code> pain.</p>\n<p>Both <code>submodule</code> and <code>subtree</code> let you add a\nlibrary as a subfolder of your project.</p>\n<p>But <code>subtree</code> integrates the history of the library into\nyour main project. And you can get it back out as a standalone library\nlater.</p>\n<p>This lets you branch and tag a project along with its libraries—a\ncritical limitation to <code>git submodule</code>.</p>\n<p>For example:</p>\n<pre><code>git clone https://github.com/thcipriani/my-parent &amp;&amp; cd my-parent\ngit subtree add --prefix=mylib https://github.com/thcipriani/my-library</code></pre>\n<p>Adds <code>my-library</code> to the <code>my-parent</code> project in\na folder called <code>mylib</code>—the two projects’ history gets\nmerged. From there, it works like a monorepo.</p>\n<p>After I’ve made a series of changes inside <code>my-parent</code>,\nincluding changes to <code>mylib</code>, I can extract the history of\n<code>mylib</code> with:</p>\n<pre><code>git subtree split --prefix=mylib\n0b64183b7a0a27ad1f466d5cac61cbfefd1e598e\ngit push https://github.com/thcipriani/my-library 0b64183b7a0a27ad1f466d5cac61cbfefd1e598e:master</code></pre>\n<p>Or, in one step:</p>\n<pre><code>git subtree push --prefix=mylib https://github.com/thcipriani/my-library main</code></pre>\n</section>\n<section id=\"more\" class=\"level2\">\n<h2>More</h2>\n<ul>\n<li><a href=\"https://git-scm.com/docs/git-worktree\">git worktree</a>: is\nan example of a contrib script that’s made the jump to a git built-in\ncommand. Maybe, in time, other commands in this list will, too.</li>\n<li><a\nhref=\"https://github.com/git/git/tree/a62a7060a50e09089fb63b793b97c4b570993142/contrib/git-jump\">git-jump</a>:\nopens your editor to interesting bits of code. For example,\n<code>git jump diff</code> opens vim to the first diff hunk.</li>\n<li><a\nhref=\"https://github.com/git/git/tree/1ef1cce9c254d3787586ac87c1d1a2ca2c00bfd3/contrib/mw-to-git\">mw-to-git</a>:\nlets you read and edit MediaWiki wikis (like <a\nhref=\"https://en.wikipedia.org\">Wikipedia</a>) as if they were a local\ngit repo (cf:\n<a href=\"https://tylercipriani.com/blog/2019/11/14/maintaining-wiki-userscripts-via-git/\">maintaining\nuserscripts with git</a>)</li>\n<li><a\nhref=\"https://github.com/git/git/blob/781262c5e7ad4a7813c528803117ed0d2e8c5172/contrib/hooks/pre-auto-gc-battery\">pre-auto-gc-battery</a>:\na hook that prevents git’s automatic garbage collection if you’re on a\nlaptop using battery power</li>\n</ul>\n<p>And there are even more weird gems to unearth. <a\nhref=\"https://github.com/git/git/tree/master/contrib\">Take a\nlook!</a></p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>The script contains <a\nhref=\"https://github.com/git/git/blob/4ca12e10e6fbda68adcb32e78497dc261e94734d/contrib/completion/git-prompt.sh#L8-L31\">detail\nusage instuctions</a>, too<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/11/30/racy-git/",

    "title": "Racy git magic",
    "url": "https://tylercipriani.com/blog/2023/11/30/racy-git/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-11-30T23:52:32Z",
    "date_modified": "2023-12-01T04:37:09Z",


    "content_html": "<p>Exploting a long-standing git bug for my own amusement.</p>\n<blockquote>\n<p>And I think there is one known race: the index mtime itself is not\nrace-free.</p>\n<p>– Linus Torvalds, <a\nhref=\"https://lore.kernel.org/git/alpine.LFD.1.10.0806101249580.3101@woody.linux-foundation.org/\">Re:git\nbugs</a>, 2008</p>\n</blockquote>\n<p>A well-known race condition skulks through git’s plumbing.</p>\n<p>And I can demo it via a <strong>git magic trick 🪄</strong><a\nhref=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></p>\n<pre><code>$ tree -L 1 -a .\n.\n├── file\n└── .git\n\n$ cat file\nokbye\n$ git status\nOn branch main\nChanges to be committed:\n        new file:   file\n\n$ git ls-files --modified  # No output. A clean working directory.\n$ git commit --message=&quot;The file sez $(cat file)&quot;\n$ git log --oneline HEAD -1\n600fcac (HEAD -&gt; main) The file sez okbye\n$ git status\nOn branch main\nnothing to commit, working tree clean</code></pre>\n<p>Nothing up my sleeves:</p>\n<ul>\n<li>The git repo had one staged file, <code>file</code>, containing\n<code>okbye</code>—nothing else</li>\n<li>I committed it</li>\n<li>And the commit message is <code>The file sez okbye</code></li>\n</ul>\n<p><strong>Now, the big reveal</strong>:</p>\n<pre><code>$ cat file\nokbye\n$ git show HEAD:file\nhello\n$ git status\nnothing to commit, working tree clean</code></pre>\n<p>Boom. ✨Magic✨</p>\n<p>Git is clueless that the wrong file is in your work tree.</p>\n<p>Even <code>git restore</code> has no effect:</p>\n<pre><code>$ git restore file\n$ cat file\nokbye</code></pre>\n<p>Git maintainers know this sleight-of-hand well—dubbing it the “<a\nhref=\"https://git-scm.com/docs/racy-git/en\">Racy Git Problem</a>” circa\n2006.</p>\n<p>But it can still generate <a\nhref=\"https://en.wikipedia.org/wiki/Heisenbug\">heisenbugs</a> in\nunexpected places.</p>\n<section id=\"what-is-the-racy-git-problem\" class=\"level2\">\n<h2>What is the racy git problem?</h2>\n<p>The two biggest problems in computer science are:</p>\n<ol type=\"1\">\n<li>cache invalidation,</li>\n<li>naming things, and</li>\n<li>off-by-one</li>\n</ol>\n<p>Racy git is a cache invalidation problem.</p>\n<p>Git speeds operations by stowing two bits of data about each file in\nyour work tree:</p>\n<ol type=\"1\">\n<li>The file size</li>\n<li>The last time the file was modified—its <code>mtime</code></li>\n</ol>\n<p>So, if you tweak a file, without changing the mtime or the size—how\nwould git know?</p>\n<p>Before 2006, git was oblivious.</p>\n<p>Now, it’s wised up—if the file looks unchanged (via size and mtime),\nthen git performs another check. If file mtime &gt;= the mtime of the\nindex file (<code>.git/index</code>), then git rebuilds the index.</p>\n<p>Thus, the core of my lame magic trick:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">echo</span> hello <span class=\"op\">&gt;</span> file</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Stage the file for commit</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> update-index <span class=\"at\">--add</span> file</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Send .git/index&#39;s mtime INTO THE FUTURE!!!1!</span></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">touch</span> <span class=\"at\">--date</span><span class=\"op\">=</span><span class=\"st\">&#39;1 second&#39;</span> .git/index</span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Now modify &quot;file&quot; behind git&#39;s back. So. Sneaky.</span></span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">echo</span> okbye <span class=\"op\">&gt;</span> file</span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># CAVEAT OF DOOoooM: this has to happen within a single second to work---yeah. git&#39;s good. :D</span></span></code></pre></div>\n</section>\n<section id=\"how-this-happens-in-the-real-world\" class=\"level2\">\n<h2>How this happens in the real world</h2>\n<p>This problem can still happen in the real world.</p>\n<p>I stumbled onto this while working with <code>git fat</code> (a\nforerunner of GitHub’s “Git Large File Storage”—git-lfs) in 2017.</p>\n<p>At that time, we had a tool that pulled git code onto hundreds of\nservers. And every so often, a server would fail to fetch large\nfiles.</p>\n<p>The basic steps were:</p>\n<ul>\n<li>ssh into 100s of servers in parallel</li>\n<li><code>git clone &lt;repo&gt;</code></li>\n<li><code>git fat pull</code></li>\n</ul>\n<p><code>git fat pull</code> rsync’d large binary files, mostly jars,\ninto the working directory.</p>\n<p>Frustratingly, when this failed, I could jump on the server and rerun\n<code>git fat pull</code>, which worked every time.</p>\n<p>This was the racy git problem in disguise.</p>\n<p>See, <code>git fat</code> uses git <a\nhref=\"https://git-scm.com/docs/gitattributes#_filter\">filters</a> (just\nlike git-lfs). Filters are scripts that git runs automagically at\ncheckout or commit time.</p>\n<p>But git is smart—it only triggers filters when it has to—when your\nworking directory differs from its index.</p>\n<p>So, when we ran <code>git clone</code> within the same second as\n<code>git fat pull</code>, the files on disk were the same as in the\nindex—so, git never triggered the filter.</p>\n<p>Why did it work when I ran it manually? Because <code>git fat</code>\nwas smart, too—it <code>touch</code>’d files on disk, which invalidated\nthe index which caused git to run the filter command.</p>\n<p>And so the racy git problem persists. It plagues every system that\nrelies on the git filters<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a> to. this. day.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>This will only seem like magic if you\ncan distiguish normal git operations from magic. For nerds only.<a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>This means almost all large file\nstorage mechanisms in git. <a\nhref=\"https://git-annex.branchable.com/todo/git_smudge_clean_interface_suboptiomal/\">git\nannex</a>’s “indirect mode” eschewed git’s smudge and clean filters. But\nI see both “direct” and “indirect” mode are now deprecated. I’m unclear\nhow this works today <code>¯\\_(ツ)_/¯</code>.<a href=\"https://tylercipriani.com/blog/#fnref2\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/10/29/daylight-confusion-time/",

    "title": "Daylight confusion week",
    "url": "https://tylercipriani.com/blog/2023/10/29/daylight-confusion-time/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-10-29T19:00:50Z",
    "date_modified": "2023-10-30T19:54:52Z",


    "content_html": "<figure>\n<img src=\"https://photos.tylercipriani.com/2023-10-30_days-since-last-timezone-issue.png\" alt=\"Days since last timezone issue: -1 (via @accousticmirror)\" style=\"\n    height: 450px;\n\">\n<figcaption aria-hidden=\"true\">Days since last timezone issue: -1 (via\n<a href=\"https://post.lurk.org/@acousticmirror/111008144295294599\" class=\"citation\" data-cites=\"accousticmirror\">@accousticmirror</a>)</figcaption>\n</figure>\n<p>It’s Daylight Confusion Week.</p>\n<p>So, my meetings with Europeans shift by an hour—either forward or\nbackward, depending on who made the meeting.</p>\n<p>Yes, this is hard to think about. Here’s a chart:</p>\n<table class=\"sortable\">\n<thead>\n<tr class=\"header\">\n    <th></th>\n    <th>23 Oct</th>\n    <th style=\"border-inline: 2px solid black; border-top: 2px solid black;\">30 Oct 😵</th>\n    <th>06 Nov</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"America_Los_Angeles\">\n    <td style=\"font-weight: bold;\"><a href=\"https://tylercipriani.com/blog/#America/Los_Angeles\">San Francisco, CA</a> 📌</td>\n    <td style=\"background: lightblue; font-weight: normal;\">08:00</td>\n    <td style=\"border-inline: 2px solid black; background: lightblue; font-weight: normal;\">08:00</td>\n    <td style=\"background-color: lightblue; font-weight: normal;\">08:00</td>\n</tr>\n<tr class=\"Europe_Paris\">\n    <td style=\"font-weight: normal;\"><a href=\"https://tylercipriani.com/blog/#Europe/Paris\">Paris, France</a></td>\n    <td style=\"background: transparent; font-weight: normal;\">17:00</td>\n    <td style=\"border-inline: 2px solid black; border-bottom: 2px solid black; background-color: rgb(245, 163, 163); font-weight: normal;\">16:00 (-1hr)</td>\n    <td style=\"background-color: transparent; font-weight: normal;\">17:00</td>\n</tr>\n</tbody>\n</table>\n<p>See the problem?</p>\n<ol type=\"1\">\n<li>🇪🇺 <span style=\"color: tomato; font-weight: bold\">← -1:00</span>:\nMeetings for most of Europe are an hour earlier if the meeting is pinned\nto the US.</li>\n<li>🇺🇸 <span style=\"color: green; font-weight: bold\">→ +1:00</span>:\nMeetings for most of North America are an hour later if the meeting is\npinned to Europe.</li>\n</ol>\n<p>Next week, it’ll all be back to normal, at least until March\n2024.</p>\n<p>As a software engineer, my first instinct is to ask how we can fix\nthis. But that’s the best part: we can’t.</p>\n<section id=\"why-this-happens\" class=\"level2\">\n<h2>Why this happens</h2>\n<p>tl;dr: daylight savings complicates timezone math.</p>\n<p>In much of Europe, Daylight Savings Time ends today.</p>\n<p>But North America will neglect their clocks for another week.</p>\n<p>So, this week, Central Europe falls back one hour—making them one\nhour closer to North American timezones than usual. This happens two\nweeks a year—once in March and now.</p>\n<p>But between Central Europe, North America, and places in the Southern\nHemisphere—we’re sometimes 2-hours out of sync.</p>\n<p>And for places without daylight savings time, this one-hour shift\nsticks around for half a year then shifts back.</p>\n<p>It’s a mess.</p>\n</section>\n<section id=\"ok-so-pin-meetings-to-utc\" class=\"level2\">\n<h2>OK, so pin meetings to UTC</h2>\n<p>Coordinated Universal Time (UTC) is lovely. But it won’t fix for\nDaylight Confusion Time.</p>\n<p>We coordinate meetings using UTC. As in: “Hey, wanna meet Mondays at\n15:00 UTC?”</p>\n<p>But we book meetings in our local time zones.</p>\n<p>If we used UTC instead, Daylight Confusion Week would expand to the\nentirety of Daylight Savings Time. Meetings would shift an hour in March\nand roll back in November.</p>\n<p>There’s no “base timezone” that keeps the weekly meeting at the same\nlocal time for everyone all year long.</p>\n<table class=\"sortable\">\n<thead>\n<tr class=\"header\">\n    <th></th>\n    <th>23 Oct</th>\n    <th style=\"border-inline: 2px solid black; border-top: 2px solid black;\">30 Oct 😵</th>\n    <th>06 Nov</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"UTC\">\n    <td style=\"font-weight: normal;\"><a href=\"https://tylercipriani.com/blog/#UTC\">UTC</a></td>\n    <td style=\"background: transparent; font-weight: normal;\">15:00</td>\n    <td style=\"border-inline: 2px solid; background: transparent; font-weight: normal;\">15:00</td>\n    <td style=\"background: rgb(171, 209, 198); font-weight: normal;\">16:00 (+1hr)</td>\n</tr>\n<tr class=\"America_Los_Angeles\">\n    <td style=\"font-weight: bold;\"><a href=\"https://tylercipriani.com/blog/#America/Los_Angeles\">San Francisco, CA</a> 📌</td>\n    <td style=\"background: lightblue; font-weight: normal;\">08:00</td>\n    <td style=\"border-inline: 2px solid black; background: lightblue; font-weight: normal;\">08:00</td>\n    <td style=\"background-color: lightblue; font-weight: normal;\">08:00</td>\n</tr>\n<tr class=\"Europe_Paris\">\n    <td style=\"font-weight: normal;\"><a href=\"https://tylercipriani.com/blog/#Europe/Paris\">Paris, France</a></td>\n    <td style=\"background: transparent; font-weight: normal;\">17:00</td>\n    <td style=\"border-inline: 2px solid black; border-bottom: 2px solid black; background-color: rgb(245, 163, 163); font-weight: normal;\">16:00 (-1hr)</td>\n    <td style=\"background-color: transparent; font-weight: normal;\">17:00</td>\n</tr>\n</tbody>\n</table>\n</section>\n<section id=\"no-really-theres-got-to-be-a-way-to-fix-this\"\nclass=\"level2\">\n<h2>No, really, there’s got to be a way to fix this</h2>\n<p>In order of preference, this is how I think we could fix this:</p>\n<ul>\n<li>Stop having recurring meetings</li>\n<li>Ban daylight savings everywhere forever</li>\n<li>Coordinate our daylight savings times</li>\n<li>Continue to suffer for a couple weeks a year</li>\n</ul>\n<p>So far, we’ve made our choice. We’ve opted to suffer.</p>\n<script>\n// Please don\'t tell people how I live.\nconst tables = document.querySelectorAll(\'table.sortable\')\nconst red = \'hsl(0 80% 80%)\',\n      yellow = \'lightyellow\',\n      blue = \'lightblue\'\n      green = \'#abd1c6\'\nconst time_table = {\n    \'UTC\': {\n        \'UTC\': [15, 15, 15],\n        \'America_Los_Angeles\': [8, 8, 7],\n        \'Europe_Paris\': [17, 16, 16]\n    },\n    \'Europe/Paris\': {\n        \'Europe_Paris\': [17, 17, 17],\n        \'UTC\': [15, 16, 16],\n        \'America_Los_Angeles\': [8, 9, 8]\n    },\n    \'America/Los_Angeles\': {\n        \'America_Los_Angeles\': [8, 8, 8],\n        \'UTC\': [15, 15, 16],\n        \'Europe_Paris\': [17, 16, 17]\n    }\n}\n\nlet sortedBy = window.location.hash\n\nwindow.addEventListener(\'hashchange\', hashChangeEvent)\n\nfunction hashChangeEvent() {\n    updateTables(window.location.hash.substring(1))\n}\n\nfunction formatTime(number, timeShift = 0) {\n  const hours = number < 10 ? `0${number}` : number\n\n  let timeFormat = `${hours}:00`\n  if (timeShift > 0) {\n    timeFormat += ` (+${timeShift}hr)`\n  } else if (timeShift < 0) {\n    timeFormat += ` (${timeShift}hr)`\n  }\n  return timeFormat\n}\n\nfunction updateTables(timezone) {\n    let selector = \'.\' + timezone.replace(/\\//g, \'_\')\n    tables.forEach((table) => {\n        let selected_row = table.querySelector(selector)\n        if (! selected_row) {\n            return\n        }\n\n        for (let [tz, times] of Object.entries(time_table[timezone])) {\n            let tr = table.querySelectorAll(\'.\' + tz)\n            let firstTime = times[0]\n            tr.forEach((col) => {\n                col.querySelectorAll(\'td\').forEach((td, idx) => {\n                    td.innerHTML = td.innerHTML.replace(\' 📌\', \'\')\n                    td.style.fontWeight = \'normal\'\n                    if (idx !== 0) {\n                        let newTime = times[idx - 1]\n                        let timeShift = 0\n                        if (newTime === firstTime) {\n                            td.style.backgroundColor = \'transparent\'\n                            timeShift = 0\n                        } else if (newTime > firstTime) {\n                            td.style.backgroundColor = green\n                            timeShift = 1\n                        } else {\n                            td.style.backgroundColor = red\n                            timeShift = -1\n                        }\n                        td.innerHTML = formatTime(newTime, timeShift);\n                    }\n                })\n            })\n        }\n        selected_row.querySelectorAll(\'td\').forEach((td, idx) => {\n            if (idx !== 0) {\n                td.style.backgroundColor = \'lightblue\'\n            } else {\n                td.style.fontWeight = \'bold\'\n                td.innerHTML = td.innerHTML  + \' 📌\'\n            }\n        })\n    })\n}\n\nif (! sortedBy) {\n    updateTables(\'America/Los_Angeles\')\n} else {\n    hashChangeEvent()\n}\n</script>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/09/24/stacked-patches/",

    "title": "Pull requests make CI harder",
    "url": "https://tylercipriani.com/blog/2023/09/24/stacked-patches/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-09-24T23:28:28Z",
    "date_modified": "2023-10-02T23:47:33Z",


    "content_html": "<blockquote>\n<p>You should never have more than a day’s work sitting unintegrated in\nyour local repository</p>\n<p>– Martin Fowler, <a\nhref=\"https://martinfowler.com/articles/branching-patterns.html\">Branching\nPatterns</a></p>\n</blockquote>\n<p>In interviews, I throw out a gimme: “Can you explain continuous\nintegration?”</p>\n<p>Folks tend to ignore the easy answer: <strong>Continuous\nintegration</strong> is when folks merge code to <code>main</code> as\nsoon as it’s healthy—often a couple of times a day.</p>\n<p>Some code review systems <a\nhref=\"https://en.wikipedia.org/wiki/Affordance\">afford</a> continuous\nintegration.</p>\n<p>But GitHub doesn’t. Instead, pull requests afford integration\npain.</p>\n<section id=\"how-pull-requests-can-slow-you-down\" class=\"level2\">\n<h2><span aria-hidden=\"true\">🦥</span> How pull requests can slow you\ndown</h2>\n<p>If folks finish a feature before merging to <code>main</code>, that’s\ncalled a <strong>feature branch</strong>.</p>\n<p><a\nhref=\"https://docs.github.com/en/get-started/quickstart/github-flow\">GitHub\nFlow</a> is focused on feature branches—fork a repo, make changes to a\nbranch, and create a pull request. This is how most people learn to\nshare code.</p>\n<p>But this is a trap.</p>\n<p>Feature branches slow you down in two ways</p>\n<ol type=\"1\">\n<li><strong>Hard to review</strong> – They’re large, slowing down\nreview.</li>\n<li><strong>Painful to integrate</strong> – They contain many changes,\ncreating more opportunities for merge conflicts.</li>\n</ol>\n</section>\n<section id=\"feature-branches-encourage-big-diffs\" class=\"level2\">\n<h2><span aria-hidden=\"true\">🐘</span> Feature branches encourage big\ndiffs</h2>\n<p><a href=\"https://tylercipriani.com/blog/2022/03/12/code-review-procrastination-and-clarity/\">Code\nreview decision fatigue</a> is real—big changes make for slow reviews.<a\nhref=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></p>\n<p>Imagine a feature branch with a three commits:</p>\n<ul>\n<li>Refactor some code</li>\n<li>Add a model class</li>\n<li>Add a database migration</li>\n</ul>\n<p>Push that branch as a pull request and you get this:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-09-30_github-flow.png\"\nalt=\"Feature branch flow: a local feature branch becomes a review with three commits\" />\n<figcaption aria-hidden=\"true\">Feature branch flow: a local feature\nbranch becomes a review with three commits</figcaption>\n</figure>\n<p>But this is an anti-pattern—you’ve created a monster pull request\nthat some poor sap has to wade through.</p>\n<p>Compare the same local branch pushed up as a stack of three\nreviews:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-09-30_stacked-flow.png\"\nalt=\"Stacked patches flow: a local feature branch becomes three reviews with one commit each\" />\n<figcaption aria-hidden=\"true\">Stacked patches flow: a local feature\nbranch becomes three reviews with one commit each</figcaption>\n</figure>\n<p>Now, each commit gets reviewed on its own. And that makes each review\nsmall.</p>\n<p>The small delta means less code for the reviewer to understand,\nmaking each change easier to review and faster to merge.</p>\n</section>\n<section id=\"feature-branches-create-integration-pain\" class=\"level2\">\n<h2><span aria-hidden=\"true\">😖</span> Feature branches create\nintegration pain</h2>\n<p>It’s common for two developers to create conflicting code\nchanges.</p>\n<p>Feature branches make integration painful by hiding conflicts until\nmerge time:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-09-30_github-alice-and-bob.png\"\nalt=\"Feature branches resolve conflicts long after they’re created, resulting in lots of rework\" />\n<figcaption aria-hidden=\"true\">Feature branches resolve conflicts long\nafter they’re created, resulting in lots of rework</figcaption>\n</figure>\n<p>Continuous integration makes it easier to catch the same situation\nearlier:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-09-30_stacked-alice-and-bob-2.png\"\nalt=\"Continuous integration catches conflicts when they happen, resulting in less rework\" />\n<figcaption aria-hidden=\"true\">Continuous integration catches conflicts\nwhen they happen, resulting in less rework</figcaption>\n</figure>\n<p>Now, instead of waiting until their feature is complete, developers\npush and resolve their conflicts along the way.</p>\n<p>Less painful integration means you’ll do it more and move faster.</p>\n</section>\n<section id=\"stacked-patches-afford-continuous-integration\"\nclass=\"level2\">\n<h2><span aria-hidden=\"true\">📚</span> Stacked patches afford continuous\nintegration</h2>\n<p>It’s possible to make small pull requests.</p>\n<p>But GitHub isn’t making it easy.</p>\n<p>Developers hacking away at ginormous feature branches is the root of\nall the problems I outline above.</p>\n<p>And that’s precisely where “GitHub Flow” steers you.</p>\n<p><strong>Stacked patch</strong> systems—like <a\nhref=\"https://www.gerritcodereview.com/\">Gerrit</a> and <a\nhref=\"https://phorge.it/\">Phorge</a>—afford continuous integration. Each\ncommit makes a patchset. And each patchset can merge with\n<code>main</code>.</p>\n<p>This is one of the reasons big software projects<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a>\nhave opted for stacked patch systems.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>“Smaller patches undergo fewer rounds\nof revisions, while larger changes have more re-work done before they\nsuccessfully land into the project’s version control repository.” via <a\nhref=\"https://doi.org/10.1007/s10664-015-9366-8\">Investigating technical\nand non-technical factors influencing modern code review</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>Google, Facebook, Twitter, Android\nall use either Gerrit or Phabricator/Phorge for code review (or did at\nsome point)<a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/08/31/beepy/",

    "title": "Review: Beepy, the pocket-sized, linux-powered cyberdeck",
    "url": "https://tylercipriani.com/blog/2023/08/31/beepy/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-08-31T00:25:41Z",
    "date_modified": "2023-09-01T03:41:31Z",


    "content_html": "<blockquote>\n<p>THIS IS NOT A REAL FINISHED PRODUCT.</p>\n<p>– <a\nhref=\"https://news.ycombinator.com/item?id=35976488\">Erohead</a>,\nbirther of Beepy</p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/58/fa1c9cd37283573390d381188d09d5/large.jpg\"\nalt=\"The SQFMI Beepy alongside my cat printer\" />\n<figcaption aria-hidden=\"true\">The SQFMI Beepy alongside my cat\nprinter</figcaption>\n</figure>\n<p>The Beepy is a handheld Linux console designed by artists and built\nfor nerds.</p>\n<p>From the first announcement, Beepy’s creator—<a\nhref=\"https://sqfmi.com/\">SQFMI</a>—was candid about the device’s lack\nof polish.</p>\n<p>“Buyer beware!” was a direct quote.</p>\n<p>But I snagged one anyway. And so far, the punishment has been\nminor.</p>\n<section id=\"what-i-dislike\" class=\"level2\">\n<h2>What I dislike</h2>\n<p>Day one: I breezed through the “<a\nhref=\"https://beepy.sqfmi.com/docs/getting-started\">Getting Started</a>”\ndocs and readied myself for hacking.</p>\n<p>Then the keyboard wailed “aaaaaaaaaa” at me until I rebooted.</p>\n<figure>\n    <video autoplay loop muted>\n        <source src=\"https://photos.tylercipriani.com/2023-08-22_beepy-aaaa-smol.mp4\" type=\"video/mp4\">\n    </video>\n    <figcaption>Day one: The spirit trapped in the Beepy keyboard cries for freedom.</figcaption>\n</figure>\n<p>Off to a bad start.</p>\n<p>Undeterred, I took to the <a\nhref=\"https://discord.gg/QERrSferdF\">Beepy Discord</a>, where I found\nsolace among other new and confused Beepy owners.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-08-31_beepy-discord.png\"\nalt=\"The Beepy Discord\" />\n<figcaption aria-hidden=\"true\">The Beepy Discord</figcaption>\n</figure>\n<p>Thanks to the active Discord community, I was clued into to the fix:\ndowngrade all the things.<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></p>\n<p>While this experience was bumpy, everyone in the discord was helpful\nand awesome—I’m grateful for all the volunteers assisting us wayward\nnerds.</p>\n<p>I’ve contributed some <a\nhref=\"https://github.com/sqfmi/beepy-docs/pulls?q=is%3Apr+author%3Athcipriani\">pending\ndocumentation changes</a> to pay it forward.</p>\n</section>\n<section id=\"what-i-like\" class=\"level2\">\n<h2>What I like</h2>\n<blockquote>\n<p>The idea of a breakable computer was important to us.</p>\n<p>– Eben Upton, CEO, Raspberry Pi Ltd</p>\n</blockquote>\n<p>The Beepy is scrappy—an ideal platform for hacking and tinkering.</p>\n<p>The form factor inspired some fun ideas for me:</p>\n<ol type=\"1\">\n<li><code>gphoto2</code> intervalometer for my camera (a compact version\nof what I used for the last <a href=\"https://tylercipriani.com/photos/solar-eclipse/\">solar\neclipse</a>)</li>\n<li><a\nhref=\"https://learn.adafruit.com/ble-thermal-cat-printer-with-circuitpython/overview\">Catprinter</a>-powered\nlow-fi photobooth</li>\n<li><a href=\"https://www.arrl.org/direction-finding\">Ham radio fox\nhunting</a> with <a\nhref=\"https://github.com/r4d10n/retrogram-rtlsdr\">retrogram~rtlsdr</a></li>\n<li>Distraction-free RSS reader and podcasting device via <a\nhref=\"https://newsboat.org/\">newsboat</a></li>\n</ol>\n<p>Sure, I could do all these things with <a\nhref=\"https://termux.com/\">termux</a> on my phone.</p>\n<p>But something about the cold monolithic slab of modern smartphones\nfeels considerably less cyberpunk—you’ll never hack an ATM <a\nhref=\"https://www.youtube.com/watch?v=yB82FNPoiPM\">ála Terminator 2</a>\nwith a smartphone.</p>\n<p>The keyboard is clicky and satisfying. Key chording gets you all the\ncharacters you need to use the terminal.</p>\n<p>Bonus points for the stellar <a\nhref=\"https://github.com/wallComputer/bbqX0kbd_driver#keyboard-layout\">ASCII-art\nkey chord documentation</a>.</p>\n<p>Plus, it’s a delightful Frankenstein’s monster of off-the-shelf\nparts:</p>\n<ul>\n<li><a href=\"https://www.adafruit.com/product/5291\">Raspberry Pi Zero\nW2</a> ($15)</li>\n<li><a\nhref=\"https://shop.pimoroni.com/products/bbq20-keyboard-with-trackpad-usb-i2c-pmod?variant=39913457188947\">Blackberry\nkeyboard</a> (using Solder Party’s BB Q20 keyboard driver via RP2040)\n($30)</li>\n<li><a href=\"https://www.adafruit.com/product/4694\">2.7” SHARP Memory\nDisplay at 400×240</a> ($45)</li>\n</ul>\n<p>As <a\nhref=\"https://hackaday.com/2023/08/07/review-beepy-a-palm-sized-linux-hacking-playground/\">Hackaday</a>\nalready pointed out—the parts alone make the Beepy a screaming deal at\n$99.</p>\n</section>\n<section id=\"final-verdict\" class=\"level2\">\n<h2>Final verdict</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/5b/13e96b1ed282980fbfd43e2f81a73d/large.jpg\"\nalt=\"The PocketCHIP next to its spiritual successor\" />\n<figcaption aria-hidden=\"true\">The PocketCHIP next to its spiritual\nsuccessor</figcaption>\n</figure>\n<p>I’m a sucker for pocket-sized Linux devices. And a glutton for a\ncertain kind of punishment.</p>\n<p>The Beepy is not a finished product, but that’s the whole point.</p>\n<p>It scratches an itch I’ve always had: the desire to hack alongside\nlike-minded nerds, all tilting at our joyless monolithic slabs.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><pre><code>- Install the old firmware from here: https://github.com/sqfmi/i2c_puppet/raw/df121c7273a204f17f0d21b28f48cd938787216b/i2c_puppet.uf2\n- Set up a new sd card and boot Beepy. Wait until it finishes resizing its partition then connect via ssh.\n- Run this setup script which installs the latest sharp drm driver and the old keyboard driver: `curl -s https://raw.githubusercontent.com/TheMediocritist/beepy_setup/main/temp_beepy_setup.sh | bash`</code></pre>\n<p>The “Downgrade all the things” fix, for posterity, via the <a\nhref=\"https://discord.com/channels/1108020055318462606/1108024614669537291/1144047784044023878\">Beepy\nDiscord</a><a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/07/31/git-files-hidden-in-plain-sight/",

    "title": "Git files hidden in plain sight &#x1FAE5;",
    "url": "https://tylercipriani.com/blog/2023/07/31/git-files-hidden-in-plain-sight/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-08-01T00:39:40Z",
    "date_modified": "2023-08-01T02:47:02Z",


    "content_html": "<blockquote>\n<p>I doubt that it is a good practice to ship the public key used to\nsign things in the repository in the repository itself</p>\n<p>– Junio C Hamano, <a\nhref=\"https://lore.kernel.org/git/20210907204100.ptapvn4wrqn3qrzq@meerkat.local/T/\">git@vger.kernel.org:\nexpired key in junio-gpg-pub</a></p>\n</blockquote>\n<p>Git ships with the maintainer’s public key.</p>\n<p>But you won’t find it in your worktree—it’s hidden in plain\nsight.</p>\n<p>Junio Hamano’s public key is a blob in the <code>git</code> object\ndatabase. It’s tagged with <code>junio-gpg-pub</code>, so you can only\nsee it with <code>git cat-file</code>:</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ git cat-file blob junio-gpg-pub\n-----BEGIN PGP PUBLIC KEY BLOCK-----\nVersion: GnuPG v1\n...</code></pre>\n<p>In 2021, Junio pretty much said that this was a <a\nhref=\"https://lore.kernel.org/git/20210907204100.ptapvn4wrqn3qrzq@meerkat.local/T/\">bad\nidea</a>.</p>\n<p>But it led me to think about some other wonderful bad ideas.</p>\n<section id=\"fake-empty-github-repos\" class=\"level2\">\n<h2>Fake empty GitHub repos <span aria-role=\"hidden\">📦</span></h2>\n<p>I made an empty GitHub repo called <a\nhref=\"https://github.com/thcipriani/hidden-zangief\">hidden-zangief</a>.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-07-31_empty-github.png\"\nalt=\"hidden-zangief\" />\n<figcaption aria-hidden=\"true\">hidden-zangief</figcaption>\n</figure>\n<p>Except it’s not empty.</p>\n<p>Instead, it’s chockfull of sweet ANSI art—Zangief from Street Fighter\nII.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-07-31_zangief-ansii.png\"\nalt=\"Zangief + Figlet = magic\" />\n<figcaption aria-hidden=\"true\">Zangief + Figlet = magic</figcaption>\n</figure>\n<p>And if you clone it, after an initial warning, you can see Zangief is\nstill in there:</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ git clone https://github.com/thcipriani/hidden-zangief &amp;&amp; cd hidden-zangief\nCloning into &#39;hidden-zangief&#39;...\nwarning: You appear to have cloned an empty repository.\n(/^ヮ^)/*:・ﾟ✧ git fetch origin refs/atomic/piledriver\nremote: Enumerating objects: 1, done.\nremote: Counting objects: 100% (1/1), done.\nremote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0\nUnpacking objects: 100% (1/1), 1.71 KiB | 1.71 MiB/s, done.\nFrom https://github.com/thcipriani/hidden-zangief\n * branch            refs/atomic/piledriver -&gt; FETCH_HEAD\n(/^ヮ^)/*:・ﾟ✧ git show FETCH_HEAD\n\n                        [...sweet zangief ansi art...]\n                        _____                 _       __ \n                       |__  /__ _ _ __   __ _(_) ___ / _|\n                         / // _` | &#39;_ \\ / _` | |/ _ \\ |_ \n                        / /| (_| | | | | (_| | |  __/  _|\n                       /____\\__,_|_| |_|\\__, |_|\\___|_|  \n                                        |___/        </code></pre>\n</section>\n<section id=\"dubious-git-plumbing-hacks\" class=\"level2\">\n<h2>Dubious git plumbing hacks <span aria-role=\"hidden\">🪓</span></h2>\n<p>Inspired by Junio, I misused and finagled a couple of <a\nhref=\"https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain\">git\nplumbing commands</a> to make this fake empty repo:</p>\n<ol type=\"1\">\n<li><code>git hash-object</code></li>\n<li><code>git update-ref</code></li>\n</ol>\n<p>First, I used <code>hash-object</code> to create a dangling git\nobject with the <code>~/zangief.txt</code> contents.</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ mkdir /tmp/hidden-zangief &amp;&amp; cd /tmp/hidden-zangief\n(/^ヮ^)/*:・ﾟ✧ git init\n(/^ヮ^)/*:・ﾟ✧ git hash-object -w ~/zangief.txt\n7dd9e2d2d2d8b5107d225b4708e1177abb08e7c8</code></pre>\n<p>Now Zangief is lurking in your git plumbing, atomic-suplexing your\nother git objects.</p>\n<p>I imagine this is how Junio added his public key to the git object\ndatabase. Then he tagged it with <code>junio-gpg-pub</code> and pushed\nit to the <code>git</code> repo.</p>\n<p>But a tag would appear in the GitHub UI, and I wondered whether I\ncould hide it.</p>\n<p>So I opted to abuse the wide-open git ref namespace, imagining a ref\nbeyond tags and branches: <code>refs/atomic/piledriver</code>.</p>\n<p>Then I schlepped that ref to GitHub.</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ git update-ref refs/atomic/piledriver 7dd9e2d2d2d8b5107d225b4708e1177abb08e7c8\n(/^ヮ^)/*:・ﾟ✧ git remote add origin https://github.com/thcipriani/hidden-zangief\n(/^ヮ^)/*:・ﾟ✧ git push origin refs/atomic/piledriver:refs/atomic/piledriver</code></pre>\n<p>And, of course, Microsoft GitHub foolishly neglects the\n<code>refs/atomic/*</code> namespace in their UI, rendering our 400 lb\nwrestler friend invisible.</p>\n<p>Infinite magic awaits the intrepid developer willing to abuse\n<code>git</code> plumbing. After all, git is just a database with a\nterrible interface.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/07/30/sriracha-taste-test/",

    "title": "Sriracha Fight!! &#x1F94A;",
    "url": "https://tylercipriani.com/blog/2023/07/30/sriracha-taste-test/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-07-30T22:59:56Z",
    "date_modified": "2023-07-30T23:58:27Z",


    "content_html": "<figure>\n<img alt=\"Huy Fong Foods Inc. factory signage\" src=\"https://photos.tylercipriani.com/2014-08-24_at-the-birthplace-of-the-famous-rooster-sauce_paul-narvaez_cc-by-2.0.jpg\">\n<figcaption aria-hidden=\"true\">\n    At the birthplace of the famous rooster sauce. by\n    <a href=\"https://flickr.com/photos/the_photographer/\">Paul Narvaez</a>\n    (<a href=\"https://creativecommons.org/licenses/by/2.0/\">CC-By-2.0</a>)\n</figcaption>\n</figure>\n<p>There’s plenty of sriracha—unless you’re looking for the brand anyone\nwants.</p>\n<p>Huy Fong Foods, Inc’s Sriracha vanished from stores, and they <a\nhref=\"https://www.callifd.com/uploads/1/3/0/7/130789654/customer_notice_-_chili_supply_update_may_2023.pdf\">have\nno idea</a> when it’ll be back.</p>\n<p>So, driven by the shortage and the scorn of sriracha hipsters\ndecrying Huy Fong as an <a\nhref=\"https://www.seriouseats.com/taste-test-the-best-sriracha\">Americanized\nknockoff</a> of the original Thai sauce, I did a blind taste test.</p>\n<p>Before the test, I cling to two expectations:</p>\n<ol type=\"1\">\n<li>I’ll be able to pick out the Huy Fong Sriracha</li>\n<li>Huy Fong Sriracha will be the best, dooming me to wander the earth\nsearching for it</li>\n</ol>\n<p>Except that’s only kind of what happened.</p>\n<section id=\"the-contenders\" class=\"level2\">\n<h2>The contenders</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/08/b273a3fe4a0165b0c2dda245e98b9d/large.jpg\"\nalt=\"Sriracha Fight!\" />\n<figcaption aria-hidden=\"true\">Sriracha Fight!</figcaption>\n</figure>\n<p>I bought six brands of sriracha and sacrificed a precious portion of\nmy dwindling Huy Fong Sriracha for science:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th><span role=img aria-label=\"Picture\">🖼️</a></th>\n<th>Product</th>\n<th>Origin</th>\n<th>Price</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/2d/ae31b85357fa72b635465c777ff27f/\"><img alt=\"Huy Fong Foods Inc. Sriracha\" src=\"https://photos.tylercipriani.com/thumbs/2d/ae31b85357fa72b635465c777ff27f/small.jpg\"></a></td>\n<td>Huy Fong Foods, Inc. Sriracha</td>\n<td>Irwindale, CA, USA</td>\n<td><code>inf</code></td>\n</tr>\n<tr class=\"even\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/f0/050a300055072c70884f8871ae19f3/\"><img alt=\"Amazon/Whole foods Ninja Squirrel Sriracha\" src=\"https://photos.tylercipriani.com/thumbs/f0/050a300055072c70884f8871ae19f3/small.jpg\"></a></td>\n<td>Amazon/Whole Foods Ninja Squirrel</td>\n<td>Austin, TX, USA</td>\n<td>$4.79</td>\n</tr>\n<tr class=\"odd\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/55/696bd74b7bded7754519b9ba0f22ff/\"><img alt=\"Lee Kum Kee Sriracha Chili Sauce\" src=\"https://photos.tylercipriani.com/thumbs/55/696bd74b7bded7754519b9ba0f22ff/small.jpg\"></a></td>\n<td>Lee Kum Kee Sriracha Chili Sauce</td>\n<td>City of Industry, CA, USA</td>\n<td>$5.99</td>\n</tr>\n<tr class=\"even\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/54/7a7ba90cee0c7bb14f704245f8f1ca/\"><img alt=\"Yellowbird Organic Sriracha\" src=\"https://photos.tylercipriani.com/thumbs/54/7a7ba90cee0c7bb14f704245f8f1ca/small.jpg\"></a></td>\n<td>Yellowbird Organic Sriracha</td>\n<td>San Marcos, TX, USA</td>\n<td>$9.29(! And it’s so tiny)</td>\n</tr>\n<tr class=\"odd\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/2a/c90f14cc237e2e173606b1754a6f23/\"><img alt=\"Shark Brand Sriracha Chili Sauce\" src=\"https://photos.tylercipriani.com/thumbs/2a/c90f14cc237e2e173606b1754a6f23/small.jpg\"></a></td>\n<td>Shark Brand Sriracha Chili Sauce</td>\n<td>Chon Buri, Thailand</td>\n<td>$18.99(! This is a big bottle. But still.)</td>\n</tr>\n<tr class=\"even\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/98/bfbabad2b2e80d9006ec80506da393/\"><img alt=\"MW Polar Sriracha Chili Sauce\" src=\"https://photos.tylercipriani.com/thumbs/98/bfbabad2b2e80d9006ec80506da393/small.jpg\"></a></td>\n<td>MW Polar Sriracha Chili Sauce</td>\n<td>Thailand</td>\n<td>$3.83 (6-pack for $22.99—hope I like it <span\naria-hidden=\"true\">🤞</span>)</td>\n</tr>\n<tr class=\"odd\">\n<td><a href=\"https://photos.tylercipriani.com/thumbs/11/10cff5e55518f541267baefaf67b35/\"><img alt=\"Sriraja Panich Sriracha Chili Sauce\" src=\"https://photos.tylercipriani.com/thumbs/11/10cff5e55518f541267baefaf67b35/small.jpg\"></a></td>\n<td>Sriraja Panich Sriracha Chili Sauce</td>\n<td>Thailand</td>\n<td>$3.98</td>\n</tr>\n</tbody>\n</table>\n</section>\n<section id=\"methods\" class=\"level2\">\n<h2>Methods</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/97/a0521e1fd3556293e2bf1de6e815eb/large.jpg\"\nalt=\"Tater-tots. Lots of ’em.\" />\n<figcaption aria-hidden=\"true\">Tater-tots. Lots of ’em.</figcaption>\n</figure>\n<p>On a very normal Friday night, I blindfolded myself and ate\ntater-tots.</p>\n<p>I dispensed each sriracha into its own stainless-steel ramekin and\nassigned it a letter. This way, my steadfast assistant would remain\nunaware which sriracha was which, ensuring the validity of my\nresults.</p>\n<p>Between srirachas, I cleansed my palate using plant-powered protein\ntortillas because <code>¯\\_(ツ)_/¯</code>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/56/5370fce49d9c94269fbb71e8db53be/large.jpg\"\nalt=\"Ramekins with sriracha, assigned a letter\" />\n<figcaption aria-hidden=\"true\">Ramekins with sriracha, assigned a\nletter</figcaption>\n</figure>\n<p>I ranked each sriracha from 1–10 using four criteria:</p>\n<ol type=\"1\">\n<li>Garlic</li>\n<li>Sweetness</li>\n<li>Spiciness/heat</li>\n<li>Overall flavor</li>\n</ol>\n</section>\n<section id=\"results\" class=\"level2\">\n<h2>Results</h2>\n<p>I forgot to guess which was Huy Fong Sriracha.</p>\n<p>And, oddly, Huy Fong was the only sriracha I tasted without comment.\nI suppose I received a sriracha that tasted like Sriracha—what was there\nto say?</p>\n<p>My “overall” ranking is more of “I like this” vs. “this is a good Huy\nFong Sriracha substitute.”</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Brand</th>\n<th>Garlic</th>\n<th>Sweetness</th>\n<th>Spice</th>\n<th>Overall</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>Lee Kum Kee Sriracha Chili Sauce</td>\n<td>4th</td>\n<td>1st</td>\n<td>2nd</td>\n<td><strong>1st</strong></td>\n</tr>\n<tr class=\"even\">\n<td>Huy Fong Foods, Inc Sriracha</td>\n<td>3rd</td>\n<td>3rd</td>\n<td>3rd</td>\n<td><strong>2nd</strong></td>\n</tr>\n<tr class=\"odd\">\n<td>MW Polar Sriracha Chili Sauce</td>\n<td>4th</td>\n<td>1st</td>\n<td>3rd</td>\n<td><strong>3rd</strong></td>\n</tr>\n<tr class=\"even\">\n<td>Yellowbird Organic Sriracha</td>\n<td>3rd</td>\n<td>3rd</td>\n<td>4th</td>\n<td><strong>3rd</strong></td>\n</tr>\n<tr class=\"odd\">\n<td>Shark Brand Sriracha Chili Sauce</td>\n<td>2nd</td>\n<td>2nd</td>\n<td>4th</td>\n<td><strong>4th</strong></td>\n</tr>\n<tr class=\"even\">\n<td>Sriraja Panich Sriracha Chili Sauce</td>\n<td>1st</td>\n<td>4th</td>\n<td>1st</td>\n<td><strong>4th</strong></td>\n</tr>\n<tr class=\"odd\">\n<td>Amazon/Whole foods Ninja Squirrel Sriracha</td>\n<td>3rd</td>\n<td>2nd</td>\n<td>5th</td>\n<td><strong>5th</strong></td>\n</tr>\n</tbody>\n</table>\n<p><strong>Comments</strong></p>\n<p>First, I grew up on Doritos and Pizza Hut and this all opinion.</p>\n<p>Second, some observations:</p>\n<ul>\n<li>The Thai brands were red-orange. American brands were dark red. The\nexception was Huy Fong Sriracha which was in between the two.</li>\n<li>The American brands were spicier.</li>\n<li>The Thai brands tasted like fermented garlic, an acquired taste, I\nguess, since I found it off-putting.</li>\n</ul>\n<p>Brand-sepcific comments:</p>\n<ul>\n<li><strong>Lee Kum Kee</strong>\n<ul>\n<li>“Sharp cayenne-pepper-type heat”</li>\n<li>“Like spicy ketchup”</li>\n<li>This was more like hot sauce than sriracha. But I like hot sauce,\nso.</li>\n</ul></li>\n<li><strong>Huy Fong Foods, Inc</strong> – No comment.</li>\n<li><strong>MW Polar</strong>\n<ul>\n<li>“Initially not very spicy, but heat builds”</li>\n<li>“Garlic-y, but not how I want my garlic”</li>\n<li>It seemed fishy. I think this is the flavor of fermented\ngarlic.</li>\n</ul></li>\n<li><strong>Yellowbird Organic</strong>\n<ul>\n<li>“This tastes like barbecue sauce”</li>\n<li>Once I accepted this as expensive barbecue sauce, I liked it much\nbetter.</li>\n</ul></li>\n<li><strong>Shark Brand</strong>\n<ul>\n<li>“This tastes like jarred garlic”</li>\n</ul></li>\n<li><strong>Sriraja Panich</strong>\n<ul>\n<li>“Some up-front heat”</li>\n<li>“This tastes like fishy garlic”</li>\n</ul></li>\n<li><strong>Amazon/Whole Foods Ninja Squirrel</strong>\n<ul>\n<li>“Weird old sweetness, like molasses”</li>\n</ul></li>\n</ul>\n<p>So it seems I’ve found some new condiments.</p>\n<p>But Huy Fong Sriracha is still the only sriracha, at least to my dumb\nAmerican palette.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/06/30/well-crafted-grocery-lists/",

    "title": "Well-crafted grocery lists",
    "url": "https://tylercipriani.com/blog/2023/06/30/well-crafted-grocery-lists/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-06-30T23:35:25Z",
    "date_modified": "2023-07-01T00:14:01Z",


    "content_html": "<blockquote>\n<p>Inspired by the simple unassuming beauty of a well-crafted grocery\nlist</p>\n<p>– Field Notes back inside cover</p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/49/df190c5ecd82ed9d988af5d8e8a454/large.jpg\"\nalt=\"The list.\" />\n<figcaption aria-hidden=\"true\">The list.</figcaption>\n</figure>\n<p>Lists are powerful technology.</p>\n<p>In his book <a\nhref=\"https://openlibrary.org/books/OL24611967M/Moonwalking_with_Einstein\">Moonwalking\nwith Einstein</a>, Joshua Foer likens early writing to sheet music for\nstory-telling.</p>\n<p><a href=\"https://en.wikipedia.org/wiki/Scriptio_continua\">Scripto\ncontinua</a> had zero punctuation—even lacking spaces between words.\nThis dearth of punctuation meant (Foer argues) that ancient writing was\nlittle more than a mnemonic device for remembering stories. Reading\nsilently to yourself was difficult and uncommon.</p>\n<p>Today punctuation abounds. And lists are the ultimate in punctuation\ntechnology, enabling you to read text at a glance.</p>\n<p>Umberto Eco, working as a librarian in residence at the Library of\nCongress, went further, arguing <a\nhref=\"https://en.wikipedia.org/wiki/The_Infinity_of_Lists\">lists created\nmodernity</a>.</p>\n<p>But I think it’s more than just lists—it’s lists you run into\nagain.</p>\n<section id=\"inboxes-are-only-useful-when-theyre-drained\"\nclass=\"level2\">\n<h2>Inboxes are only useful when they’re drained</h2>\n<blockquote>\n<p>Reliable inboxes are powerful because they let us Close open loops\nand focus on the work itself, rather than on meta-work.</p>\n<p>– Andy Matuschak, <a\nhref=\"https://notes.andymatuschak.org/z5tiFxnNKMZCnc8G9R1N51L5hknyRGmyCQx18\">Inboxes\nonly work if you trust how they’re drained</a></p>\n</blockquote>\n<p>The power of the well-crafted grocery list goes unrealized when you\nleave it at home.</p>\n<p>There’s a principle in Gestalt psychology called <a\nhref=\"https://en.wikipedia.org/wiki/Zeigarnik_effect\">Zeigarnik\nEffect</a>—named after the psychologist Bluma Zeigarnik.</p>\n<p>An incomplete task, Zeigarnik observed, was more readily recalled\nthan a completed task. Zeigarnik also discovered a cure to this\naffliction: If you write it down, you can forget it.</p>\n<p>But, for me, that’s not enough. I have to trust that I’ll run into it\nagain.</p>\n<p>If my email inbox is stuffed, it means I’ve lost trust in my TODO\nlist, leading me to keep unread emails around just in case.</p>\n<p>This is the core of David Allen’s <a\nhref=\"https://openlibrary.org/works/OL271504W/Getting_Things_Done\">Getting\nThings Done</a>. Allen preaches the practice of a weekly review, where\nyou review your TODO list, your “someday/maybe” list, and your calendar\nonce a week to ensure you stay on track.</p>\n<p>If you make a list. And you never review it. You’ll never trust\nit.</p>\n<p>The only well-crafted grocery list is the one you have at the\nstore.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/06/13/email-tips/",

    "title": "Please stop writing email like mail",
    "url": "https://tylercipriani.com/blog/2023/06/13/email-tips/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-06-13T03:14:13Z",
    "date_modified": "2023-06-17T21:14:31Z",


    "content_html": "<blockquote>\n<p>I have never seen an email message too short.</p>\n<p>– Roman and Raphaelson, <a\nhref=\"https://openlibrary.org/works/OL2683652W/Writing_that_works\">Writing\nThat Works</a></p>\n</blockquote>\n<p>Email is both a cornerstone of remote-first culture and a colossal\nwaste of time.</p>\n<p>This is because <strong>folks think of email as mail</strong>—like\nthey’re writing a letter. <strong>But it’s more like popping into my\noffice.</strong></p>\n<p>You’d never stop me in the hall and go: “Hey, about Project X—I hope\nthis day finds you well and you’re staying healthy. As you may know, for\nthe past six months, I have been working on Project X…”.</p>\n<p>All that throat-clearing would be so awkward. You’d go: “Hey, Project\nX is done! Do you want to try it?”</p>\n<p>But it’s hard to <strong>pare down your email to its\nessence</strong>. Here are some tips that may help.</p>\n<section id=\"clear-short-and-simple\" class=\"level2\">\n<h2>💌 Clear, short, and simple</h2>\n<p>If you want to communicate: <a\nhref=\"http://paulgraham.com/talk.html\">write like you talk</a>.</p>\n<p>Avoid the big words—instead of “utilize,” try “use.” Cut lengthy\nasides and empty jargon—they make it harder to understand what you’re\nsaying.</p>\n<p>In his essay “<a\nhref=\"https://www.orwell.ru/library/essays/politics/english/e_polit/\">Politics\nand the English Language</a>,” George Orwell condemned modern business\njargon as “gumming together long strips of words […] by sheer humbug.”\nAn all-too-apt description of emails post-ChatGPT.</p>\n<p>Consider Orwell’s rewrite of this passage from Ecclesiastes:</p>\n<blockquote>\n<p>The race is not to the swift, nor the battle to the strong […]; but\ntime and chance happeneth to them all.</p>\n</blockquote>\n<p>Which, in modern businessese, becomes:</p>\n<blockquote>\n<p>Objective consideration of contemporary phenomena compels the\nconclusion that success or failure in competitive activities exhibits no\ntendency to be commensurate with innate capacity, but that a\nconsiderable element of the unpredictable must invariably be taken into\naccount.</p>\n</blockquote>\n</section>\n<section id=\"embrace-the-inverted-pyramid\" class=\"level2\">\n<h2>⏳ Embrace the inverted pyramid</h2>\n<p>Get to the point.</p>\n<p>Journalists crank out stories using a method called the “<a\nhref=\"https://www.nngroup.com/articles/inverted-pyramid/\">inverted\npyramid</a>.” The pyramid’s base—the most essential information—comes\nfirst.</p>\n<p>This structure lets readers bail early and still get the gist of the\nstory.</p>\n<p>That’s perfect for email. People are busy; get to your point as soon\nas possible.</p>\n</section>\n<section id=\"use-the-subject-line\" class=\"level2\">\n<h2>🏥 Use the subject line</h2>\n<p>When I’m at my best, I use David Allen’s <a\nhref=\"https://openlibrary.org/works/OL271504W/Getting_Things_Done\">Getting\nThings Done</a> (GTD) method to process my inbox:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-06-13_gtd.png\"\nalt=\"GTD Flow diagram (made in Excalidraw)\" />\n<figcaption aria-hidden=\"true\">GTD Flow diagram (made in\nExcalidraw)</figcaption>\n</figure>\n<p>I use the subject line to triage.</p>\n<p>Allen’s method focuses on the next action. So, if you need action\nfrom me, try tagging it in the subject line:</p>\n<ul>\n<li><strong>[ACTION]</strong> – you need me to do something</li>\n<li><strong>[Low Priority]</strong> – no need for immediate action.</li>\n<li><strong>[Info]</strong> – no action required; information only.</li>\n</ul>\n<p>Include the deadline in the subject; e.g., “[ACTION] Review blog post\nby Tue, 13 Jun 2023”</p>\n</section>\n<section id=\"tldr-bullet-points\" class=\"level2\">\n<h2>👉 tl;dr: bullet points</h2>\n<p>tl;dr: “too-long; didn’t read”-style summaries at the top emails save\ntime and mental energy—highly recommended.</p>\n<p>And instead of long paragraphs and walls of text:</p>\n<ul>\n<li>Use bullet points.</li>\n<li>They’re swell.</li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/05/29/air-quality/",

    "title": "Monitoring my indoor air quality",
    "url": "https://tylercipriani.com/blog/2023/05/29/air-quality/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-05-29T23:58:34Z",
    "date_modified": "2023-05-30T00:17:21Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/f5/8878d060ad53e8657d7653dc25c289/large.jpg\"\nalt=\"Fri, 19 May 2023 Denver air quality live cam\" />\n<figcaption aria-hidden=\"true\">Fri, 19 May 2023 Denver air quality live\ncam</figcaption>\n</figure>\n<p>If there’s one thing that feels like it’s gotten worse in my\nlifetime, it’s air quality.</p>\n<p>Colorado’s air quality last week was dismal, filled with smoke from\nCanadian wildfires, making Denver’s air quality among the <a\nhref=\"https://www.weather5280.com/2023/05/19/denver-weather-wildfire-smoke-threatens-air-quality\">worst\nof any major city</a>.</p>\n<p>This is what happened to air quality <a\nhref=\"https://www.bouldair.com/longmont.htm\">four miles from my\nhouse</a>:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-05-29_fine-particles-pm25-longmont.png\"\nalt=\"Fine particles (PM2.5), Union Resevior, Longmont, CO\" />\n<figcaption aria-hidden=\"true\">Fine particles (PM2.5), Union Resevior,\nLongmont, CO</figcaption>\n</figure>\n<p>And here’s the air quality index (AQI) in my bedroom:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-05-23_bedroom-airgradient-aqi2.png\"\nalt=\"Bedroom air quality index 2023-05-18–2023-05-19\" />\n<figcaption aria-hidden=\"true\">Bedroom air quality index\n2023-05-18–2023-05-19</figcaption>\n</figure>\n<p>You can see spikes from cooking. And you can see the moment\n(2023-05-19T22:25 MDT) I swapped out the aging filter on my little <a\nhref=\"https://www.amazon.com/LEVOIT-Purifier-Home-Allergies-Pets/dp/B07VVK39F7/ref=sr_1_3\">LEVOIT\nair purifier</a>, holding particulate in check, returning indoor air\nquality to baseline.</p>\n<section id=\"why-care-about-air-quality\" class=\"level2\">\n<h2>Why care about air quality?</h2>\n<p>Acute exposure to air pollution makes you acutely dumber.</p>\n<p>This was the conclusion of MIT researchers back in 2022 when they\nlooked at the effect of <a\nhref=\"https://doi.org/10.1287/mnsc.2022.4643\">air quality on\nchess</a>.</p>\n<p>They combed through 30,000 chess moves, evaluating them with the <a\nhref=\"https://stockfishchess.org/\">Stockfish</a> chess engine, comparing\n121 players against themselves under different air quality conditions\n(which they monitored with <a href=\"https://foobot.io/\">foobot</a>\nsensors).</p>\n<p>The researchers concluded that an increase as small as <strong>10\nµg/m³ PM2.5 causes a 2.1% increased likelihood of player\nerror</strong>.</p>\n</section>\n<section id=\"measuring-air-quality\" class=\"level2\">\n<h2>Measuring air quality</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/35/66fd2f6bcb8f4874d5074b9c39b55f/large.jpg\"\nalt=\"AirGradient DIY alongside my previous cludgy attempts at making something similar.\" />\n<figcaption aria-hidden=\"true\">AirGradient DIY alongside my previous\ncludgy attempts at making something similar.</figcaption>\n</figure>\n<p>Reference particle mass counters cost thousands of dollars. And even\nso-called low-cost air sensors like the ubiquitous <a\nhref=\"https://www2.purpleair.com/\">PurpleAir</a> will set you back\n$200.</p>\n<p>But the same sensors used inside the PurpleAir, the <a\nhref=\"https://www.plantower.com/en/products_33/74.html\">PlanTower\nPMS5003</a>, can be found for as little as $15 on <a\nhref=\"https://www.aliexpress.com/w/wholesale-plantower-pms5003.html\">AliExpress</a>.</p>\n<p>The Plantower sensor, however, is far from a reference device. But\nstudies suggest it’s directionally correct. And, with after-the-factory\ncalibration, it can match readings from more expensive reference\nmeters<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>.</p>\n<p>The Plantower PMS5003 features in <a\nhref=\"https://www.airgradient.com/open-airgradient/instructions/diy/\">AirGradient’s\nDIY printed circuit board (PCB)</a>, which combines air quality,\ntemperature, and CO2 sensors with a cheap ESP8266 for internet. I\nordered ten of these PCBs from <a\nhref=\"https://www.pcbway.com/\">PCBWay</a> back in 2021 for about\n$30.</p>\n<p>I’ve since <a\nhref=\"https://github.com/thcipriani/airgradient-mqtt\">modified\nAirGradient’s example code</a> to support pushing data to Home Assistant\nvia MQTT. From there, sensor data gets sucked up by Prometheus, so I can\nmonitor it via Grafana.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/69/4f4a343e769c1de338f6434fc95407/large.jpg\"\nalt=\"AirGradient Grafana dashboard\" />\n<figcaption aria-hidden=\"true\">AirGradient Grafana\ndashboard</figcaption>\n</figure>\n<p>This system gives me a full view of my indoor air quality. And it’s a\nneedlessly complicated way of reminding me to change out my air filter\n😬.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p><a\nhref=\"https://doi.org/10.4236/ojap.2021.101001\"\nclass=\"uri\">https://doi.org/10.4236/ojap.2021.101001</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/05/18/chartjunk/",

    "title": "What I&#x27;ve learned about data visualization",
    "url": "https://tylercipriani.com/blog/2023/05/18/chartjunk/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-05-18T22:12:14Z",
    "date_modified": "2023-05-20T14:22:54Z",


    "content_html": "<blockquote>\n<p>For many people the first word that comes to mind when they think\nabout statistical charts is “lie.”</p>\n<p>– Edward R. Tufte</p>\n</blockquote>\n<figure>\n<img src=\"https://photos.tylercipriani.com/thumbs/4d/7b7093596f72b025439eda463f52ca/large.jpg\" alt=\"William Playfair, 1801, Statistical map showing the extent, population and income of the principal nations of Europe The birth of the pie chart. Playfair’s attempt to show the size of European countries by relating them to planets, saying: “we have a more accurate idea of the sizes of the planets, which are spheres, than of the nations of Europe […] all of which are irregular forms”\">\n<figcaption aria-hidden=\"true\">\nThe first pie chart ever. William Playfair, 1801, Statistical map of the principal nations of Europe.\n</figcaption>\n</figure>\n<p>When I moved from engineering to management, people expected me to\nmake charts.</p>\n<p>After spending some time learning about data visualization, I’ve come\nto two important conclusions:</p>\n<ol type=\"1\">\n<li>Good data visualization is powerful</li>\n<li>Powerful data visualization is rare</li>\n</ol>\n<p>But creating a compelling chart is an underrated superpower for\nengineers. Here are some ideas that helped me learn how to do that.</p>\n<section id=\"learning-from-experts\" class=\"level2\">\n<h2>Learning from experts</h2>\n<p>The best books I’ve read on data visualization are:</p>\n<ul>\n<li>“<a\nhref=\"https://openlibrary.org/books/OL3966475M/The_Visual_Display_of_Quantitative_Information\">The\nVisual Display of Quantitative Information</a>” by Tufte, and</li>\n<li>“<a\nhref=\"https://openlibrary.org/works/OL17659741W/Storytelling_with_Data\">Storytelling\nwith Data</a>” by Cole Nussbaumer Knaflic</li>\n</ul>\n<p>Between those two books, you get a balance: the ideal (from Tufte)\nand the PowerPoint world (from Knaflic).</p>\n<p><strong>Tufte</strong></p>\n<p><a href=\"https://en.wikipedia.org/wiki/Edward_Tufte\">Edward R.\nTufte</a> is professor emeritus of statistics, political science, and\ncomputer science at Yale.</p>\n<p>And he’s a man upset by pie charts.</p>\n<blockquote>\n<p>the only worse design than a pie chart is several of them.</p>\n<p>– Edward R. Tufte</p>\n</blockquote>\n<p>Tufte’s rules:</p>\n<ul>\n<li>🦑<strong>Maximize the data-ink ratio</strong> – Most of your chart\nshould be data. Erase the parts that convey nothing.</li>\n<li>🍫<strong>Avoid chart junk</strong> – Avoid needless colors,\nshading, tickmarks, and gridlines: remove distractions from data.</li>\n</ul>\n<p><strong>Knaflic</strong></p>\n<p>Cole Nussbaumer Knaflic was the former manager of Google’s People\nAnalytics team. She knows her way around a PowerPoint<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>.</p>\n<p>Knaflic’s rules:</p>\n<ul>\n<li>📈<strong>Choose an appropriate visual display</strong> – Know your\ncontext, then pick your chart</li>\n<li>🏰<strong>Tell a story</strong> – Charts ought to communicate\nsomething; you should know what that something is.</li>\n</ul>\n</section>\n<section id=\"tuftes-principles-a-case-study\" class=\"level2\">\n<h2>Tufte’s principles: a case study</h2>\n<p>Take a look at this chart from the Wikimedia Foundation’s <a\nhref=\"https://meta.wikimedia.org/wiki/Wikimedia_Foundation_Annual_Plan/2023-2024/Foundation_Details\">2023–2024\nbudget projections</a>:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-05-17_Wikimedia-foundation-annual-plan-2023-2024-draft-budget-overview.png\"\nalt=\"Wikimedia Foundation 2023–2024 Draft Budget\" />\n<figcaption aria-hidden=\"true\">Wikimedia Foundation 2023–2024 Draft\nBudget</figcaption>\n</figure>\n<p>This is a default Google Sheets chart for this data.</p>\n<p>What I’m able to glean from this chart:</p>\n<ul>\n<li>“Building analytics &amp; ML Services”: the biggest, &gt; 25%</li>\n<li>“Features and functionality” and “Supporting volunteers”: smaller,\n~20% each</li>\n<li>“Fundraising,” “Protecting access,” and “General &amp; Admin”:\nsmaller still, ~10% each</li>\n<li>The colors seem meaningless</li>\n</ul>\n<p>Now consider what we glean from the table used to generate it:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Program</th>\n<th>Budget (millions)</th>\n<th>Percent</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>Building analytics &amp; ML services</td>\n<td>$46.4</td>\n<td>26.2%</td>\n</tr>\n<tr class=\"even\">\n<td>Features and functionality</td>\n<td>$39.7</td>\n<td>22.4%</td>\n</tr>\n<tr class=\"odd\">\n<td>Supporting volunteers</td>\n<td>$35.1</td>\n<td>19.8%</td>\n</tr>\n<tr class=\"even\">\n<td>General &amp; Admin</td>\n<td>$21.3</td>\n<td>12.0%</td>\n</tr>\n<tr class=\"odd\">\n<td>Fundraising</td>\n<td>$17.9</td>\n<td>10.1%</td>\n</tr>\n<tr class=\"even\">\n<td>Protecting access</td>\n<td>$16.6</td>\n<td>9.4%</td>\n</tr>\n<tr class=\"odd\">\n<td>Total</td>\n<td>$177.0</td>\n<td>100.0%</td>\n</tr>\n</tbody>\n</table>\n<p>This table gives us more information than the chart in a similar\namount of space.</p>\n<p>From the table, we learn:</p>\n<ul>\n<li>Exact percentages—no need to guess</li>\n<li>Exact dollar amounts</li>\n<li>The total budget as a dollar figure</li>\n</ul>\n<p>And we get rid of the meaningless colors.</p>\n<p>OK—confession time: there were percentages on the original pie chart.\nI edited them out.</p>\n<p>But I did that to prove a point. <strong>The pie chart is doing less\nwork than the numbers</strong>. The slices of the pie add almost nothing\nto the numbers.</p>\n<p>Tufte would prefer the table above to the pie chart above because the\ntable:</p>\n<ul>\n<li>Shows the data</li>\n<li>Maximizes the data-ink ratio</li>\n<li>Avoids <a\nhref=\"https://en.wikipedia.org/wiki/Chartjunk\">chartjunk</a> (like the\nmeaningless colors)</li>\n</ul>\n<p>And in this case, I agree: I like the table.</p>\n<p>But choosing data visualizations is difficult.</p>\n</section>\n<section id=\"how-to-choose-a-chart-visual-perception-accuracy-ranked\"\nclass=\"level2\">\n<h2>How to choose a chart: visual perception accuracy ranked</h2>\n<p>If you intend to communicate, then people must be able to read your\nchart.</p>\n<p>In 1985, Cleveland &amp; McGill conducted what is still the most\ncited experiment <a href=\"https://doi.org/10.2307/2288400\">on what\ncharts are easiest to read</a>. Their purpose was simple: rank standard\ncharts by the number of errors people make while reading them.</p>\n<p>Here’s their ranking of charts—from easiest to hardest to read:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Icon</th>\n<th>Name</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td><img src=\"https://photos.tylercipriani.com/bar-chart-icon.png\"></td>\n<td>Position along a common scale</td>\n<td><a href=\"https://datavizcatalogue.com/methods/scatterplot.html\">scatterplots</a>,\n<a href=\"https://datavizcatalogue.com/methods/bar_chart.html\">bar\ncharts</a>,\n<a href=\"https://en.wikipedia.org/wiki/Sparkline\">sparklines</a></td>\n</tr>\n<tr class=\"even\">\n<td><img src=\"https://photos.tylercipriani.com/2023-05-18_stacked-bar-chart-icon.png\"></td>\n<td>Positions along nonaligned scales</td>\n<td><a href=\"https://datavizcatalogue.com/methods/stacked_bar_graph.html\">stacked\nbar charts</a></td>\n</tr>\n<tr class=\"odd\">\n<td><img src=\"https://photos.tylercipriani.com/2023-05-18_pie-chart-icon.png\"></td>\n<td>Length, direction, angle</td>\n<td><a href=\"https://datavizcatalogue.com/methods/pie_chart.html\">pie\ncharts</a>,\n<a href=\"https://datavizcatalogue.com/methods/donut_chart.html\">donut\ncharts</a></td>\n</tr>\n<tr class=\"even\">\n<td><img src=\"https://photos.tylercipriani.com/2023-05-18_bubble-chart-icon.png\"></td>\n<td>Area</td>\n<td><a href=\"https://datavizcatalogue.com/methods/bubble_chart.html\">bubble\ncharts</a>,\n<a href=\"https://datavizcatalogue.com/methods/treemap.html\">treemaps</a></td>\n</tr>\n<tr class=\"odd\">\n<td><img src=\"https://photos.tylercipriani.com/2023-05-18_3d-volume-chart-icon.png\"></td>\n<td>Volume, curvature</td>\n<td>3d charts</td>\n</tr>\n<tr class=\"even\">\n<td><img src=\"https://photos.tylercipriani.com/2023-05-18_heatmap-icon.png\"></td>\n<td>Shading, color saturation</td>\n<td><a href=\"https://datavizcatalogue.com/methods/heatmap.html\">Heatmaps</a></td>\n</tr>\n</tbody>\n</table>\n<p>But I love heatmaps! You can use heatmaps. Just understand that only\na sophisticated audience can interpret heatmaps correctly.</p>\n<p>Know your audience, then use something like <a\nhref=\"https://datavizcatalogue.com/\">the data viz catalog</a> to choose\nyour chart.</p>\n</section>\n<section id=\"tell-a-story\" class=\"level2\">\n<h2>Tell a story</h2>\n<p>Charts are communication.</p>\n<p>At their worst, as Tufte said, they’re little more than “devices for\nshowing the obvious to the ignorant.”</p>\n<p>But at their best, they’re a powerful way to intuitively communicate\na lot of data in a small space.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Tufte will not help you with\nPowerPoint. In his essay, “<a\nhref=\"https://www.inf.ed.ac.uk/teaching/courses/pi/2016_2017/phil/tufte-powerpoint.pdf\">The\nCognitive Style of PowerPoint</a>” (which is included in the book “<a\nhref=\"https://openlibrary.org/works/OL2824008W/Beautiful_Evidence\">Beautiful\nEvidence</a>”), he says: “bulleted outlines make us stupid” before going\non to blame PowerPoint for <a\nhref=\"https://en.wikipedia.org/wiki/Space_Shuttle_Columbia_disaster\">the\nspace shuttle Columbia disaster</a>.<a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/04/29/distraction-free-writing/",

    "title": "Write every day: my AlphaSmart fail",
    "url": "https://tylercipriani.com/blog/2023/04/29/distraction-free-writing/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-04-29T22:15:43Z",
    "date_modified": "2023-05-05T14:23:15Z",


    "content_html": "<blockquote>\n<p>All I need in this life of sin is my AlphaSmart 3000.</p>\n<p>– <a\nhref=\"https://theoutline.com/post/3238/the-alphasmart-3000-is-super-duper-chill\">Drew\nMillard</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/2f/46708821b38442f2760d85b1fdaa88/large.jpg\"\nalt=\"AlphaSmart3000, in its Bondi-blue glory\" />\n<figcaption aria-hidden=\"true\">AlphaSmart3000, in its Bondi-blue\nglory</figcaption>\n</figure>\n<p>When I decided to develop a daily writing habit, I bought a toy\nkeyboard.</p>\n<p>It did not go well.</p>\n<p>To begin with, I knew I wanted two things:</p>\n<ol type=\"1\">\n<li><strong>To avoid my computer</strong> – The urge to check email,\nsleep-destroying blue light, the siren song of Reddit: all reasons to\navoid computers when possible.</li>\n<li><strong>To type instead of write</strong> – I can tap out my\nthoughts on a keyboard much faster than I can scribble them in a\nnotebook.</li>\n</ol>\n<p>Enter the AlphaSmart3000—a pleasingly luddite word processor from the\nearly aughts.</p>\n<p>Everyone from writers at the <a\nhref=\"https://www.newyorker.com/magazine/2021/12/20/can-distraction-free-devices-change-the-way-we-write\">New\nYorker</a> to the hardware tinkerers at <a\nhref=\"https://hackaday.com/tag/alphasmart/\">Hackaday</a> gushed praise\nfor the AlphaSmart.</p>\n<p>So, when I found one for ~$30 on eBay, I snatched it up.</p>\n<p>I thought I was going to love it. But I’ve never used it like I’d\ndreamed.</p>\n<section id=\"the-dream\" class=\"level2\">\n<h2>🌈✨The Dream✨🌈</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/38/8aa4ff6790d15ded901ad75cf7623f/large.jpg\"\nalt=\"Magic hold laptop stand + AlphaSmart3000 set up for writing on my screened-in porch (Bowie dog sold separately)\" />\n<figcaption aria-hidden=\"true\">Magic hold laptop stand + AlphaSmart3000\nset up for writing on my screened-in porch (Bowie dog sold\nseparately)</figcaption>\n</figure>\n<p>Everything I like about this device harkens back to the bygone era\nwhen manufacturers designed new tech to last, not become e-waste.</p>\n<p><strong>Replaceable batteries with a long battery life</strong></p>\n<p>The AlphaSmart3000 boasts 700 hours of battery life on three AAs.</p>\n<p>Replacable batteries in 2023: 🤯</p>\n<p>Instead of AAs, my AlphaSmart3000 came with a rechargeable NiMH\nbattery pack. But I’ve never had to recharge it. The little battery bar\ninsists it’s fully charged, even after nearly a year of typing on it\n(albeit intermittently).</p>\n<p><strong>Future-proof upload interface</strong></p>\n<figure>\n    <video autoplay loop muted>\n        <source src=\"https://photos.tylercipriani.com/2023-04-29_alphasmart-xfer.mp4\" type=\"video/mp4\">\n    </video>\n    <figcaption>\"Uploading\" text with the AlphaSmart3000</figcaption>\n</figure>\n<p>The Alphasmart3000 can double as a keyboard—you can plug it in (via\nUSB-A) and type on it.</p>\n<p>This is also how it transfers files—it types them out on your\ncomputer.</p>\n<p>It’s slow, but I’m impressed with the elegance of the solution. The\nAlphaSmart will continue to work as long as there are USB keyboards.</p>\n</section>\n<section id=\"the-reality\" class=\"level2\">\n<h2>🤬The reality</h2>\n<p><strong>It’s a feature; not a bug</strong></p>\n<p>Almost everything I could complain about is arguably a feature.</p>\n<p>No virtual writing assistant prodding you about adverb use. No way to\nsync to the cloud. No ChatGPT.</p>\n<p>Even the four-line screen is a feature—it keeps you focused on the\nfew sentences you’re currently wrestling with.</p>\n<p>But I have some legitimate gripes.</p>\n<p><strong>The keyboard is terrible</strong></p>\n<p>Despite appearances, the keyboard is a trying experience. The feeling\nof little rubber domes popping down, stuck keys: it’s brutal.</p>\n<p>LazyDog—a tilde.club member and AlphaSmart enthusiast—created a <a\nhref=\"https://tilde.club/~jy4m/alphasmart/\">mechanical keyboard mod kit\nfor the AlphaSmart3000</a>. But I’m hesitant to put in that kind of\ntime.</p>\n<p><strong>I miss Vim 😩</strong></p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/e6/37c011f6884dce4beee22ce348c688/large.jpg\"\nalt=\"Why are you not Vim\" />\n<figcaption aria-hidden=\"true\">Why are you not Vim</figcaption>\n</figure>\n<p>The shortcuts and macros for the AlphaSmart would be familiar to\nanyone who remembers Microsoft Word. But, as a Vim user, my brain is\ntotally broken.</p>\n<p>I’ll be the first one to admit: this one is petty.</p>\n</section>\n<section id=\"why-i-never-use-it\" class=\"level2\">\n<h2>😭Why I never use it</h2>\n<p>Whenever I fantasize about how to improve this device, I realize I’m\nbuilding an eink laptop.</p>\n<p>When I’m writing: I want to use Vim. I want to render Markdown and\nsee how it looks in a browser. I want to look up bookmarked\nreferences.</p>\n<p>I thought I wanted distraction-free writing, but <strong>what I\nactually want is for computers to be better</strong>.</p>\n<p>In 2012, I was among the first in line to buy a <a\nhref=\"https://en.wikipedia.org/wiki/Raspberry_Pi\">Raspberry Pi</a>. In\n2016, I shelled out for the <a\nhref=\"https://en.wikipedia.org/wiki/CHIP_(computer)#Pocket_CHIP_and_Pockulus\">PocketC.H.I.P.</a>\nAnd now I’m gearing up for my <a\nhref=\"https://www.crowdsupply.com/mnt/pocket-reform\">MNT Pocket\nReform</a>. It’d be easy to say: I’m a sucker for open hardware (and\nthat’s true). But I’d also say: <strong>I hate the existing hardware\nhegemony.</strong></p>\n<p>I’m ready for what’s next: where is my eink laptop already?</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/04/22/better-1on1s/",

    "title": "Towards better 1-on-1s: an awkward manifesto",
    "url": "https://tylercipriani.com/blog/2023/04/22/better-1on1s/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-04-22T22:23:54Z",
    "date_modified": "2023-04-23T18:44:55Z",


    "content_html": "<blockquote>\n<p>It is unimaginably hard to […] stay conscious and alive in the adult\nworld day in and day out.</p>\n<p>– David Foster Wallace, <a\nhref=\"https://fs.blog/david-foster-wallace-this-is-water/\">This is\nWater</a></p>\n</blockquote>\n<p>At the heart of my management philosophy lies a simple belief:\n<strong>people are working as hard as they can.</strong></p>\n<p>It’s a lazy assumption to assume people are lazy. Especially when\nburnout and overwork are so common.</p>\n<p>And that’s why <strong>1-on-1s are so crucial for engineering\nmanagers</strong>. Once a week, you get to reconnect with each person on\nyour team.</p>\n<p><strong>But it’s all too easy to have another pointless\nmeeting.</strong></p>\n<p>So, here is my kludged-together process to generate valuable 1-on-1s.\nI’ve honed it over time as a new(ish) engineering manager. I hope it\nwill be helpful for both engineering managers and individual\ncontributors.</p>\n<section id=\"my-basic-agenda-for-1-on-1s\" class=\"level2\">\n<h2>💼 My basic agenda for 1-on-1s</h2>\n<p>I follow the GitLab handbook rule: <a\nhref=\"https://about.gitlab.com/company/culture/all-remote/meetings/#4-all-meetings-must-have-an-agenda\">No\nagenda; no attend…a</a>.</p>\n<p>When meetings lack an up-front agenda, I wonder whether anyone\nthought about the meeting at all. It’s a meeting smell. It warns me:\nthis meeting is about to waste my time.</p>\n<p>So, for my 1-on-1s, I use a simple agenda formula—<strong>Purpose,\nOutcome, Process</strong> (POP):</p>\n<ul>\n<li><strong>Purpose</strong> – A once-per-week check-in between me and a\ndirect report to ensure we’re OK. To provide feedback for each other and\nsurface small problems (before they grow into big problems).</li>\n<li><strong>Outcome</strong> – A solid understanding of our goals at\nwork and an up-to-date picture of our current level of shared\nburnout.</li>\n<li><strong>Process</strong> – My direct reports drive this one—it’s\ntheir meeting. But I fall back on a standard checklist if they come\nempty-handed.</li>\n</ul>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-04-21_checklist.png\"\nalt=\"☑️ My 1-on-1 checklist\" />\n<figcaption aria-hidden=\"true\">☑️ My 1-on-1 checklist</figcaption>\n</figure>\n<p>I have a <a\nhref=\"https://docs.google.com/document/d/1o2TT5VWHH2HWw1mNXvTqspTCMnaq3FdkuMLl-0LonXw/edit\">printable\nchecklist for 1-on-1s</a>. Everyone has access.</p>\n<ol type=\"1\">\n<li><strong>“How’s it going?”/“What’s on your mind?”</strong> – this is\noften as far as I get in this meeting—and that’s wonderful.</li>\n<li><strong>What was the highlight of your past week, work-related or\nnot?</strong> I stole this from Clearbit’s <a\nhref=\"https://themanagershandbook.com/coaching-and-feedback/running-one-on-ones#format\">Managers’\nHandbook</a> (which is an excellent resource). It reminds us: it’s a\ngreat big world—both inside and outside work—there’s fantastic stuff out\nthere.</li>\n<li><strong>Brag document</strong> – I cribbed this idea from <a\nhref=\"https://jvns.ca/blog/brag-documents/\">Julia Evans</a>—let’s update\nyour brag document. A brag document is a running list of work you’ve\ncompleted. So, come promotion or review time, we have a convenient place\nto remind ourselves about your great work.</li>\n<li><strong>Is there anyone you’d like to praise?</strong> – this\nquestion gives me feedback for someone on our team or another team’s\nmanager. It’s a nice way to spread appreciation.</li>\n<li><strong>Stop doing/keep doing</strong> – Feedback from me, feedback\nfrom you. I believe that success in management means no surprises—no\nwondering how I feel about your work. This small question keeps us both\nhonest. Small feedback given often is usually all I need to provide\nfolks. Quarterly review meetings, promotions, and performance\nimprovement plans consist of the same feedback I share in these\nmeetings.</li>\n</ol>\n</section>\n<section id=\"my-note-taking-and-todo-system-for-1-on-1s\" class=\"level2\">\n<h2>📓 My note-taking and TODO system for 1-on-1s</h2>\n<p>I buy tons of <a\nhref=\"https://www.amazon.com/AmazonBasics-Pocket-Folders-Fasteners-25-Pack/dp/B0734V7GRB/\">cheap\nthree-prong, twin-pocket file folders</a>—every person on my team gets\none.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/d8/7d664df38bf19e22bdc56438e63825/large.jpg\"\nalt=\"Ugmonk Analog; three-prong, twin-pocket file folders; pen; and highlighters—the core of my 1-on-1 notes\" />\n<figcaption aria-hidden=\"true\">Ugmonk Analog; three-prong, twin-pocket\nfile folders; pen; and highlighters—the core of my 1-on-1\nnotes</figcaption>\n</figure>\n<p>Every workday, I review my calendar and print off a copy of my\nchecklist for each of my 1-on-1s.</p>\n<p>During the meeting, I take notes at the bottom of the checklist.</p>\n<p>And after the meeting, those notes go into that person’s folder.</p>\n<p>I highlight any <strong>TODO</strong>s I take during the meeting and\nadd them to my handy dandy <a\nhref=\"https://ugmonk.com/pages/analog\">Ugmonk Analog</a>.</p>\n<p><strong>🎒 All my 1-on-1 gear</strong>:</p>\n<ul>\n<li><a\nhref=\"https://www.amazon.com/AmazonBasics-Pocket-Folders-Fasteners-25-Pack/dp/B0734V7GRB/\">Three-prong,\ntwin-pocket file folders</a> – each person on my team gets their own\nfolder, which makes reviewing old notes quick and easy.</li>\n<li><a\nhref=\"https://www.amazon.com/Swingline-A7074133-SmartTouch-Sheets-Capacity/dp/B00AFTQ4X8/\">Swingline\nthree-hole punch</a> – I’ve owned this since college, works great.</li>\n<li><a\nhref=\"https://baronfig.com/products/squire?variant=18056190689363\">Baronfig\nsquire rollerball pen</a> – I was gifted this pen for Christmas—it’s\nbeen weighty and satisfying.</li>\n<li><a\nhref=\"https://www.jetpens.com/Kokuyo-Mark-2-Way-Marker-Pen-5-Color-Set-A/pd/30007\">Kokuyo\nMark+ 2-way highlighters</a> – useful for ensuring any\n<strong>TODOs</strong> get done (or remembered, at least).</li>\n<li><a href=\"https://ugmonk.com/pages/analog\">Ugmonk Analog</a> – an\nelegant alternative to a monitor covered in Post-Its.</li>\n<li>Brother laser printer – they no longer make the one I have. But\nwhatever the ubiquitous $100 black-and-white laser printer du jour is is\nprobably fine.</li>\n</ul>\n</section>\n<section id=\"to-talk-about-hard-topics-lean-into-awkward-questions\"\nclass=\"level2\">\n<h2>😬 To talk about hard topics, lean into awkward questions</h2>\n<p>If a 1-on-1 is never awkward—if the discussion is never\nchallenging—you may be avoiding tough topics.</p>\n<p>So, I built a thing that forces me into the danger zone.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-04-22_1-on-1-questions.png\" alt=\"🎱 Random question generator—stretchquestion.toolforge.org\">\n<figcaption aria-hidden=\"true\">A screenshot showing off <a href=\"https://stretchquestion.toolforge.org\">🎱 my random question generator</a></figcaption>\n</figure>\n<p>I braved far too many “awesome 1-on-1 questions”-type listicles and\ndistilled their wisdom into a <a\nhref=\"https://stretchquestion.toolforge.org/\">small web tool</a>. It\ngives me a linkable question to share during my 1-on-1s.</p>\n<p>Toward the end of the meeting, I’ll often share a question from the\nlist.</p>\n<p>Some of the best ideas, initiatives, and experiments we’ve tried as a\nteam come from these questions.</p>\n</section>\n<section id=\"watch-out-for-doorknob-comments\" class=\"level2\">\n<h2>🚪 Watch out for doorknob comments</h2>\n<p>Doorknob comments are tantalizing tidbits dropped right as you’re\nabout to end the meeting—when your hand’s on the doorknob to leave (or\nhovering above the “end call” button).</p>\n<p>It’s easy to glide right over these comments unless you’re watching\nfor them.</p>\n<p>Parting volleys like, “I guess I’ll get back to it—if I could ever\nget my MR reviewed,” or “I sure wish we’d kill that project.”</p>\n<p>These comments may seem like passing thoughts, but it’s possible your\ndirect reports spent the whole meeting amping themselves up to say\nsomething important. And it’s your job in 1-on-1s to listen and\nlearn.</p>\n<p>It’d be a shame to lose these insights in the shuffle from one\nmeeting to the next.</p>\n</section>\n<section id=\"on-1-objections\" class=\"level2\">\n<h2>⚖️ 1-on-1 objections</h2>\n<p>Reasonable people have a lot of reasonable-sounding objections to\n1-on-1s.</p>\n<ul>\n<li>“Everything’s fine. Do we need to talk every week?”</li>\n<li>“They’re too much of an interruption.”</li>\n<li>“They’re a waste of time.”</li>\n</ul>\n<p>The solution here is to get curious. What could make this 1-on-1\nbetter?</p>\n<p>Of course, asking that question is a surefire way to make a 1-on-1\neven more unbearable. So, instead, I turn to my favorite awkward\nquestion: <strong>what project are you most proud of?</strong></p>\n<p>If you listen to the answer, it often cuts right to what a person\nvalues.</p>\n<p>If they’re proud of their big solo rewrite, maybe they want more\nindependence and challenge. If they’re proud of the small tweak they\nmade that saved 100s of hours of toil, maybe they’re searching for more\nimpact.</p>\n<p>Of course, you have to be genuinely curious—you have to dig into\nthese answers to learn anything.</p>\n<p>And that’s the only secret of successful 1-on-1s: <strong>if you want\nyour direct report to care, you have to care.</strong></p>\n<p>If you want to have interesting 1-on-1s: get interested.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/03/31/private-ish-github-repos/",

    "title": "GitHub private repos considered private-&#xAD;ish",
    "url": "https://tylercipriani.com/blog/2023/03/31/private-ish-github-repos/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-03-31T22:40:11Z",
    "date_modified": "2023-04-01T16:47:40Z",


    "content_html": "<blockquote>\n<p>This week, we discovered that GitHub.com’s RSA SSH private key was\nbriefly exposed in a public GitHub repository.</p>\n<p>– <a\nhref=\"https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/\">GitHub’s\n“We updated our RSA SSH host key” blog</a>, 2023-03-23</p>\n</blockquote>\n<p>GitHub private repos lull us into lazy thinking.</p>\n<p>We cram our secrets into git, then shove it off to the most expansive\ncode forge in the history of humanity, and <strong>most of the time:\neverything’s fine.</strong></p>\n<p>But <a\nhref=\"https://github.blog/2023-03-23-we-updated-our-rsa-ssh-host-key/\">GitHub’s\nssh host key leak</a> last week demonstrates that <strong>private repos\nare, at best, private-ish</strong>.</p>\n<p>Secrets get out. <a\nhref=\"https://www.youtube.com/watch?v=kiVVzxoPTtg\">🦖 Life finds a\nway</a>.</p>\n<section id=\"how-repos-become-public\" class=\"level2\">\n<h2>How repos become public 💀</h2>\n<p>There are oodles of trivial ways you can spill your git secrets to\nthe world.</p>\n<ul>\n<li>📢 <strong>Publish your <code>.git</code> directory</strong> –\nExposing the entire history of your code through server misconfiguration\nor deployment mistakes is <a\nhref=\"https://www.google.com/search?q=%22.git%22+intitle%3A%22index+of%22\">alarmingly.\ncommon.</a></li>\n<li>🎣 <strong>Get phished</strong> – Even cool kids can have their\npasswords stolen. Examples in the wild:\n<ul>\n<li><a\nhref=\"https://slack.com/intl/en-gb/blog/news/slack-security-update\">Slack</a></li>\n<li><a\nhref=\"https://dropbox.tech/security/a-recent-phishing-campaign-targeting-dropbox\">Dropbox</a>.</li>\n</ul></li>\n<li>🥄 <strong>Bad fork</strong> – Especially true with the\nGitHub/GitLab model—a developer forks a private repo and makes it\npublic. Examples in the wild:\n<ul>\n<li><a\nhref=\"https://www.wired.com/story/uber-paid-off-hackers-to-hide-a-57-million-user-data-breach/\">Uber’s\n“$57M” data breach</a></li>\n<li><a href=\"https://hackerone.com/reports/694931\">Equifax\nincident</a></li>\n<li><a href=\"https://hackerone.com/reports/716292\">Starbucks</a></li>\n</ul></li>\n<li>🖱️ <strong>Click the wrong button</strong> – You’re a handful of\nbutton clicks away from making a private repo public—miscommunication or\nconfusing UI can leave you exposed.</li>\n</ul>\n</section>\n<section id=\"move-fast-leak-things\" class=\"level2\">\n<h2>Move fast, leak things 🚰</h2>\n<p>Most of the people at GitHub and GitLab are humans. And humans make\nmistakes (especially when they’re on a deadline).</p>\n<p>Back in 2016, GitHub had an incident where private repos <a\nhref=\"https://github.blog/2016-10-28-incident-report-inadvertent-private-repository-disclosure/\">exposed\nto unauthorized users</a>.</p>\n<p>And GitLab has had at least three incidents matching the search\n“GitLab+Private repos” in the Common Vulnerabilities and Exposures (CVE)\ndatabase (<a\nhref=\"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22167\">1</a>,\n<a\nhref=\"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-13277\">2</a>,\n<a\nhref=\"https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-13303\">3</a>).</p>\n</section>\n<section id=\"mitigations\" class=\"level2\">\n<h2>Mitigations 🛠️</h2>\n<p>In the spirit of <a\nhref=\"https://medium.com/@jpaulreed/why-blameless-postmortems-might-feel-wrong-cbeee00d51b2\">blame-aware\npostmortems</a>—what can we do to fix this?</p>\n<p><strong>Easy fixes</strong></p>\n<ul>\n<li>Keep your <code>.git</code> directory to yourself. Avoid deploying\nit. Configure your webserver to deny access to it if you do.</li>\n<li>Setup <a\nhref=\"https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa/accessing-github-using-two-factor-authentication\">two-factor\nauthentication</a>, like, Right. Now. Bonus points if your second factor\nis a hardware key.</li>\n<li>Audit your access control on your forge of choice.</li>\n</ul>\n<p><strong>Impossible fixes</strong></p>\n<p>It’s impossible to prevent a zero-day that exposes your private\nrepo.</p>\n<p>So, if you’re worried about it: <strong>stop putting sensitive data\ninto private repositories</strong>.</p>\n<p>Especially the kind that would damage your reputation if it got\nout:</p>\n<ul>\n<li>Passwords/production credentials</li>\n<li>Personally identifying information (PII) of users</li>\n<li>Any code, data, or metadata you expect to be permanently\nprivate</li>\n</ul>\n<p>You can set a policy and ensure developers use secret scanners as\npre-commit git hooks. Inject secrets into your application at\nruntime.</p>\n<p>Beyond runtime secrets? Keep that junk out of git.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/03/28/just-stop-adding-people/",

    "title": "Just stop adding people.",
    "url": "https://tylercipriani.com/blog/2023/03/28/just-stop-adding-people/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-03-28T01:45:38Z",
    "date_modified": "2023-03-28T02:30:57Z",


    "content_html": "<blockquote>\n<p>“Communication is a sign of dysfunction.”</p>\n<p>– Jeff Bezos, via Brad Stone, <a\nhref=\"https://openlibrary.org/books/OL25432651M/The_Everything_Store\">The\nEverything Store</a></p>\n</blockquote>\n<p>Slack is a great way to destroy a workday.</p>\n<p>You can lose whole days hammering out details with coworkers across a\nfew Slack threads.</p>\n<p>But communication is the cost you pay for capacity—the bigger the\nteam, the greater the costs.</p>\n<p>And this is why big teams fail to deliver. As team size approaches\nthe magic number<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>, team overhead overwhelms its\ncapacity for meaningful work.</p>\n<section id=\"for-𝑛-people-communication-costs-approach-𝑛²\"\nclass=\"level2\">\n<h2>🌐 For 𝑛 people, communication costs approach 𝑛²</h2>\n<blockquote>\n<p>our research has shown that the number of performance problems a team\nencounters increases exponentially as team size increases.</p>\n<p>– J. Richard Hackman, <a\nhref=\"https://hbswk.hbs.edu/archive/leading-teams-setting-the-stage-for-great-performances-the-five-keys-to-successful-teams\">Leading\nTeams: Setting the Stage for Great Performances</a></p>\n</blockquote>\n<p>The cost of shooting off a Slack message is darn near zero.</p>\n<p>But multiplying that cost by each person on your team adds up. And\nfor each new person, you don’t add one connection—you add a connection\nfor <strong>each person on the team</strong>.</p>\n<p>In his 1975 book <a\nhref=\"https://en.wikipedia.org/wiki/The_Mythical_Man-Month\">The Mythical\nMan-Month</a>, author Fred Brooks formulates the communication costs of\nadding a new team member—a <a\nhref=\"https://en.wikipedia.org/wiki/Triangular_number\">triangle\nnumber</a>: 𝑛(𝑛-1)/2</p>\n<p>The situation devolves quickly:</p>\n<ul>\n<li>Three people: 3 connections</li>\n<li>Four people: 6 connections</li>\n<li>12 people: 66 connections</li>\n<li>150 people: <strong>11,175 connections</strong></li>\n</ul>\n<p><a href=\"https://en.wikipedia.org/wiki/Metcalfe%27s_law\">Metcalfe’s\nLaw</a>, originally intended to describe the value of communication\nnetworks, also describes connections among team members: the number of\nconnections in a network is proportional to the square of the number of\nconnected users of the system.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2023-03-26_metcalfe-law.png\"\nalt=\"Metcalfe’s law visualized—each person communicates with everyone else\" />\n<figcaption aria-hidden=\"true\">Metcalfe’s law visualized—each person\ncommunicates with everyone else</figcaption>\n</figure>\n</section>\n<section id=\"the-mythical-two-pizza-team\" class=\"level2\">\n<h2>🍕 The mythical two-pizza team</h2>\n<blockquote>\n<p>Oversimplifying outrageously, we state Brooks’s Law: Adding manpower\nto a late software project makes it later.</p>\n<p>– Fred Brooks, The Mythical Man-Month</p>\n</blockquote>\n<p>Amazon uses the two-pizza team rule.</p>\n<p>The intention is that the ideal team is small enough to feed with two\npizzas—a highly variable measure. But a more straightforward way to say\nthis is: about ten people.</p>\n<p>🐉 Here be dragons.</p>\n<p>Max limits on team size only thwart communication problems when teams\nare autonomous.</p>\n<p>Cross-team dependencies obfuscate lines of communication. If teams\nare interdependent, they’ll still need to communicate. Regardless of\nwhat the org chart says, when two or more two-pizza teams depend on each\nother: you’ve got a bogged-down MegaTeam™.</p>\n<p>Only small, independent teams with the power to build and deploy\nsoftware can avoid the scourge of communication overhead.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>7±2 per <a\nhref=\"https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two\">Miller’s\nLaw</a><a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/02/28/books-i-remember/",

    "title": "Books I can remember",
    "url": "https://tylercipriani.com/blog/2023/02/28/books-i-remember/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-02-28T23:43:42Z",
    "date_modified": "2023-03-01T04:02:45Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ad/a7cae7cd159f0f97c5f55289939834/large.jpg\"\nalt=\"📚\" />\n<figcaption aria-hidden=\"true\">📚</figcaption>\n</figure>\n<p>The best part of reading is forgetting.</p>\n<p>This is why I struggle with book reviews—it’s hard to know how\nvaluable a book is until later. But sometimes you find yourself\ndeclaiming a book’s key point long after you’ve forgotten most of\nit.</p>\n<p>That’s when you know a book is worthwhile.</p>\n<p>Here are some books I’ve forgotten most of, mostly from memory:</p>\n<section id=\"the-death-and-life-of-great-american-cities\"\nclass=\"level2\">\n<h2>The Death and Life of Great American Cities</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/41czx9OKhpL.jpg\"\nalt=\"The Death and Life of Great American Cities by Jane Jacobs\" />\n<figcaption aria-hidden=\"true\">The Death and Life of Great American\nCities by Jane Jacobs</figcaption>\n</figure>\n<p>This book explains the life you can feel in some neighborhoods. And\nthe complete sterility of others.</p>\n<p><strong>🌠 What I remember</strong>: The normalcy of strangers makes\na neighborhood safer.</p>\n<p>Mixing offices, shops, restaurants, and family housing in a single\nneighborhood creates a diversity of use, making the place lively. And\nthere will always be eyes on the street, day or night.</p>\n<p>Neighborhoods feel sterile when strangers seem out of place. When a\nstranger is a common sight: you’ve found a community.</p>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: The Death and Life of Great American Cities</li>\n<li>Author: Jane Jacobs</li>\n<li><a href=\"https://worldcat.org/isbn/067974195X\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/067974195X\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9780679741954\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9780679741954\">Bookwyrm</a></li>\n</ul>\n</section>\n<section id=\"how-to-read-a-book\" class=\"level2\">\n<h2>How to Read a Book</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/51EG8AyJiQL.jpg\"\nalt=\"How to Read a Book by Mortimer J Adler and Charles Van Doren\" />\n<figcaption aria-hidden=\"true\">How to Read a Book by Mortimer J Adler\nand Charles Van Doren</figcaption>\n</figure>\n<p>I read every day.</p>\n<p>But much of what I read is garbage—pulp sci-fi or book-of-the-month\njunk I’ll have forgotten I read by year’s end.</p>\n<p><strong>🌠 What I remember</strong>: There are different levels of\nreading. And each book demands its own style of reading.</p>\n<p>tl;dr: spend less effort (and feel less guilty) reading Malcolm\nGladwell vs. Darwin.</p>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: How to Read a Book: The Classic Guide to Intelligent\nReading</li>\n<li>Author: Mortimer J Adler and Charles Van Doren</li>\n<li><a href=\"https://worldcat.org/isbn/0671212095\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/0671212095\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9780671212094\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9780671212094\">Bookwyrm</a></li>\n</ul>\n</section>\n<section id=\"the-managers-path\" class=\"level2\">\n<h2>The Manager’s Path</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/51yxw+lJoTL._SY344_.jpg\"\nalt=\"The Manager’s Path\" />\n<figcaption aria-hidden=\"true\">The Manager’s Path</figcaption>\n</figure>\n<p>Almost every page in my dog-eared copy of “The Manager’s Path” is\nunderlined, scribbled in, or marked up.</p>\n<p><strong>🌠 What I remember</strong>:</p>\n<ul>\n<li>Management is a different skillset vs. development</li>\n<li>Deliver feedback quickly (especially if it’s negative)</li>\n<li>Using manager powers to override technical decisions is a bad\nidea</li>\n<li>Never surprise your direct reports</li>\n</ul>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: The Manager’s Path: A Guide for Tech Leaders Navigating\nGrowth and Change</li>\n<li>Author: Camille Fournier</li>\n<li><a href=\"https://worldcat.org/isbn/1491973897\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/1491973897\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9781491973899\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9781491973899\">Bookwyrm</a></li>\n</ul>\n</section>\n<section id=\"the-e-myth-revisited\" class=\"level2\">\n<h2>The E-Myth Revisited</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/41kONb0oymL.jpg\"\nalt=\"The E-Myth Revisited by Michael Gerber\" />\n<figcaption aria-hidden=\"true\">The E-Myth Revisited by Michael\nGerber</figcaption>\n</figure>\n<p>Few people win medals in the final round of the <a\nhref=\"https://www.homebrewersassociation.org/national-homebrew-competition/\">biggest\nhomebrewing competition on the planet</a>. I’ve won two.</p>\n<p>In college, I was certain I’d open a brewery. Then, in senior year, I\nread “The E-Myth Revisited” and changed my mind.</p>\n<p><strong>🌠 What I remember</strong>: the technical work of a business\nhas little to do with running the business.</p>\n<p>I have zero interest in the operations of a brewery—I’m just a guy\nwho likes beer. Why ruin that by making it my job?</p>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: The E-Myth Revisited: Why Most Small Businesses Don’t Work\nand What to Do About It</li>\n<li>Author: Michael Gerber</li>\n<li><a href=\"https://worldcat.org/isbn/0887307280\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/0887307280\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9780887307287\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9780887307287\">Bookwyrm</a></li>\n</ul>\n</section>\n<section id=\"storytelling-with-data\" class=\"level2\">\n<h2>Storytelling with Data</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/41M8UKaaO1L.jpg\"\nalt=\"Storytelling with Data by Cole Nussbaumer Knaflic\" />\n<figcaption aria-hidden=\"true\">Storytelling with Data by Cole Nussbaumer\nKnaflic</figcaption>\n</figure>\n<p>Once you know how to make a good graph, you’ll see bad graphs\neverywhere.</p>\n<figure>\n<img src=\"https://imgs.xkcd.com/comics/kerning.png\" title=\"I have never been as self-conscious about my handwriting as when I was inking in the caption for this comic.\" alt=\"XKCD #1015 by Randall Monroe CC-By-NC 2.5\">\n<figcaption aria-hidden=\"true\">XKCD <a href=\"https://xkcd.com/1015/\">#1015</a> by Randall Munroe <a href=\"https://creativecommons.org/licenses/by-nc/2.5/\">CC-By-NC 2.5</a></figcaption>\n</figure>\n<p><strong>🌠 What I remember</strong>:</p>\n<ul>\n<li>Pie charts are tricky for most people to read (see also Stephen\nFew’s “<a\nhref=\"https://www.perceptualedge.com/articles/visual_business_intelligence/save_the_pies_for_dessert.pdf\">Save\nthe Pies for Dessert</a>”)</li>\n<li>Sometimes the best data representation is a table</li>\n<li>Only use colors in a graph if they mean something</li>\n</ul>\n<p>My personal pet peve: the default Google Sheets chart colors\n(<code>*shudder*</code>)</p>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: Storytelling with Data</li>\n<li>Author: Cole Nussbaumer Knaflic</li>\n<li><a href=\"https://worldcat.org/isbn/9781119002253\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/9781119002253\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9781119002253\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9781119002253\">Bookwyrm</a></li>\n</ul>\n</section>\n<section id=\"the-elements-of-style\" class=\"level2\">\n<h2>The Elements of Style</h2>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/41zd3am1nzL.jpg\"\nalt=\"The Elements of Style by William Strunk, Jr. and E.B. White\" />\n<figcaption aria-hidden=\"true\">The Elements of Style by William Strunk,\nJr. and E.B. White</figcaption>\n</figure>\n<p><strong>🌠 What I remember</strong>: omit needless words.</p>\n<p>But really—how necessary is “needless” in that dictum?</p>\n<p><strong>Metadata</strong></p>\n<ul>\n<li>Title: The Elements of Style</li>\n<li>Author: William Strunk, Jr. and E.B. White</li>\n<li><a href=\"https://worldcat.org/isbn/1989862004\">Worldcat</a></li>\n<li><a href=\"https://openlibrary.org/isbn/1989862004\">Open\nLibrary</a></li>\n<li><a href=\"https://bookshop.org/books/isbn/9781989862001\">Bookshop</a></li>\n<li><a href=\"https://bookwyrm.social/search?q=9781989862001\">Bookwyrm</a></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/02/19/weather-station/",

    "title": "Monitoring my weather at home&#xA0;&#x1F329;&#xFE0F;",
    "url": "https://tylercipriani.com/blog/2023/02/19/weather-station/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-02-19T22:45:49Z",
    "date_modified": "2023-02-22T18:16:24Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/b7/0a25cc9833763feb38a6899162a010/large.jpg\"\nalt=\"Davis Vantage Wireless Console/Reciever, Raspberry Pi 3 Model B Rev 1.2, RTC module—the heart of my weather center\" />\n<figcaption aria-hidden=\"true\">Davis Vantage Wireless Console/Reciever,\nRaspberry Pi 3 Model B Rev 1.2, RTC module—the heart of my weather\ncenter</figcaption>\n</figure>\n<p>Despite their best efforts, all weather apps will eventually lie.</p>\n<p>Weather is often hyper-local. For example, trying to suss out the\ntemperature this morning:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>App</th>\n<th>Temperature</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>Accuweather</td>\n<td>41°F (5°C)</td>\n</tr>\n<tr class=\"even\">\n<td>Carrot</td>\n<td>36°F (2°C)</td>\n</tr>\n<tr class=\"odd\">\n<td>Ventusky</td>\n<td>22°F (-5°C)</td>\n</tr>\n<tr class=\"even\">\n<td>Garmin Running watch</td>\n<td>48°F (8.8°C)</td>\n</tr>\n</tbody>\n</table>\n<p>So, in 2013, I set up a Davis Vantage Vue integrated sensor suite\n(ISS) and mounted it on a pole attached to my garage.</p>\n<p><strong>Actual temperature</strong> (in my backyard): <strong>47°F\n(8°C)</strong></p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/35/850cdf9bbf633667704eb076e68bbe/large.jpg\"\nalt=\"My Davis Vantage Vue Wireless Integrated Sensor Suite in all its glory\" />\n<figcaption aria-hidden=\"true\">My Davis Vantage Vue Wireless Integrated\nSensor Suite in all its glory</figcaption>\n</figure>\n<section id=\"weather-station-hardware\" class=\"level2\">\n<h2>Weather station hardware 🖥️</h2>\n<p>In 2013, the DIY weather station route wasn’t for me.</p>\n<p>A DIY station was:</p>\n<ul>\n<li>🙃 Beyond my skillset (at the time)</li>\n<li>🏴󠁵󠁳󠁣󠁯󠁿 Built with fragile, general-purpose parts that may fail when\ntasked with standing up to the harsh Colorado sunshine year after\nyear</li>\n</ul>\n<p>So, over time, I cobbled together an off-the-shelf solution:</p>\n<ul>\n<li><a\nhref=\"https://www.davisinstruments.com/collections/vantage-vue/products/vantage-vue-wireless-integrated-sensor-suite\">Davis\nVantage Vue Wireless Integrated Sensor Suite (ISS)</a></li>\n<li><a\nhref=\"https://www.davisinstruments.com/products/vantage-vue-wireless-console-receiver\">Davis\nVantage Wireless Console/Receiver</a></li>\n<li><a href=\"https://ambientweather.com/amwewe-html\">Ambient Weather\nWeatherMount station mount</a></li>\n<li><a\nhref=\"https://www.davisinstruments.com/products/weatherlink-windows-usb\">Davis\nWeatherLink® USB Data Logger</a></li>\n<li>Raspberry Pi 3 Model B Rev 1.2</li>\n<li><a\nhref=\"https://www.amazon.com/SunFounder-DS3231-Precision-Raspberry-Arduino/dp/B00HF4NUSS\">SunFounder\nPCF8563 IIC I2C Real Time Clock RTC</a> (for the Raspberry pi).</li>\n</ul>\n</section>\n<section id=\"weather-station-software\" class=\"level2\">\n<h2>Weather station software 🌐</h2>\n<p><a href=\"https://weewx.com/\">WeeWX</a> is <a\nhref=\"https://en.wikipedia.org/wiki/Free_and_open-source_software\">free\nand open-source</a> weather station software written in Python. And it’s\nthe heart of my system.</p>\n<p>It has out-of-the-box support for everything I want:</p>\n<ul>\n<li><a href=\"https://github.com/weewx/weewx/wiki\">Great docs</a></li>\n<li>Local SQLite storage for weather data</li>\n<li>Support for sending your data over MQTT</li>\n<li>Uploads to <a href=\"http://www.pwsweather.com/\">PWSWeather.com</a>,\n<a href=\"http://www.wxqa.com/\">CWOP</a>, <a\nhref=\"http://wow.metoffice.gov.uk/\">WOW</a>, <a\nhref=\"http://awekas.at/\">AWEKAS</a>, and even WUnderground (if you’re\ninterested in gifting your data to IBM and getting bupkis for it)</li>\n<li>Static HTML/plain text reports, including:\n<ul>\n<li>Graphs of current and historical conditions</li>\n<li><a\nhref=\"https://gist.github.com/thcipriani/dd464e126548d2d5da3dbd6255cc45d4\">Historical\nclimatology reports</a> (complete with <a\nhref=\"https://www.weather.gov/key/climate_heat_cool\">heat/cool degree\ndays per month</a>)</li>\n</ul></li>\n</ul>\n</section>\n<section id=\"frustrations\" class=\"level2\">\n<h2>Frustrations 🤬</h2>\n<figure>\n<img src=\"https://imgs.xkcd.com/comics/weather_station.png\" title=\"\'Pour one out for precipitation data integrity,\' I say, solemnly upending the glass into the rain gauge.\" alt=\"XKCD 2737 by Randall Monroe (Licensed: (CC-by-NC 2.5)[https://creativecommons.org/licenses/by-nc/2.5/])\">\n<figcaption aria-hidden=\"true\"><a href=\"https://xkcd.com/2737/\">XKCD #2737</a> by Randall Munroe (Licensed: <a href=\"https://creativecommons.org/licenses/by-nc/2.5/\">CC-By-NC 2.5</a>)</figcaption>\n</figure>\n<p><strong>Raspberry Pi</strong></p>\n<p>In 2023, using a Raspberry Pi is a mistake.</p>\n<p>Any of the cheapo x86 mini-pcs that retail for about $150 would be a\nnicer option than a Raspberry Pi.</p>\n<p>Running WeeWX on a Raspberry Pi has some problems (all of which are\nwell-document on their wiki):</p>\n<ul>\n<li><strong>No hardware clock</strong> – this causes screwy date/time\ndata following a reboot. I added an RTC module to thwart this\nproblem.</li>\n<li><strong>Write-heavy vs. SD-Cards</strong> – WeeWX is a write-heavy\napplication, corrupting even the best sd-cards over time. I’m writing\nmost data to a tmpfs and relying on backup and MQTT for data\npersistence.</li>\n<li><strong>Unobtainium</strong> – In the mid-2010s, Pis were ~$40. Now,\nPis are $150 for old models and infinity expensive for newer models\n(since you can’t find them anywhere).</li>\n</ul>\n<p><strong>Davis Vantage Vue</strong></p>\n<p>I’m unreasonably angry about Davis forcing me to buy a <a\nhref=\"https://www.davisinstruments.com/products/weatherlink-windows-usb\">USB\ndata logger</a>.</p>\n<p>Why is there no USB-out in the $275 console? It feels like punishment\nfor eschewing open-source hardware.</p>\n<p>Maybe something like the <a\nhref=\"https://www.smartbedded.com/wiki/index.php/Meteostick\">Meteostick</a>\nwould obviate the need for the console+data logger combo, but I’ve never\ntried it.</p>\n<p>But the integrated sensor suite has been great: the only maintenance\nI do is swapping out the CR123A battery every few years (it’s mostly\nsolar powered).</p>\n</section>\n<section id=\"weather-data-everywhere\" class=\"level2\">\n<h2>Weather data everywhere 🚀</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/94/21116f27a369247a0674c3ca415b79/large.jpg\"\nalt=\"My old Pocket CHIP (🪦 R.I.P.) showing off some Grafana weather graphs\" />\n<figcaption aria-hidden=\"true\">My old Pocket CHIP (🪦 R.I.P.) showing\noff some Grafana weather graphs</figcaption>\n</figure>\n<p>Now that I own my own weather data: I spew it all over the place.</p>\n<p>I publish data to:</p>\n<ul>\n<li><a href=\"http://www.wxqa.com/\">Citizen Weather Observer Program</a>\nusing my ham callsign\n<ul>\n<li>so, my data shows up on the <a href=\"https://aprs.fi\">APRS.fi</a>\nmap</li>\n</ul></li>\n<li><a href=\"http://www.pwsweather.com/\">PWSWeather.com</a>, and</li>\n<li>MQTT to Home Assistant</li>\n<li>Prometheus</li>\n</ul>\n<p>There are weather widgets all over my house:</p>\n<ul>\n<li>My desktop’s taskbar (<a\nhref=\"https://codeberg.org/xmobar/xmobar\">XMobar</a>) shows the current\noutdoor and indoor temperatures</li>\n<li>Grafana dashboards show me the current conditions (as shown in the\npicture of my <a href=\"https://shop.pocketchip.co/\">PocketCHIP</a>\nabove)</li>\n<li>I even have a small eink display in my bathroom to check the weather\nbefore my morning run</li>\n</ul>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/99/d1f95bac511948477c9a9eda51e492/large.jpg\"\nalt=\"Adafruit MagTag in my bathroom\" />\n<figcaption aria-hidden=\"true\">Adafruit MagTag in my\nbathroom</figcaption>\n</figure>\n<p>And if eink weather displays in the bathroom are unappealing to you,\nI just don’t understand what you’re doing here.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/01/31/coffee-science/",

    "title": "The beginner&#x27;s guide to over&#xAD;complicating coffee&#xA0;&#x2615;",
    "url": "https://tylercipriani.com/blog/2023/01/31/coffee-science/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2023-01-31T01:10:46Z",
    "date_modified": "2023-01-31T02:24:41Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/7a/bd0d5d6de2d41f24dc6985f8302331/large.jpg\"\nalt=\"Complicated coffee: plain and simple.\" />\n<figcaption aria-hidden=\"true\">Complicated coffee: plain and\nsimple.</figcaption>\n</figure>\n<p>There’s a scene in AMC’s “<a\nhref=\"https://breakingbad.fandom.com/wiki/Breaking_Bad_Wiki\">Breaking\nBad</a>” where Gail Boetticher explains to Walter White <a\nhref=\"https://www.youtube.com/watch?v=pJ83kt4a2-A\">how to make the\nperfect cup of coffee</a>. And it all sounds so plausible—there’s a\nperfect coffee, and science will magic it for us.</p>\n<p>That whole idea, scene, and contraption are, of course, <a\nhref=\"https://chemistry.stackexchange.com/questions/7439/chemistry-behind-gales-coffee-maker-in-breaking-bad\">wrong</a>.</p>\n<p>But there are real ways to experiment your way towards a more perfect\ncup.</p>\n<section id=\"the-quest-for-good-coffee\" class=\"level2\">\n<h2>🗺️ The quest for good coffee</h2>\n<p>In 1957, a professor of food science at MIT forever changed what we\nthink of as good coffee.</p>\n<p>E.E. Lockhart <a\nhref=\"https://www.worldcat.org/title/soluble-solids-in-beverage-coffee-as-an-index-to-cup-quality/oclc/40651254\">posited</a>\nthat coffee flavor is the result of two variables:</p>\n<ol type=\"1\">\n<li>How much coffee you use</li>\n<li>How much of that coffee dissolves into the final cup (total\ndissolved solids—TDS%)</li>\n</ol>\n<p>Lockhart surveyed a bunch of people to suss out the ideal range for\nthese values, creating the “Coffee Brewing Control Chart,”—which is\nstill in use today.<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a></p>\n<figure class=\"narrow-figure\">\n    <img src=\"https://photos.tylercipriani.com/2023-01-30_coffee-brewing-control-chart.svg\" alt=\"Coffee Brewing Control Chart\">\n    <figcaption aria-hidden=\"true\">Coffee Brewing Control Chart</figcaption>\n</figure>\n<p>And you can use Lockhart’s data to better your own brew.</p>\n</section>\n<section id=\"coffee-science-at-home\" class=\"level2\">\n<h2>🔬 Coffee science at home</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/e8/1d7597af78d719dcf36c2b38789bd4/large.jpg\"\nalt=\"Using a brix refractometer to compare two different brews\" />\n<figcaption aria-hidden=\"true\">Using a brix refractometer to compare two\ndifferent brews</figcaption>\n</figure>\n<p>When he was developing the Aeropress, Alan Adler was a frequent\nposter on the coffeegeek forums. There he shared the results of his\nexperiments measuring coffee <a\nhref=\"https://web.archive.org/web/20190810050548/https://www.coffeegeek.com/forums/coffee/machines/203992\">using\na simple brix refractometer</a>.</p>\n<p>And, unfortunately for everyone in my immediate family—I own one of\nthose, too!</p>\n</section>\n<section id=\"an-experiment-finding-the-ideal-grind-for-the-hario-v60\"\nclass=\"level2\">\n<h2>🧪 An experiment: finding the ideal grind for the Hario v60</h2>\n<p>Over Christmas, I got a Hario v60 pour-over brewer. And I used\nscience to zero-in on what I think is the perfect grind size.</p>\n<p><strong>Materials</strong></p>\n<ul>\n<li><a\nhref=\"https://www.hario-usa.com/collections/drippers/products/v60-plastic-deep-sea\">Hario\nV60 plastic dripper</a></li>\n<li><a href=\"https://baratza.com/grinder/virtuoso/\">Baratza\nVirtuoso</a></li>\n<li><a\nhref=\"https://bonavita.co/collections/kettles/products/1-0l-variable-temperature-kettle\">Bonavita\nelectric kettle</a></li>\n<li><a\nhref=\"https://escali.com/products/primo-digital-scale?variant=43686292848956\">Escali\nPrimo gram scale</a></li>\n<li><a\nhref=\"https://www.ozocoffee.com/product/ethiopia-refisa-dry-process/\">Ethiopia\nRefisa dry process from Ozo coffee</a></li>\n<li>Tap water—the miracle of modernity</li>\n</ul>\n<p><strong>Methods and Results</strong></p>\n<p>I tried to brew two cups of coffee the exact. same. way. Except for\none variable: <strong>the grind</strong>.</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Variable</th>\n<th>Course grind</th>\n<th>Fine grind</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>Grinder dial setting</td>\n<td>22</td>\n<td>17</td>\n</tr>\n<tr class=\"even\">\n<td>Water temperature</td>\n<td>95°C</td>\n<td>95°C</td>\n</tr>\n<tr class=\"odd\">\n<td>Water amount</td>\n<td>320g</td>\n<td>320g</td>\n</tr>\n<tr class=\"even\">\n<td>Coffee used</td>\n<td>20g</td>\n<td>20g</td>\n</tr>\n<tr class=\"odd\">\n<td><strong>Coffee brewed</strong></td>\n<td>277g</td>\n<td>271g</td>\n</tr>\n<tr class=\"even\">\n<td><strong>TDS%</strong></td>\n<td>1.4%</td>\n<td>1.7%</td>\n</tr>\n<tr class=\"odd\">\n<td><strong>Extract%</strong></td>\n<td>20%</td>\n<td>23%</td>\n</tr>\n</tbody>\n</table>\n<figure class=\"narrow-figure\">\n    <img src=\"https://photos.tylercipriani.com/2023-01-30_coffee-brewing-control-chart-data.svg\" alt=\"“17” setting might be too fine—it’s off the chart\">\n    <figcaption aria-hidden=\"true\">“17” setting might be too fine—it’s off the chart</figcaption>\n</figure>\n<p>This measured difference is obvious, but can I taste a\ndifference?</p>\n<p><strong>Taste and preference</strong></p>\n<p>A widely used protocol for figuring out if you can discern a\ndifference between two products is the <a\nhref=\"https://en.wikipedia.org/wiki/Discrimination_testing#Triangle\">triangle\ntest</a>.</p>\n<p>In a triangle test, you present three cups of coffee: two are\nidentical, one is different. The goal is to pick out the odd cup\nconsistently (better than random change; i.e., 1/3).</p>\n<p>So, I took my two coffees and split them into 3 cups:</p>\n<ul>\n<li>3 cups: A, B, and C</li>\n<li>Cups A &amp; C – <strong>fine grind</strong> (“17”)</li>\n<li>Cup B – <strong>course grind</strong> (“22”)</li>\n</ul>\n<p>And, then I mixed up the cups and tried to pick the odd one out:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>Result</th>\n<th>Trial</th>\n<th>Different cup</th>\n<th>Cup I picked</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>✅</td>\n<td>1</td>\n<td>B</td>\n<td>B</td>\n</tr>\n<tr class=\"even\">\n<td>✅</td>\n<td>2</td>\n<td>B</td>\n<td>B</td>\n</tr>\n<tr class=\"odd\">\n<td>❌</td>\n<td>3</td>\n<td>B</td>\n<td>A</td>\n</tr>\n<tr class=\"even\">\n<td>❌</td>\n<td>4</td>\n<td>B</td>\n<td>A</td>\n</tr>\n<tr class=\"odd\">\n<td>✅</td>\n<td>5</td>\n<td>B</td>\n<td>B</td>\n</tr>\n</tbody>\n</table>\n<p>As dramatic as the chart above looks, picking the “different” cup was\ntricky. I encourage you to try it—it was a fun experiment.</p>\n<p>In the end, I preferred the course grind—it seemed sweeter and fuller\nvs. the fine grind. The fine grind coffee was astringent: sharp and\ntannic.</p>\n</section>\n<section id=\"coffee-cognition-theory\" class=\"level2\">\n<h2>🍕 Coffee cognition theory</h2>\n<blockquote>\n<p>The theory of pizza cognition tells us that an individual’s first and\nprimary source of pizza … will become the pizza against which all others\nare judged.</p>\n<p>– Sam Sifton, <a\nhref=\"https://www.nytimes.com/2022/01/19/dining/your-new-favorite-pizza-is-french.html\">The\nNew York Times</a></p>\n</blockquote>\n<p>I prefer strong coffee.</p>\n<p>But I also prefer a light roast, single-origin coffee.</p>\n<p>Much of the science of coffee is about extraction. <strong>But the\nart of coffee is hundreds of other choices</strong>: light roast, dark\nroast, Ethiopian, Sumatran, dry process, honey process, “<a\nhref=\"https://briping.com/\">briping</a>,” and any other outre preference\nfolks would find criminal to omit.</p>\n<p>So far there have been three waves of coffee in the United\nStates:</p>\n<ul>\n<li><strong>First wave</strong> – Instant coffee. Diner coffee.\nFolgers.</li>\n<li><strong>Second wave</strong> – Dark roast. Peet’s/Starbucks.</li>\n<li><strong>Third wave</strong> – light roast, single origin: Blue\nbottle/Stumptown.</li>\n</ul>\n<p>What I consider “good coffee” is a product of when I started drinking\ncoffee—smack in the middle of the third wave.</p>\n<p>But there’s no perfect coffee, no matter what Gail Boetticher\nsays.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>In 2020, scientists recreated\nLockhart’s experiment—the coffee chart holds up! But cluster analysis\nholds some new insights: <a\nhref=\"https://ift.onlinelibrary.wiley.com/doi/abs/10.1111/1750-3841.15561\"\nclass=\"uri\">https://ift.onlinelibrary.wiley.com/doi/abs/10.1111/1750-3841.15561</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2023/01/15/entitlement-burnout-and-toxicity/",

    "title": "Paper Review: &#x201C;Did you miss my comments or what?&#x201D; Toxicity in Open Source Discussions",
    "url": "https://tylercipriani.com/blog/2023/01/15/entitlement-burnout-and-toxicity/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2023-01-15T02:29:26Z",
    "date_modified": "2023-01-16T02:32:43Z",


    "content_html": "<p>On entitlement, toxicity, and burnout in Open Source.</p>\n<blockquote>\n<p>[Toxicity is] rude, disrespectful, or unreasonable language that is\nlikely to make someone leave a discussion.</p>\n<p>– Google, <a\nhref=\"https://jigsaw.google.com/the-current/toxicity/\">Project\nJigsaw</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2023-01-10_open-source-is-retain.png\"\nalt=\"Thu, 19 Aug 2021 @EmilyKager &amp; @wardellbagby@androiddev.social\" />\n<figcaption aria-hidden=\"true\">Thu, 19 Aug 2021 <a\nhref=\"https://twitter.com/wardellbagby/status/1428529304011345925\"><span\nclass=\"citation\" data-cites=\"EmilyKager\">@EmilyKager</span> &amp; <span\nclass=\"citation\" data-cites=\"wardellbagby\">@wardellbagby</span><span\nclass=\"citation\"\ndata-cites=\"androiddev.social\">@androiddev.social</span></a></figcaption>\n</figure>\n<p>I didn’t expect to learn something new from this paper.</p>\n<p>I’d hoped it was obvious by now: there’s no room in tech for the\nbrilliant jerk.</p>\n<p>But the paper, <a\nhref=\"https://cmustrudel.github.io/papers/osstoxicity22.pdf\">“‘Did you\nmiss my comments or what?’ Understanding Toxicity in Open Source\nDiscussions,”</a> taught me something new. They took a deep-dive into\nGitHub comments to name something I’d seen but never had a term for:\n<strong>“entitlement.”</strong></p>\n<section id=\"the-five-flavors-of-toxicity\" class=\"level2\">\n<h2>The five flavors of toxicity</h2>\n<p>The authors lump toxic comments into five flavors—four I’ve seen\nbefore:</p>\n<ul>\n<li>🤬 <strong>Insulting</strong> – Typing angry words at people.</li>\n<li>😏 <strong>Arrogance</strong> – When a comment author forces their\n“clearly superior” views on others. A hallmark of many technical\ndisagreements.</li>\n<li>🤡 <strong>Unprofessional comments</strong> – Comments that make\nproject members uncomfortable. Mostly unfunny attempts at humor that are\ninappropriate in a professional setting.</li>\n<li>🧌 <strong>Trolling</strong> – The lowest form of toxicity. As <a\nhref=\"https://en.wikipedia.org/wiki/Potter_Stewart\">Justice Potter\nStewart</a> quipped about trolling<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>, “I’ll know it when I\nsee it.”</li>\n</ul>\n<p>And one is new to me:</p>\n<ul>\n<li>🆕 <strong>Entitlement</strong> – Pure <a\nhref=\"https://en.wikipedia.org/wiki/User_error#Acronyms_and_other_names\">PEBKAC</a>\nfury. Comment authors act as if maintainers have violated a contract.\nThey make unreasonable requests of the maintainers. They demand the\nsoftware be different.</li>\n</ul>\n<p>I’d seen entitled comments but never had a name for them.</p>\n</section>\n<section id=\"entitlement-is-a-new-term-for-me\" class=\"level2\">\n<h2>“Entitlement” is a new term for me</h2>\n<blockquote>\n<p>Entitlement is commonly targeted at people, […] insulting them for\nnot doing what they wanted them to do or do it fast enough.</p>\n<p>– Understanding Toxicity in Open Source Discussions</p>\n</blockquote>\n<p>The term is new, but the paper renders a familiar scene, “The author\nis usually visibly upset about not being able to use the tool, often\ncomplaining about wasted time.”</p>\n<p>The situation is all-too-common and exhausting. And when it happens\nover-and-over, maintainers give up.</p>\n<p>It made me wonder: <strong>why have I never seen “entitlement” in a\ncode of conduct?</strong></p>\n<p>For example, the <a\nhref=\"https://www.contributor-covenant.org/\">Contributor Covenant</a><a\nhref=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a> names all the flavors of toxicity\nfrom the paper—except “entitlement.”</p>\n<p>Maybe “entitlement” is a new term for everyone\n<code>¯\\_(ツ)_/¯</code>.</p>\n</section>\n<section id=\"the-entitlement-burnout-cycle\" class=\"level2\">\n<h2>♻️ The entitlement-burnout cycle</h2>\n<blockquote>\n<p>complaints, questions, and requests for enhancement from users can\nfeel like ‘a constant stream of negativity’</p>\n<p>– Understanding Toxicity in Open Source Discussions</p>\n</blockquote>\n<p>When maintainers make toxic comments, they’re often responding to\nentitled comments.</p>\n<p>The cycle looks like this:</p>\n<ul>\n<li><strong>Frustration</strong> – A user gets frustrated with the\nproject</li>\n<li><strong>Entitlement</strong> – Users start making demands of\nmaintainers\n<ul>\n<li>They complain about the project not working how anyone would\nexpect</li>\n<li>Or they complain about the maintainer not working fast enough.</li>\n<li>“wasted time”</li>\n</ul></li>\n<li><strong>Insulting</strong> – Finally, this causes project members to\nsnap—insulting the user</li>\n<li><strong>Burnout</strong> – This interaction burns out project\nmembers and repels new users. The burnout withers the project and causes\nmore users to get frustrated.</li>\n</ul>\n</section>\n<section id=\"so-lets-do-something-about-entitlement\" class=\"level2\">\n<h2>So, let’s do something about entitlement</h2>\n<blockquote>\n<p>[Toxicity] can increase the risk of projects becoming abandoned or\nunmaintained</p>\n<p>– Understanding Toxicity in Open Source Discussions</p>\n</blockquote>\n<figure>\n<img src=\"https://imgs.xkcd.com/comics/dependency.png\"\nalt=\"XKCD #2347: Dependency—CC-By-NC 2.5 by Randall Munroe\" />\n<figcaption aria-hidden=\"true\"><a href=\"https://xkcd.com/2347/\">XKCD\n#2347</a>: Dependency—<a\nhref=\"https://creativecommons.org/licenses/by-nc/2.5/\">CC-By-NC 2.5</a>\nby Randall Munroe</figcaption>\n</figure>\n<p>The Open Source software powering the internet is chronically\nunderfunded and understaffed.</p>\n<p>We still refuse to learn one of the crtical <a\nhref=\"https://en.wikipedia.org/wiki/Heartbleed#Root_causes,_possible_lessons,_and_reactions\">lessons\nof heartbleed</a>: <strong>maintainers need our support</strong>. </p>\n<p>First, <strong>Open Source maintainers need money—give them\nmoney</strong> if they’ve written code critical for you or your\ncompany.</p>\n<p>But maintainers also need mental space to function.</p>\n<p>So, now that we have a term <strong>let’s do something about\nentitlement</strong>:</p>\n<ul>\n<li>Add it to your code of conduct.</li>\n<li>And say something when you see it happening.</li>\n</ul>\n<p>Otherwise, at best, we’re all doomed to reimplement terrible versions\nof OpenSSL and ImageMagick forever <code>*shudder*</code>.</p>\n<hr />\n<p><small>Thank you to <a href=\"https://p1k3.com\">Brennen</a>, <a\nhref=\"https://www.kostaharlan.net/\">Kosta</a>, and <a\nhref=\"https://filipin.eu/\">Željko</a> for reading the early drafts of\nthis blog. The remaining errors and dumb opinions are mine; all the\ninvisible fixes are theirs.</small></p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>IIRC,\n<code>{{citation-needed}}</code><a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>Which, to be clear, is amazing<a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/12/31/favorite-books-of-2022/",

    "title": "Reading in 2022",
    "url": "https://tylercipriani.com/blog/2022/12/31/favorite-books-of-2022/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2022-12-31T15:03:35Z",
    "date_modified": "2023-01-01T03:21:40Z",


    "content_html": "<blockquote>\n<p>Every book should be read no more slowly than it deserves, and no\nmore quickly than you can read it with satisfaction and\ncomprehension.</p>\n<p>– Mortimer J Adler, <a\nhref=\"https://openlibrary.org/books/OL8673330M/How_to_Read_a_Book\">How\nto Read a Book</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/17/5ff7048676236f8155e2a293e44d3b/large.jpg\"\nalt=\"My trusty, hated Kindle\" />\n<figcaption aria-hidden=\"true\">My trusty, hated Kindle</figcaption>\n</figure>\n<p>Reading only “<a\nhref=\"https://en.wikipedia.org/wiki/1001_Books_You_Must_Read_Before_You_Die\">1000\nbooks before you die</a>” used to strike me as unambitious.</p>\n<p>Then I started <a href=\"https://tylercipriani.com/books/\">tracking my reading</a>, and I\nrealized it would take me <strong>40+ years to read 1000\nbooks</strong>.</p>\n<p>I needed to set goals to improve my natural average pace of 24 books\nper year. And in 2022 I eked out a respectable\n<a href=\"https://tylercipriani.com/books/2022/\">55 books</a>.</p>\n<p>This post catalogs the systems and habits I used to boost my\nreading.</p>\n<section id=\"motivation\" class=\"level2\">\n<h2>Motivation</h2>\n<p>I like reading.</p>\n<p>When I contrast how I feel after I spend an hour doomscrolling Reddit\nvs an hour spent reading, there’s no comparison—reading always wins. Too\nmuch internet can leave me feeling desolate.</p>\n<p>Nonfiction continues to be the best way to learn more about myriad\ntopics. And science now touts the <a\nhref=\"https://lithub.com/its-official-according-to-science-reading-fiction-makes-you-nicer/\">benefits\nof reading fiction</a>.</p>\n<p>But there’s so much to read and so little time. Plus, I worried I was\nlosing what I’d already read. So I set goals and built habits to achieve\nthose goals.</p>\n</section>\n<section id=\"what-is-working-well\" class=\"level2\">\n<h2>What is working well</h2>\n<ul>\n<li><p><strong>My Kindle</strong> – I wish an open device existed that\nwas as wonderful as my Kindle. I hate that I love it so much. But it’s a\nboon to my reading, and the benefits are hard to quibble over:</p>\n<ul>\n<li>Front-lit, ePaper display so I can read at night without a light and\nwithout interfering with my sleep</li>\n<li>Stores 100s of books</li>\n<li>Whispersync keeps it synced with audiobooks on Audible</li>\n<li>Stores highlights in <code>MyClippings.txt</code>—makes it easy to\nexport highlights</li>\n<li>Stores words you look up in the dictionary in\n<code>vocab.db</code>—makes it easy to make vocabulary words into <a\nhref=\"https://github.com/psamim/kindle2anki\">Anki flashcards</a></li>\n<li>Light enough to drop on your face while reading in bed (this is a\nbig concern for me)</li>\n</ul></li>\n<li><p><strong>Reading notes</strong> – I highlight quotes I like and\nsave them in <a href=\"https://readwise.io/\">Readwise</a>.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-12-31_readwise.png\"\nalt=\"Notes in my Readwise library\" />\n<figcaption aria-hidden=\"true\">Notes in my Readwise library</figcaption>\n</figure>\n<p>This happens automatically for books I read on my Kindle.</p>\n<p>For paper books, I stole my entire process from <a\nhref=\"https://www.calnewport.com/blog/2017/08/14/how-i-read-when-researching-a-book/\">Cal\nNewport</a>:</p>\n<ul>\n<li>Read with a <a\nhref=\"https://www.amazon.com/Zebra-Mechanical-Standard-Assorted-28-Count/dp/B001BZ4RJS/ref=sr_1_10\">Zebra\n#2</a> in hand</li>\n<li>Highlight interesting passages—underline or bracket or make a mark\nin the margins</li>\n<li>For each page where I highlight a passage, <strong>I also make a\nline across the corner of the page</strong></li>\n<li>Later, I can flip through the book and find all the pages with lines\nto find my highlights</li>\n<li>Then I’ll use Readwise’s “Add via photo” feature to add the\nhighlights to the app</li>\n</ul>\n<p>Readwise can automatically export to online notetaking apps like\nEvernote. But I like to export each book’s notes to markdown and save\nthem for quick ripgrepping and offline reading under\n<code>~/Documents/notes/brain</code>.</p></li>\n<li><p><strong>Tracking</strong> – It’s surprising how much benefit you\nget from simply writing down the books your read somewhere.</p>\n<p>I used to forget whole books all the time.</p>\n<p>I’ve tracked every book I’ve read <a href=\"https://tylercipriani.com/books/2016/\">since\n2016</a> on this blog. Posting it online may give me a bit of public\naccountability, but I think a plain text file would net you the same\nbenefits.</p></li>\n</ul>\n</section>\n<section id=\"what-still-needs-improvement\" class=\"level2\">\n<h2>What still needs improvement</h2>\n<ul>\n<li><p><strong>Reviewing</strong> – I failed to write a review for each\nbook I read this year. I started strong but faltered around book 30.</p>\n<p>I want to improve this next year. Maybe I should finally concede and\njoin a social reading forum—it might help to have some social\naccountability.</p>\n<p>The anti-corporate, ActivityPub-backed Goodreads alternative <a\nhref=\"https://bookwyrm.social/\">BookWyrm</a> could be a cool\nplace.</p></li>\n</ul>\n</section>\n<section id=\"goals-for-2023\" class=\"level2\">\n<h2>Goals for 2023</h2>\n<p>I’m going for fifty books again.</p>\n<p>Here are a few of my vague notions for reading in 2023:</p>\n<ul>\n<li>Math – I want to read about math. I’ve got A.N. Whiteheads’s “<a\nhref=\"https://archive.org/details/introductiontoma00whitiala\">An\nIntroduction to Mathematics</a>” and Mark C. Chu-Carroll’s <a\nhref=\"https://pragprog.com/titles/mcmath/good-math/\">Good Math</a> on my\nlist.</li>\n<li>Trees – I read “The Overstory” by Richard Powers in 2020. In an\ninterview with the Guardian in 2019, Powers said <a\nhref=\"https://www.theguardian.com/books/2019/may/11/richard-powers-interview-the-overstory-radicalised\">he’d\nread 120 books about trees</a> while he was writing it. I wonder which\nwas the best?</li>\n<li>The <a\nhref=\"https://www.ursulakleguin.com/hainish-novels-and-stories\">Hainish\nCycle</a> books – I’m a sucker for Ursula K. Le Guin. The Dispossessed\nis one of my favorites. I’ve never read any other book in this series.\nWhy not try a few in 2023?</li>\n<li>Lonesome Dove by Larry McMurtry – In 1994, David Foster Wallace\ntaught English 102 at Illinois State. <a\nhref=\"https://www.openculture.com/2013/02/david_foster_wallaces_1994_syllabus.html\">His\nsyllabus survives online</a>. All the required reading is mass-market\npaperbacks. Lonesome Dove is one of these cheap paperbacks that also\nhappens to have won the 1986 Pulitzer Prize for fiction, so it’s\nprobably an OK read.</li>\n<li>Moar US President biographies – reading a biography of every\nAmerican president might be a fun project <code>¯\\_(ツ)_/¯</code></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/12/21/writing-raft/",

    "title": "Writing raft",
    "url": "https://tylercipriani.com/blog/2022/12/21/writing-raft/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-12-21T01:30:25Z",
    "date_modified": "2022-12-24T02:34:00Z",


    "content_html": "<p>✏️⚡🔪<br>The club that’s write or die.</p>\n<blockquote>\n<p>If you want to be a writer, you must do two things above all others:\nread a lot and write a lot.</p>\n<p>– Stephen King, “On Writing”</p>\n</blockquote>\n<p>In 2022, I made a <a\nhref=\"https://en.wikipedia.org/wiki/Ulysses_pact\">Ulysses pact</a> to\nforce myself to write—either write or feel the white-hot shame of\n(temporary) banishment.</p>\n<p>And it worked.</p>\n<p><strong>I wrote more blog posts in 2022 than in any previous\nyear—more than the last three years combined.</strong></p>\n<p>I eked out two blog posts a month, every month, for the whole of last\nyear. And I owe much of my success to my write-or-die crew—the writing\nraft.</p>\n<section id=\"what-is-a-writing-raft\" class=\"level2\">\n<h2>⛵ What is a writing raft?</h2>\n<p>First proposed by <a href=\"https://shime.sh/raft\">Hrvoje Šimić</a>, a\nwriting raft is <strong>a club that forces you to write</strong>.</p>\n<p>The rules are simple:</p>\n<ol type=\"1\">\n<li>You must publish a blog post by the end of the month.</li>\n<li>If you do not publish on time, you’re out of the club (for a\nmonth).</li>\n<li>The club is limited to 5 members.</li>\n</ol>\n<p><a href=\"https://filipin.eu/\">Željko Filipin</a> conceived of our\nlittle <a href=\"https://en.wikipedia.org/wiki/Junto_(club)\">Junto</a>\ntowards the <a href=\"https://phabricator.wikimedia.org/T263660\">end of\n2020</a>.</p>\n<p>Today we have three members: Me, Željko, and <a\nhref=\"https://www.kostaharlan.net/\">Kosta Harlan</a>. And as of December\n2022, <strong>the three of us have managed to stay on our raft for one.\nfull. year</strong>.</p>\n<p>In honor of this milestone, we’re all posting about lessons we\nlearned over the past 12 months.</p>\n</section>\n<section id=\"lessons-from-a-year-of-writing\" class=\"level2\">\n<h2>🍎 Lessons from a year of writing</h2>\n<p><strong>Blogs should be easy to read.</strong> In 1997, Jakob Nielsen\nsuccinctly summarized “<a\nhref=\"https://www.nngroup.com/articles/how-users-read-on-the-web/\">How\nUsers Read on the Web</a>”: <strong>“They don’t.”</strong> I use short\nsentences and omit needless words. And I try to make my blogs\n<strong>look</strong> easy to read to keep readers moving.</p>\n<p><strong>Get to the point.</strong> Nobody has time for\nthroat-clearing—<a\nhref=\"https://en.wikipedia.org/wiki/Inverted_pyramid_(journalism)\">start\nwith your point</a>. If you need more details, add them later.</p>\n<p><strong>Your unconscious mind is a better writer than you.</strong>\nWriting and publishing on the same day used to be my habit. Now, I let\nmy rough drafts sit for a day. And I often wake up with a better idea,\nclearer point, or different direction—even if nobody gives me feedback.\nMy unconscious mind was working on my writing the whole time.</p>\n<blockquote>\n<p>The core question is not how you do math but how does the unconscious\ndo it. How is it that it’s demonstrably better at it than you are?</p>\n<p>– Cormac McCarthy, “Stella Maris”</p>\n</blockquote>\n<p><strong>Practice in public. It’s the fastest way to improve.</strong>\nAnother deal I made with myself this year is that after I publish a\npost, I must link it somewhere online.</p>\n<p>Internet strangers are a fickle crowd, which makes them a great\nlitmus test for your writing. If a post generates nothing but\nsilence—why not tweak it?</p>\n<p>Figure out how to say it better and try again. And try to learn\nsomething for next time.</p>\n<p><strong>Peer pressure is a tool.</strong> The writing raft has shown\nme: I need someone to notice if I skip a month of writing. Writing the\n<a\nhref=\"https://wrd.as.uky.edu/sites/default/files/1-Shitty%20First%20Drafts.pdf\">first\ndraft</a> is painful. Knowing I have a deadline keeps me moving through\nthe pain.</p>\n<p><strong>And conclusions</strong>. I’m so bad at conclusions. But I’m\nworking on it <code>¯\\_(ツ)_/¯</code>.</p>\n<hr />\n<ul>\n<li>Kosta’s post: <a\nhref=\"https://www.kostaharlan.net/posts/a-year-of-writing-club/\">A year\nof writing club</a></li>\n<li>Željko’s post: <a\nhref=\"https://filipin.eu/two-years-of-blog-post-writing-club\">Two years\nof blog post writing club</a></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/11/30/home-temperature-monitoring-on-the-cheap/",

    "title": "Home temperature monitoring on the cheap",
    "url": "https://tylercipriani.com/blog/2022/11/30/home-temperature-monitoring-on-the-cheap/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-12-01T01:05:02Z",
    "date_modified": "2022-12-01T03:26:08Z",


    "content_html": "<blockquote>\n<p>One accurate measurement is worth a thousand expert opinions</p>\n<p>– Grace Hopper</p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/29/572c7a17b2370f5a2a9e3b32760166/large.jpg\"\nalt=\"One of my many AcuRite 06044M Wireless Temperature and Humidity Monitor Sensors\" />\n<figcaption aria-hidden=\"true\">One of my many AcuRite 06044M Wireless\nTemperature and Humidity Monitor Sensors</figcaption>\n</figure>\n<p>As I meandered around our new house, it was apparent some rooms were\nsweltering, others were freezing, and the thermostat was lying about\neverything.</p>\n<p>I could <strong>feel</strong> it.</p>\n<p>But I felt compelled to <strong>measure</strong> it. I was struck by\nthe need to know:</p>\n<ul>\n<li>The temperature of each room</li>\n<li>How it changed throughout the day</li>\n<li>And how to monitor changes over time</li>\n</ul>\n<p>And I fulfilled my weird compulsion with a few simple tools:</p>\n<ol type=\"1\">\n<li>Cheap temperature and humidity sensors from Home Depot</li>\n<li>Home Assistant</li>\n<li>The original internet of things protocol: radio.</li>\n</ol>\n<section id=\"cheap-temperature-sensors\" class=\"level2\">\n<h2>Cheap temperature sensors</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/a8/92ab5b5fa2723e87cab3c833b53dad/large.jpg\"\nalt=\"My rtl-sdr.com-branded rtl2832u dvb-t dongle I’ve had since 2013\" />\n<figcaption aria-hidden=\"true\">My rtl-sdr.com-branded rtl2832u dvb-t\ndongle I’ve had since 2013</figcaption>\n</figure>\n<p>I have a handful of <a\nhref=\"https://www.amazon.com/gp/product/B01G7BE9WK/ref=ox_sc_act_title_1?smid=ATVPDKIKX0DER&amp;th=1\">AcuRite\nsensors</a> sprinkled throughout my house.</p>\n<p>These sensors are $16 today, but I bought mine around 2017 for $12\neach at Home Depot.</p>\n<p>I know I could cobble together a cheaper temperature sensor:</p>\n<table>\n<tbody>\n<tr class=\"odd\">\n<td><a href=\"https://www.aliexpress.com/item/32678741657.html\">SHT30</a>\ntemperature/humidity sensor</td>\n<td style=\"text-align: left;\">$1</td>\n</tr>\n<tr class=\"even\">\n<td><a\nhref=\"https://www.aliexpress.com/item/1005004005586872.html\">WeMos\nesp8266</a></td>\n<td style=\"text-align: left;\">$5</td>\n</tr>\n<tr class=\"odd\">\n<td><a href=\"https://aliexpress.com/item/32800979738.html\">D1Mini OLED\nscreen</a></td>\n<td style=\"text-align: left;\">$2</td>\n</tr>\n<tr class=\"even\">\n<td>Shipping</td>\n<td style=\"text-align: left;\">~$2</td>\n</tr>\n<tr class=\"odd\">\n<td>A month of waiting for shipping</td>\n<td style=\"text-align: left;\">priceless</td>\n</tr>\n</tbody>\n</table>\n<p>So for like $10 + solder + a weekend fiddling, you could make a\ncraptastic internet-equipped temperature/humidity sensor.</p>\n<p>But I dreaded building it.</p>\n<p>Tinkering with electronic doodads is a fun hobby. But I just wanted\nsomething cheapish that would work.</p>\n<p>And the AcuRites work.</p>\n<p>Plus, the AcuRites work forever on a couple AAAs because they eschew\npower-hungry wifi in favor of squawking data on 433 MHz.</p>\n</section>\n<section id=\"mhz-the-original-iot-protocol\" class=\"level2\">\n<h2>433 MHz, the original IoT protocol</h2>\n<p>Even though 433.92 MHz sits squarely in the 70cm ham band, tons of\nelectronic junk spews signals on that frequency.</p>\n<p>And with a <a\nhref=\"https://www.amazon.com/NooElec-NESDR-Mini-Compatible-Packages/dp/B009U7WZCA/ref=sr_1_6\">$25\nUSB dongle</a> and <a\nhref=\"https://github.com/merbanan/rtl_433/blob/6e1f120212005a5549dc184d9cd18002d49fdd10/src/devices/acurite.c#L974\">free\nsoftware</a>, it’s easy to decode messages chirped out by your AcuRite\ntemperature sensors.</p>\n<p>So far, this project had been cheap and simple. But the next step,\ngathering the data into a time-series database, required more fiddling\nthan I’d expected.</p>\n</section>\n<section id=\"home-assistant-mqtt-prometheus-and-grafana.\"\nclass=\"level2\">\n<h2>Home Assistant, MQTT, Prometheus, and Grafana.</h2>\n<p><img src=\"https://photos.tylercipriani.com/2022-11-30_rtl-433.png\"\nalt=\"rtl_433’s commandline output\" /> <img\nsrc=\"https://photos.tylercipriani.com/2022-11-30_house-temp.png\"\nalt=\"Grafana graph of rooms of my house\" /></p>\n<p>It was a pain to get <code>rtl_433</code> data into Home\nAssistant.</p>\n<p>Maybe I’m missing something. But I ended up with a more complex\nsystem than I wanted:</p>\n<ol type=\"1\">\n<li>a systemd unit running rtl_433 with syslog output over UDP:\n<code>rtl_433 -F syslog:127.0.0.1:1433</code></li>\n<li>a systemd unit relaying and filtering syslog output to MQTT (based\non <a\nhref=\"https://github.com/merbanan/rtl_433/blob/54f0ebe4865327f89452d8e30ecb4c02fde065ae/examples/rtl_433_mqtt_relay.py\">this\nupstream example</a>)</li>\n<li>a systemd timer to restart rtl_433 when it unexpectedly hangs\n(often)</li>\n</ol>\n<p>After endless fiddling, the relay has an uptime measured in\nmonths—it’s stable.</p>\n<p>From there, pushing data to Home Assistant, exposing it via the <a\nhref=\"https://www.home-assistant.io/integrations/prometheus/\">Prometheus</a>\nplugin, and graphing it with Grafana was a breeze.</p>\n<p>Given all this work I’m happy to confirm what I’d long suspected:\n<strong>some rooms in my house are hot while others are\ncold</strong>.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/",

    "title": "Git Notes: git&#x27;s coolest, most&#xA0;unloved&#xAD;&#xA0;feature",
    "url": "https://tylercipriani.com/blog/2022/11/19/git-notes-gits-coolest-most-unloved-feature/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-11-19T22:43:37Z",
    "date_modified": "2022-11-27T20:11:22Z",


    "content_html": "<blockquote>\n<p>the short of it is: they’re cool for appending notes from automated\nsystems (like ticket or build systems) but not really for having\ninteractive conversations with other developers (at least not yet)</p>\n<p>– Scott Chacon, <a\nhref=\"https://github.blog/2010-08-25-git-notes-display/\">GitHub.blog</a>,\nAug. 2010</p>\n</blockquote>\n<p>Git notes are almost a secret.</p>\n<p>They’re buried by their own distressing usability.</p>\n<p>But git notes are continually rediscovered by engineers trying to\nstash metadata inside git.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-10-30_simonw-git-notes.png\"\nalt=\"Sun, 30 Oct 2022 11:05 @simonw\" />\n<figcaption aria-hidden=\"true\">Sun, 30 Oct 2022 11:05 <a\nhref=\"https://twitter.com/simonw/status/1586766260842266625\"><span\nclass=\"citation\" data-cites=\"simonw\">@simonw</span></a></figcaption>\n</figure>\n<p><strong>Git notes are powerful tools.</strong> And they could solve\nso many problems—if only they were better known and easier to use.</p>\n<section id=\"what-are-git-notes\" class=\"level2\">\n<h2><span>🧐</span> What are git notes?</h2>\n<p>A common use of git notes is tacking metadata onto commits.</p>\n<p>Once a commit cements itself in git’s history—that’s it. It’s\nimpossible to amend a commit message buried deep in a repo’s log<a\nhref=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>.</p>\n<p>But git notes enable you to amend new information about old commits\nin a special namespace. And they’re capable of so much more.</p>\n<p><strong>Notes stow metadata about anything tracked by\ngit</strong>—any object: commits, blobs, and trees. All without futzing\nwith the object itself.</p>\n<p>You add notes to the latest commit in a repo like this:</p>\n<pre><code>git notes add -m &#39;Acked-by: &lt;tyler@tylercipriani.com&gt;&#39;</code></pre>\n<p>And then it shows up in <code>git log</code>:</p>\n<pre><code>commit 1ef8b30ab7fc218ccc85c9a6411b1d2dd2925a16\nAuthor: Tyler Cipriani &lt;thcipriani@gmail.com&gt;\nDate:   Thu Nov 17 16:51:43 2022 -0700\n\n    Initial commit\n\n    Notes:\n        Acked-by: &lt;tyler@tylercipriani.com&gt;</code></pre>\n</section>\n<section id=\"git-notes-in-the-wild\" class=\"level2\">\n<h2><span>🥾</span> Git notes in the wild</h2>\n<p>The git project itself offers an example of git notes in the wild.\nThey link each commit to its discussion on their mailing list.</p>\n<p>For example:</p>\n<pre><code>commit 00f09d0e4b1826ee0519ea64e919515032966450\nAuthor: &lt;redacted&gt;\nDate:   Thu Jan 28 02:05:55 2010 +0100\n\n    bash: support &#39;git notes&#39; and its subcommands\n    ...\n\nNotes (amlog):\n    Message-Id: &lt;1264640755-22447-1-git-send-email-szeder@ira.uka.de&gt;</code></pre>\n<p>This commit’s notes point intrepid users to the <a\nhref=\"https://lore.kernel.org/git/1264640755-22447-1-git-send-email-szeder@ira.uka.de/\">thread\nwhere this patch was discussed</a>.</p>\n<p>Other folks are using notes for things like:</p>\n<ul>\n<li>Tracking time spent per commit or branch</li>\n<li>Adding review and testing information to git log</li>\n<li>And even fully distributed code review</li>\n</ul>\n</section>\n<section id=\"storing-code-reviews-and-test-results-in-git-notes\"\nclass=\"level2\">\n<h2><span>📦</span> Storing code reviews and test results in git\nnotes</h2>\n<p>Here is a plea for all forges: make code review metadata available\noffline, inside git.</p>\n<p>The <a\nhref=\"https://gerrit.googlesource.com/plugins/reviewnotes/+/refs/heads/master/src/main/resources/Documentation/refs-notes-review.md\">reviewnotes</a>\nplugin for Gerrit<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a> is an example of how to do this\nwell. It makes it easy to see who reviewed code in git log:</p>\n<pre><code>git fetch origin refs/notes/review:refs/notes/review\ngit log --show-notes=review</code></pre>\n<p>The command above shows me all the standard git log info alongside\ninformation about what tests ran and who reviewed the code. All without\nforcing me into my browser.</p>\n<pre><code>commit d1d17908d2a97f057887a4afbd99f6c40be56849\nAuthor: User &lt;user@example.com&gt;\nDate:   Sun Mar 27 18:10:51 2022 +0200\n\n    Change the thing\n\nNotes (review):\n    Verified+1: SonarQube Bot\n    Verified+2: jenkins-bot\n    Code-Review+2: Reviewer Human &lt;reviewerhuman@wikimedia.org&gt;\n    Submitted-by: jenkins-bot\n    Submitted-at: Tue, 14 Jun 2022 21:59:58 +0000\n    Reviewed-on: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/774005\n    Project: mediawiki/core\n    Branch: refs/heads/master</code></pre>\n</section>\n<section id=\"distributed-code-review-inside-git-notes\" class=\"level2\">\n<h2><span>💠</span> Distributed code review <u>inside</u> git notes</h2>\n<p>Motivated hackers can knead and extend git notes. Using them as\ndistributed storage for any madcap idea.</p>\n<p>Someone at Google cobbled together a full-on code review system\nteetering atop git notes called <a\nhref=\"https://github.com/google/git-appraise\">git-appraise</a>.</p>\n<p>Its authors have declared it a “fully distributed code\nreview”—independent of GitHub, GitLab, or any other code forge.</p>\n<p>This system lets you:</p>\n<ul>\n<li>Request review of a change</li>\n<li>Comment on a change</li>\n<li>Review and merge a change</li>\n</ul>\n<p>And you can do all this from your local computer, even if GitHub is\ndown.</p>\n<p>Plus, it’s equipped with an affectedly unaesthetic web interface, if\nthat’s your thing.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-11-27_git-appraise-web.png\"\nalt=\"The git-appraise web interface, in all its NaN-line-numbering glory.\" />\n<figcaption aria-hidden=\"true\">The git-appraise web interface, in all\nits NaN-line-numbering glory.</figcaption>\n</figure>\n</section>\n<section id=\"no-one-uses-git-notes\" class=\"level2\">\n<h2><span>😭</span> No one uses git notes</h2>\n<p>Git notes are a pain to use.</p>\n<p>And GitHub <a\nhref=\"https://github.blog/2010-08-25-git-notes-display/\">opted to stop\ndisplaying commit notes in 2014</a> without much explanation.</p>\n<p>For commits, you can make viewing and adding notes easier using fancy\noptions in your gitconfig<a href=\"https://tylercipriani.com/blog/#fn3\" class=\"footnote-ref\" id=\"fnref3\"\nrole=\"doc-noteref\"><sup>3</sup></a>. But for storing notes about blobs\nor trees? Forget it. You’d need to be comfortable rooting around in\ngit’s <a\nhref=\"https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain\">plumbing</a>\nfirst.</p>\n<p>So, for now: <strong>git notes are relegated to obscurity</strong>.\nForever hamstrung by an obscure and clunky interface and limited\nadoption—I often forget they’re there.</p>\n</section>\n<section id=\"forge-independence\" class=\"level2\">\n<h2><span>🗽</span> Forge independence</h2>\n<p>Git is a distributed code review system. But much of the value of git\nrepos ends up locked into forges, like GitHub.</p>\n<p>Git notes are a path toward an alternative.</p>\n<p>Git distributes the history of a piece of code. <strong>Git notes\ncould make it possible to distribute the history of an entire\nproject.</strong></p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Without having to endure the <a\nhref=\"https://groups.google.com/g/jenkinsci-dev/c/-myjRIPcVwU/m/mrwn8VkyXagJ\">perils\nof a force push</a>, anyway.<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>The code review system used for <a\nhref=\"https://gerrit.wikimedia.org/r/\">a</a> <a\nhref=\"https://go-review.googlesource.com/\">couple</a> of <a\nhref=\"https://android-review.googlesource.com/\">bigish</a> <a\nhref=\"https://chromium-review.googlesource.com/\">projects</a>.<a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p>Noteably by automagically fetching\nnotes and displaying them in <code>git log</code> via:</p>\n<pre><code>$ git config --add \\\nremote.origin.fetch \\\n&#39;+refs/notes/*:refs/notes/*&#39;\n$ git config \\\nnotes.displayRef \\\n&#39;refs/notes/*&#39;</code></pre>\n<a href=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/10/31/a-tech-lead-guide-to-manager-powers/",

    "title": "A tech lead guide to manager powers &#x1F9D9;",
    "url": "https://tylercipriani.com/blog/2022/10/31/a-tech-lead-guide-to-manager-powers/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "work"

    ],

    "date_published": "2022-10-31T22:20:16Z",
    "date_modified": "2022-11-01T04:14:29Z",


    "content_html": "<blockquote>\n<p>It took me two years as a manager to reach the “leadership is lonely”\nphase.</p>\n<p>– Will Larson, An Elegant Puzzle</p>\n</blockquote>\n<p>When you jump from tech lead to manager: things change.</p>\n<p>Your deep understanding of the system evaporates and becomes shallow.\nYou’ll stop writing all the critical code. Your focus will shift.</p>\n<p>But for me the weirdest change was everyone treating me like a\nmanager all the time.</p>\n<section id=\"managers-are-leaders-with-awkward-power\" class=\"level2\">\n<h2>Managers are leaders with awkward power 😬</h2>\n<p>The transition from tech lead to manager is awkward.</p>\n<p>You know the work of the team as well as anyone.</p>\n<p>But moving to management grants you special powers—all new and\nunfamiliar:</p>\n<ul>\n<li>You’ll set <strong>team goals and vision</strong> for the\nfuture</li>\n<li>You get to make <strong>hiring decisions</strong></li>\n<li>You hold a <strong>budget</strong></li>\n<li>You <strong>organize special events</strong> (and maybe day-to-day\nevents, depending on the support you have)</li>\n<li>You get to talk to the organization’s <strong>leadership</strong>\nmore often than most on your team</li>\n</ul>\n<p>These are superpowers. You should relish these opportunities—you’re\nempowered to contribute to the team like no one else can.</p>\n<p>But your new powers may leave your team uneasy. And if you fail to\nreckon with this new power imbalance, you risk alienating people.</p>\n</section>\n<section id=\"never-make-folks-worry-about-their-livelihood\"\nclass=\"level2\">\n<h2>Never make folks worry about their livelihood 😟</h2>\n<blockquote>\n<p>The second you became their manager you forfeited the right to joke\naround in any capacity about their employment at the company.</p>\n<p>– <a\nhref=\"https://staysaasy.com/engineering/2020/06/09/Don%27t-Joke.html\">Stay\nSaaSy</a></p>\n</blockquote>\n<p>You can hire, and you can fire. This Sword of Damocles now dangles\nover your relationships as a manager.</p>\n<p>“Oh, what’s the worst that can happen? We all get fired?” has ceased\nto be light-hearted banter.</p>\n<p>Folks might laugh, but it leaves lingering doubt. And doubts chip\naway at the trust teams need to do their job.</p>\n</section>\n<section id=\"contentless-pings-from-managers-are-scary\" class=\"level2\">\n<h2>Contentless pings from managers are scary 😱</h2>\n<blockquote>\n<p>It may seem trivial, but asking your question before getting that\ninitial salutatory reply also allows for asynchronous communication.</p>\n<p>– <a href=\"https://nohello.net/\">no hello</a></p>\n</blockquote>\n<p>Now that you’re a manager, your <a\nhref=\"https://github.com/lamby/contentless-ping/blob/master/contentless_ping.pl\">contentless\npings</a> have transformed from annoying to panic-inducing.</p>\n<p>Sure, you should avoid saying nothing but “hi!” to someone in a\ndirect message.</p>\n<p>But you should never, ever say something like, “Do you have a minute\nto jump on a call?” without context.</p>\n<p>“Do you have a minute to talk?” from your boss, out of nowhere,\nimmediately sets people’s minds racing.</p>\n<p>Is this about my project? Something with the budget? A policy change?\nA change to my benefits? Am I being fired?</p>\n<p>Your manager powers will wreak havoc on people who tend to\ncatastrophize.</p>\n</section>\n<section id=\"youre-the-decider\" class=\"level2\">\n<h2>You’re the decider ☑️</h2>\n<p>People expect you to be the decider. Even for small stuff.</p>\n<p>Folks may even be unaware they have this expectation.</p>\n<p>But it applies to everything from team vision to where we’re eating\ndinner at the offsite. You can and should delegate decisions, but you\ncan’t abdicate.</p>\n</section>\n<section id=\"clarity-is-key\" class=\"level2\">\n<h2>Clarity is key 🔑</h2>\n<blockquote>\n<p>Clear is kind. Unclear is unkind.</p>\n<p>– Brené Brown, <a\nhref=\"https://brenebrown.com/articles/2018/10/15/clear-is-kind-unclear-is-unkind/\">Dare\nto Lead</a></p>\n</blockquote>\n<p>When you leap from tech lead to manager, you have to learn about\npeople.</p>\n<p>And what people need most from you is clarity.</p>\n<p>So instead of striving to be liked, or striving to be funny: you\nshould strive to be clear.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/10/17/whole-house-circadian-lighting-with-home-assistant/",

    "title": "f.lux, but for your house",
    "url": "https://tylercipriani.com/blog/2022/10/17/whole-house-circadian-lighting-with-home-assistant/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-10-17T19:10:21Z",
    "date_modified": "2022-10-18T21:35:21Z",


    "content_html": "<blockquote>\n<p>Artificial lighting is omnipresent in contemporary society with\ndisruptive consequences for human sleep</p>\n<p>– Sarah L Chellappa, <a\nhref=\"https://doi.org/10.1093/sleep/zsaa214\">https://doi.org/10.1093/sleep/zsaa214</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/e3/bca0651e47a7d6aed643f9560bdd5c/large.jpg\"\nalt=\"Night &amp; Day – 🌛 left-side is 18:14 MDT (light color @ 2600 K); 🌞 right-side is 15:20 MDT (light color @ 4900 K)\" />\n<figcaption aria-hidden=\"true\">Night &amp; Day – 🌛 left-side is 18:14\nMDT (light color @ 2600 K); 🌞 right-side is 15:20 MDT (light color @\n4900 K)</figcaption>\n</figure>\n<p>Light messes with my sleep, mood, and alertness.</p>\n<p>My house lights should auto-adjust themselves—like <a\nhref=\"https://justgetflux.com/\">f.lux</a> or <a\nhref=\"http://jonls.dk/redshift/\">redshift</a> on my laptop:</p>\n<ul>\n<li>🌞 White/Blue, bright light during the day</li>\n<li>🌛 Red/Yellow, dim light at night</li>\n</ul>\n<p>I was worried that getting this to work for my whole house meant\nendless fiddling with <a\nhref=\"https://twitter.com/internetofshit\">“smart”</a> devices.</p>\n<p>But <a href=\"https://www.home-assistant.io/\">Home Assistant</a>\npapered over the vendor and hardware woes and made setup simple.</p>\n<section id=\"the-goals-of-my-house-lighting\" class=\"level2\">\n<h2>The goals of my house lighting</h2>\n<p>I had the following goals for this project:</p>\n<ul>\n<li><strong>Circadian lighting in all rooms</strong> – Bright,\nblue/white light during the day; dim, red/yellow light after\nsunset.</li>\n<li><strong>Control by switches</strong> – I disdain fiddling with\ntablets/phones to turn lights on and off. I’d also hoped to avoid an\nalways-on speaker listening to me.</li>\n<li><strong>Automatic</strong> – Light should shift temperature and\nbrightness automatically throughout the day.</li>\n<li><strong>Ability to override</strong> – I should be able to override\nthe automatic settings quickly with a switch. Sometimes it’s nice to be\nable to see what you’re doing late at night—circadian rhythm be\ndamned.</li>\n<li><strong>Platform independent</strong> – Because hue bulbs are\nexpensive, I need to be able to add to the system over time. Everything\nfrom DIY light strips to hue bulbs to random smart bulbs from\nAlibaba.com should work together.</li>\n<li><strong>Self-hosted</strong> – All software should live on my home\nnetwork and work with only a local network.</li>\n</ul>\n</section>\n<section id=\"the-results\" class=\"level2\">\n<h2>The Results</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/18/b3386a14e8de005cbb0460f590e51b/large.jpg\"\nalt=\"Red light from my Taloya smart light in the bathroom, so I’m not blinded in the middle of the night\" />\n<figcaption aria-hidden=\"true\">Red light from my Taloya smart light in\nthe bathroom, so I’m not blinded in the middle of the night</figcaption>\n</figure>\n<p>The effects have been subtle but noticeable.</p>\n<p>During the day, I’m sharp, and at night I’m ready to sleep.</p>\n<p>In the evenings, after the sun sets, the lights dim, and it gets\nharder to read and work on projects—<strong>that’s a feature</strong>.\nIt’s a signal that it’s time for bed.</p>\n<p>The most significant benefit I’ve noticed is that <strong>I can get\nback to sleep</strong> after getting up in the middle of the night—now\nthat I’m no longer blinded by harsh overhead light in the bathroom.</p>\n</section>\n<section id=\"home-assistant-setup\" class=\"level2\">\n<h2>Home Assistant setup</h2>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-10-18_HA-kitchen.png\"\nalt=\"Home Assistant Lovelace card to control my Circadian Lighting\" />\n<figcaption aria-hidden=\"true\">Home Assistant Lovelace card to control\nmy Circadian Lighting</figcaption>\n</figure>\n<p>Home Assistant made this possible.</p>\n<p>The <a\nhref=\"https://github.com/claytonjn/hass-circadian_lighting\">Circadian\nlighting component</a> (available via <a href=\"https://hacs.xyz/\">Home\nAssistant Community Store (HACS)</a>) computes solar noon based on my\nlocation and auto-adjusts the brightness of my lights and the color\ntemperature based on the time of day.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-10-17_circadian-lighting-grafana.png\"\nalt=\"Grafana graph of all the lights in my house—brightness % vs. color temperature in Kelvin over a week\" />\n<figcaption aria-hidden=\"true\">Grafana graph of all the lights in my\nhouse—brightness % vs. color temperature in Kelvin over a\nweek</figcaption>\n</figure>\n<p>I use <a href=\"https://www.zigbee2mqtt.io/\">Zigbee2MQTT</a> to\ncapture events from my switches and send them to Home Assistant over <a\nhref=\"https://www.home-assistant.io/integrations/mqtt\">MQTT</a>—I found\nthis easier than adding a Zigbee gateway to Home Assistant directly.</p>\n<p>I have <a\nhref=\"https://www.home-assistant.io/getting-started/automation/\">automation</a>\nthat allows me to override circadian lighting when I need maximum\nbrightness or when I want the nightlight.</p>\n</section>\n<section id=\"the-hardware-setup\" class=\"level2\">\n<h2>The hardware setup</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/b9/9dba616bfc80749e863e52bf110a24/large.jpg\"\nalt=\"Tiny linux box for running Home Assistant VM + Conbee II Zigbee Gateway\" />\n<figcaption aria-hidden=\"true\">Tiny linux box for running Home Assistant\nVM + Conbee II Zigbee Gateway</figcaption>\n</figure>\n<p><strong>Lights</strong>:</p>\n<ul>\n<li>Hue bulbs – I have a lot of hue bulbs.\n<ul>\n<li>Some are <a\nhref=\"https://www.amazon.com/Philips-Hue-Bluetooth-compatible-Assistant/dp/B07QV9XB87/\">full-color\nbulbs</a>, while others do <a\nhref=\"https://www.amazon.com/gp/product/B07QV9XLSD/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">color\ntemperature</a>.</li>\n<li>Three different form factors—A19 bulbs, <a\nhref=\"https://www.amazon.com/gp/product/B07WTJZCZL/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">GU10s</a>\nfor the <a\nhref=\"https://www.ikea.com/us/en/p/tidig-ceiling-light-with-5-spotlights-nickel-plated-00262657/\">Ikea\nTidig</a> in our kitchen, and the <a\nhref=\"https://www.amazon.com/Philips-Hue-Bluetooth-compatible-activated/dp/B07VRF9NWK/\">Edison\nbulb</a> for our fancy dining room light.</li>\n<li>These are good light bulbs.</li>\n</ul></li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B07WY3VM1M/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">Taloya\nsmart ceiling light</a> – this is the bathroom light, integrated with\nHome Assistant via <a\nhref=\"https://github.com/rospogrigio/localtuya\">LocalTuya</a>.</li>\n</ul>\n<p><strong>Buttons</strong>:</p>\n<ul>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B07D19YXND/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">Aqara\nmini switch</a> – one each for me and my partner for controlling the\nbedroom lamps.</li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B099KDS3W9/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;th=1\">MOES\nZigbee 4-gang switch</a> – bathroom lights—one button for on/off, one\nbutton for bright, one for dim, one for the red nightlight.</li>\n</ul>\n<p><strong>Other hardware</strong>:</p>\n<ul>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B07PZ7ZHG5/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1\">Conbee\nII Zigbee Gateway</a> – Handles the incoming Zigbee signals.</li>\n</ul>\n</section>\n<section id=\"todo-finish-lighting\" class=\"level2\">\n<h2>TODO: finish lighting</h2>\n<p>House lighting is never done. I have ideas for my lights that I’m\nstill pondering.</p>\n<ol type=\"1\">\n<li><strong>SAD office light</strong> – I’m lacking an extremely bright\noffice light—this is especially noticeable when winter brings darkness\nat 4:30pm. I’m pondering building something that I can attach to this\nsystem.</li>\n<li><strong>Hyperion media lighting</strong> – Ambiant bias lighting for\nthe TV via <a\nhref=\"https://sequr.be/blog/2021/04/diy-ambilight-for-your-tv-or-computer-using-a-rpi-and-hyperion/\">Hyperion</a>.\nThis is neat, but it’s a low priority since I don’t watch much TV (and\nmy TV is from 2012, anyway. I’m not fancy).</li>\n<li><strong>Moar WLED</strong> – I added <a\nhref=\"https://kno.wled.ge\">WLED</a> strip lighting over the sink (which\nworks perfectly with Home Assistant), but I need more to brighten up the\nwhole space.</li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/09/30/githubs-missing-merge-option/",

    "title": "GitHub&#x27;s missing merge option",
    "url": "https://tylercipriani.com/blog/2022/09/30/githubs-missing-merge-option/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-09-30T20:56:36Z",
    "date_modified": "2022-09-30T23:24:26Z",


    "content_html": "<blockquote>\n<p>github is a perfectly fine hosting site, and it does a number of\nother things well too, but merges is not one of those things.</p>\n<p>– <a\nhref=\"https://lore.kernel.org/lkml/CAHk-=wjbtip559HcMG9VQLGPmkurh5Kc50y5BceL8Q8=aL0H3Q@mail.gmail.com/\">Linus\nTorvalds</a></p>\n</blockquote>\n<p>Git possesses parts of a decent <a\nhref=\"https://en.wikipedia.org/wiki/Forge_(software)\">software\nforge</a>.</p>\n<p>When git was developed by the Linux kernel community, they already\nhad bug tracking, documentation, and a mailing list, so (unlike <a\nhref=\"https://fossil-scm.org/home/doc/trunk/www/fossil-v-git.wiki\">fossil</a>)\ngit has none of those things.</p>\n<p>Enter GitHub. It uses “issues” for bug tracking and discussion, and\nits code browser is unrivaled.</p>\n<p>But for all of its features, GitHub implements only a subset of git.\nFor instance, GitHub lacks the default merge strategy of git—the\nfast-forward merge.</p>\n<p>And after some pondering I realized there’s a good reason for that:\nit’s a cop-out.</p>\n<section id=\"git-log-can-be-clean-or-accurate-not-both\" class=\"level2\">\n<h2><code>git log</code> can be clean or accurate, not both</h2>\n<blockquote>\n<p>I want clean history, but that really means (a) clean and (b)\nhistory.</p>\n<p>– <a\nhref=\"https://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html\">Linus\nTorvalds</a></p>\n</blockquote>\n<p>Git log will always suck for someone.</p>\n<p>An eternal war rages between team “git log should be clean” vs. team\n“git log should have an accurate history.”</p>\n<ul>\n<li>📚 <strong>Team History</strong>\n<ul>\n<li>Method: <code>git merge --no-ff</code></li>\n<li>🟢 Pros: A complete history of how everything was developed</li>\n<li>🔴 Cons: You’ve opened a pandoras box of strange git situations. And\nyour git log looks like this now<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>:</li>\n</ul>\n<pre><code>* (refs/heads/B)\n* * Merge &#39;C&#39; into &#39;B&#39;\n* |\\\n* | | * (refs/heads/C -- git revert B8)\n* | | * Merge &#39;B&#39; into &#39;C&#39;\n* | |/|\n* | |/\n* |/|\n* * | B8\n* | * C3\n* |/\n* * A (refs/heads/A)</code></pre></li>\n</ul>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-09-30_git-merge.png\"\nalt=\"Team history uses git merge --no-ff to ensure a merge commit is always created\" />\n<figcaption aria-hidden=\"true\">Team history uses\n<code>git merge --no-ff</code> to ensure a merge commit is always\ncreated</figcaption>\n</figure>\n<ul>\n<li>✨ <strong>Team Clean</strong>\n<ul>\n<li>Methods: <code>git merge --ff-only</code> or\n<code>git rebase &amp;&amp; git merge</code> (extreme clean freaks add\nthe <code>--squash</code> option)</li>\n<li>🟢 Pros: Linear history, <code>git log</code> is easy to read,\n<code>git revert</code> requires no thought.</li>\n<li>🔴 Cons: You’re erasing history—you can no longer tell if two\ncommits were written together on a single feature branch.</li>\n</ul></li>\n</ul>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-09-30_git-rebase.png\"\nalt=\"Team clean uses git rebase &amp;&amp; git merge --ff-only to make it appear there was never a feature branch at all\" />\n<figcaption aria-hidden=\"true\">Team clean uses <code>git rebase</code>\n&amp;&amp; <code>git merge --ff-only</code> to make it appear there was\nnever a feature branch at all</figcaption>\n</figure>\n</section>\n<section id=\"why-is-git-merge-bad\" class=\"level2\">\n<h2>Why is <code>git merge</code> bad?</h2>\n<p><code>git merge</code> opted out.</p>\n<p>If a branch can be fast-forwarded, <code>git merge</code> sticks the\ncommits on the end of the branch and never tells you there was a\nmerge—team clean.</p>\n<p>But if a branch has conflicts, you’ll need to fix them and create a\nmerge commit to say what you did—team history.</p>\n<p>Sometimes there’s a merge commit; sometimes not: Madness.</p>\n</section>\n<section id=\"what-does-github-do\" class=\"level2\">\n<h2>What does GitHub do?</h2>\n<p>When you mash “merge” in GitHub it never executes plain\n<code>git merge</code>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-09-30_git-merge-button.png\"\nalt=\"The GitHub merge options (the command line instructions are a lie)\" />\n<figcaption aria-hidden=\"true\">The GitHub merge options (the command\nline instructions are a lie)</figcaption>\n</figure>\n<p>And sussing out what git command it will run is kafkaesque. I spent\nsome time mapping all the checkboxes and merge strategies into something\nyou could type into bash.</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>command</th>\n<th>GitHub</th>\n<th>Alignment</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td><code>git merge</code></td>\n<td><strong>not implemented</strong></td>\n<td><code>¯\\_(ツ)_/¯</code></td>\n</tr>\n<tr class=\"even\">\n<td><code>git merge --ff-only</code></td>\n<td><strong>not implemented</strong></td>\n<td>✨ Team Clean</td>\n</tr>\n<tr class=\"odd\">\n<td><code>git rebase &amp;&amp; git merge --ff-only</code></td>\n<td>Rebase and Merge</td>\n<td>✨ Team Clean</td>\n</tr>\n<tr class=\"even\">\n<td><code>git merge --no-ff</code></td>\n<td>Create a merge commit</td>\n<td>📚 Team History</td>\n</tr>\n<tr class=\"odd\">\n<td><code>git merge --squash --ff-only BRANCH</code></td>\n<td>Squash and merge</td>\n<td>✨ Team Clean</td>\n</tr>\n<tr class=\"even\">\n<td><code>git merge --is-ancestor &amp;&amp; git merge --no-ff</code></td>\n<td>Create a merge commit + <a\nhref=\"https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches#require-linear-history\">Require\nlinear history</a></td>\n<td>✨ Team Clean<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a></td>\n</tr>\n</tbody>\n</table>\n<p>There is a distinction between\n<code>git rebase &amp;&amp; git merge --ff-only</code> and\n<code>git merge --ff-only</code>. Rebasing modifies the commit—you end\nup with a different SHA1.</p>\n<p>By not using the “merge if necessary” strategy of\n<code>git merge</code>, GitHub forces you to choose a side in the\neternal war. And that’s a good thing.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>This is a contrived example of a “<a\nhref=\"https://gist.github.com/thcipriani/0749be2a13815f398550a2865197dc49\">criss-cross\nmerge</a>”<a href=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>In GitLab this is “Merge Commit with\nSemi-linear history” which seems like a nicer UI vs the buried option to\n“Require linear history”. This option mitigates some of the pain of an\nugly git log.<a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/09/15/staging-is-a-trap/",

    "title": "Staging is a trap",
    "url": "https://tylercipriani.com/blog/2022/09/15/staging-is-a-trap/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-09-15T21:41:02Z",
    "date_modified": "2022-09-16T17:38:11Z",


    "content_html": "<figure>\n<img src=\"https://photos.tylercipriani.com/2022-09-15_staging-tweet.png\"\nalt=\"@mipsytipsy\" />\n<figcaption\naria-hidden=\"true\"><a href=\"https://twitter.com/mipsytipsy\"><span\nclass=\"citation\"\ndata-cites=\"mipsytipsy\">@mipsytipsy</span></a></figcaption>\n</figure>\n<p>Software staging clusters only grow.</p>\n<p>As production accrues more services, staging’s costs ramp up.</p>\n<p>And maintaining a single, massive, production-like staging may no\nlonger be the right answer.</p>\n<p>But several, small staging clusters—each fit for their purpose—offers\na more maintainable, cheaper alternative.</p>\n<section\nid=\"there-is-no-perfect-staging-there-are-only-perfect-stagings\"\nclass=\"level2\">\n<h2>🍝 There is no perfect staging; there are only perfect stagings</h2>\n<p>Each reason for having a staging cluster requires a different level\nof “production-likeness” to fit its use.</p>\n<p>You could put Apache and PHP on raspberry pi and call it Wikipedia’s\n“staging.”</p>\n<p>And that’d be a fine place to demo a MediaWiki patch. But to be\nconfident deploying that patch into Wikipedia’s production: (to\nparaphrase “Jaws” 🦈): you’re gonna need a bigger staging .</p>\n<p>In the 1970s, the pasta sauce brand Ragu tasked the psychophysicist\nHoward Moskowitz with finding the perfect pasta sauce.<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a></p>\n<p>Moskowitz concluded the perfect pasta sauce doesn’t exist—it depends\non each individual’s wants and needs. <strong>There is no perfect pasta\nsauce; there are only perfect pasta sauces.</strong></p>\n<p>Howard’s work is why you’ll find <a\nhref=\"https://www.ragu.com/our-sauces/old-world-style-sauces/old-world-style-marinara-sauce/\">Ragu\nOld World Style®</a> next to <a\nhref=\"https://www.ragu.com/our-sauces/ragu-simply/chunky-garden-vegetable\">Ragu\nChunky Garden Vegetable</a> next to 10s of other Ragus.</p>\n<p>And much like pasta sauce<a href=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\"\nid=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a>: <strong>there can be no\nperfect staging; only perfect stagings</strong>.</p>\n</section>\n<section id=\"staging-trades-cost-vs.-production-likeness\"\nclass=\"level2\">\n<h2>💱 Staging trades cost vs. production-likeness</h2>\n<p>The requirements for a staging cluster depend on its use.</p>\n<ul>\n<li><strong>Demos</strong> – Demoing new code requires the same\nsoftware, maybe a few microservices, and (possibly) a subset of\nproduction data.\n<ul>\n<li>🟢 Low cost</li>\n<li>🟢 Low production-likeness</li>\n</ul></li>\n<li><strong>Exploratory testing</strong> – QA requires the same\nsoftware, services, and a subset of production data. It’d be nice to run\nit on the same type of infrastructure, too.\n<ul>\n<li>🟡 Medium cost</li>\n<li>🟡 Medium production-likeness</li>\n</ul></li>\n<li><strong>Deployment confidence</strong> – 100% confidence requires a\nparallel universe you destroy whenever a deployment goes wrong.\n<ul>\n<li>🔴 High cost</li>\n<li>🔴 High production-likeness</li>\n</ul></li>\n</ul>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-09-15_staging.png\"\nalt=\"Staging trades costs for nearness to production\" />\n<figcaption aria-hidden=\"true\">Staging trades costs for nearness to\nproduction</figcaption>\n</figure>\n<p>Staging is a trade-off: resources (money, people, time) against\nasymptotically approaching <strong>actual</strong> production.</p>\n<p>The closer you get to production, the higher the costs and\ncomplexity.</p>\n</section>\n<section id=\"production-should-be-reproducable\" class=\"level2\">\n<h2>🔁 Production should be reproducable</h2>\n<blockquote>\n<p><strong>Setting up a staging server should be easy.</strong> If it is\nnot easy, you already have a problem in your infrastructure, you just\ndon’t know it yet</p>\n<p>– Patrick McKenzie 🐉, <a\nhref=\"https://www.kalzumeus.com/2010/12/12/staging-servers-source-control-deploy-workflows-and-other-stuff-nobody-teaches-you/\">Staging\nServers, Source Control &amp; Deploy Workflows, And Other Stuff Nobody\nTeaches You</a></p>\n</blockquote>\n<p>Configuration management should make it easy to rebuild production\nfrom scratch. Otherwise, you’ve got a disaster in the offing.</p>\n<p>This creates an environment suitable for demos and end-to-end test\nautomation.</p>\n<p>But organizations are evolving away from using pre-production staging\nto build deployment confidence.</p>\n<p>They’ve replaced their high-cost staging with a mix of <a\nhref=\"https://martinfowler.com/bliki/CanaryRelease.html\">canary\ndeployments</a> and advanced <a\nhref=\"https://martinfowler.com/bliki/FeatureToggle.html\">feature\nflagging</a>.</p>\n<p>Small environments with narrow scope—like testing or demoing—seem\nlike a reasonable trade-off of cost vs. benefit.</p>\n<p>But using pre-production staging as insurance for your\ndeployments—requiring snapshots of production data and maybe even\nreplayed traffic—seems too. darn. expensive.</p>\n</section>\n<section id=\"further-reading\" class=\"level2\">\n<h2>📚 Further reading</h2>\n<ul>\n<li><a\nhref=\"https://squeaky.ai/blog/development/why-we-dont-use-a-staging-environment\">Why\nwe don’t use a staging environment</a></li>\n<li><a href=\"https://devops.com/dear-staging-were-done/\">Dear staging,\nwe’re done</a></li>\n<li><a\nhref=\"https://flagsmith.com/blog/delete-your-staging-environment/\">Delete\nyour staging environment</a></li>\n</ul>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>This is an anecdote related by\nMalcolm Gladwell in a 2007 Ted Talk, “<a\nhref=\"https://www.ted.com/talks/malcolm_gladwell_choice_happiness_and_spaghetti_sauce\">Choice,\nHappiness, and Spaghetti Sauce</a><a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>There’s a joke here about “spaghetti\ncode” that I’m too lazy to find.<a href=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\"\nrole=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/08/31/the-purpose-of-saas-is-selling-out/",

    "title": "The purpose of SaaS is selling&#xA0;out",
    "url": "https://tylercipriani.com/blog/2022/08/31/the-purpose-of-saas-is-selling-out/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-08-31T18:02:37Z",
    "date_modified": "2022-08-31T20:46:41Z",


    "content_html": "<blockquote>\n<p>The purpose of a system is what it does.</p>\n<p>–Stafford Beer, <a\nhref=\"https://doi.org/10.1108/03684920210417283\">What is\nCybernetics</a></p>\n</blockquote>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-08-31_myfitnesspal.png\"\nalt=\"MyFitnessPal’s announcement to the “community”\" />\n<figcaption aria-hidden=\"true\">MyFitnessPal’s announcement to the\n“community”</figcaption>\n</figure>\n<p>Yet another Software as a Service (SaaS) is hawking my own data back\nto me.</p>\n<p>The nutrition tracker MyFitnessPal announced it’ll now cost $80/yr to\nscan barcodes—a service powered by a database crowdsourced from its dumb\nusers (like me!).</p>\n<p>But it’s ok—this is yet another software as a service (SaaS) company\nfulfilling its ultimate purpose: selling out its users.</p>\n<section id=\"the-purpose-of-a-system-is-what-it-does\" class=\"level2\">\n<h2>The purpose of a system is what it does</h2>\n<p>So what does a SaaS company do? The typical lifecycle seems to\nbe:</p>\n<ul>\n<li>Build a software product</li>\n<li>Attract new users and collect their data</li>\n<li>Sell the software to BigCompany™</li>\n<li>Destroy the product</li>\n<li>Sellout users</li>\n<li>Repeat.</li>\n</ul>\n<p>Management cyberneticist and author Stafford Beer coined the phrase,\n“The purpose of a system is what it does” (<a\nhref=\"https://en.wikipedia.org/wiki/The_purpose_of_a_system_is_what_it_does\">POSIWID</a>)\nto describe a system that may be at odds with its stated purpose.</p>\n<p>A SaaS company is <strong>a system built to extract and sell user\ndata</strong>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/af/f7a6f3486683bc2be7db3949fcf63c/large.jpg\"\nalt=\"The lifecycle of SaaS\" />\n<figcaption aria-hidden=\"true\">The lifecycle of SaaS</figcaption>\n</figure>\n<p>This is as natural as a lion taking down an antelope: no malice, just\nthe way things are. And there is a lot of value created along the\nway:</p>\n<ul>\n<li>Users get to use a product while it exists</li>\n<li>Employees of the SaaS get paid and gain experience</li>\n</ul>\n<p>But that’s the deal: the only things that outlive the SaaS are the\nwealth created from the sale of user data and the user data itself.</p>\n</section>\n<section id=\"community-is-how-they-get-you\" class=\"level2\">\n<h2>Community is how they get you</h2>\n<blockquote>\n<p>It is beyond the scope of anyone’s imagination to create a\ncommunity.</p>\n<p>– Jane Jacobs, <a\nhref=\"https://openlibrary.org/books/OL1742994M/The_death_and_life_of_great_American_cities\">The\nDeath and Life of Great America Cities</a></p>\n</blockquote>\n<p>For a SaaS to harvest my data, it has to convince me I’m part of a\ncommunity.</p>\n<p>Weather Underground did this well.</p>\n<p>The <a\nhref=\"https://web.archive.org/web/20070308143754/https://www.wunderground.com/about/background.asp\">Weather\nUnderground</a> attracted a devoted group of nerds (like me!) to its\n“Personal Weather Station” (PWS) network.</p>\n<p>We bought our own weather stations and supplied the Weather\nUnderground with data for free.</p>\n<p>And later, the SaaS model did what it always does. Weather\nUnderground <a\nhref=\"https://www.nytimes.com/2012/07/04/us/as-weather-channel-buys-weather-underground-fans-fear-change.html?smid=pl-share\">sold\nto IBM</a> and <a\nhref=\"https://web.archive.org/web/20180530133216/https://apicommunity.wunderground.com/weatherapi/topics/weather-underground-api-changes\">announced</a>\nthat to “enhance the relationship” with its users: <strong>you had to\nbuy your own data back from them</strong>.</p>\n<p>Now I am among the ham nerds sending data to the Citizen Weather\nObserver Program (<a href=\"http://www.wxqa.com/\">CWOP</a>)\n<code>¯\\_(ツ)_/¯</code>.</p>\n</section>\n<section id=\"software-as-a-service-as-a-lifestyle-business\"\nclass=\"level2\">\n<h2>Software as a Service as a lifestyle business</h2>\n<blockquote>\n<p>Instead of being widely shared, the pattern languages which determine\nhow a town gets made become specialized and private.</p>\n<p>– Christopher Alexander, <a\nhref=\"https://openlibrary.org/works/OL17431345W/The_Timeless_Way_of_Building\">The\nTimeless Way of Building</a></p>\n</blockquote>\n<p>Maybe I’m näivé, but I believe many SaaS founders and employees enjoy\nsolving problems for their users. And maybe they believe scaling up (by\nselling out) will ultimately help users.</p>\n<p><strong>But we could change this</strong>.</p>\n<p>Instead of selling out their users, SaaS companies could opt to\nbecome lifestyle businesses.</p>\n<p>We could celebrate companies who avoid endless scaling and instead\nfocus on keeping their products working and their users happy.</p>\n<p>Examples I can think of SaaS companies who care about their\nusers:</p>\n<ol type=\"1\">\n<li><a href=\"https://pinboard.in\">Pinboard</a></li>\n<li><a href=\"https://newsblur.com/\">NewsBlur</a></li>\n<li><a href=\"https://tarsnap.com\">Tarsnap</a></li>\n<li><a href=\"https://mullvad.net/en/\">Mullvad</a></li>\n</ol>\n<p>Plenty of folk dream of opening a little bookstore or a quaint coffee\nshop—the kind with a lazy cat. Why not a cozy website? Seems viable. It\ncould even have a lazy cat.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/08/16/engineering-managers-guide-to-debugging-delivery/",

    "title": "Fixing delivery: a guide for engineering managers",
    "url": "https://tylercipriani.com/blog/2022/08/16/engineering-managers-guide-to-debugging-delivery/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-08-16T00:26:26Z",
    "date_modified": "2022-08-19T18:46:39Z",


    "content_html": "<blockquote>\n<p>Humans, by and large, feel good when they set small goals and meet\nthem regularly.</p>\n<p>– Camille Fournier, The Manager’s Path</p>\n</blockquote>\n<p>Shipping motivates software teams.</p>\n<p>So it’s understandable for a team’s morale to suffer when delivery\ndrags.</p>\n<p>Getting the team pushing software they’re proud of is the only cure.\nIt might be a slog to get there, but it’s possible if the team works\ntogether and the manager recognizes the unique role they play.</p>\n<section id=\"managers-get-to-make-system-fixes\" class=\"level2\">\n<h2>🛠️ Managers get to make system fixes</h2>\n<blockquote>\n<p>As a manager, your obligation is to identify the correct system\nsolution</p>\n<p>– Will Larson, An Elegant Puzzle</p>\n</blockquote>\n<p>In his book <a href=\"https://press.stripe.com/an-elegant-puzzle\">An\nElegant Puzzle: Systems of Engineering Management</a>, Will Larson\ndistinguishes between <strong>system fixes vs. tactical support</strong>\nfor engineering teams.</p>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/51aTO3pGp9L.jpg\"\nalt=\"An Elegant Puzzle by Will Larson\" />\n<figcaption aria-hidden=\"true\">An Elegant Puzzle by Will\nLarson</figcaption>\n</figure>\n<p>System fixes are large-scale interventions: hiring, changing the\nteam’s goals, and changing deadlines.</p>\n<p>And, typically, <strong>engineering managers are the only people\nempowered to employ system fixes</strong>.</p>\n<p>In contrast, tactical support is a smaller-scale intervention like\nchanging code review guidelines.</p>\n<p>The real job of an engineering manager is to <strong>identify the\ncorrect system fix and keep the faith of the team</strong>.</p>\n</section>\n<section id=\"limit-work-in-progress\" class=\"level2\">\n<h2>⛔ Limit work in progress</h2>\n<p>The system fix for a code delivery problem is simple (but not easy):\n<strong>do fewer projects</strong>.</p>\n<p>If you’re unable to drop your existing projects, you artificially do\nfewer projects—you <strong>limit your work in progress</strong>.</p>\n<p>The menu of system fixes Larson offers are:</p>\n<ul>\n<li>Add people</li>\n<li>Limit work in progress</li>\n<li>Add time</li>\n<li>Make sure there’s slack in the schedule</li>\n</ul>\n<p>Limiting parallel work gets people working together on what’s\nessential.</p>\n</section>\n<section id=\"dont-mistake-people-for-resources\" class=\"level2\">\n<h2>🤦 Don’t mistake people for “resources”</h2>\n<blockquote>\n<p>Oversimplifying outrageously, we state Brooks’s Law: Adding manpower\nto a late software project makes it later.</p>\n<p>– Fred Brooks, The Mythical Man-Month</p>\n</blockquote>\n<p>The primary objection to limiting work in progress is Brooks’s\nLaw—<strong>adding people slows down projects</strong>.</p>\n<p>And although managers may odiously refer to people as “resources,”\n<strong>people are not interchangeable</strong>. It takes time for a new\nperson to become productive on a new project.</p>\n<figure>\n<img\nsrc=\"https://images-na.ssl-images-amazon.com/images/I/51WIpM70FEL.jpg\"\nalt=\"The Mythical Man Month by Fred P. Brooks, Jr.\" />\n<figcaption aria-hidden=\"true\">The Mythical Man Month by Fred P. Brooks,\nJr.</figcaption>\n</figure>\n<p>But system fixes are long-term.</p>\n<p>This isn’t the way to quickly deliver on a late project or instantly\ngel your team and boost morale. Most of these interventions will be\ndisruptive and painful in the short term.</p>\n<p>And <strong>your team needs to have trust</strong> to implement\nthem.</p>\n<p>That’s why it’s so essential, tactically, to keep the faith of your\nteam. As a manager, you must collaborate with your team to identify\ncrucial work.</p>\n<p>You should provide tactical support for your team’s ideas while you\n<strong>let the system fix work its magic</strong>.</p>\n<hr />\n<p><small>Thanks to <a href=\"https://p1k3.com/\">Brennen Bearnes</a> for\nreading an early draft of this post and making it marginally less\nawful.</small></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/07/31/meshtastic-a-review/",

    "title": "Meshtastic: A Review",
    "url": "https://tylercipriani.com/blog/2022/07/31/meshtastic-a-review/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-07-31T22:15:47Z",
    "date_modified": "2022-08-01T01:55:54Z",


    "content_html": "<p>The Meshtastic is my solarpunk dream—a cheap, encrypted, offgrid\ncommunicator. But the project is still in the alpha stages (and it\nshows).</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/f3/350cee528c8c41071befaffc524dc1/large.jpg\"\nalt=\"LILYGO® TTGO Meshtastic T-Beam V1.1 ESP32 LoRa\" />\n<figcaption aria-hidden=\"true\">LILYGO® TTGO Meshtastic T-Beam V1.1 ESP32\nLoRa</figcaption>\n</figure>\n<p><a href=\"https://meshtastic.org/\">Meshtastic</a> is a communication\nsystem. Its firmware runs on bare-bones “T-Beam” devices. T-Beams are\navailable fully-assembled and pre-flashed <a\nhref=\"https://www.aliexpress.com/item/2255800992363816.html\">for about\n$35</a>.</p>\n<p>The devices enable encrypted, text-message-style communication via an\napp on your smartphone. No cell service required.</p>\n<p>I bought two Meshtastic T-Beams for a recent trip to <a\nhref=\"https://www.nps.gov/yell/index.htm\">Yellowstone National Park</a>.\nThe devices worked as advertised—we could share texts and locations\nbetween our Android phones even though we had no service.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/90/377211ff8add4dc1e3950dc71c8ae9/medium.jpg\"\nalt=\"Meshtastic in Yellowstone National Park\" />\n<figcaption aria-hidden=\"true\">Meshtastic in Yellowstone National\nPark</figcaption>\n</figure>\n<section id=\"problems-meshtastic-solves\" class=\"level1\">\n<h1>Problems Meshtastic solves</h1>\n<p><strong>Communication infrastructure fails</strong>. Whether an <a\nhref=\"https://www.arrl.org/news/american-red-cross-asks-arrl-s-assistance-with-puerto-rico-relief-effort\">earthquake\nin Puerto Rico</a> or a trip to a national park—it’s easy to imagine a\nsituation where your smartphone is useless.</p>\n<p>And <strong>it’s trivial to surveil your\ncommunications</strong>—AT&amp;T established room <a\nhref=\"https://en.wikipedia.org/wiki/Room_641A\">641A</a> to funnel\ncommunication to the NSA. And there are reports of “<a\nhref=\"https://theintercept.com/2020/07/31/protests-surveillance-stingrays-dirtboxes-phone-tracking/\">stingrays</a>”—devices\nthat masquerade as cell towers—intercepting the text messages of\nprotestors.</p>\n<p>Meshtastic attempts to solve these problems using cheap, readily\navailable parts and open-source software.</p>\n<p>Shut up and take my money.</p>\n<section id=\"what-i-dislike\" class=\"level2\">\n<h2>What I dislike</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/13/b962ea3b15638114a64e5750f7d0c6/large.jpg\"\nalt=\"Opus BT-C3100 battery charger\" />\n<figcaption aria-hidden=\"true\">Opus BT-C3100 battery\ncharger</figcaption>\n</figure>\n<p>There’s no way around it: this is an alpha quality project. Right\nnow, it’s only usable by nerds (like me 🌠). You’ll probably have a bad\ntime if you’re not a tinkerer or a hobbyist.</p>\n<ul>\n<li><strong>Alpha quality</strong> – The project is hard to use, even\nfor the basics. During our trip to Yellowstone, we repeatedly lost our\nbluetooth connection to the devices—they kept going to sleep. And the\ninterface is sometimes unclear—I ended up holding down buttons, waiting\nfor something (anything) to happen.</li>\n<li><strong>iOS requires Testflight</strong> – The Android mobile app\nworked well, but the iOS app requires Testflight to install—which seems\nlike a pain.</li>\n<li><strong>Batteries</strong>/<a href=\"https://xkcd.com/651/\">small\nbombs</a> – The T-Beams run off big honkin’ 18650 batteries—the same\nlithium-ion cells used in Tesla battery packs. While the batteries last\nall day, I had to make extra purchases. Later I realized they run fine\noff of USB battery packs, but I was uncertain about that when I bought\nit. These things added to my costs:\n<ul>\n<li><a\nhref=\"https://www.18650batterystore.com/products/opus-btc3100-v2-2\">Opus\nBT-C3100 battery charger</a></li>\n<li><a\nhref=\"https://www.18650batterystore.com/products/sanyo-ncr18650ga\">Sanyo\nNCR18650GA 3500mAh 10A Battery</a></li>\n</ul></li>\n<li><strong>PCBs are intimidating</strong> – Holding a PCB (printed\ncircuit board) intimidates electronics neophytes. There are stickers\navailable on the discourse that read: “<a\nhref=\"https://meshtastic.discourse.group/t/limited-run-meshtastic-stickers/6092\">Meshtastic:\nthis is not a bomb</a>” (for <a\nhref=\"https://uniteng.com/wiki/doku.php?id=meshtastic:station\">base\nstations</a> in the field).</li>\n<li><strong>“Meshtastic”</strong> – My brain refuses to type\n“meshtastic” on the first try; this may be a personal problem.</li>\n</ul>\n</section>\n<section id=\"what-i-love\" class=\"level2\">\n<h2>What I love</h2>\n<p>There is a lot to love about this project.</p>\n<ul>\n<li><strong>FOSS</strong> – Meshtastic is free software—the firmware is\nGPL-3.0 licensed—the <a\nhref=\"https://www.gnu.org/philosophy/free-sw.html\">four software\nfreedoms</a> are essential for users to trust this device.</li>\n<li><strong>Encryption</strong> – Data moving between T-Beam devices is\nencrypted via AES256—an as-yet <a\nhref=\"https://www.youtube.com/watch?v=O4xNJsjtN6E\">unbroken\nstandard</a>. Although, the documentation on this worries me a little:\n“It is pretty likely that the AES256 security is implemented ‘correctly’\nand an observer will not be able to decode your messages.”<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>\n😅</li>\n<li><strong>LoRa</strong> – The Meshtastic devices work via LoRa\n(<b>Lo</b>ng <b>Ra</b>nge) radio. In the US, LoRa uses the ISM band (on\n915mHz). The ISM band has no license requirement—which means it’s legal\nto encrypt traffic, unlike ham radio. In testing, LoRa works up to a few\nmiles away with a good line of sight.</li>\n<li><strong>Community</strong> – There’s a vibrant community on <a\nhref=\"https://github.com/meshtastic\">GitHub</a>, <a\nhref=\"https://www.thingiverse.com/thing:4753247\">Thingiverse</a>, <a\nhref=\"https://meshtastic.discourse.group/\">Discourse</a>, and <a\nhref=\"https://meshtastic.discourse.group/\">Discord</a>. There’s\nexcellent <a href=\"https://meshtastic.org/docs/about\">Documentation</a>\nand folks <a\nhref=\"https://hackaday.com/2020/02/26/lora-mesh-network-with-off-the-shelf-hardware/\">blogging</a>\n(and <a\nhref=\"https://www.youtube.com/watch?v=TY6m6fS8bxU\">vlogging</a>).</li>\n</ul>\n</section>\n<section id=\"the-verdict\" class=\"level2\">\n<h2>The verdict</h2>\n<p>I’m thrilled with this project. The talented people bolstering this\ncommunity experiment with setting up <a\nhref=\"https://meshtastic.discourse.group/t/do-you-plan-on-going-to-burning-man-2022/4170\">base\nstations at Burning Man</a> and running <a\nhref=\"https://meshtastic.discourse.group/t/guide-ssh-over-meshtastic/2579\">ssh\ntunnels via LoRa</a>—they’re doing awesome things.</p>\n<p>I’ve not yet begun to nerd out on this.</p>\n</section>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p><a\nhref=\"https://meshtastic.org/docs/developers/Firmware/encryption\"\nclass=\"uri\">https://meshtastic.org/docs/developers/Firmware/encryption</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/07/13/hacking-a-half-marathon/",

    "title": "How I built a running habit",
    "url": "https://tylercipriani.com/blog/2022/07/13/hacking-a-half-marathon/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-07-13T19:04:21Z",
    "date_modified": "2022-07-15T15:39:26Z",


    "content_html": "<p style=\"max-width: 28em;\">\nI dashed through a half-marathon on the Fourth of July 2022—but in 2021, I\ndidn\'t run at all😐.\n</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/2d/c5d1fb2cdf8fa4eb2382aab07ca41e/medium.jpg\"\nalt=\"Independence day half-marathon👟🎆\" />\n<figcaption aria-hidden=\"true\">Independence day\nhalf-marathon👟🎆</figcaption>\n</figure>\n<p>It’s gratifying to now think of myself as a runner—I never did\nbefore.</p>\n<p>I used these tactics and gear to hack my life, build a running habit,\nand (incredibly, to me) push through a half-marathon.</p>\n<section id=\"tactics-for-weight-loss\" class=\"level2\">\n<h2>Tactics for weight loss</h2>\n<p>In 2020, I was like <a\nhref=\"https://academic.oup.com/epirev/article/29/1/6/440773\">most\nAmericans</a>—overweight. I had to shed some fat before I could start\nrunning.</p>\n<p>Weight loss is simple: <strong>eat fewer calories than you\nuse</strong>.</p>\n<figure>\n<img\nsrc=\"https://images-na.ssl-images-amazon.com/images/I/51lkEwss5dL.jpg\"\nalt=\"Fat Loss Forever by Peter Baker and Layne Norton, PH.D\" />\n<figcaption aria-hidden=\"true\">Fat Loss Forever by Peter Baker and Layne\nNorton, PH.D</figcaption>\n</figure>\n<p>I recommend reading <a\nhref=\"https://biolayne.com/fat-loss-forever/\">Fat Loss Forever</a> by\nPeter Baker and Layne Norton, PH.D.</p>\n<p>The book asserts <strong>all diets work</strong>—you can lose weight\nby eating <a href=\"https://www.reddit.com/r/snakediet/\">one hour each\nday</a> or eating <a href=\"https://dynomight.net/potato-diet/\">nothing\nbut potatoes</a>.</p>\n<p><strong>But you need a diet that can work\n<u>forever</u></strong>—otherwise, the outcome is grim.</p>\n<p>According to the book, of people who lose 10% of their body\nweight:</p>\n<ul>\n<li>50–70% of people gain it back in a year</li>\n<li>85% gain it back within two years</li>\n<li>95% gain it back within three years</li>\n</ul>\n<p>Since all I care about is calories, I’ve opted to track my weight,\ncalories, and exercise in <a\nhref=\"https://www.myfitnesspal.com/\">myfitnesspal</a> (free for the\nbasics).</p>\n<p>Using this strategy, I lost 70lbs(!) and have kept it off for a year\nnow.</p>\n</section>\n<section id=\"developing-a-running-habit-by-walking\" class=\"level2\">\n<h2>Developing a running habit by walking</h2>\n<p>My walking habit granted me time for running later.</p>\n<p><strong>Even if you never plan on running—walking is an excellent\nhabit.</strong></p>\n<p>Walking is proven to:</p>\n<ul>\n<li>Improve your sleep</li>\n<li>Reduce anxiety and depression</li>\n<li>Improve your cognitive functioning</li>\n<li>Reduce your all-cause and disease-specific mortality</li>\n</ul>\n<p>Inspired by the likes of <a\nhref=\"https://www.themarginalian.org/2021/12/12/nietzsche-walking/\">Nietzsche</a>\nand <a\nhref=\"https://www.gutenberg.org/files/1022/1022-h/1022-h.htm\">Thoreau</a>,\nI started walking 30 minutes daily at a “<a\nhref=\"https://www.heart.org/en/healthy-living/fitness/fitness-basics/aha-recs-for-physical-activity-in-adults#:~:text=Examples%20of\">brisk\npace</a>” (2.5mph/4kph).</p>\n<p>Walking was my gateway drug.</p>\n</section>\n<section id=\"sign-up-for-a-race\" class=\"level2\">\n<h2>Sign up for a race</h2>\n<p>If you want to be a runner: <strong>sign up for a race and follow a\nplan</strong>.</p>\n<p>Back in February, a friend and I dared each other to sign up for a 5K\nrace.</p>\n<p>Our commitment required training, and our <strong>improvement sparked\nmotivation</strong>. When we saw ourselves run faster, it motivated us\nto work harder.</p>\n<p>Later, while training for the half-marathon, I needed a better\nplan.</p>\n<p>Plans for every distance are available for free online:</p>\n<ul>\n<li><a href=\"https://www.runnersworld.com/uk/training-plans/\">Runner’s\nWorld</a></li>\n<li><a href=\"https://www.halhigdon.com/training/\">Hal Higdon</a></li>\n</ul>\n<figure>\n<img src=\"https://m.media-amazon.com/images/I/51hABd0hdAL.jpg\"\nalt=\"Run Like a Pro (Even if You’re Slow) by Matt Fitzgerald and Ben Rosario\" />\n<figcaption aria-hidden=\"true\">Run Like a Pro (Even if You’re Slow) by\nMatt Fitzgerald and Ben Rosario</figcaption>\n</figure>\n<p>I studied the book <a\nhref=\"https://www.amazon.com/Run-Like-Even-Youre-Slow-ebook/dp/B096DH95W8/\">Run\nLike a Pro (Even if You’re Slow)</a> by Matt Fitzgerald and Ben Rosario\nand found my training plan in the back.</p>\n<p><a\nhref=\"https://critter.blog/2020/09/09/running-advice-i-wish-id-gotten/\">Mike\nCrittenden’s blog</a> has more tips on how to build your running\nhabit.</p>\n</section>\n<section id=\"most-runs-are-slow-runs\" class=\"level2\">\n<h2>Most runs are slow runs</h2>\n<p>Since you must run often, <strong><a\nhref=\"https://www.reddit.com/r/running/comments/q15p3/you_shouldnt_be_winded/\">slow\nruns</a> should form the foundation of your training.</strong></p>\n<p>For training, you can pick any two of the following:</p>\n<ul>\n<li>🔒Frequent runs (a must)</li>\n<li>Long runs</li>\n<li>Fast runs</li>\n</ul>\n<p>Otherwise, you risk either your training schedule or your recovery.\n<strong>The only time to run fast AND far is race day.</strong></p>\n<p>I run six days a week; each day is either:</p>\n<ul>\n<li>short, fast runs where I work on speed (e.g., <a\nhref=\"https://en.wikipedia.org/wiki/Fartlek\">fartleks</a>) vs.</li>\n<li>long, slow runs where I work on stamina</li>\n</ul>\n</section>\n<section id=\"pace-yourself\" class=\"level2\">\n<h2>Pace yourself</h2>\n<p>How slow is a slow run?</p>\n<p><a href=\"https://www.mcmillanrunning.com/\">McMillan running’s pace\ncalculator</a> computes your ideal pace for you (in exchange for an\nemail). For my slow runs, I target 10.5 minutes per mile (6.5 minutes\nper kilometer).</p>\n<figure>\n<img\nsrc=\"https://m.media-amazon.com/images/I/71U60K-9oVS._AC_UY541_.jpg\"\nalt=\"my old Casio AE-1300WH-8AVCF\" />\n<figcaption aria-hidden=\"true\">my old <a\nhref=\"https://www.amazon.com/gp/product/B00IYUYAFY\">Casio\nAE-1300WH-8AVCF</a></figcaption>\n</figure>\n<p>I bought a running watch to pace myself. My criteria for a running\nwatch were:</p>\n<ul>\n<li>Shows me:\n<ul>\n<li>Current pace</li>\n<li>Current heart rate</li>\n<li>Total distance run</li>\n<li>Total running time</li>\n</ul></li>\n<li>Has buttons (instead of a touchscreen)</li>\n<li>I can program it to alert me at intervals</li>\n<li>The screen is always on</li>\n<li>Beeps</li>\n</ul>\n<p>I spent $230 for a watch that checks all the boxes—the <a\nhref=\"https://www.amazon.com/Garmin-Forerunner-Smartwatch-Advanced-Dynamics/dp/B07QLVHBLF/ref=sr_1_3?\">Garmin\n245 music</a>.</p>\n<p>I’m happy with my Garmin, but my old <a\nhref=\"https://www.amazon.com/gp/product/B00IYUYAFY\">Casio\nAE-1300WH-8AVCF</a> beeped and did intervals for $20—it was enough to\nget me through my 5K.</p>\n<p>My ideal watch would be my Casio with all the functions of my\nGarmin, but it would output a <a\nhref=\"https://en.wikipedia.org/wiki/GPS_Exchange_Format\">GPX file</a>\nrather than force me to use an app.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/44/4dec350665b01fc68586916396647b/large.jpg\"\nalt=\"For now, the G-SHOCK watch face for my Garmin is as close as I can get to my ✨dream✨ watch⌚\" />\n<figcaption aria-hidden=\"true\">For now, the G-SHOCK watch face for my\nGarmin is as close as I can get to my ✨dream✨ watch⌚</figcaption>\n</figure>\n</section>\n<section id=\"running-shoes\" class=\"level2\">\n<h2>Running shoes</h2>\n<p>When I went to the local running store, they 3D-scanned my feet.</p>\n<p>The scan convinced me my current shoes were too big—my toes were\nsliding around—causing blisters.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/56/f04921cedd35c23131e21992a0a41c/large.jpg\"\nalt=\"The actual 3d scan of my feet\" />\n<figcaption aria-hidden=\"true\">The actual 3d scan of my\nfeet</figcaption>\n</figure>\n<p>I’ve since put 350 miles on my new shoes—blister-free.</p>\n<p>The moral? <strong>Go to the local running store and buy\nshoes.</strong></p>\n<p>Shoes I’ve worn and liked:</p>\n<ul>\n<li><a\nhref=\"https://www.amazon.com/dp/B097CB2JHS/ref=sspa_dk_detail_0\">Saucony\nRide 15</a> – my current shoes</li>\n<li><a\nhref=\"https://www.amazon.com/HOKA-ONE-Clifton-Shoes-Color/dp/B09DZRN992/ref=sr_1_1\">HOKA\nONE ONE Clifton 8</a> – my beginner shoes</li>\n<li><a\nhref=\"https://www.amazon.com/HOKA-ONE-Speedgoat-Synthetic-Provincial/dp/B08MF7993M/ref=sr_1_1\">HOKA\nONE ONE Speedgoat 4</a> – for trail running (and <a\nhref=\"https://www.outsideonline.com/outdoor-gear/hiking-gear/hoka-speedgoat-mids-300-mile-blister-test/\">hiking</a>)</li>\n</ul>\n</section>\n<section id=\"foam-rollers\" class=\"level2\">\n<h2>Foam rollers</h2>\n<p>A tip I gleaned from the book “Run Like a Pro (Even if You’re Slow)”\nis that <strong>professional runners use foam rollers</strong>.</p>\n<figure>\n<img\nsrc=\"https://m.media-amazon.com/images/I/71QPrigOjtL._AC_SX500_.jpg\"\nalt=\"TriggerPoint GRID Foam Roller\" />\n<figcaption aria-hidden=\"true\">TriggerPoint GRID Foam\nRoller</figcaption>\n</figure>\n<p>The thin casing of muscle-protecting fascia in your legs can knot\nitself into a little ball—making your calves feel tight.</p>\n<p>Foam rolling—“self-myofascial release”—can massage out all these\nknots.</p>\n<p>I found a good routine in a <a\nhref=\"https://www.youtube.com/watch?v=JvLWJiB48tM\">video from McMillian\nrunning</a>.</p>\n<p>Some studies link foam rolling to <a\nhref=\"https://pubmed.ncbi.nlm.nih.gov/25968853/\">faster recovery</a> and\n<a\nhref=\"https://www.frontiersin.org/articles/10.3389/fphys.2019.00376/full?fbclid=IwAR1wMoGkHgXUIN12UUf3VnpnaT715kT0R8loil6THZt0Bt4zTJukl28Jzqw\">increased\nathletic performance</a>.</p>\n<p>I’m ambivalent, but it feels good and seems harmless, so I do it.</p>\n<p>I use and own both:</p>\n<ul>\n<li><a href=\"https://www.amazon.com/gp/product/B0040EKZDY\">TriggerPoint\nGRID Foam Roller</a> – everyone recommends this one, and you can find it\neverywhere</li>\n<li><a href=\"https://tylercipriani.com/blog/amazon.com/gp/product/B001O0H436\">TheStick Little Stick</a>\n– I found this in a Runner’s World article on “<a\nhref=\"https://www.runnersworld.com/advanced/a20846383/calf-heart-attacks/\">calf\nheart attacks</a>.”</li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/06/30/sock-nerdery/",

    "title": "Sock&#x1F9E6; nerdery&#x1F913;",
    "url": "https://tylercipriani.com/blog/2022/06/30/sock-nerdery/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-07-01T00:16:39Z",
    "date_modified": "2022-07-01T01:15:39Z",


    "content_html": "<blockquote>\n<p>Being a nerd is not about what you love; it’s about how you love\nit.</p>\n<p>– <a\nhref=\"https://wilwheaton.net/2013/04/being-a-nerd-is-not-about-what-you-love-its-about-how-you-love-it/\">Wil\nWheaton</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/c3/c15f35110a3b91a254d00d2a0a3607/large.jpg\"\nalt=\"My running last week\" />\n<figcaption aria-hidden=\"true\">My running last week</figcaption>\n</figure>\n<p>I’m a runner and a sock nerd, and in four days, I’m running a\nhalf-marathon (eek!).</p>\n<p>Here are some reflections on socks because if there’s one thing every\nrunner knows it’s: <strong>socks. matter.</strong></p>\n<section id=\"join-the-darn-tough-sock-cult.\" class=\"level2\">\n<h2>Join the Darn Tough sock cult.</h2>\n<p>Darn Tough makes merino wool socks prized by hikers, runners, and <a\nhref=\"https://www.reddit.com/r/BuyItForLife/comments/rzuven/putting_darn_toughs_lifetime_guarantee_to_the/\">buy-it-for-lifers</a>\nbecause they’re <strong>guaranteed for life</strong>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/06/684d7743a6e29fed924b01e7287e74/medium.jpg\"\nalt=\"Darn Tough’s lifetime warranty\" />\n<figcaption aria-hidden=\"true\">Darn Tough’s lifetime\nwarranty</figcaption>\n</figure>\n<p>According to my Amazon order history, I ordered five pairs of “Darn\nTough Merino Wool Double Cross, No Show Tab, Light Cushion Sock Molten\nLarge” socks in 2016. Today, six years later, I’m wearing a pair of the\nsocks I ordered in 2016, and they’re great.</p>\n<p>And in all this time I’ve never used their warranty program, but I\ndecided to try it out on a particularly worn pair—we’ll see how it\ngoes!</p>\n</section>\n<section id=\"about-compression-socks\" class=\"level2\">\n<h2>About compression socks</h2>\n<blockquote>\n<p>Why? Because squeezy is good.</p>\n<p>– <a\nhref=\"https://www.runnersworld.com/gear/a20837999/compression-socks-for-runners-0/\">Peter\nSagal</a>, Host of NPR’s “Wait Wait… Don’t Tell Me!”</p>\n</blockquote>\n<p>Compression socks supply support and structure. And it makes them a\njoy to wear—even when you’re not running.</p>\n<p>Initially, compression socks emerged to support circulation in the\nlegs of diabetics. But now <strong>savvy runners sport them to\ncapitalize on <a\nhref=\"https://journals.lww.com/nsca-jscr/Fulltext/2015/02000/Compression_Socks_and_Functional_Recovery.30.aspx\">numerous\nstudies</a> claiming they aid <a\nhref=\"https://journals.humankinetics.com/view/journals/ijspp/12/5/article-p621.xml\">performance</a>\nand <a\nhref=\"https://www.sciencedirect.com/science/article/abs/pii/S1440244018302615\">recovery</a></strong>\n(although who knows what the control is in those studies).</p>\n<p>I own two colors of <a\nhref=\"https://www.amazon.com/CEP-Progressive-Compression-Athletics-20-30mmHg/dp/B00BAV9C4I/\">CEP\nProgressive+ Run 2.0</a>—basic black and caution-tape yellow.</p>\n<p>These socks are made of nylon (mostly) which massages my calves,\nkeeping my blood flowing on my recovery days. I’ve owned these socks for\nyears and wear them weekly.</p>\n<p>But it’s not all cozy, compressed joy:</p>\n<ul>\n<li>💸Compression socks are too expensive—mine cost $65 a pair!</li>\n<li>🧐 The socks come with instructions about how to put them on</li>\n<li>🛂 You <strong>need</strong> instructions to put them on</li>\n</ul>\n</section>\n<section id=\"avoid-cotton-socks\" class=\"level2\">\n<h2>Avoid cotton socks</h2>\n<blockquote>\n<p>90% of everything is crap</p>\n<p>– <a href=\"https://en.wikipedia.org/wiki/Sturgeon%27s_law\">Sturgeon’s\nLaw</a></p>\n</blockquote>\n<p>Most socks are crap for running because most socks are cotton.</p>\n<p>But <strong>cotton is the wrong material for socks</strong> for the\nsame reason it’s the right material for towels. Cotton is absorbent—it\nholds water and doesn’t release it. The sweat trapped between your foot\nand your cotton sock can cause blisters while running or hiking.</p>\n<p>In contrast, technical socks tend to be made of less absorbent\nmaterial that dries quickly. So when you sweat, your sweat moves to the\nsurface of the sock and evaporates before it gives you blisters.</p>\n<p>I believed blisters were unavoidable—I tossed a roll of <a\nhref=\"https://www.amazon.com/BSN-Medical-BEI076168-Leukotape-Sports/dp/B000E59HXC/\">Leukotape</a>\nin my firstaid kit and accepted that I’d use it often. But then I\nrealized the real problem was my cotton socks.</p>\n</section>\n<section id=\"you-think-about-socks-every-day.\" class=\"level2\">\n<h2>You think about socks every day.</h2>\n<blockquote>\n<p>“I don’t want to make decisions about what I’m eating or wearing.\nBecause I have too many other decisions to make.”</p>\n<p>– <a\nhref=\"https://www.vanityfair.com/news/2012/10/michael-lewis-profile-barack-obama\">Barack\nObama</a></p>\n</blockquote>\n<p>Mental energy is precious. You should avoid misspending your limited\nmental energy on your socks.</p>\n<p>You could argue writing a blog post about socks is the definition of\nmisspent mental energy. But I believe it’s <strong>when</strong> you’re\nspending your mental energy that matters.</p>\n<p>If you find yourself bleary-eyed, rooting around for the one good\npair of socks in the drawer, then <strong>you’re thinking about socks at\nthe wrong time</strong>.</p>\n<p>Spend your effort up-front.</p>\n<p><strong>Declare sock bankruptcy</strong> and find a brand of\ncomfortable socks that you can wear in every situation, and then stock\nup.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/06/15/choose-boring-desktop-technology/",

    "title": "Cool desktops don&#x2019;t change&#xA0;&#x1F60E;",
    "url": "https://tylercipriani.com/blog/2022/06/15/choose-boring-desktop-technology/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-06-15T19:08:21Z",
    "date_modified": "2022-06-16T18:52:30Z",


    "content_html": "<blockquote>\n<p>Tools can be a subtle trap.</p>\n<p>– Neil Gaiman, <strong><a\nhref=\"https://en.wikipedia.org/wiki/The_Sandman_(comic_book)\">The\nSandman</a></strong></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ff/009e411ecaa6134a44d729bf0129e0/large.jpg\"\nalt=\"My ThinkPad X220 in all its glory\" />\n<figcaption aria-hidden=\"true\">My ThinkPad X220 in all its\nglory</figcaption>\n</figure>\n<p>Working on my old\n<a href=\"https://tylercipriani.com/blog/2016/11/13/coreboot-on-the-thinkpad-x220-with-a-raspberry-pi/\">ThinkPad\nx220</a> feels easy because I’ve used the same software for over a\ndecade.</p>\n<p>And while it’s tempting to switch to one of the endless new apps out\nthere, <strong>there are good reasons to trust old tools</strong>.</p>\n<section id=\"the-lindy-effect\" class=\"level2\">\n<h2>The Lindy Effect</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ff/19ab08fafac299e6c4ec2507042b7e/medium.jpg\"\nalt=\"My boring desktop\" />\n<figcaption aria-hidden=\"true\">My boring desktop</figcaption>\n</figure>\n<p>The <a href=\"https://en.wikipedia.org/wiki/Lindy_effect\">Lindy\neffect</a> posits <strong>the older something is, the longer it’ll be\naround</strong>.</p>\n<p>According to the Lindy Effect, you can assume most software is\nhalfway through its lifespan.</p>\n<p>So, <strong>Vi will be around in 2068</strong>, whereas Visual Studio\nCode will be defunct before the end of this decade.<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a></p>\n<table>\n    <tbody>\n    <tr class=\"odd\">\n        <td><a href=\"https://www.debian.org/\">Debian</a></td>\n        <td>1993</td>\n        <td>28 years old</td>\n    </tr>\n    <tr class=\"even\">\n        <td><a href=\"https://www.gnu.org/software/bash/\">Bash</a></td>\n        <td>1989</td>\n        <td>33 years old</td>\n    </tr>\n    <tr class=\"odd\">\n        <td><a href=\"https://xmonad.org/\">XMonad</a></td>\n        <td>2007</td>\n        <td>15 years old</td>\n    </tr>\n    <tr class=\"even\">\n        <td><a href=\"http://software.schmorp.de/pkg/rxvt-unicode.html\">URXvt</a></td>\n        <td>2001</td>\n        <td>20 years old</td>\n    </tr>\n    <tr class=\"odd\">\n        <td><a href=\"https://github.com/tmux/tmux/wiki\">Tmux</a></td>\n        <td>2007</td>\n        <td>15 years old</td>\n    </tr>\n    <tr class=\"even\">\n        <td><a href=\"https://www.vim.org\">Vim</a></td>\n        <td>1991</td>\n        <td>30 years old</td>\n    </tr>\n    </tbody>\n</table>\n<p>The average software running my laptop is 24 years old. So, 24 more\nyears of this desktop (right!? 😅).</p>\n</section>\n<section id=\"preserve-your-flow-state\" class=\"level2\">\n<h2>Preserve your flow state</h2>\n<p>My desktop has features that are missing from other people’s\ncomputers.</p>\n<p>These features whisk me into a flow state and keep me there; they\npreserve my limited attention, willpower, and (frankly) mental\ncapacity.</p>\n</section>\n<section id=\"vim-instead-of-a-new-notetaking-app\" class=\"level2\">\n<h2>Vim instead of a new notetaking app</h2>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-06-11_twitter-netcapgirl-vimmaxing.png\"\nalt=\"Sage advice from @netcapgirl on Twitter, 2022-04-27\" />\n<figcaption aria-hidden=\"true\">Sage advice from <span class=\"citation\"\ndata-cites=\"netcapgirl\">@netcapgirl</span> on Twitter,\n2022-04-27</figcaption>\n</figure>\n<p>The problem with most notetaking apps is <strong>editing text outside\nVim breaks my brain</strong>.</p>\n<p><a\nhref=\"https://vimawesome.com/plugin/vimwiki-the-lucky-one\">Vimwiki</a>\nhas piqued my interest, but I have yet to use it.</p>\n<p>Meanwhile, I keep boring notes in Vim using <a\nhref=\"https://gist.github.com/thcipriani/7efb15b2057fe6348b45df26a3e3c479\">a\nbash script</a>, <a href=\"https://pandoc.org/\">Pandoc</a>, <a\nhref=\"https://commonmark.org/\">markdown</a>, and a <a\nhref=\"https://vimawesome.com/plugin/goyo-vim\">distraction-free</a>\nwriting environment.</p>\n<p>In the end, I get a bunch of webpages available on\n<code>http://localhost/~thcipriani/brain</code>:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-06-15_boring-brain-index-page.png\"\nalt=\"This is basically Roam + Obsidian + Notion…right?\" />\n<figcaption aria-hidden=\"true\">This is basically Roam + Obsidian +\nNotion…right?</figcaption>\n</figure>\n</section>\n<section id=\"bash-instead-of-duckduckgo\" class=\"level2\">\n<h2>Bash instead of DuckDuckGo</h2>\n<p>Some folks rely on DuckDuckGo (or, worse yet, Google) for basic\nutilities:</p>\n<ul>\n<li>Calculator</li>\n<li>Dictionary</li>\n<li>Spell check</li>\n<li>Unit conversion</li>\n</ul>\n<p>But you can achieve the same thing faster, without breaking your\nconcentration.</p>\n<ul>\n<li><p><strong>Calculator</strong></p>\n<p>I stole the <a\nhref=\"https://github.com/addyosmani/dotfiles/blob/master/.functions#L1-L17\"><code>calc</code>\nbash function</a> from Addy Osmani in 2012 and have used it daily\nsince.</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ calc 6922251*8\n55378008</code></pre></li>\n<li><p><strong>Dictionary</strong></p>\n<p>I 😍 <a\nhref=\"https://nicolaiarocci.com/youre-probably-using-the-wrong-dictionary/\">dictionaries</a>.</p>\n<p>One of the <a href=\"https://www.websters1913.com/\">best dictionaries\nfor writers</a> is available as the <code>gcide-dict</code> package in\nDebian:</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ dict fustian\n  Fustian \\Fus&quot;tian\\, n.\n     1. A kind of coarse twilled cotton or cotton and linen stuff,\n        including corduroy, velveteen, etc.\n        [1913 Webster]\n\n     2. An inflated style of writing; a kind of writing in which\n        high-sounding words are used, above the dignity of the\n        thoughts or subject; bombast.\n        [1913 Webster]\n\n              Claudius . . . has run his description into the most\n              wretched fustian.                              --Addison.\n        [1913 Webster]</code></pre></li>\n<li><p><strong>Spell checker</strong></p>\n<p>Spellcheck is available almost everywhere, but when it isn’t, people\ntend to search for whatever word they’re spelling. I\n<a href=\"https://tylercipriani.com/blog/2017/08/14/offline-spelling-with-aspell/\">wrote a script\ncalled <code>spell</code></a> which uses <code>aspell</code> to improve\nmy spelling:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/od/46c92a641342553f36e77e406e1613/original.gif\"\nalt=\"spell in action\" />\n<figcaption aria-hidden=\"true\"><code>spell</code> in action</figcaption>\n</figure></li>\n<li><p><strong>Temperature conversion</strong></p>\n<p><code>units</code> is a unit conversion and calculation program. And\nits <a\nhref=\"https://gist.github.com/thcipriani/0d9d977e3aba2c10be4f5072d7e265a8#file-definitions-units-L32-L68\">database</a>\nis one of my favorite sources of trivia.</p>\n<p>You can make <a\nhref=\"https://gist.github.com/thcipriani/915b47d59308db2bd9ea8a70e6719b1c\">scripts</a>\nfor the most common functions. I made one called <code>temp</code>,\nwhich uses <code>units</code> to show temp in both °C and °F—handy for\ntalking about the weather.</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ temp 100\n37.777778°C\n212°F</code></pre></li>\n</ul>\n</section>\n<section id=\"scratchpads-instead-of-pinned-tabs\" class=\"level2\">\n<h2>Scratchpads instead of pinned tabs</h2>\n<p>Scratchpads are little windows you summon with a keyboard shortcut.\nI’ve combined <a\nhref=\"https://hackage.haskell.org/package/xmonad-contrib-0.13/docs/XMonad-Util-NamedScratchpad.html\">XMonad</a>\nand <a href=\"https://superuser.com/a/33553\">Chrome</a> to get little\nfloating web apps all over my desktop.</p>\n<ul>\n<li>⌘ + Shift + p is an ever-present notetaking terminal window.</li>\n<li>⌘ + Shift + s is Google calendar.</li>\n<li>⌘ + Shift + o used to bring up an org-mode capture template, but now\nit brings up todoist (yes, I’m suitably ashamed).</li>\n</ul>\n<figure>\n    <video autoplay loop muted>\n        <source src=\"https://photos.tylercipriani.com/2022-06-15_namedscratchpads.mp4\" type=\"video/mp4\">\n    </video>\n    <figcaption>XMonad NamedScratchpads 👏</figcaption>\n</figure>\n</section>\n<section id=\"the-year-decade-of-linux-on-the-desktop\" class=\"level2\">\n<h2>The <strike>year</strike> decade of Linux on the desktop</h2>\n<p>There’s a bitter joke that goes like this: <strong>“It’s the year of\nLinux on the desktop.”</strong></p>\n<p>People say it in video calls when they can’t get their audio to work.\nBut, honestly, I’ve had a pleasant <strong>decade</strong> of Linux on\nthe desktop.</p>\n<p>And when <a href=\"https://wayland.freedesktop.org/\">Wayland</a>\nfinally happens? Well. I guess I’ll have no choice but to stop using\ncomputers forever <code>¯\\_(ツ)_/¯</code><a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a>.</p>\n<p>Anyway. Here’s to the next decade and beyond.</p>\n<hr />\n<p><small>Thanks to <a href=\"https://p1k3.com\">Brennen</a>, <a\nhref=\"https://www.kostaharlan.net/\">Kostah</a>, and <a\nhref=\"https://filipin.eu/\">Željko</a> for reading an early draft of this\npost and making it less terrible. &lt;3</small></p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>There is precedent here: <a\nhref=\"https://github.blog/2022-06-08-sunsetting-atom/\"\nclass=\"uri\">https://github.blog/2022-06-08-sunsetting-atom/</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p>or, I suppose, I could finally figure\nout how to use <a href=\"https://swaywm.org/\">SwayWM</a><a href=\"https://tylercipriani.com/blog/#fnref2\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/05/28/on-the-proper-use-of-post-its/",

    "title": "On the Proper use of Post-Its&#xAE;",
    "url": "https://tylercipriani.com/blog/2022/05/28/on-the-proper-use-of-post-its/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-05-28T00:21:28Z",
    "date_modified": "2022-05-29T14:38:06Z",


    "content_html": "<blockquote>\n<p>Instead of lifting each sheet from the bottom and pulling it off of\nthe pad in a vertical direction, lift each sheet from the side.</p>\n<p>– post-it.com, <a\nhref=\"https://www.post-it.com/3M/en_US/post-it/ideas/articles/7-tips-for-creating-post-it-super-sticky-note-pixel-art/\">Tips\nfor creating Post-it® Super Sticky Note pixel art</a></p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ea/c989bbb2b561839155a4c9caf7fa33/large.jpg\"\nalt=\"How to peel a Post-It®\" />\n<figcaption aria-hidden=\"true\">How to peel a Post-It®</figcaption>\n</figure>\n<p>💡 <strong>tl;dr</strong>: Always peel post-its from the side, not\nthe bottom.</p>\n<section id=\"the-more-you-know\" class=\"level2\">\n<h2>🌠 The More You Know</h2>\n<p>This is a public service announcement: <strong>you’re peeling your\nsticky notes all wrong</strong>.</p>\n<p>But you’re not alone; I only learned how to properly peel a Post-It\nat an in-person offsite in 2015.</p>\n<p>As our team worked, we noticed some of our Post-Its were curlier than\nothers. And the curlier Post-Its tended to fall off the wall.</p>\n<p>Our facilitator diagnosed our dispair, <strong>“If you peel post-its\nfrom the side, they don’t curl up.”</strong></p>\n</section>\n<section id=\"why-this-works\" class=\"level2\">\n<h2>🧐 Why this works</h2>\n<p>3M scientists <a\nhref=\"https://www.post-it.com/3M/en_US/post-it/contact-us/about-us/\">Spencer\nSilver and Art Fry</a> gifted the Post-It to humanity.</p>\n<p>The Post-It’s magic is its <strong>microsphere adhesive</strong>,\ndiscovered in 1968 by Silver; it affords Post-Its the singular ability\nto stick and unstick from paper without damaging it.</p>\n<figure style=\"text-align: center;\">\n<img src=\"https://photos.tylercipriani.com/thumbs/29/3bbe0d0813a6f4213c138c0677481c/medium.jpg\" alt=\"\">\n<figcaption style=\"text-align: left;\">Post-It® at 400× magnification, The microsphere adhesive, top: “beautiful, bright, clear, crystalline spheres — like little glass balls,” – Spencer Silver</figcaption>\n</figure>\n<p>A Post-It’s easy unstickability is its biggest feature and its\ndownfall.</p>\n<p>When you yank a note from the bottom, it curls. That curling is just\nenough force to lift the note off the paper, the whiteboard, or whatever\nit’s stuck to.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/cc/07355e69b27a6a302fc71f58bb410c/large.jpg\"\nalt=\"✅ nice and flat vs. ❌ curly and cursed\" />\n<figcaption aria-hidden=\"true\">✅ nice and flat vs. ❌ curly and\ncursed</figcaption>\n</figure>\n<p>So the next time you’re slingin’ stickies, just remember: <strong>one\nrule you must abide: always peel a Post-It® from the side.</strong></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/05/14/git-diffs-deep-deception/",

    "title": "Explaining git diff to myself",
    "url": "https://tylercipriani.com/blog/2022/05/14/git-diffs-deep-deception/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-05-14T00:26:49Z",
    "date_modified": "2022-05-16T17:56:21Z",


    "content_html": "<blockquote>\n<p>But try to understand<br> Try to understand<br> Try try try to\nunderstand<br> Git’s a magic command.</p>\n<p>– <a\nhref=\"https://www.youtube.com/watch?v=Ps7tVvQHLyo\">Heart  💕</a></p>\n</blockquote>\n<p>Once upon a time, I believed git was storing diffs somewhere. But\nthen I learned I was wrong.</p>\n<p>It’s challenging to wield git’s clunky interface when you have a\nbroken mental model of its internals. Learning more about what’s\nhappening inside git transformed me into a more effective git user.</p>\n<p>In this post, I’ll attempt to explain all the deep details of\n<code>git diff</code> to my past self.</p>\n<section id=\"git-add-makes-blobs\" class=\"level2\">\n<h2>📍 Git add makes blobs</h2>\n<p>We can add files to repos using <code>git add</code>. But behind the\n<a\nhref=\"https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain\">porcelain</a>,\ngit’s busy compressing and storing this file deep in its bowels. Git\nterms the results of this process a “blob.”</p>\n<p>Git stores blobs (among other things) inside the\n<code>.git/objects</code> directory.</p>\n<pre><code>$ git init\nInitialized empty Git repository in /tmp/bar/.git/\n$ echo &quot;Hi, I&#39;m blob&quot; &gt; foo\n$ git add foo\n$ tree .git/objects/\n.git/objects/\n└── 26\n  └── 45aab142ef6b135a700d037e75cd9f1f1c94dc</code></pre>\n<p>But what’s in a blob? And why is this blob stored as\n<code>./26/45aab142ef6b135a700d037e75cd9f1f1c94dc</code>?</p>\n</section>\n<section id=\"git-stores-things-by-their-hash\" class=\"level2\">\n<h2>🗃️ Git stores things by their hash</h2>\n<p>Why did <code>git add foo</code> store the contents of\n<code>foo</code> as\n<code>2645aab142ef6b135a700d037e75cd9f1f1c94dc</code>?</p>\n<p>Git mapped our file to a number via a hash function.</p>\n<p><strong>A hash function maps data to a unique number</strong> (<a\nhref=\"https://shattered.io\">mostly</a>)—whenever the data changes, the\nhash function’s output changes dramatically.</p>\n<p><a href=\"https://en.wikipedia.org/wiki/SHA-1\">SHA1</a> is the hash\nfunction git uses by default. And when we <code>git add foo</code> git\napplies SHA1 to the contents of\n<code>foo</code>—<code>Hi, I\'m blob\\n</code>—and that spits out\n<code>2645aab142ef6b135a700d037e75cd9f1f1c94dc</code>.</p>\n<p>Blobs are all about content. The filename “foo” doesn’t matter at\nall! We could have named the file “🌈”—git still would have stored it in\nthe same place. If the file contents are EXACTLY the same, then the hash\nwill be exactly the same.</p>\n</section>\n<section id=\"git-commit-creates-commits-and-trees\" class=\"level2\">\n<h2>🌱 Git commit creates commits and trees</h2>\n<p>You already know <code>git commit</code> creates a commit, but what\nis a commit?</p>\n<p>A commit is a type of object. Git uses the word “object” to mean: a\ncommit, a folder or directory (tree), a file (blob), or a tag. Git\nstores objects in its object database—everything inside the\n<code>.git/objects</code> directory.</p>\n<pre><code>$ git commit -m &#39;Initial Commit&#39;\n[main (root-commit) 0644991] Initial Commit\n1 file changed, 1 insertion(+)\ncreate mode 100644 foo\n$ tree .git/objects/\n.git/objects/\n├── 06\n│   └── 449913ac0e43b73bfbd3141f5643a4db6d47f8\n├── 26\n│   └── 45aab142ef6b135a700d037e75cd9f1f1c94dc\n└── 41\n  └── 81320a57137264d436b2ef861c31f430256bf4</code></pre>\n<p>After our commit, the object database has three objects:\n<code>06449913</code>, <code>2645aab1</code>, and\n<code>4181320a</code>.</p>\n<p>So now we’ve established that one of these three objects is our blob\n(<code>2645aab1</code>)—let’s see if we can suss out the others.</p>\n</section>\n<section id=\"the-magic-command\" class=\"level2\">\n<h2>✨ The magic command</h2>\n<p>The magic command to learn about any object is\n<code>git cat-file -p</code>. We can use that command to find out more\nabout our mystery objects:</p>\n<pre><code>$ git cat-file -p 06449913ac0e43b73bfbd3141f5643a4db6d47f8\ntree 4181320a57137264d436b2ef861c31f430256bf4\nauthor Tyler Cipriani &lt;tcipriani@wikimedia.org&gt; 1652310544 -0600\ncommitter Tyler Cipriani &lt;tcipriani@wikimedia.org&gt; 1652310544 -0600\n\nInitial Commit</code></pre>\n<p>This object (<code>06449913</code>) appears to be our commit. A\ncommit is metadata compressed and stored inside git’s object\ndatabase.</p>\n<p>Some of the metadata is obvious, but then there’s a tree. And that\ntree points to our other mystery object, <code>418132</code>. Let’s see\nwhat we can learn about our last remaining mystery object using our\nmagic command:</p>\n<pre><code>$ git cat-file -p 4181320a57137264d436b2ef861c31f430256bf4\n100644 blob 2645aab142ef6b135a700d037e75cd9f1f1c94dc    foo</code></pre>\n<p>So a <strong>tree is an object that stores a directory listing of\nobjects by their SHA1s</strong>. And a <strong>commit is an object that\npoints at a tree</strong> by recording the tree’s SHA1!</p>\n<p>Commits point to trees, and trees point to blobs and other trees.\nNeat!</p>\n</section>\n<section id=\"gits-dependency-graph\" class=\"level2\">\n<h2>📈 Git’s dependency graph</h2>\n<p>So if we graphed the state of dependencies in our object database,\nwe’d get something like this:</p>\n<figure>\n<img src=\"http://photos.tylercipriani.com/2022-05-15_git-merkle-1.png\"\nalt=\"Simple git repo’s object dependency graph\" />\n<figcaption aria-hidden=\"true\">Simple git repo’s object dependency\ngraph</figcaption>\n</figure>\n<p>The commit incorporates our tree, which includes our blob—everything\ndepends on our blob!</p>\n<p>So if we change even a single bit inside a single file: git will\nnotice—everything is entirely traceable from the commit down to the bit\nlevel. We get this for free by hashing objects and including those\nhashes in other objects.</p>\n<p>This is the whole concept of a <a\nhref=\"https://en.wikipedia.org/wiki/Merkle_tree\">Merkle Directed Acyclic\nGraph</a> (Merkle DAG)!</p>\n</section>\n<section id=\"so-wheres-the-diff\" class=\"level2\">\n<h2>🍔 So, where’s the diff?</h2>\n<p>When we type <code>git diff</code>, git presents us a diff. We know\nthere are blobs and trees and commits—so where’s the diff!?</p>\n<p><strong>Git doesn’t store diffs anywhere at all!</strong> It derives\ndiffs from what’s stored in the object database.</p>\n<pre><code>$ echo &quot;I&#39;m ALSO blob&quot; &gt; baz\n$ git add baz\n$ git commit -m &#39;Add baz&#39;\n$ tree .git/objects/\n.git/objects/\n├── 06\n│   └── 449913ac0e43b73bfbd3141f5643a4db6d47f8\n├── 26\n│   └── 45aab142ef6b135a700d037e75cd9f1f1c94dc\n├── 41\n│   └── 81320a57137264d436b2ef861c31f430256bf4\n├── 95\n│   └── 42599fac463c434456c0a16b13e346787f25da\n├── 9b\n│   └── 2716e4540c11e8d590e906dd8fa5a75904810a\n└── e6\n   └── 5a7344c46cebe61d052de6e30d33636e1cd0b4</code></pre>\n<p>We made a new commit, and now we have three new objects. We added a\nnew file (blob), which made our directory different (tree), and we\ncommitted it (commit).</p>\n<p>Our graph now looks like this:</p>\n<figure>\n<img src=\"http://photos.tylercipriani.com/2022-05-15_git-merkle-2.png\"\nalt=\"Simple git repo’s updated object dependency graph\" />\n<figcaption aria-hidden=\"true\">Simple git repo’s updated object\ndependency graph</figcaption>\n</figure>\n<p>You might be surprised by a few things in the graph:</p>\n<ul>\n<li>Our new commit stores its parent commit as metadata</li>\n<li>Our new tree points to our old blob, and our NEW blob</li>\n</ul>\n<p>So now what happens when we try git diff:</p>\n<pre><code>$ git diff 064499..e65a73\ndiff --git a/baz b/baz\nnew file mode 100644\nindex 0000000..9b2716e\n--- /dev/null\n+++ b/baz\n@@ -0,0 +1 @@\n+I&#39;m ALSO blob</code></pre>\n<p>Git compares the two commits, finds their trees, sees a new blob in\nthe second commit, and shows you the diff of <code>/dev/null</code> and\n<code>baz</code>.</p>\n<p>No diffs. Just Merkle DAGs. And now you know.</p>\n<hr />\n<p><small>Thanks to <a href=\"https://github.com/joescottswanson\">Joe\nSwanson</a> for providing excellent early feedback on this post. And\nthanks to <a href=\"https://www.kostaharlan.net/\">Kostah Harlan</a> for\nreading an early draft of this post and making it less terrible.\n&lt;3</small></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/04/30/ive-used-all-the-notebooks/",

    "title": "I&#x27;ve Used All The Notebooks",
    "url": "https://tylercipriani.com/blog/2022/04/30/ive-used-all-the-notebooks/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2022-04-30T17:59:17Z",
    "date_modified": "2022-04-30T18:49:24Z",


    "content_html": "<blockquote>\n<p>They aren’t a record of my thinking process. They are my thinking\nprocess.</p>\n<p>– Richard Feynman, on his notebooks<br> (via <a\nhref=\"https://bookshop.org/books/how-to-take-smart-notes-one-simple-technique-to-boost-writing-learning-and-thinking-for-students-academics-and-nonfiction-book-writers/9781542866507\">How\nto Take Smart Notes</a>)</p>\n</blockquote>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/b6/6abb8398d7085d6204632424f64f4a/large.jpg\"\nalt=\"My notebook obsession laid bare\" />\n<figcaption aria-hidden=\"true\">My notebook obsession laid\nbare</figcaption>\n</figure>\n<p>I jot, doodle, scribe, and scribble in several notebooks every\nday—it’s how I do my thinking.</p>\n<p>This post catalogs my loose notetaking system and some of my opinions\non notebooks.</p>\n<section id=\"why-take-notes\" class=\"level2\">\n<h2>Why take notes</h2>\n<p>During meetings I race to note what’s being said. I don’t often refer\nback to what I’ve written—I get value from doing the writing itself.</p>\n<blockquote>\n<p>I’m not writing it down to remember it later, I’m writing it down to\nremember it now</p>\n<p>– <a href=\"https://fieldnotesbrand.com/\">Field Notes credo</a></p>\n</blockquote>\n<p>Here’s a bad and sweeping summary of how educational psychologists\ncategorize the purposes of taking notes:</p>\n<ol type=\"1\">\n<li><strong>Storage</strong> – you write things down so you can remember\nthem. Birthdays, websites, movies recommendations—you can refer back to\nyour notes and “remember” with perfect fidelity.</li>\n<li><strong>Encoding</strong> – you write things down to write things\ndown.</li>\n</ol>\n<p>Writing things down without ever reading them again can still have\nvalue. In a much cited 2014 paper titled, “<a\nhref=\"https://doi.org/10.1177%2F0956797614524581\">the Pen is Mightier\nthan the Keyboard</a>,” authors Muller and Oppenheimer concluded\nstudents taking notes in physical notebooks had a better understanding\nof lecture material vs. their laptop-tapping counterparts. The act of\nwriting helped them solidify complicated ideas.</p>\n</section>\n<section id=\"how-to-take-notes\" class=\"level2\">\n<h2>How to take notes</h2>\n<p>I’ve perused innumerable books and blogs on notetaking, but my system\nemerged independently. I do a small number of things consistently:</p>\n<ul>\n<li>dates</li>\n<li>lists</li>\n<li>todos</li>\n<li>marginalia</li>\n</ul>\n<blockquote>\n<p>It’s also just a great habit to date every thing you handwrite</p>\n<p>– David Allen, <a\nhref=\"https://en.wikipedia.org/wiki/Getting_Things_Done\">Getting Things\nDone</a></p>\n</blockquote>\n<p>I start every note with an underlined, left-aligned date in ISO-8601\nformat. I follow this with a space and a title for the note. Something\nlike “GitLab meeting” or “Hiring roundup” or “Gratitude”—anything I can\nmentally cling to later.</p>\n<figure>\n<img src=\"https://imgs.xkcd.com/comics/iso_8601.png\"\nalt=\"Obligatory ISO-8601 XKCD by Randall Munroe (CC-BY-SA 2.5)\" />\n<figcaption aria-hidden=\"true\">Obligatory ISO-8601 XKCD by Randall\nMunroe (CC-BY-SA 2.5)</figcaption>\n</figure>\n<blockquote>\n<p>[The list] has an irresistible magic.</p>\n<p>– Umberto Eco, via <a\nhref=\"https://www.spiegel.de/international/zeitgeist/spiegel-interview-with-umberto-eco-we-like-lists-because-we-don-t-want-to-die-a-659577.html\">Der\nSpiegel</a></p>\n</blockquote>\n<p>Most of my notes are lists. Lists capture fleeting thought quickly,\nbut are unfit for conveying new and complex ideas—perfect for\nnotetaking.</p>\n<p>If I’m noting something I’ll have to do later, I’ll write\n<strong>TODO</strong> in all caps and put a square box around it. If I\nhave a highlighter handy, I’ll highlight it, too. Later, I’ll transpose\nthis list item into whatever todo list app I’m using at the moment.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/d8/dc3af431aebae40b28f4583975d7e1/large.jpg\"\nalt=\"How I take notes\" />\n<figcaption aria-hidden=\"true\">How I take notes</figcaption>\n</figure>\n<p>Marginalia describes short notes in the margins, often in the margins\nof books. I provide ample margins in my notes to jot down questions and\nthoughts. This is handy in meetings to structure what I’m about to\nsay.</p>\n<p>I’ve endeavoured to strip my process until its as simple as I can\nmake it. Complicated systems yield inconsistency—it’s not a system; it’s\na mess. I always start with the dumbest system that could work—often it\nworks forever.</p>\n</section>\n<section id=\"notebooks\" class=\"level2\">\n<h2>Notebooks</h2>\n<p>I accumulate notebooks I enjoy holding. I get a little thrill when I\nfind a notebook that’s well made.</p>\n<p>Notebooks I’ve tried:</p>\n<table style=\"width:2%;\">\n<colgroup>\n<col style=\"width: 1%\" />\n<col style=\"width: 0%\" />\n<col style=\"width: 0%\" />\n<col style=\"width: 0%\" />\n<col style=\"width: 0%\" />\n<col style=\"width: 0%\" />\n</colgroup>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: left;\">Name</th>\n<th style=\"text-align: left;\">Size</th>\n<th style=\"text-align: left;\">Paper</th>\n<th style=\"text-align: left;\">Binding</th>\n<th style=\"text-align: left;\">Paper weight</th>\n<th style=\"text-align: left;\">My Rating</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.jetpens.com/Leuchtturm1917-Hardcover-Notebook-Medium-A5-Black-Dotted/pd/28522\">Leuchtturm1917</a></td>\n<td style=\"text-align: left;\">A5</td>\n<td style=\"text-align: left;\">dotted</td>\n<td style=\"text-align: left;\">Left</td>\n<td style=\"text-align: left;\">80g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑⭑⭑</td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.jetpens.com/JetPens-Tomoe-River-52-gsm-Kanso-Noto-Notebook-A5-Dot-Grid-Dark-Green/pd/29707\">JetPens\nTomoe River Kanso Noto</a></td>\n<td style=\"text-align: left;\">A5</td>\n<td style=\"text-align: left;\">dotted</td>\n<td style=\"text-align: left;\">Bound</td>\n<td style=\"text-align: left;\">52g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑⭑⭑</td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.madebyendless.com/products/storyboard-standard-edition-large\">Endless\nStoryboard Standard</a></td>\n<td style=\"text-align: left;\">5.1”✕7.5”</td>\n<td style=\"text-align: left;\">dotted</td>\n<td style=\"text-align: left;\"><strong>sewn</strong></td>\n<td style=\"text-align: left;\">68g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑⭑</td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: left;\"><a\nhref=\"https://fieldnotesbrand.com/products/original-kraft\">Field\nNotes</a></td>\n<td style=\"text-align: left;\">3.5”×5.5”</td>\n<td style=\"text-align: left;\">grid s</td>\n<td style=\"text-align: left;\">tapled</td>\n<td style=\"text-align: left;\">60#T (90g/m², I think)</td>\n<td style=\"text-align: left;\">⭑⭑⭑⭑</td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.baronfig.com/tools/confidant/classic?size=flagship+%285.4%22+x+7.7%22%29&amp;color=light+gray&amp;paper+type=dot+grid\">Baron\nFig Confidant II</a></td>\n<td style=\"text-align: left;\">5.5”×7.7”</td>\n<td style=\"text-align: left;\">dotted</td>\n<td style=\"text-align: left;\">Bound</td>\n<td style=\"text-align: left;\">90g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑<small>½</small></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.sparkfun.com/products/retired/11064\">SparkFun SFE\nProject Notebook</a></td>\n<td style=\"text-align: left;\">10”×7.5”</td>\n<td style=\"text-align: left;\"><strong>reverse grid</strong></td>\n<td style=\"text-align: left;\">Bound</td>\n<td style=\"text-align: left;\"><code>¯\\_(ツ)_/¯</code></td>\n<td style=\"text-align: left;\">⭑⭑⭑<small>½</small></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.jetpens.com/Rhodia-DotPad-Notepad-No.-16-A5-Dot-Grid-Black/pd/6552\">Rhodia\nNº16</a></td>\n<td style=\"text-align: left;\">A5</td>\n<td style=\"text-align: left;\">dotted</td>\n<td style=\"text-align: left;\">Top stapled</td>\n<td style=\"text-align: left;\">80g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑</td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.jetpens.com/Clairefontaine-Triomphe-Notepad-A4-Blank-50-Sheets/pd/10365\">Clairefontaine\nTriomphe Notepad</a></td>\n<td style=\"text-align: left;\">A4</td>\n<td style=\"text-align: left;\">lined</td>\n<td style=\"text-align: left;\">top bound</td>\n<td style=\"text-align: left;\">90g/m²</td>\n<td style=\"text-align: left;\">⭑⭑⭑</td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: left;\"><a\nhref=\"https://www.jetpens.com/Rhodia-Meeting-Book-90-A5-6.5-x-8.3-Lined-Black/pd/10890\">Rhodia\nMeeting Book</a></td>\n<td style=\"text-align: left;\">A5+</td>\n<td style=\"text-align: left;\">lined</td>\n<td style=\"text-align: left;\">spiral</td>\n<td style=\"text-align: left;\">90g/m²</td>\n<td style=\"text-align: left;\">⭑⭑</td>\n</tr>\n</tbody>\n</table>\n<p>My go-to notebook is the Leuchtturm1917 A5, dot-grid, 80g/sqm paper.\nIt’s got an index, page numbers, a little pocket in the back.</p>\n<p>But I’d love it if it were more disposable; maybe not quite as\ndisposable as Field Notes, something like the Endless Storyboard\nStandard notebook with sewn binding.</p>\n<p>I’d also love to find <strong>any</strong> notebook offering the grid\npattern of the old SparkFun SFE Project Notebook—reverse grid with a\nthicker gridline every 8 squares.</p>\n<p>I’ve been playing with the idea of making my own notebook. With a\nUUID for every notebook, page numbers, and a QR code that will let me\njump from the page to some digital system.</p>\n<p>Here’s what I’ve got so far (it’s a work in progress):</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-04-30_notebook.png\"\nalt=\"rough idea for an ideal page layout\" />\n<figcaption aria-hidden=\"true\">rough idea for an ideal page\nlayout</figcaption>\n</figure>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/04/20/the-unreasonable-fight-for-municipal-broadband/",

    "title": "The Unreasonable Fight for Municipal Broadband",
    "url": "https://tylercipriani.com/blog/2022/04/20/the-unreasonable-fight-for-municipal-broadband/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-04-20T14:17:08Z",
    "date_modified": "2022-04-20T17:31:39Z",


    "content_html": "<p>I love Longmont’s municipal broadband, but we had to fight Comcast\nevery step of the way to get it.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/8e/9534dace7708c006b964a93fa95abb/large.jpg\"\nalt=\"NextLight—Longmont’s Broadband\" />\n<figcaption aria-hidden=\"true\">NextLight—Longmont’s\nBroadband</figcaption>\n</figure>\n<p>As a gracious person, I’ll dutifully pretend that the problem\n<em>might be</em> on my side of the Zoom call. But the problem is never\nme—my internet is just too good.</p>\n<p>Since 2016, I’ve been using Longmont’s municipal\nbroadband—NextLight—and it’s been objectively awesome.</p>\n<ul>\n<li>It’s fast—1Gbps symmetric</li>\n<li>It’s cheap(ish)—$49.95 per month</li>\n<li>It’s rock-solid—I’ve never had an outage</li>\n<li>I’ve never hit a data cap</li>\n<li>PC Magazine ranks NextLight among the <a\nhref=\"https://www.pcmag.com/news/the-fastest-isps-of-2021\">top five ISPs\nin the United States</a> every year—often besting Google Fiber</li>\n</ul>\n<p>And, even better, the city insists I’ll pay $49.95 forever.</p>\n<p><strong>But Longmont spent more than a decade fighting Comcast to\nprovide this excellent internet</strong>. And any city working on its\nmunicipal broadband offering should prepare to do the same.</p>\n<section id=\"canceling-comcast\" class=\"level2\">\n<h2>🎉 Canceling Comcast</h2>\n<p>In 2016, I was paying Comcast $150 a month for their top-tier (at the\ntime) 100Mbps speeds. I could usually eke out a little more than 30Mbps\non a good day.</p>\n<p><strong>I lept at the chance for gigabit internet.</strong> I signed\nup for NextLight as a charter member—locking in $49.95/mo for life (the\ncurrent price is only $69.95 last I checked). And I took the opportunity\nto upgrade my $20 router from 2008 at the same time.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/1c/86afb64500c8b266736799ff98a147/large.jpg\"\nalt=\"My new fancy router—Ubiquiti EdgeRouter Lite + EdgeSwitch 16-POE\" />\n<figcaption aria-hidden=\"true\">My new fancy router—Ubiquiti EdgeRouter\nLite + EdgeSwitch 16-POE</figcaption>\n</figure>\n<p>And when I returned my cable box to Comcast to cancel my service, the\nrepresentative felt compelled to counsel me: “NextLight, huh? you know,”\nhe said, leaning in, “if you miss even a single payment, they’ll raise\nyour price?”</p>\n<p>“I’ll take my chances.”</p>\n<p>I’ve been automatically billed $49.95 every month since, and this is\nwhat my speed looks like this morning:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-04-19_fast.com.png\"\nalt=\"930Mbps is not quite 1Gbps, but I’ll take it\" />\n<figcaption aria-hidden=\"true\">930Mbps is not quite 1Gbps, but I’ll take\nit</figcaption>\n</figure>\n</section>\n<section id=\"why-cant-we-have-nice-things\" class=\"level2\">\n<h2>🥺 Why can’t we have nice things?</h2>\n<p>Big cable companies suck. <strong>Big cable companies burned hundreds\nof thousands of dollars to stop Longmont’s municipal\nbroadband.</strong></p>\n<p>In 2005, Comcast and CenturyLink rammed through the egregious <a\nhref=\"http://cityofalamosa.org/wp-content/uploads/2016/12/152_enr.pdf\">Colorado\nSB-05-152</a>, prohibiting municipalities in the state of Colorado from\noffering telecommunication services.</p>\n<p>Longmont had to hold two referendums on the measure—one in 2009,\nwhich failed, and another in 2011, which passed:</p>\n<p>In 2009, “<a\nhref=\"https://www.boulderweekly.com/news/montanabased-org-pours-cash-into-conservative-coffers-in-longmont-city-council-race/\">No\nBlank Check Longmont</a>” (Comcast/CenturyLink) <strong>spent\n$250,000</strong> to dash our dreams of municipal broadband. They framed\nit as a choice between fast internet vs. police and firefighters.</p>\n<p>In 2011, “<a\nhref=\"https://www.boulderweekly.com/news/terrifying-telecom-tale/\">Look\nBefore You Leap Longmont</a>” (Comcast/CenturyLink) <strong>spent\n$300,000</strong> urging us to rethink our municipal broadband plans.\nThey stood in lone opposition to our unanimous city council and our\nlocal paper.</p>\n<p>Comcast spent $500,000 in a tiny city of less than 100,000 people.\nYou can be sure, Comcast will do all this again in a heartbeat.</p>\n</section>\n<section id=\"lessons\" class=\"level2\">\n<h2>📓 Lessons</h2>\n<p>Rather than use their vast resources to improve their service,\n<strong>Comcast will spend big to ensure they never have to\ncompete</strong>.</p>\n<p>Let Longmont be a lesson. In 2011, <strong>Longmont won because it\nformed an honest citizens’ advisory group</strong>: <a\nhref=\"https://web.archive.org/web/20111008235441/http://www.longmontsfuture.com/\">Longmont’s\nFuture</a>. Longmont’s Future got the word out about the vote on\nFacebook, its website, and the local press.</p>\n<p>And ever since, Longmonsters (that’s right—Longmont’s demonym is\n“Longmonster”) have <a\nhref=\"https://muninetworks.org/content/more-half-longmonters-choose-nextlight-fiber-because-nextlight-fiber\">chosen\nNextLight over competing services</a>.</p>\n<p>Real competition won. Fuck Comcast. Long live municipal\nbroadband.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/03/27/my-home-assistant-music-cube/",

    "title": "My Home Assistant Music Cube",
    "url": "https://tylercipriani.com/blog/2022/03/27/my-home-assistant-music-cube/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-03-27T19:19:04Z",
    "date_modified": "2022-03-28T00:02:13Z",


    "content_html": "<p>Last year, I spent $17 on an <a\nhref=\"https://www.aqara.com/us/cube.html\">Aqara cube</a>, and it’s been\none of my best purchases for enjoyment per dollar spent.</p>\n<figure>\n    <video autoplay loop muted>\n        <source src=\"https://photos.tylercipriani.com/2022-03-27_squeezebox-cube.mp4\" type=\"video/mp4\">\n    </video>\n    <figcaption>I control my multi-room audio using a gyroscopic gesture-recognition cube -- yes, this basically makes me Iron Man.</figcaption>\n</figure>\n<p>The Aqara cube is a three-inch square plastic cube that sends\ngestures over Zigbee to a <a\nhref=\"https://www.amazon.com/dresden-elektronik-ConBee-Universal-Gateway/dp/B07PZ7ZHG5/ref=sr_1_4?keywords=zigbee+dongle&amp;qid=1648415026&amp;sr=8-4\">cheap\noff-the-shelf dongle</a>.</p>\n<p>By pairing this cube with <a\nhref=\"https://www.home-assistant.io/\">Home Assistant</a>, I have a\nthree-dimensional button with 45 unique interactions to control whatever\nI want.</p>\n<p>And over the last six months, I’ve used it to control a small fleet\nof antiquated streaming devices to help me discover new music.</p>\n<section id=\"the-tragedy-of-the-logitech-squeezebox\" class=\"level2\">\n<h2>🎭 The Tragedy of the Logitech Squeezebox</h2>\n<p>The Logitech Squeezebox is a bygone streaming device that was too\nbeautiful for this world. Logitech snuffed the Squeezebox in 2012.</p>\n<p>But because others share my enthusiasm for Squeezeboxes, there’s\nstill hope. The second-hand market persists. And there are wonderful\nnerds <a href=\"https://www.picoreplayer.org/\">cobbling together\nSqueezeboxes from Raspberry Pis</a>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-03-27_dozens-of-us-arrested-development.gif\"\nalt=\"Logitech Squeezebox fans\" />\n<figcaption aria-hidden=\"true\">Logitech Squeezebox fans</figcaption>\n</figure>\n<p>I built a DIY Squeezebox from a Pi Zero <a\nhref=\"https://shop.pimoroni.com/products/pirate-radio-pi-zero-w-project-kit?variant=38476372426\">Pimoroni\nPirateRadio</a> kit and <a\nhref=\"https://github.com/ralph-irving/squeezelite\">Squeezelite</a>\nsoftware.</p>\n<p>I blanket my humble abode in music by combining a DIY PirateRadio, a\nSqueezebox Boom, and a Squeezebox Touch.</p>\n<p>My Dockerized Logitech Media Server perfectly synchronizes these\nthree devices. Music from Spotify or <a\nhref=\"https://www.wqxr.org/\">WQXR</a> is seamless when you walk from\nbedroom to kitchen to dining room.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/4a/d8cc93b5fd5ac94334d78034bb0ffe/large.jpg\"\nalt=\"🏴‍☠️ Pimoroni PirateRadio\" />\n<figcaption aria-hidden=\"true\">🏴‍☠️ Pimoroni PirateRadio</figcaption>\n</figure>\n</section>\n<section id=\"home-assistant-is-magic\" class=\"level2\">\n<h2>Home Assistant is ✨magic✨</h2>\n<p>Home Assistant is open-source home automation software, and it’s the\nonly IoT software I don’t find myself screaming at regularly.</p>\n<p>And, of course, there’s a <a\nhref=\"https://www.home-assistant.io/integrations/squeezebox\">Logitech\nSqueezebox integration for Home Assistant</a>. The integration lets you\nuse Logitech Media Server’s (somewhat <a\nhref=\"https://gist.github.com/samtherussell/335bf9ba75363bd167d2470b8689d9f2\">esoteric</a>)\nAPI to control your devices from Home Assistant.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-03-27_squeezebox-homeassistant-honky-tonkin.png\"\nalt=\"Home Assistant Squeezebox Lovelace Card\" />\n<figcaption aria-hidden=\"true\">Home Assistant Squeezebox Lovelace\nCard</figcaption>\n</figure>\n<p>I also use a community-made <a\nhref=\"https://community.home-assistant.io/t/mi-magic-cube-deconz-45-actions/256656\">Home\nAssistant Blueprint</a> that automates each of the cube’s 45 unique\ngestures.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-03-27_homeassistant-magic-cube.png\"\nalt=\"Mi Magic Cube in Home Assistant\" />\n<figcaption aria-hidden=\"true\">Mi Magic Cube in Home\nAssistant</figcaption>\n</figure>\n<p>Currently, since my mental stack is tiny, I only use four\ngestures:</p>\n<ol type=\"1\">\n<li><strong>Shake</strong>: Turn on all players, and start playing a\nrandom album from Spotify (that’s right, <strong>album</strong> – I’m\nold enough to yearn for the halcyon days of <a\nhref=\"https://github.com/thcipriani/rdio-shit#rdio-shit\">Rdio</a>).</li>\n<li><strong>Double-tap</strong>: Turn off all players.</li>\n<li><strong>Flip</strong>: Next track.</li>\n<li><strong>Twist</strong>: Twist right for volume up; twist left for\nvolume down – like a volume knob.</li>\n</ol>\n</section>\n<section id=\"why-would-anyone-do-this\" class=\"level2\">\n<h2>🧐 Why would anyone do this?</h2>\n<p>In a 2011 article, “<a\nhref=\"http://worrydream.com/ABriefRantOnTheFutureOfInteractionDesign/\">A\nBrief Rant on the Future of Interaction Design</a>,” Brett Victor\ndescribes <strong>touchscreens</strong> as “pictures under glass.”\n<strong>I loathe pictures under glass</strong>.</p>\n<p>It’s impossible to use a device with a touchscreen without looking at\nit. And touchscreen interaction is slow – traversing a menu system is\nall point-and-click, there are no shortcuts.</p>\n<p>Another alternative is control via <strong>smart speakers</strong> –\ndevices literally straight out of a dystopian novel.</p>\n<p>While the smart speaker is the closest thing to a ubiquitous\ncommand-line interface in everyday use, <strong>I’m too weirded-out to\nhave a smart speaker in my house</strong>.</p>\n<p>I’ve opted for a better way: shake a cube and music appears.</p>\n<p><strong>The cube is a pleasant tactile experience</strong> – shake\nit, tap it, spin it – its a weighty and fun fidget toy. <strong>Its\ndesign affords instant access to all its features</strong> – there is no\nmenu system to dig through.</p>\n<p>The cube is frictionless <a href=\"https://calmtech.com/\">calm\ntechnology</a> and it’s behaved beautifully in the background of my\nday-to-day for months.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/03/12/code-review-procrastination-and-clarity/",

    "title": "Code Review Decision Fatigue",
    "url": "https://tylercipriani.com/blog/2022/03/12/code-review-procrastination-and-clarity/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-03-12T23:52:02Z",
    "date_modified": "2022-03-13T20:10:49Z",


    "content_html": "<blockquote>\n<p>People think they lack motivation, what they really lack is\nclarity</p>\n<p>– James Clear, <u>Atomic Habits</u></p>\n</blockquote>\n<p>Code review innocently asks a staggering question: “does this code\nlook good to you?” It’s not even clear how to start to answer this\nquestion – which makes putting off code reviews easy.</p>\n<p>With so many decisions left for the reviewer, the easiest decision is\nto opt out – to defer code review for a time when I have more mental\nenergy.</p>\n<p>This post explores the problem of decision fatigue in code review.\nThen it looks at individual and institutional strategies for fighting\nfatigue.</p>\n<section id=\"code-review-is-a-request-for-my-willpower\" class=\"level2\">\n<h2>Code review is a request for my willpower</h2>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-03-07_10loc-500loc.png\"\nalt=\"The chaotic evil response to an unreasonable review request\" />\n<figcaption aria-hidden=\"true\">The <strong>chaotic evil</strong>\nresponse to an unreasonable review request</figcaption>\n</figure>\n<p>Code review is a big task for even a tiny change. But if your patch\nis enormous and tricky, then you’re asking for a titanic share of my\nwillpower.</p>\n<p>When a review demands too much of my daily willpower reserve, I have\na few options:</p>\n<ul>\n<li><strong>Lawful Good</strong>: Carve out time when I know I’ll be\nable to power through the review.</li>\n<li><strong>Neutral</strong>: Defer reviewing your code — and devoutly\nwish that it somehow disappears.</li>\n<li><strong>Chaotic Evil</strong>: YOLO it into production and let you\ndeal with the fallout.</li>\n</ul>\n<p>None of these options is fair to both the developer and the\nreviewer.</p>\n</section>\n<section id=\"where-to-even-begin-code-review\" class=\"level2\">\n<h2>Where to even begin code review</h2>\n<p>Often even the basic questions of code review are up to a reviewer to\ndecide.</p>\n<p>A thread on hacker news recently asked a fundamental question about\ncode review: <a href=\"https://news.ycombinator.com/item?id=30577735\">do\nyou run the code as part of your review</a>? The immediate responses\nwere illuminating to me, and I can summarize them as follows:</p>\n<ol type=\"1\">\n<li><a href=\"https://news.ycombinator.com/item?id=30578033\">No, but\nhere’s how I trick developers into running their own code</a></li>\n<li><a href=\"https://news.ycombinator.com/item?id=30577790\">Yes, because\nneglecting to run code has left me traumatized</a></li>\n<li><a href=\"https://news.ycombinator.com/item?id=30579389\">Rarely,\nbecause tests</a></li>\n<li><a href=\"https://news.ycombinator.com/item?id=30578049\">It depends,\nand you need a standard</a></li>\n</ol>\n<p>Google’s code review guidelines are blasé on the subject:</p>\n<blockquote>\n<p>You can validate the CL [code under review] if you want</p>\n<p>– What to look for in a code review,\nhttps://google.github.io/eng-practices/review/</p>\n</blockquote>\n<p>Google’s engineering practices documentation goes on to mention times\nyou’ll definitely want to ensure you’ve run the code: UI changes and\nparallelism — places where it’s easy (even likely) for an individual to\nmake a noticeable (in retrospect) mistake. But what about all the other\ncode reviews?</p>\n</section>\n<section id=\"requesting-changes-to-the-code-review-process\"\nclass=\"level2\">\n<h2>Requesting changes to the code review process</h2>\n<p>We should optimize the code review process to reduce the decision\nfatigue of reviewers.</p>\n<p>Here are a few tricks developers can use to lessen the mental\nload:</p>\n<ul>\n<li>Split your merge request into smaller, independent merge\nrequests</li>\n<li>Add some tests and linting to exercise the code</li>\n<li>Write clearer commit messages</li>\n<li>Add comments to the code</li>\n<li>Ask them for a narrower review — e.g., a design review or an\narchitecture review</li>\n<li>Write better code</li>\n</ul>\n<p>Some tools exist that ease the burden of remembering your review\nbacklog – Automattic has <a\nhref=\"https://www.software-engineering-unlocked.com/episode-4-leif-singer/\">The\nStick</a>, and Microsoft has <a\nhref=\"https://arxiv.org/pdf/2011.12468v1.pdf\">Nudge</a>. And studies\nhave shown code review reminder tools like these may <a\nhref=\"https://www.michaelagreiler.com/code-review-reminder/\">speed up\nreviews by as much as 60%</a>.</p>\n<p>But there are no magic bullets. Code review’s harshest feedback is\nsilence. There are times when you gape as your code rots, awaiting final\njudgement. And that sucks for everyone.</p>\n<p>To speed up the process, <strong>we’ve got to make it easier for\nreviewers</strong> – we should start with a shared agreement about the\nscope of review. Perhaps beginning with the fundamental question of\nwhether they’re even supposed to run the code. The answer here is\nprobably different for different teams and various types of software,\nbut we all do reviews; maybe we should all have review standards,\ntoo.</p>\n<hr />\n<p><small>Thanks to <a href=\"https://p1k3.com/\">Brennen Bearnes</a> for\nreading an early draft of this post and making it less\nwronger.</small></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/02/21/why-i-blog/",

    "title": "Why I blog",
    "url": "https://tylercipriani.com/blog/2022/02/21/why-i-blog/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-02-21T21:15:57Z",
    "date_modified": "2022-02-21T22:56:04Z",


    "content_html": "<p>In 2022 I resolved to publish two posts a month on this blog.</p>\n<p>This post attempts to explain the value I get out of blogging.</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/2022-02-21_why-blog.png\"\ntitle=\"Blogging is a virtuous cycle\"\nalt=\"The virtuous cycle of blogging\" />\n<figcaption aria-hidden=\"true\">The virtuous cycle of\nblogging</figcaption>\n</figure>\n<p>For me, <strong>blogging is a virtuous cycle</strong>.</p>\n<p>I blog to refine my thinking and improve my writing. As my writing\nimproves, I get more feedback on my ideas. More feedback helps me refine\nmy ideas which leads to more writing.</p>\n<section id=\"writing-is-thinking\" class=\"level2\">\n<h2>Writing is thinking</h2>\n<p><strong>If you want strength, you lift weights; if you want clear\nthinking, you write.</strong></p>\n<p>I don’t like writing. It was an epiphany to me that <a\nhref=\"http://wrd.as.uky.edu/sites/default/files/1-Shitty%20First%20Drafts.pdf\">almost\nno one does</a>. Wrestling the jumble of emotions, facts, and opinions\nfloating in my mind into a blog post can be an exhausting and\ndemoralizing process.</p>\n<p>Writing is a harsh medium for your ideas. As William Zinsser\nremarked, “The ear makes allowances for grammar, syntax and transitions\nthat the eye wouldn’t tolerate in print.” <strong>Writing is hard-mode\nfor thinking.</strong></p>\n<p>But matching words with ideas is addictive and electrifying. You have\nto hunt for the perfect combination of words to describe and clarify\nyour thinking. As you hold up new words against your existing ideas, you\nsee your ideas in new ways.</p>\n<p>This process repeats itself for as long as you have the patience to\nwrite and rewrite a sentence. And when I have that patience, I’m shocked\nat how neat and tidy my thoughts look on the page and in my mind.</p>\n</section>\n<section id=\"learning-is-teaching\" class=\"level2\">\n<h2>Learning is teaching</h2>\n<p>Writing is a test of your understanding.</p>\n<p>The Nobel Prize winning physicist Richard Feynman developed <a\nhref=\"https://www.colorado.edu/artssciences-advising/resource-library/life-skills/the-feynman-technique-in-academic-coaching\">a\ntechnique for learning any topic</a>. <strong>If you want to deeply\nlearn something, try teaching it to someone else.</strong> It seems to\nme the next level of this technique is to try to teach it to an endless\nnumber of people via your writing.</p>\n<p>Another goal of mine is to read more, and the best test of whether I\nunderstand what I’ve read is to write about it.</p>\n<p>Mortimer J. Adler in <u>How to Read a Book</u> uses the term\n“verbalizing” to  describe the act of mindlessly quoting books without\nattempting to put what you’ve read into your own words. It’s liberating\nto recall and use an old idea in a new way – indeed, this is the origin\nof the term “liberal arts.”</p>\n</section>\n<section id=\"blogs-are-conversations\" class=\"level2\">\n<h2>Blogs are conversations</h2>\n<p>When you blog, <strong>you get to talk to brilliant people and (if\nyou’re lucky) they volunteer to refine your ideas</strong>.</p>\n<p>Benjamin Franklin’s autobiography (which reads like a series of blog\nposts) attributes much of his early success to his writing. The example\nthat struck me was how he brought street sweeping to Philadelphia.</p>\n<p>Franklin wished the street in front of his printing shop was cleaner,\nso he wrote a paper detailing the myriad advantages of clean streets. He\nsent a copy of his paper to all the shop owners in his neighborhood\nwhich convinced them to pool their money to pay for a street\nsweeper.</p>\n<p>Using the feedback from this experience, Franklin wrote a bill for\nthe Assembly to pave and clean the streets for the whole of\nPhiladelphia.</p>\n<p>As I read this anecdote, I realized how analogous it is to the tech\nindustry. Beyond building and open-sourcing Kubernetes, Google\nevangelized it. They experimented with the ideas behind Kubernetes,  <a\nhref=\"https://research.google/pubs/pub43438/\">wrote about the experience\nin the Borg paper</a>, encouraged others to do the same and over time\nchanged everything about data centers.</p>\n<p><strong>Ideas that change everything are refinements.</strong>\nExperiment, write, get feedback, repeat. The most tried and proven\nmechanism of refining your ideas is to write about them.</p>\n</section>\n<section id=\"why-i-blog\" class=\"level2\">\n<h2>Why I blog</h2>\n<p>Blogging is a virtuous cycle. First, you mediate the argument between\nyour mind and the page to fully form your ideas and write them down for\nothers. Then you release your ideas into the world where strangers will\ncombine them with their own ideas and morph and refine them into new\nthoughts you never imagined.</p>\n<p>The gift for your efforts might be new ideas to blog about. Or it\nmight be the warm-fuzzies of perfectly capturing the zeitgeist. Or you\nmay get nothing but the harsh and telling feedback of silence.</p>\n<p>I find the endless struggle of zooming and enhancing the details of\nmy ideas in exchange for these gifts to be worth the trade-off. And\nthat’s why I blog.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/02/17/its-still-not-rocket-science/",

    "title": "Repos that always pass their tests",
    "url": "https://tylercipriani.com/blog/2022/02/17/its-still-not-rocket-science/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-02-17T02:20:43Z",
    "date_modified": "2022-02-18T19:02:10Z",


    "content_html": "<p>Losing faith in your build hobbles a software project. Continual test\nfailures create alarm fatigue—people habituate to ignoring test\nresults.</p>\n<p>Ignoring your tests creates an apathy spiral: more breakage, more\nfailure, more apathy, resulting in decreased velocity. Fortunately, more\nbrilliant people than me have already thought really hard about this\nproblem.</p>\n<section id=\"its-not-rocket-science\" class=\"level2\">\n<h2>It’s not rocket science</h2>\n<p>In 2014, Graydon Hoare, the creator of the Rust programming language,\nwrote a blog post entitled, “<a\nhref=\"https://graydon2.dreamwidth.org/1597.html\">The Not Rocket Science\nRule Of Software Engineering</a>.” In the post, he desribes a CI system\nhis team cobbled together circa 2001. The purpose of the system was to\nenforce one simple rule:</p>\n<blockquote>\n<p><strong>The Not Rocket Science Rule Of Software\nEngineering:</strong></p>\n<p>automatically maintain a repository of code that always passes all\nthe tests</p>\n</blockquote>\n<p>Lurking under that placid description is a simple concept, but it’s\nchallenging to execute.</p>\n</section>\n<section id=\"why-is-this-so-hard\" class=\"level2\">\n<h2>Why is this so hard</h2>\n<p><strong>Most CI systems only guarantee that the tests pass in your\nbranch</strong>. But that’s different than saying your tests will pass\nwhen your branch merges.</p>\n<p>One reason for this mismatch may be <a\nhref=\"https://martinfowler.com/articles/branching-patterns.html#integration-friction\">integration\nfriction</a>: your branch diverged from the main branch over time.</p>\n<p>It’s unsafe to merge changes in parallel in a conventional CI system.\nSemantic conflicts between patches can break the build post-merge.\nImagine renaming a method in one branch while merging a patch that\ndepends on that method in another.</p>\n</section>\n<section id=\"the-queue\" class=\"level2\">\n<h2>The queue</h2>\n<p>Adopting a rebase-and-merge policy is a possible solution — where you\nrebase and merge all patches one at a time.</p>\n<p>But processing a queue in serial is slow and won’t scale up as you\nadd more developers.</p>\n</section>\n<section id=\"speculative-future-state\" class=\"level2\">\n<h2>Speculative future state</h2>\n<p>By enqueuing patches to rebase-and-merge, you know what the codebase\nwill look like after each patch is merged. That work can be done before\nyou test and before you merge.</p>\n<p>At the end of last year, GitHub introduced the <a\nhref=\"https://github.blog/changelog/2021-10-27-pull-request-merge-queue-limited-beta/\">Merge\nQueue</a>, a mirror of GitLab’s (premium-tier only) <a\nhref=\"https://about.gitlab.com/blog/2020/12/14/merge-trains-explained/\">Merge\nTrains</a> feature to do exactly this.</p>\n<p>You can put your merge requests into a queue to be merged. Each merge\nrequest in the queue is combined with the merge requests in front of it.\n<strong>It then runs its tests as if it had already merged</strong>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/2022-02-18_merging-models.png\"\nalt=\"The Merge Queue\" />\n<figcaption aria-hidden=\"true\">The Merge Queue</figcaption>\n</figure>\n<p>We can run the tests for all patches in the queue in parallel.\nWaiting to merge each patch until all the patches in front of it pass\ntheir tests.</p>\n<p>If a patch fails, we remove it and re-run the tests for all the\npatches behind it in the queue—it’s not rocket science!</p>\n<p>This is how the Merge Queue and the Merge Train work today.</p>\n</section>\n<section id=\"multiply-by-𝑛\" class=\"level2\">\n<h2>Multiply by 𝑛</h2>\n<p>One of my former colleagues was fond of saying:</p>\n<blockquote>\n<p>The only numbers that matter in computer science are 0, 1, and 𝑛.</p>\n</blockquote>\n<p>The “not rocket science” problem gets more complicated when a\nproduction build is composed of 𝑛 repos.</p>\n<p>At my work, we’ve yet to embrace the monorepo trend 😬. The result is\na release to production composed of roughly 200 different repositories –\nsome of which depend on one another in an ever-spidering graph of\nmaddening dependencies.</p>\n</section>\n<section id=\"a-merge-queue-of-merge-queues\" class=\"level2\">\n<h2>A merge queue of merge queues</h2>\n<p>In 2012, the <a href=\"https://opendev.org/\">Openstack Infrastructure\nteam</a> started work on <a\nhref=\"https://opendev.org/zuul/zuul/commit/ee743613ce5b3aee11d12e91e932d7876bc0b40c\">Zuul</a>.\nWhat’s unique about Zuul is that it can assure that a build works, even\nwhen it’s composed of several repositories.</p>\n<p>Zuul maintains what it calls “dependent pipelines.” Dependent\npipelines can ensure merge requests across multiple repos get tested and\nmerged together as if they were part of a single Merge Queue – <strong>a\nmerge queue of merge queues</strong>.</p>\n<p>Today it’s a decade after development began on Zuul — more than two\ndecades after Graydon Hoare built his CI system. And the most prominent\nand best-funded software forges in the history of humanity are pretty\ngosh darn close to catching up.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/01/27/on-the-term-blameless-postmortem/",

    "title": "On the term &#x201C;Blameless Postmortem&#x201D;",
    "url": "https://tylercipriani.com/blog/2022/01/27/on-the-term-blameless-postmortem/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-01-27T19:04:31Z",
    "date_modified": "2022-02-10T20:11:58Z",


    "content_html": "<blockquote>\n<p>A <em>term</em> is not a <em>word</em> […] a term is a word\n<strong>used unambiguously</strong></p>\n<p>Mortimer J Adler, <u>How to Read a Book</u></p>\n</blockquote>\n<p>I identify with a seeming minority who believe words have meaning.\nAnd I have problems with the software industry term <strong>blameless\npostmortem</strong>.</p>\n<p>Software engineers love to scrutinize terms. Variable names are\n(rightfully, I believe) an endless topic of debate. There’s even an\naphorism explaining this aspect of software: the two hardest problems in\ncomputer science are cache invalidation and naming things (and\noff-by-one errors 😂).</p>\n<p>The problem is that <strong>terms help us model reality</strong>. As\nthe saying goes: all models are wrong, some are useful. And if a term\nleads you to an incorrect model, it ceases to be useful. The term\n<strong>blameless postmortem</strong> carries some baggage that puts it\nat odds with its goals as a term.</p>\n<section id=\"what-is-a-blameless-postmortem\" class=\"level2\">\n<h2>What is a blameless postmortem?</h2>\n<blockquote>\n<p>A postmortem is a written record of an incident, its impact, the\nactions taken to mitigate or resolve it, the root cause(s), and the\nfollow-up actions to prevent the incident from recurring.</p>\n<p>– Postmortem Culture: Learning from Failure, <u>Site Reliability\nEngineering</u></p>\n</blockquote>\n<p><strong>If you’re doing things, you’ll eventually break\nsomething</strong>.</p>\n<p>A blameless postmortem is a document recounting what you broke, how\nyou fixed it, and what tripped you up and made you break it. The goal is\nto fix whatever made you break it in the first place.</p>\n<p>In a complex system, the cause of a problem is far from obvious.\nToyota famously developed the <a\nhref=\"https://en.wikipedia.org/wiki/Five_whys\">Five Whys</a> method of\nproblem investigation to traverse the layers of causality to find the\nunderlying cause of a problem.</p>\n<p>The practice of the blameless postmortem is excellent. The term\nblameless postmortem could use some improvement.</p>\n</section>\n<section id=\"the-negation-of-𝑥-implies-𝑥\" class=\"level2\">\n<h2>The negation of 𝑥 implies 𝑥</h2>\n<p><strong>“Blameless” implies “blame.”</strong></p>\n<p><em>Apophasis</em> is a term in rhetoric that I just learned, wherein\na speaker denies a topic should be brought up so they can bring it up.\nIt’s like when you say, “I don’t care what anyone says, I like you.”</p>\n<p>By calling the process of finding the root cause of an incident\n“blameless,” it’s tantamount to: “I don’t care that everyone blames you;\nI want to know the real cause.”</p>\n<p>It feels a little hostile right from the start.</p>\n</section>\n<section id=\"postmortem-is-macabre\" class=\"level2\">\n<h2>Postmortem is macabre</h2>\n<p>The earliest definition of “postmortem” is still in use: <strong>“an\nexamination of a body after death to determine the cause of death”<a\nhref=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>.</strong></p>\n<p>This definition is a pretty heavy thing to lay on someone who’s\nalready sheepish about breaking the website. Especially combined with\nthe term “blameless.”</p>\n<p>It’s like saying: “We can all agree you basically killed somebody,\nand even though others believe you’re to blame, I know you’re probably\nmaybe innocent.”</p>\n</section>\n<section id=\"feature-not-a-bug\" class=\"level2\">\n<h2>Feature, not a bug</h2>\n<p>I get that <strong>sometimes we need to be reminded that the goal is\nnot to place blame</strong> and that sometimes it’s worth being\nexplicit. But I think that becomes a problem when it’s at odds with its\nown goals, as I believe the term “blameless” is.</p>\n<p><strong>Postmortem has also come to mean “following the\nevent.”</strong> Language evolves. But language is also laden with\nhistorical use, and that history, too, can muddy our meaning.</p>\n<p>I’ll admit the term “blameless postmortem” is useful as it represents\na shared idea. But I still think <strong>we could develop a term that is\na better fit for our goals</strong>.</p>\n<p>After digging in a thesaurus for a few minutes, I’ve landed at\n“Disquisition.”</p>\n<pre><code>(/^ヮ^)/*:・ﾟ✧ dict disquisition\n1 definition found\n\nFrom The Collaborative International Dictionary of English v.0.48 [gcide]:\n\n  Disquisition \\Dis`qui*si&quot;tion\\, n. [L. disquisitio, fr.\n     disquirere to inquire diligently, investigate; dis- +\n     quaerere to seek. See {Quest}.]\n     A formal or systematic inquiry into, or discussion of, any\n     subject; a full examination or investigation of a matter,\n     with the arguments and facts bearing upon it; elaborate\n     essay; dissertation.\n     [1913 Webster]\n  \n           For accurate research or grave disquisition he was not\n           well qualified.                          --Macaulay.\n     [1913 Webster]</code></pre>\n<p>And the only connotation I can attribute to that term is:\n<strong>“Nobody expects a software disquisition!”</strong> which is\nclearly free of any negative historical baggage.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p><a\nhref=\"https://www.merriam-webster.com/dictionary/postmortem\"\nclass=\"uri\">https://www.merriam-webster.com/dictionary/postmortem</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2022/01/18/job-interviews-by-zombies/",

    "title": "Job Interviews By Zombies",
    "url": "https://tylercipriani.com/blog/2022/01/18/job-interviews-by-zombies/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2022-01-18T22:43:01Z",
    "date_modified": "2022-01-19T00:09:49Z",


    "content_html": "<p>The golden rule of interviewing is: <strong>make yourself easy to\nhire</strong>.</p>\n<p>Like many organizations at the moment, <a\nhref=\"https://wikimediafoundation.org/about/jobs/\">we’re hiring</a>. As\nI’m interviewing people, I’m struck by how hard some folks make it for\nme to give them a “yes.”</p>\n<p>Candidates tend to murmur things like, “we decided to move to\nKubernetes” or “the team built a release pipeline.” Bromides like these\nmake me wonder – what exactly did <strong>you</strong> (the candidate)\ndo?</p>\n<blockquote>\n<p>[Often in an interview, a candidate’s] answers are about “we”, “us”,\nand “the team.” The interviewer walks away having little idea what the\ncandidate’s actual impact was and might conclude that the candidate did\nlittle</p>\n<p>– Gale Laakmann McDowell, <u>Cracking the Coding Interview</u></p>\n</blockquote>\n<section id=\"when-youre-humble-youre-hard-to-hire\" class=\"level2\">\n<h2>When you’re humble, you’re hard to hire</h2>\n<p>Being humble is an admirable trait. When candidates succumb to words\nlike “team” and “we” and “us,” it’s possible they’re just being humble.\nBut it’s also reasonable to conclude that the word “I” is absent from\ntheir pat answers because they didn’t actually do anything.</p>\n<p>I’m compelled to press candidates, “what was your role in that\nproject?” I have many questions I’d love to ask, and I don’t relish\nusing our short time together asking questions to clarify vagaries.\n<strong>You’re easier to hire when I know what you did</strong>.</p>\n</section>\n<section id=\"take-the-blame-take-the-credit\" class=\"level2\">\n<h2>Take the blame? Take the credit</h2>\n<p>If you’re not the kind of person who shifts blame when things go\nwrong, then <strong>why shift the blame when things have gone\nright</strong>? Writers and speakers use the <em>passive voice</em> to\nhide who’s responsible for an action. “Mistakes were made” rather than\n“I made a mistake.”</p>\n<p>An easy trick to detect the passive voice in writing is to inject the\nphrase “by zombies” after the verb:</p>\n<p>Like: “Mistakes were made <em>by zombies</em>.”</p>\n<p>Or: “The ball was thrown <strike>by the boy</strike> <em>by\nzombies</em>.”</p>\n<p>There must be a corollary rule for job interviews.</p>\n</section>\n<section id=\"just-say-i-the-unaccountable-zombie-rule-of-interviewing\"\nclass=\"level2\">\n<h2>Just say I: the unaccountable zombie rule of interviewing</h2>\n<p>You’re making it hard to hire you if you’re talking about the\nunaccountable zombies you worked with: “<strike>We</strike> <em>The\nunaccountable zombies I worked with</em> decided it was more sensible to\nuse boring technologies, so <strike>we</strike> <em>the unaccountable\nzombies I worked with</em> went with MySQL.”</p>\n<p>Just as I’d have to stop the interview to inquire, “I’m sorry, did\nyou say <em>the team of unaccountable zombies you worked with</em>?” I’d\nhave to stop the interview to clarify, “who exactly is <em>we</em>?”</p>\n<p>The not-so-secret secret of hiring is: <strong>I want to hire\nyou.</strong> I’m interviewing you after all—you must be one singular\nhuman being!</p>\n<p>If you agree, just say “I.”</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/12/31/useful-photography-for-beginners/",

    "title": "Useful photography for beginners",
    "url": "https://tylercipriani.com/blog/2021/12/31/useful-photography-for-beginners/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2021-12-31T22:40:12Z",
    "date_modified": "2021-12-31T23:41:18Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/cf/be61bb9611742b0927b9683697795a/large.jpg\"\nalt=\"❄️ Snowflake macro photo (Tyler Cipriani — CC-BY-SA-4.0 — Original)\" />\n<figcaption aria-hidden=\"true\">❄️ Snowflake macro photo (Tyler Cipriani\n— CC-BY-SA-4.0 — <a\nhref=\"https://tylercipriani.com/photos/snowflake-macro/\">Original</a>)</figcaption>\n</figure>\n<blockquote>\n<p>The implicit agreement [of social media] is that in return for\nreceiving (for the most part, undeserved) attention from your friends\nand followers, you’ll return the favor by lavishing (similarly\nundeserved) attention on them. <strong>You “like” my status update and\nI’ll “like” yours.</strong></p>\n<p>– Cal Newport, <em>Deep Work</em></p>\n</blockquote>\n<p>Nobody cares about most of your photos on social media. Sure, likes\nand social updoots are gratifying, and documenting your life may be\nuseful in some sense, but that’s not what I mean when I call a photo\n<em>useful</em>.</p>\n<p>Useful photos abstract ideas and subjects. Researchers, journalists,\nand encyclopedia authors push the boundaries of our understanding with\nuseful pictures. If this all sounds grandiose — it is, but it’s within\nreach of the dedicated amateur.</p>\n<p>This is a short guide to getting started taking useful pictures.</p>\n<section id=\"what-is-a-useful-picture\" class=\"level2\">\n<h2>What is a useful picture?</h2>\n<blockquote>\n<p>A great architect’s creative power […] lies in his capacity to\nobserve correctly and deeply.</p>\n<p>– Christopher Alexander, <em>A Timeless Way of Building</em></p>\n</blockquote>\n<p>A useful photograph is technically sound; focuses on a\n<strong>single</strong>, important subject; and makes its subject\nobvious. Most people will never create a useful picture because they\ndon’t have the know-how.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ce/27122f6fe08e3882e930b0bf6092e1/large.jpg\"\nalt=\"International Space Station solar transit (Tyler Cipriani — CC-BY-SA-4.0 — Original)\" />\n<figcaption aria-hidden=\"true\">International Space Station solar transit\n(Tyler Cipriani — CC-BY-SA-4.0 — <a\nhref=\"https://tylercipriani.com/photos/iss-solar-transit/\">Original</a>)</figcaption>\n</figure>\n<p>It’s easy to make a useful picture when you focus on your subject.\n<em>Focus</em> means picking a single subject and highlighting it.\nSocial media pictures aren’t useful because the subject is always\n<strong>both</strong>: <em>you and your subject</em>. <em>You</em> ate\ndal makhani vs. <em>this is</em> dal makhani. This subtle shift changes\na thousand little technical choices.</p>\n<p>A useful picture is the result of good technical choices (this is a\nsummary of the <a\nhref=\"https://commons.wikimedia.org/wiki/Commons:Image_guidelines\">Wikimedia\nCommons image guidelines</a>):</p>\n<ul>\n<li>The subject is in focus</li>\n<li>The subject is the most prominent thing in the image</li>\n<li>Depth of field (i.e., a blurred background) should have a purpose\n(e.g., to isolate the subject)</li>\n<li>You’ve appropriately lit your subject (avoid harsh light, ensure\nit’s light enough to see)</li>\n<li>The colors are natural, balanced, and attractive</li>\n<li>The exposure is correct; you don’t lose details in dark or light\nareas</li>\n<li>Distorted and blurred image areas should have a purpose (e.g., to\nshow motion) — if it looks wrong, it is wrong</li>\n<li>Digital image editing should make an image look more real, not more\nsurreal (use\n<a href=\"https://tylercipriani.com/blog/2021/06/29/commandline-hdr-image-processing/\">HDR</a>\nsparingly)</li>\n</ul>\n</section>\n<section id=\"how-to-buy-a-useful-camera\" class=\"level2\">\n<h2>How to buy a useful camera</h2>\n<p>First off, <strong>a useful camera is a camera</strong>, not a phone.\nBuy a camera. When a picture matters and people have a choice, they\nrarely choose to use a phone instead of a camera: presidential\nportraits, for example, are never shot using an iPhone.</p>\n<p>Featured Pictures are the best photos on Wikimedia Commons. At the\ntime of this writing, only 0.019% of the almost eight million pictures\non the site were “Featured Pictures”—the best of the best. I looked at\nmore than 12,000 of these pictures (you can find my <a\nhref=\"https://gitlab.com/thcipriani/wikimedia-commons-featured-exif\">database\nof EXIF data on GitLab</a>) you know how many were iPhoneography? Three.\nThese three:</p>\n<p><img\nsrc=\"https://photos.tylercipriani.com/thumbs/3f/c660c5d38e2d3748b297a779ee0db4/medium.jpg\"\nalt=\"Gulls on Morro Strand State Beach — CC-BY-2.0 by Mike Baird\" />\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/cc/2deed1de609558f7a8fd1ca87f2566/medium.jpg\"\nalt=\"Izvori na Crn Drim, Chun — CC-BY-SA-3.0 by Taskosmileski\" /> <img\nsrc=\"https://photos.tylercipriani.com/thumbs/ed/3c4bb35c265d0d94bef4c8e506bea2/medium.jpg\"\nalt=\"Celing of Wien Hauptbahnhof (Vienna Main Station), Austria 01 — CC-BY-SA-4.0 by Jules Verne Times Two\" /></p>\n<p>What do those three pictures have in common? Their subject is\nhuman-scaled; it fills the frame, is well illuminated, and is close to\nthem. If you’re dealing with subjects that don’t match those criteria,\nyour phone picture probably won’t be useful.</p>\n<p>For example, try to take a picture of any of the following on your\nsmartphone (without any extra equipment):</p>\n<ul>\n<li>A fly, super up-close</li>\n<li>The moon or the stars</li>\n<li>A bird in a tree</li>\n<li>A mountain in the distance</li>\n</ul>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/wikimedia-commons-camera-make-barchart.png\"\nalt=\"Wikimedia Commons Featured Pictures by camera make — smartphones are poorly represented (Original data)\" />\n<figcaption aria-hidden=\"true\">Wikimedia Commons Featured Pictures by\ncamera make — smartphones are poorly represented (<a\nhref=\"https://gitlab.com/thcipriani/wikimedia-commons-featured-exif\">Original\ndata</a>)</figcaption>\n</figure>\n<p>The characteristics of a good camera:</p>\n<ul>\n<li>Interchangeable lenses</li>\n<li>Manual mode</li>\n<li>Intervalometer (either built-in or sold separately)</li>\n</ul>\n<p>You don’t need a top-of-the-line camera to take a useful picture. The\n<a\nhref=\"https://gitlab.com/thcipriani/wikimedia-commons-featured-exif\">data\nI collected about Featured Pictures</a> confirms this. You can find a\ncamera matching these criteria for about $100, used. The most popular\nNikon in the data (the d5200) is available on eBay for about $150, and\nits predecessor, the d5100, is even more affordable. A Canon 500d (also\npopular in the data) is less than $100, lens included. These cameras are\na good starting point for beginners.</p>\n</section>\n<section id=\"edit-your-photos\" class=\"level2\">\n<h2>Edit your photos</h2>\n<p>In the book <em>Atomic Habits</em>, author James Clear tells the\nstory of photography teacher Jerry Uelsmann’s experiment with his class\nat the University of Florida:</p>\n<blockquote>\n<p>Everyone on the left side of the classroom, he explained, would be in\nthe “quantity” group. They would be graded solely on the amount of work\nthey produced. […] Meanwhile, everyone on the right side of the room\nwould be in the “quality” group. They would be graded only on the\nexcellence of their work. […] At the end of the term, he was surprised\nto find that all the best photos were produced by the quantity\ngroup.</p>\n<p>– James Clear, <em>Atomic Habits</em></p>\n</blockquote>\n<p>The point of the story is deliberate practice produces results. You\nmight think this means if you take <strong>more</strong> photos, you’ll\ntake <strong>better</strong> photos. But the students in the class\nweren’t only taking pictures; they submitted these pictures and got\nfeedback on them.</p>\n<p>When I first started photography, I spent a lot of time focusing on\nquantity (and I still do, according to\n<code>exiftool -ShutterCount</code>, I took 3,100 pictures between Nov\n2020 and Nov 2021). But you should practice creating final, edited\nimages to the best of your ability, too. Still, you’ll need honest\nfeedback to improve.</p>\n<p>I’ve received honest feedback whenever I nominate my pictures for\neither <a\nhref=\"https://commons.wikimedia.org/wiki/File:Neue_Burg,_Hofberg_Palace,_Vienna_Austria.jpg\">Quality\nImage</a> or <a\nhref=\"https://commons.wikimedia.org/wiki/Commons:Featured_picture_candidates/File:Flatirons_Sunrise.jpg/2\">Featured\nPicture</a> on Wikimedia Commons. The process is very impartial (and\noften demoralizing), but when persnickety strangers on one of the\nlargest photo websites in the world agree your image is useful: it\nprobably is.</p>\n</section>\n<section id=\"more-resources\" class=\"level2\">\n<h2>More resources</h2>\n<ul>\n<li><a href=\"https://sites.google.com/site/marclevoylectures/home\">Marc\nLevoy’s lectures on Digital Photography</a> – The best resource I’ve\nfound for learning about photography</li>\n<li><a href=\"https://clarkvision.com/index.html\">clarkvision.com</a> –\nGalleries, articles, and reviews on photography and science</li>\n<li><a\nhref=\"https://www.youtube.com/channel/UCole_tveH6goOzP8jJ_NAXg\">Ted\nKinsman’s YouTube</a> – Too short, but great content, “scientific\nphotography”</li>\n<li><strong>🎉 BONUS</strong> <a\nhref=\"https://chaoticmind75.blogspot.com/2013/08/my-technique-for-snowflakes-shooting.html\">Snowflake\nmacro photography</a></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/12/01/lessons-from-seven-years-of-remote-work/",

    "title": "Lessons from seven years of remote work",
    "url": "https://tylercipriani.com/blog/2021/12/01/lessons-from-seven-years-of-remote-work/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2021-12-01T01:55:53Z",
    "date_modified": "2021-12-01T03:46:44Z",


    "content_html": "<blockquote>\n<p>The inspiration for this post is <a\nhref=\"https://filipin.eu/working-remotely\">Željko Filipin</a>’s post on\nthe same topic.</p>\n</blockquote>\n<p>Nobody worked remotely during the pandemic, but everybody worked from\nhome.</p>\n<p>During the pandemic, office workers had to adjust to working out of\ntheir homes. But remote work is different: you’re not working from home,\nnecessarily; you’re working while seperated from a lively, in-person\noffice. You might be in the same city as your co-workers or on the other\nside of the world.</p>\n<p>When you’re physically disconnected from your colleagues, you have to\nbuild new skills and adapt your tactics. This is advice I wish I’d had\nseven years ago when I started working remotely.</p>\n<section id=\"asynchronous-communication\" class=\"level2\">\n<h2>Asynchronous communication</h2>\n<p>Office workers have the luxury of hallway conversations. In an\nin-person office, getting feedback takes mere minutes. But in a remote\nwork position where you may be on the other side of the planet,\ncommunication may take overnight.</p>\n<p>To be effective, you need to master asynchronous communication. This\nmeans:</p>\n<ul>\n<li>Know how to <a\nhref=\"https://matt.might.net/articles/how-to-email/\">send and reply to\nemail</a></li>\n<li>Know how to <a\nhref=\"http://catb.org/~esr/faqs/smart-questions.html\">ask smart\nquestions</a></li>\n<li>People may opt to use chat systems (slack/IRC)\n<strong>asynchronously</strong> — adjust your expectations\naccordingly.</li>\n<li>Minimize the amount of back-and-forth\n<ul>\n<li>Try to anticipate and respond to questions</li>\n<li>Don’t send <a href=\"https://nohello.net/\">contentless pings</a></li>\n<li><a href=\"https://tylercipriani.com/blog/2021/10/31/what-i-learned-about-writing-as-a-new-engineering-manager/\">Write\nwell</a></li>\n</ul></li>\n</ul>\n</section>\n<section id=\"timezones-suck\" class=\"level2\">\n<h2>Timezones suck</h2>\n<p>I wish this section was as simple as saying: use UTC for everything,\nbut it’s never that easy. You should definitely give meeting times to\npeople in UTC, but you should tie meetings to a local timezone. The\nalternative is that your meetings shift by an hour twice a year due to\ndaylight savings.</p>\n<p>This all gets more complicated the more countries you have\ninvolved.</p>\n<p>While the United States ends daylight savings time on the first\nSunday in November, many countries in Europe end daylight savings on the\nlast Sunday in October, creating a <strong>daylight confusion\ntime</strong>.</p>\n<p>During daylight confusion time, meetings made by Americans may shift\nby an hour for Europeans and vice-versa.</p>\n<p>I think the only thing to learn from this section is: you’ll mess it\nup.</p>\n</section>\n<section id=\"space-and-nice-tools\" class=\"level2\">\n<h2>Space and Nice tools</h2>\n<blockquote>\n<p>Function often follows form. Give yourself a context for capturing\nthoughts, and thoughts will occur that you don’t yet know you have</p>\n<p>– David Allen, Getting Things Done</p>\n</blockquote>\n<p>Working from the kitchen table is unsustainable for your mental\nhealth and your back. You need a space that’s primary function is your\nwork, and that space needs to have tools that are a joy to use.</p>\n<p>Splurge a bit on tools you’ll use every day: your chair, keyboard,\nmonitor, headphones, webcam, and microphone. These purchases quickly\nfade into the background of your life. Still, if you ever have to work\noutside your home office again, you’ll realize how these tools enable\nyour best work.</p>\n<p>Buy a nice notebook, and don’t be afraid to absolutely destroy it. I\nprefer the <a href=\"https://www.leuchtturm1917.us/\">Leuchtturm 1917</a>\nnotebooks, but I’m currently trying out the <a\nhref=\"https://www.jetpens.com/JetPens-Tomoe-River-52-gsm-Kanso-Noto-Notebook-A5-Dot-Grid-Black/pd/29704\">JetPen’s\nTomoe River 52 gsm Kanso Noto Notebook</a>. Writing is thinking, and\nyou’ll find your thinking is sharper if you start with pen-and-paper\nfirst.</p>\n<blockquote>\n<p>“The beginning of wisdom,” according to a West African proverb, “is\nto get you a roof.”</p>\n<p>– Annie Dillard, The Writing Life</p>\n</blockquote>\n<p>The most important property of your permanent workspace is that it\nhas ample and appropriate light for video calls.</p>\n<p>Apart from that, I prefer having a door, but then again, I have a dog\nand a cat, so your mileage may vary.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/10/31/what-i-learned-about-writing-as-a-new-engineering-manager/",

    "title": "Writing Skills for Engineering Managers",
    "url": "https://tylercipriani.com/blog/2021/10/31/what-i-learned-about-writing-as-a-new-engineering-manager/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2021-10-31T17:54:44Z",
    "date_modified": "2021-11-02T13:28:45Z",


    "content_html": "<blockquote>\n<p>Managers at every level are prisoners of the notion that a simple\nstyle reflects a simple mind. Actually a simple style is the result of\nhard work and hard thinking</p>\n<p>– William Zinsser, <em>On Writing Well</em></p>\n</blockquote>\n<p>Every software engineering manager’s most precious resource is time.\nBut you wouldn’t know it from reading our emails–bloated screeds of\nbusiness buzzwords we expect our engineers to decipher.</p>\n<p>If you lead a team and you value their time, then demonstrate it\nthrough lean and confident writing. Below you will find guidelines to\nhelp hone your writing skill.</p>\n<section id=\"have-a-point\" class=\"level2\">\n<h2>1️⃣ Have a point</h2>\n<p>Make sure you have something to say before you write.</p>\n<p>Corporate-speak will write your email for you unless you remain\nvigilant<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\" id=\"fnref1\"\nrole=\"doc-noteref\"><sup>1</sup></a>. Jargon lulls the writer into the\nfalse belief they’ve said something precise while your reader may wonder\nwhether you’ve said anything at all.</p>\n<p>Be direct and start your draft with the purpose of the email. <em><a\nhref=\"https://www.worldcat.org/title/writing-that-works/oclc/671811690\">Writing\nThat Works</a></em> by Roman and Raphaelson offers this advice:\n<strong>try writing what you want to say as if you’re talking\nface-to-face</strong>. Don’t worry if your first draft sounds too\ncasual. You can always wrap your plain language in the requisite\nbusiness shibboleths later.</p>\n</section>\n<section id=\"keep-it-short\" class=\"level2\">\n<h2>2️⃣ Keep it short</h2>\n<blockquote>\n<p>Write as if you were dying. At the same time, assume you write for an\naudience consisting solely of terminal patients.</p>\n<p>– Annie Dillard, <em>The Writing Life</em></p>\n</blockquote>\n<p>Everything you write is too long.</p>\n<p>People reading your emails aren’t fans of your writing—they’re trying\nto get through their email.</p>\n<p>When you’ve finished writing your email, use Stephen King’s equation\nfrom <em><a\nhref=\"https://www.worldcat.org/title/on-writing-a-memoir-of-the-craft/oclc/1268486503\">On\nWriting</a></em>: “<strong>2nd Draft = 1st Draft – 10%</strong>.” Your\nwriting will be more effective.</p>\n</section>\n<section id=\"make-it-easy\" class=\"level2\">\n<h2>3️⃣ Make it easy</h2>\n<blockquote>\n<p>All visually displayed text involves typography</p>\n<p>– Matthew Butterick, <a\nhref=\"https://practicaltypography.com/\">Butterick’s Practical\nTypography</a></p>\n</blockquote>\n<p>Appropriate typography and thoughtful information architecture make\nyour email easier to parse. <strong>It’s not enough for your email to\n<u>be</u> easy to read; it’s got to <u>look</u> easy to\nread</strong>.</p>\n<p>Researchers at the University of Michigan gave student test subjects\ntwo identical sets of instructions: one in a hard-to-read font and one\nin an easy-to-read font.</p>\n<p>Despite the steps being identical, the student’s predictions of the\ndifficulty of the tasks differed. Students believed the less\nintelligible instructions described a more daunting task. The author’s\nconclusion is the title of their study: “<a\nhref=\"https://doi.org/10.1111/j.1467-9280.2008.02189.x\">If it’s Hard to\nRead, It’s Hard to Do</a>.”</p>\n<p>Break up long text with headings. Keep your paragraphs short. Use\nbullet points and short sentences to make your text look less\nintimidating and easier to read.</p>\n<figure>\n    <img src=\"https://photos.tylercipriani.com/thumbs/3d/fbcde6282071435a756eb899095f04/xlarge.jpg\" alt=\"A squint test of encyclopedia article vs. a popular article.\">\n    <figcaption>\n        <p>\n            <strong>Squint test</strong>: Compare the shape of the first three paragraphs of a\n            <a href=\"https://www.nytimes.com/2008/11/05/us/politics/05campaign.html\">popular article</a> about Barack Obama with the first three paragraphs of Barack Obama\'s\n            <a href=\"https://en.wikipedia.org/wiki/Barack_Obama\">Wikipedia entry</a>.\n        </p>\n        <p>\n             Professional writers know to make it easy for their readers—the first paragraph on the left is a single sentence.\n        </p>\n</figcaption>\n</figure>\n</section>\n<section id=\"make-it-pretty\" class=\"level2\">\n<h2>4️⃣ Make it ✨pretty✨</h2>\n<p>I know. Emojis 🙄.</p>\n<p>In her book <em><a\nhref=\"https://www.worldcat.org/title/because-internet-understanding-how-language-is-changing/oclc/1155805797\">Because\nInternet</a></em>, author and linguist Gretchen McCulloh posits that\npeople embraced emojis because they add body language to our writing.\nThe first two sentences of this section are an example of how emojis\nsuccinctly convey emotion.</p>\n<p><strong>Emojis help people process the shape of your text at a\nglance</strong>. I use emojis to lead the eye through a text. Emojis are\nprecognitive signposts you can use to reinforce the meaning of your\nwriting.</p>\n<p>Emojis can’t substitute for substance, but they can help make your\ntext easier for your readers.</p>\n<p>I ❤️ the judicious use of emojis.</p>\n</section>\n<section id=\"further-reading\" class=\"level2\">\n<h2>Further Reading</h2>\n<ul>\n<li><a\nhref=\"https://www.worldcat.org/title/elements-of-style/oclc/427254568\">The\nElements of Style</a> – The essential text for improving your\nwriting.</li>\n<li><a\nhref=\"https://www.worldcat.org/title/on-writing-well-the-classic-guide-to-writing-nonfiction/oclc/956385274\">On\nWriting Well</a> – An extended remix of <em>Elements of Style</em> with\nspecific chapters on writing for business.</li>\n<li><a href=\"http://www.howtomakesenseofanymess.com/\">How to Make Sense\nof Any Mess</a> – Found via the <a\nhref=\"https://www.writethedocs.org/book-club/index.html\">Write the Docs\nBook Club</a> (another great resource). Tips to improve your information\narchitecture.</li>\n<li><a href=\"https://practicaltypography.com/\">Butterick’s Practical\nTypography</a> – Your readers should judge you by your ideas, not your\ntypography.</li>\n</ul>\n</section>\n<section id=\"software\" class=\"level2\">\n<h2>Software</h2>\n<ul>\n<li><a href=\"https://hemingwayapp.com/\">Hemingway Editor</a> –\nIn-browser editor that points out problems like overuse of adverbs and\npassive voice.</li>\n<li><a href=\"https://www.grammarly.com\">Grammarly</a> – I pay $60\nquarterly for this. I don’t use the browser extension since that seems\nlikely to send every plain text field I fill in my browser to their\nservers. I don’t trust this service with my data, but I do like this\nservice.</li>\n</ul>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p>Orwell said in “Politics and the\nEnglish Language”: jargon will “construct your sentences for you—even\nthink your thoughts for you, to a certain extent.”<a href=\"https://tylercipriani.com/blog/#fnref1\"\nclass=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/08/31/the-deployment-fidelity-problem/",

    "title": "The Deployment Fidelity Problem",
    "url": "https://tylercipriani.com/blog/2021/08/31/the-deployment-fidelity-problem/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2021-08-31T00:11:51Z",
    "date_modified": "2021-08-31T13:32:05Z",


    "content_html": "<blockquote>\n<p>The most important problem that we face as software professionals is\nthis: If somebody thinks of a good idea, how do we deliver it to users\nas quickly as possible?</p>\n<p>– Continuous Delivery</p>\n</blockquote>\n<p>Production is a low-fidelity version of your codebase. Many\ndeployment metrics are just a highfalutin way to measure the\n<em>fidelity of your production</em>.</p>\n<section id=\"audio-fidelity\" class=\"level2\">\n<h2>Audio fidelity</h2>\n<p>Digital music fidelity gauges <a\nhref=\"https://en.wikipedia.org/wiki/Zero-order_hold\">the faithfulness of\na digital recording to its analog source</a>. The analog source—a piano,\nsay—is a <em>continuous signal</em>. The digital copy—an audio CD, an\nmp3, or an Ogg—samples that signal at 44.1KHz—a <em>discrete\nsignal</em>.</p>\n<figure>\n<img title=\"Zero-order hold signal processing\" src=\"https://photos.tylercipriani.com/thumbs/ca/f9f77484018c90d967eb5da3ce3421/original.svg\" alt=\"Zero-order hold DAC processing\">\n<figcaption>\n    <p>\n        Discrete digital sampling of a continuous analog signal\n    </p>\n</figcaption>\n</figure>\n</section>\n<section id=\"deployment-fidelity\" class=\"level2\">\n<h2>Deployment fidelity</h2>\n<p>Your main branch is like a soundwave—it carries changes and changes\nrapidly—it’s a continuous signal. Your production environment is like an\nmp3—it carries forward a single sample until your next deployment—it’s a\ndiscrete signal—it’s a single\n<a href=\"https://tylercipriani.com/blog/2016/03/21/Visualizing-Git-Merkle-DAG-with-D3.js/\">SHA1 in\nthe merkle DAG</a> of your main branch.</p>\n<figure>\n<img title=\"Deployment fidelity\" src=\"https://photos.tylercipriani.com/thumbs/f2/e5e1f91095c4c7989ef003c3c8af11/original.svg\" alt=\"Zero-order hold deployment\">\n<figcaption>\n    <p>\n        Discrete production sampling of a continuous stream of commits to the main branch\n    </p>\n</figcaption>\n</figure>\n<p>Everyone at Wikimedia (myself included) devoured <a\nhref=\"https://www.worldcat.org/title/accelerate-the-science-behind-devops-building-and-scaling-high-performing-technology-organizations/oclc/1104206968\"><em>Accelerate</em></a>—it\nwill frame discussions at the Wikimedia Foundation for years. The theme\nof the book is continuous deployment driving organizational change.</p>\n<p>In the book, however, the authors advocate for tracking both\n<em>change lead time</em> and <em>deployment frequency</em>. But I don’t\nget the point of measuring both: they’re two ways of looking at the same\nthing. If you have a shorter lead time, your deployment frequency is\nhigher. If your deployment frequency is higher, you have a shorter\nchange lead time—potato/potato.</p>\n<p>There are many ways to measure deployment fidelity: the time it takes\nfor a change in mainline to reach production, the number of deployments\nper month, or the number of changes bundled into a deployment. These are\nall measures of the speed at which you deliver value to users. Pick\none—not all—to be your North star.</p>\n<figure>\n<img title=\"Deployment metrics\" src=\"https://photos.tylercipriani.com/thumbs/71/ebac971f62343e9dd7c2e35fba4e40/original.svg\" alt=\"Deployment metrics\">\n<figcaption>\n    <p>\n        Various metrics gauging deployment fidelity\n    </p>\n</figcaption>\n</figure>\n</section>\n<section id=\"continuous-deployment\" class=\"level2\">\n<h2>Continuous deployment</h2>\n<p>Continuous deployment is the highest fidelity deployment.</p>\n<p>High-fidelity audio is lossless, and high-fidelity deployment is\ncontinuous. The best deployments sling out individual production changes\nby themselves within minutes of merging to the main branch. This is\ncontinuous deployment, and this is the right way to deploy code.</p>\n<figure>\n<img title=\"Continuous deployment\" src=\"https://photos.tylercipriani.com/thumbs/ab/409de44c45942de85ceb26cc661ed4/original.svg\" alt=\"Continuous deployment\">\n<figcaption>\n    <p>\n        Continuous deployment is the highest fidelity deployment\n    </p>\n</figcaption>\n</figure>\n<p>Deploying every change individually right when they merge means your\nlead time is only limited by your deployment tooling—the fastest it can\nbe. Your batch size is always 1—the lowest it can be. Your deployment\nfrequency is <code>1*commits</code>—the highest it needs to be.</p>\n<p>Sometimes things aren’t ideal. If your deployment tool cranks out one\nchange every 10 minutes, you’re capped at 144 changes in a day—if you’re\n<a\nhref=\"https://en.wikipedia.org/wiki/History_of_Facebook\">TheFacebook</a>\nthen maybe that’s not good enough, and you’re forced to batch changes,\n<a\nhref=\"https://research.fb.com/wp-content/uploads/2016/11/development-and-deployment-at-facebook.pdf\">as\nFacebook has in the recent past</a>.</p>\n</section>\n<section id=\"why-deployment-fidelity-matters\" class=\"level2\">\n<h2>Why deployment fidelity matters</h2>\n<p>This is important because <a\nhref=\"https://speakerdeck.com/charity/cd?slide=20\">“software doesn’t age\nlike wine; it ages like milk.”</a> Developers can only juggle so many\nproblems at the same time. If you have a high-fidelity production, then\nthe picture in the developer’s mind matches production. If not, then\ndeveloper assumptions don’t hold. When software languishes undeployed,\ndevelopers lose their context and, with it, the ability to solve\nproduction issues caused by their code.</p>\n<blockquote>\n<p>The longer the release cycle, the longer the development team has to\nmake incorrect assumptions before the deployment occurs, and the longer\nit will take to fix them</p>\n<p>– Continuous Delivery</p>\n</blockquote>\n<p>Think of the developers. Deploy continuously.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/07/25/code-review-is-work/",

    "title": "Code Review is Work",
    "url": "https://tylercipriani.com/blog/2021/07/25/code-review-is-work/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2021-07-25T18:58:07Z",
    "date_modified": "2021-07-25T21:37:32Z",


    "content_html": "<p>Software companies have tried to measure productivity with time\ntracking, counting closed bugs, and, infamously, by <a\nhref=\"https://www.folklore.org/StoryView.py?story=Negative_2000_Lines_Of_Code.txt\">counting\nlines of code</a>. But what are organizations doing about the time\ndevelopers lose waiting for code review?</p>\n<p>As an industry, we obsess over the <a\nhref=\"https://softwareengineering.stackexchange.com/questions/179616/a-good-programmer-can-be-as-10x-times-more-productive-than-a-mediocre-one\">10x\ndeveloper</a> and ignore small changes to improve the productivity of\nevery developer. One small change: <strong>treat code reviews like\nwork</strong>.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/make-time-for-code-review.png\"\nalt=\"Make time for code review\" />\n<figcaption aria-hidden=\"true\">Make time for code review</figcaption>\n</figure>\n<section id=\"studies-from-the-trenches\" class=\"level2\">\n<h2>Studies from the trenches</h2>\n<p>An IEEE study titled <a\nhref=\"https://ieeexplore.ieee.org/abstract/document/7950877\">“Code\nReviewing in the Trenches”</a> by researchers at Microsoft found code\nauthors aren’t getting timely reviews, and code reviewers aren’t given\nenough time to do the reviews they’re assigned. This is a problem.</p>\n<p>In 2013, Peter Rigby and Christian Bird—both empirical software\nengineering researchers—found <a\nhref=\"https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/rigby2013convergent.pdf\">similar\nmedian review times</a> among projects as varied as Google’s Chromium\nand Microsoft’s Office suite. Compared with the outdated industrial\nprocess of <a\nhref=\"https://en.wikipedia.org/wiki/Fagan_inspection\"><em>software\ninspection</em></a>, their study’s modern code review practices were\nfaster, easier, and less formal. Software inspection took 10 days to\nreview a change; <strong>projects in their study took one day to review\na change</strong>.</p>\n<p>In 2018, <a href=\"https://research.google/pubs/pub47025/\">Google\ncompared Rigby and Bird’s findings with review data from inside their\ncompany</a>. Among their findings, they discovered reviews inside Google\nwere considerably faster than the reviews from Rigby and Bird’s\nstudy—<strong>the median time to review code inside Google was about an\nhour</strong>.</p>\n</section>\n<section id=\"organizations-enable-timely-code-review.\" class=\"level2\">\n<h2>Organizations enable timely code review.</h2>\n<p>Why is code review at Google fast? Google’s code reviews follow the\nrecommendations in Microsoft’s “From the Trenches” study, which says:\n“how an organization sets the stage for reviewing activities and how it\nsupports and values code reviewing is critical to the success of code\nreviews.”</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/code-review-is-hard.png\"\nalt=\"Train people to give better reviews\" />\n<figcaption aria-hidden=\"true\">Train people to give better\nreviews</figcaption>\n</figure>\n<ul>\n<li><strong>Training</strong>: At Google, they offer readability\ncertifications to developers. Developers with python certifications\nreview python and developers with javascript certifications review\njavascript.</li>\n<li><strong>Ownership</strong>: Clear code ownership makes it easier to\nfind the right reviewer. <a\nhref=\"https://google.github.io/eng-practices/review/#best_reviewers\">At\nGoogle, the OWNERS file serves this role</a>.</li>\n<li><strong>Metrics</strong>: Count and celebrate the time spent\nreviewing. The metrics from both the Google study and Rigby and Bird are\na great place to start.</li>\n<li><strong>Time</strong>: We need to set aside time for reviews.</li>\n<li><strong>Culture</strong>: As noted in the book <a\nhref=\"https://www.worldcat.org/title/accelerate-the-science-behind-devops-building-and-scaling-high-performing-technology-organizations/oclc/1104206968\"><em>Accelerate</em></a>,\nJohn Shook, in recounting his experience introducing LEAN manufacturing\nat Toyota, says the best way to change culture is to focus on\n<em>behavior</em>. Enforcing good code review behavior makes code review\nculture better.</li>\n</ul>\n<p>The research cited above studies massive, distributed software\nprojects. Startups and independent developers may find these\norganizational practices don’t apply—and they’re probably right.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/06/29/commandline-hdr-image-processing/",

    "title": "Command Line HDR Image Processing",
    "url": "https://tylercipriani.com/blog/2021/06/29/commandline-hdr-image-processing/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2021-06-29T02:57:24Z",
    "date_modified": "2021-06-30T00:25:20Z",


    "content_html": "<p>Expensive cameras don’t take better photos. Folks tend to learn this\nwhen they do the first side-by-side between their gorgeous iPhoneograhy\nand the <strong>objectively worse</strong> shots taken with their fancy\nnew $2,000 DSLR.</p>\n<p>Cell phones have itty-bitty sensors and equally lilliputian optics –\nhow can they take better pictures? Google research has described the\ntechnique that their phones use – called “burst” photography – in <a\nhref=\"https://static.googleusercontent.com/media/hdrplusdata.org/en//hdrplus.pdf\">research\npapers</a> and <a\nhref=\"https://ai.googleblog.com/2017/04/experimental-nighttime-photography-with.html?m=1\">blogs</a>.\nEssentially, they take a whole bunch of pictures and mash them together\nto make a single good picture.</p>\n<p>By mimicking the techniques that our cell phones use to take better\npictures we get <a\nhref=\"https://www.cambridgeincolour.com/tutorials/image-averaging-noise.htm\">less\nnoisy</a>, more dynamic photos along with the improved light gathering\ncapabilities of a DSLR.</p>\n<section id=\"capture\" class=\"level2\">\n<h2>Capture</h2>\n<p><a\nhref=\"https://www.cambridgeincolour.com/tutorials/high-dynamic-range.htm\">High\ndynamic range</a> images have a large range of brightness in the\nscene—some light areas, some dark areas. By blending an underexposed\nimage that captures detail in bright areas of the scene with an\noverexposed image that captures detail in dark areas of the scene you\ncan capture a range of brightness that would not be possible with a\nsingle photograph.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/72/aa49d819d5ef6097f87088a60bd670/large.jpg\"\nalt=\"Moab Pinto Arch Trail – overexposed (left) and underexposed (right)\" />\n<figcaption aria-hidden=\"true\">Moab Pinto Arch Trail – overexposed\n(left) and underexposed (right)</figcaption>\n</figure>\n<p>In the picture above, taken on the <a\nhref=\"https://www.alltrails.com/trail/us/utah/pinto\">pinto arch\ntrail</a> in Moab, Utah, there are two exposures of one scene: the\nimmediate surroundings are in a shadow, the sky and butte in the\ndistance are in the bright sunlight. Below I’ve blended the shots into a\nsingle scene with a wide range of brightness – an HDR image:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ba/a1503f4460fa19142034b778daa920/large.jpg\"\nalt=\"Moab Pinto Arch Trail HDR\" />\n<figcaption aria-hidden=\"true\">Moab Pinto Arch Trail HDR</figcaption>\n</figure>\n<p>I captured the image above using the following equipment:</p>\n<ul>\n<li><a href=\"https://en.wikipedia.org/wiki/Nikon_D610\">Nikon\nD610</a></li>\n<li><a\nhref=\"https://en.wikipedia.org/wiki/Samyang_Optics_/_Rokinon_AF_14_mm_f/2.8_FE\">Samyang\nOptics / Rokinon AF 14 mm f/2.8 FE</a></li>\n</ul>\n<p>And that’s it: no tripod and no filters. I shot the image handheld at\nf/11 ISO 200.</p>\n<p>The shutter speed for underexposed photo was 1/400 sec. For the\noverexposed photo it was 1/60 sec. I varied the shutter speed using the\n<a\nhref=\"https://www.nikonusa.com/en/learn-and-explore/a/tips-and-techniques/exposure-bracketing-the-creative-insurance-policy.html\">exposure\nbracketing</a> feature of the Nikon D610.</p>\n</section>\n<section id=\"processing\" class=\"level2\">\n<h2>Processing</h2>\n<p>After capturing my under- and over-exposed photos I use the following\nsoftware programs:</p>\n<ul>\n<li><code>align_image_stack</code> which is part of the\n<code>hugin</code> package</li>\n<li><code>enfuse</code> which is part of the <code>enblend</code> family\nof FOSS photo tools</li>\n<li><a href=\"https://www.darktable.org/\">Darktable</a> to make final\nedits and lens correction</li>\n<li><code>exiftool</code> to manage metadata</li>\n</ul>\n<p>First, I import my images using a <a\nhref=\"https://github.com/thcipriani/dotfiles/blob/master/srv/photos/lib/import.sh\">bash\nscript</a> I wrote that maintains a strict file structure. Next, I use\nDarktable to do lens correction (based on the astounding achievement\nthat is the <a href=\"https://lensfun.github.io/\">lensfun database</a>)\nthen I export as 16-bit tif files.</p>\n<p>At this point, since I shot the images without a tripod, they have\nminor misalignments. <code>align_image_stack</code> corrects the\nmisalignments and creates a perfect stack of images:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># align.sh</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ---</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># By default align image stack tries to find 8 control points in a 5x5 grid</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># This finds 16 control points in a 10x10 grid.</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">align_image_stack</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"at\">-a</span> aligned_ <span class=\"at\">-v</span> <span class=\"at\">-m</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"at\">-g</span> 10 <span class=\"at\">-c</span> 16 <span class=\"at\">-C</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;</span><span class=\"va\">$@</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>I use the command <code>align.sh *.tif</code> with the above script\nto create aligned images.</p>\n<p>This command creates precisely aligned, stackable tif files with the\nprefix <code>aligned_</code> in the current directory.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/75/975ad85b3452908616028b7dc1394e/xlarge.jpg\"\nalt=\"Grand canyon – underexposed (left) and overexposed (right)\" />\n<figcaption aria-hidden=\"true\">Grand canyon – underexposed (left) and\noverexposed (right)</figcaption>\n</figure>\n<p>Notice in the image above – taken just East of <a\nhref=\"https://www.nps.gov/places/000/moran-point.htm\">Moran Point</a> at\nthe Grand Canyon in Arizona – that the underexposed image shows more\ndetail in the clouds and the sun, whereas in the overexposed image shows\nmuch more detail in the canyon and on the rocks in the foreground.</p>\n<p>Now I use the enfuse command to produce a not-offensively-garish HDR\nimage of the aligned images: <code>enfuse -o out.tif aligned_000*</code>\n.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ce/2f34ff201e443d4875eff46200d7c3/large.jpg\"\nalt=\"Grand canyon hdr\" />\n<figcaption aria-hidden=\"true\">Grand canyon hdr</figcaption>\n</figure>\n<p>In the final image, we retain both the detail of the sun and clouds\nin the sky as well as a clear view of the canyon (and its grandeur) and\nthe rocks in the foreground.</p>\n<p>This is a technique I use <strong>constantly</strong> to capture\nshots that would be impossible any other way, AND(!) it uses tools and\ntechniques that are useful for all FOSS photography nerds. Best of all?\nNo high-falutin cellular phone required.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2021/04/15/getting-better-at-the-new-york-times-crossword/",

    "title": "Getting better at the New York Times crossword",
    "url": "https://tylercipriani.com/blog/2021/04/15/getting-better-at-the-new-york-times-crossword/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2021-04-15T00:24:15Z",
    "date_modified": "2021-04-15T17:44:47Z",


    "content_html": "<p>I started doing crossword puzzles sometime in 2019. After learning\nthe basics of American crossword puzzles, the best way to improve is to\nsolve daily.</p>\n<p>As a budding <a\nhref=\"https://www.merriam-webster.com/dictionary/cruciverbalist\">cruciverbalist</a>\nyou develop a few key skills. The NYTimes website has <a\nhref=\"https://www.nytimes.com/guides/crosswords/how-to-solve-a-crossword-puzzle\">an\nexcellent guide</a> on the basics of solving. Beyond the basics (which\nI’m <em>just barely</em> beyond), there are a few other pieces of\ninformation you’ll learn along the way.</p>\n<p>The New York Times digital crossword subscription is currently\n$19.97/yr. If you’re a print subscriber (I subscribe for Sundays only)\nthey throw in a digital subscription with crossword puzzle access for\nfree. Prior to subscribing for the Sunday print edition I used to use my\nlocal library’s <a\nhref=\"https://www.longmontcolorado.gov/departments/departments-e-m/library/ebooks-emagazines\">digital\naccess</a> for free from home—which was nice for not only crosswords but\nalso the paywalled NYTimes Cooking section.</p>\n<p>In 2015 I bought a Brother HL-L2340DW black and white laser printer\nfor $100 and I highly recommend it to everyone. I use it to print the\ncrossword and work on it over dinner with my partner which I find more\nrelaxing than staring at my computer or phone.</p>\n<p>Although I do the print version of the crossword, the NYTimes website\nhas a number of nice features if you solve using their interface. You\ncan track your solve times daily along with rudimentary descriptive\nstatistics about your solve. There is also a <a\nhref=\"https://www.nytimes.com/puzzles/leaderboards\">leaderboard</a> so\nthat you can share your solve times with your friends and coworkers.</p>\n<p>If you prefer offline digital solving there are <code>.puz</code>\nfiles available from the NYTimes that you can use along with a locally\ninstalled crossword application. The NYTimes recommends “Across Lite”,\nwhich I’ve never used. I’ve played with “<a\nhref=\"https://parkerhiggins.net/2019/03/cursewords-crossword-puzzle-solving-interface-terminal/\">cursewords</a>”\nwhich is an ncurses interface for <code>.puz</code> files that is pretty\nusable depending on your terminal environment.</p>\n<p>The New York Times crossword puzzle ramps up in difficulty throughout\nthe week. Monday is the easiest puzzle to solve. Saturday is the most\ndifficult. Sunday is roughly mid-week difficulty but bigger (Sunday is\n21x21 with 140 words max vs 15x15 with 72–78 word max for other days –\n72 words if the puzzle has no theme).</p>\n<p>When you’re just getting started it’s best to start with the Monday\npuzzle and see where you get stuck. For the new solver I’d wager you’ll\nslow down by Thursday. If you keep pushing through week-after-week,\nyou’ll get faster and your solve percentage will improve.</p>\n<p>As a result of my proclivity for print I only have 14 solves in the\nNYTimes interface currently. My average Friday solve time is 55:13 and I\ndon’t have any Saturday solves. I’m hoping this is not indicative of my\ncurrent abilities, but it’s probably not too far off. I have slowly\nsolved many a Saturday puzzle. Not <em>every</em> Saturday puzzle\nthough.</p>\n<p>The Monday through Thursday puzzles tend to have themes. Most of them\npunny. Many of the clues are <a\nhref=\"https://www.nytimes.com/crosswords/game/mini/tips-and-tricks/question-mark-clues\">question\nmark clues</a> indicating a high-likelihood of being groan inducing.\nCracking the puzzle requires a keenly developed sense of the type of\njokes that appeal to people who do crosswords for fun. When you first\nstart solving, the clue, “They often come out at night?” does not evince\nthe answer, “FALSETEETH”. Bravery in the face of bad puns is a\ndistinguishing characteristic of a crossword puzzle solver. The Friday\nand Saturday puzzles (and sometimes Thursday puzzles) tend not to have\nthemes and focus on difficulty. I personally find themeless puzzles less\nfun than themers – the groan-factor of cracking a themer becomes an\naddiction.</p>\n<p>What it means to <em>solve</em> a puzzle is pretty flexible. Is it OK\nto lookup the spelling of <code>SCHWARZENEGGER</code>? What if two\nproper names cross each other – did you solve the puzzle if you had to\nlook one up (<a\nhref=\"https://rexwordpuzzle.blogspot.com/2008/05/saturday-may-17-2008-mike-nothnagel.html\">names\nin crosswords</a> are controversial – they have the same problems as <a\nhref=\"https://en.wikipedia.org/wiki/WP:NOTE\">Wikipedia’s Notability\nCriteria</a> – including all the issues of diversity, equity, and\ninclusion).</p>\n<p>Only you can say whether or not you solved a puzzle. And (even though\n<a\nhref=\"https://www.pastemagazine.com/games/crossword-puzzles/new-york-times-crossword-getting-easier/\">puzzles\nare getting easier</a> than ever) I still cheat even by my own\nstandards. There are useful websites for cheating: onelook.com and\nxwordinfo.com for example. I also use the Linux dictionary with\n<code>grep</code> to cheat on occasion – for example say I had the clue\n“kind of sauce” and I had <code>_AR_A_</code>, I could use\n<code>grep -iP \'^.ar.a.$\' /usr/share/dict/words</code> to find\n<code>TARTAR</code>.</p>\n<p>The key skill that makes you look smart to the uninitiated really\ncomes down to a familiarity with common <a\nhref=\"http://crosswordese.com/\"><em>crosswordese</em></a>.\n<em>Crosswordese</em> describes words that appear more frequently in\ncrosswords than they do in real life. As a player of the crossword you\nknow that <a\nhref=\"https://www.wordplays.com/crossword-clues/MTETNA\"><code>MOUNT ETNA</code></a>\nis the Sicilian eruption in the Aeneid by Virgil; that <a\nhref=\"https://www.wordplays.com/crossword-clues/ESAU\"><code>ESAU</code></a>\nis one of the twin sons of Isaac; and that Brian <a\nhref=\"https://www.wordplays.com/crossword-clues/ENO\"><code>ENO</code></a>\n(who I think as a <a\nhref=\"https://teropa.info/loop/#/airports\">generative ambient\nmusician</a>) is the glam rocker from Roxy Music. Lots of vowels and\nunique vowel/letter arrangement make a good candidate for crosswordese.\nI’ve recently noticed that Gal <a\nhref=\"https://www.wordplays.com/crossword-clues/GADOT\"><code>GADOT</code></a>\nis a rising star in the world of crosswordese, seemingly outpacing many\nother contemporary superheroes.</p>\n<p>Once I’ve “solved” a puzzle (for my self-defined and highly flexible\nvalue of “solved”), I immediately go to <a\nhref=\"https://rexwordpuzzle.blogspot.com/\">Rex Parker Does the NYTimes\nCrossword Puzzle</a>. I do this for many reasons:</p>\n<ol type=\"1\">\n<li>To learn more about the puzzle and its constructors</li>\n<li>To see if there are any theme elements I hadn’t considered – Rex\ndoes a great job of deep-diving on themes</li>\n<li>Often I go there to find out if anyone was mad about the clue I was\nmad about</li>\n<li>Just as often I’m there to be flabbergasted that Rex hated a puzzle\nI loved</li>\n</ol>\n<p>All this is to say that while I often completely disagree with Rex\nParker and Rex Parker’s comment section it remains my little crossword\ncommunity and by lurking there I get an extra dimension of enjoyment out\nof the puzzle thanks to his blog.</p>\n<p>Finally, while the NYTimes crossword is the marquee crossword, there\nare many smaller crossword sites on the internet that are worth your\ntime:</p>\n<ul>\n<li><a href=\"https://avxwords.com/\">The American Values Club\ncrossword</a> – focuses on inclusion and feels more geared towards my\nsmall sliver of the world’s Overton window</li>\n<li><a href=\"https://inkubatorcrosswords.com/\">The Inkubator</a> –\ncrossword puzzles by women</li>\n<li><a href=\"https://gluttonforpun.blogspot.com/\">Glutton for Pun (Erik\nAgard’s site)</a> – a really fabulous constructor whose clues are often\nsooo groan-inducing that it’s magic</li>\n</ul>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/10/05/git-squash-is-not-nice-history/",

    "title": "Git squash is not nice history",
    "url": "https://tylercipriani.com/blog/2020/10/05/git-squash-is-not-nice-history/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2020-10-05T18:20:31Z",
    "date_modified": "2020-10-07T02:50:41Z",


    "content_html": "<p>Today I read a brilliant article about effective use of <a\nhref=\"https://blog.ploeh.dk/2020/10/05/fortunately-i-dont-squash-my-commits/\">git\nbisect</a>, but I disagreed with a small nuance of one of its\nconclusions (and, by internet law, was honor bound to write a blog post\nabout it):</p>\n<blockquote>\n<p>Had this happened in a code base with a ‘nice history’ (as the squash\nproponents like to present it), that small commit would have been\nbundled with various other commits. The problem wouldn’t have jumped at\nme if buried in dozens of other changes.</p>\n</blockquote>\n<p>It’s true that <code>git merge --squash</code> obscures history;\nwhether or not this makes a nice history is entirely dependent on the\nsituation.</p>\n<p>First we need to agree on background and introduce terms.</p>\n<section id=\"lossless-merges\" class=\"level2\">\n<h2>Lossless merges</h2>\n<p>Let’s say you have a git history that looks like this:</p>\n<pre class=\"narrow\">\n    <code>\n      C - D         feature/magic\n     /\nA - B               main\n    </code>\n</pre>\n<p>A standard <code>git merge feature/magic</code> issued on the\n<code>main</code> branch results in this history:</p>\n<pre class=\"narrow\">\n    <code>\n      C - D         feature/magic\n     /\nA - B - C - D       main\n    </code>\n</pre>\n<p>This is a fast-forward merge. Since the <code>main</code> ref is at\n<code>B</code> and <code>B</code> is the parent of <code>C</code> when\nwe merge <code>feature/magic</code> into <code>main</code>,\n<code>main</code>’s ref is updated to point at the commit at\n<code>D</code>.</p>\n<p>There is no loss of fidelity from the point of development. Every\ndevelopment commit is kept and the relationships between commits\nmaintained.</p>\n</section>\n<section id=\"lossy-merges\" class=\"level2\">\n<h2>Lossy merges</h2>\n<p>Using <code>--squash</code> instead of the default merge strategy is\nlossy: the fidelity of git history is lost. Squash, in our example,\nresults in a new commit being added to <code>main</code>’s history that\nis an amalgam of the commits on the <code>feature/magic</code>\nbranch:</p>\n<pre class=\"narrow\">\n    <code>\n      C - D        feature/magic\n     /\nA - B - - - CD\'    main\n    </code>\n</pre>\n<p>You can no longer see that <code>C</code> and <code>D</code> were two\nseparate commits.</p>\n</section>\n<section id=\"helpful-loss\" class=\"level2\">\n<h2>Helpful Loss</h2>\n<p>There are reasons to choose a lossy merge over a lossless merge.</p>\n<p>There are blogs that advocate heavily for a <a\nhref=\"https://blog.dnsimple.com/2019/01/two-years-of-squash-merge/\">squash\nworkflow</a>. Which strategy to choose is dependent on the content of\nthe commits you are merging. The strategy chosen should maintain the\nprincipal that a commit in a mainline branch’s history should make sense\non its own.</p>\n<p>In the above example, the content of the feature branch isn’t shown.\nA new example might be a <code>feature/lossless</code> branch that\ncontains a refactor and a new feature that depends on that refactor:</p>\n<pre class=\"narrow\">\n    <code>\n| * (feature/lossless) feature: method is dynamic\n| * refactor: method instead of global\n|/\n* (main) Initial Commit\n    </code>\n</pre>\n<p>This is an example where the desired outcome is lossless: both of\nthese commits are meaningful on their own and can be vectors for bugs.\nAfter the merge, in an ideal case, the main branch should look like:</p>\n<pre class=\"narrow\">\n    <code>\n* (main, feature/lossless) feature: method is dynamic\n* refactor: method instead of global\n* Initial Commit\n    </code>\n</pre>\n<p>Now, imagine a different branch – a bugfix, with only a single commit\nthat is up for review.</p>\n<pre class=\"narrow\">\n    <code>\n| * (bugfix/lossy) bugfix: validate user input\n|/\n* (main) Initial Commit\n    </code>\n</pre>\n<p>During review, there’s a typo in a comment that needs fixing. Now the\nbranch graph looks like:</p>\n<pre class=\"narrow\">\n    <code>\n| * (bugfix/lossy) fix comment typo\n| * bugfix: validate user input\n|/\n* (main) Initial Commit\n    </code>\n</pre>\n<p>I would argue that the typo commit doesn’t make sense on its own.\nThere’s no need to persist that commit into the main branch: it’s noise.\nIt’s not a vector for meaningful error, it’s a development detail that\nshouldn’t leak back into the main branch. In short, a more functional\nhistory for a merge would be to use a lossy strategy:</p>\n<pre class=\"narrow\">\n    <code>\n* (main, bugfix/lossy) bugfix: validate user input\n* Initial Commit\n    </code>\n</pre>\n</section>\n<section id=\"this-is-all-an-oversimplification\" class=\"level2\">\n<h2>This is all an oversimplification</h2>\n<p>Of course, the example above completely ignores merge commits,\nrepository merge strategies, and any shared agreements about the state\nof feature or mainline branches, code review, testing strategies,\ndeployment pipelines, and so so (so!) much more!</p>\n<p>Many of the blog posts on git I read make broad generalizations about\nthe Right™ way to use some particularly controversial features of git\n(pull, merge, rebase, branching, commit messages …wait. 🤔 Is every\nfeature controversial?), but the reality is that there is a lot of\nnuance in the world and the only right answer depends on your\nsituation.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/09/22/migrating-git-data-with-rsync/",

    "title": "Migrating git data with rsync",
    "url": "https://tylercipriani.com/blog/2020/09/22/migrating-git-data-with-rsync/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2020-09-22T21:05:23Z",
    "date_modified": "2020-09-23T00:30:34Z",


    "content_html": "<p>This is a cautionary tale about keeping git data in sync between two\nmachines with rsync. There aren’t really a lot of pitfalls here, but we\nstumbled into one of them, and I’ve been meaning to write this up\nsince.</p>\n<p>tl;dr: to keep git repos in sync using rsync use the command:</p>\n<pre><code>rsync --archive --verbose --delete &lt;dir1&gt; &lt;dir2&gt;</code></pre>\n<section id=\"background\" class=\"level2\">\n<h2>Background</h2>\n<p>Almost a year ago we <a\nhref=\"https://phabricator.wikimedia.org/T222391\">upgraded the\nhardware</a> for our primary git host at work. We run our primary git\nserver on bare metal in one of the Equinix data centers in Virginia and\nit was starting to show its age. Our git host was coming up on the end\nof its warranty, but – more importantly – we’d simply outgrown the\nhardware. We run <a href=\"https://www.gerritcodereview.com/\">Gerrit</a>\nas our code review system and its hunger for heap led to more than one\nlate night caused by <code>java.lang.OutOfMemoryError</code>. After\nspending more time than I probably should have tuning various GC\nparameters, I put in a request for new hardware.</p>\n<p>The plan for the upgrade was pretty simple: Setup a new machine\nseeded with all of our git data and run it as a replica of the current\nmachine until the switchover window. Prevent the new machine from\nwriting to Gerrit’s database entirely. When the switchover window rolls\naround: take both machines offline, one final rsync of data, swap DNS\nrecords, allow database writes from the new machine, and bring the new\nmachine online.</p>\n<p>We finished up the migration at the end of my day and all seemed to\ngo fine, we sent out the <a\nhref=\"https://lists.wikimedia.org/pipermail/wikitech-l/2019-October/092693.html\">all\nclear</a> and claimed victory. Over my night the European cohort began\nto see the first inklings of a problem: there were <a\nhref=\"https://lists.wikimedia.org/pipermail/wikitech-l/2019-October/092696.html\">revisions\nand Gerrit comments missing</a> on the new server! Patches that had been\nmerged were showing up as unmerged! Day was night! Dogs and Cats were\nbest friends! Chaos reigned.</p>\n<p>Data integrity problems are alarming, but they are especially acute\nwhen the data that’s integrity is in doubt is the canonical source code\nto a gigantic open source project backing one of the most important free\nknowledge projects in existence. No pressure.</p>\n</section>\n<section id=\"notedb-and-things-to-know\" class=\"level2\">\n<h2>NoteDB and things to know</h2>\n<p>The first thing to know is that code reviews in Gerrit aren’t stored\nin a real database, but are stored instead in <a\nhref=\"https://gerrit-review.googlesource.com/Documentation/note-db.html\">NoteDB</a>\n– which is just a bunch of namespace conventions on top of git. In fact,\nas of today, the latest version of Gerrit stores <em>nothing</em> in the\ndatabase and stores everything in git.</p>\n<p>Everything being stored in git has some uhhh…I’ll say “interesting”….\nside-effects. For example, users are stored in a git repo called\n<code>All-Users.git</code> and in our version of that repository there\nare &gt;22,000 refs pointing to the blob\n<code>ce7b81997cf51342dedaeccb071ce4ba3ed0cf52</code>. Why tag a blob?\nWhat could be in that blob?</p>\n<pre><code>$ git show ce7b81997cf51342dedaeccb071ce4ba3ed0cf52\nstar</code></pre>\n<p>That’s right, there are 22,000 refs pointing to a single blob with\nthe contents, <code>star</code>. Each ref is of the format\n<code>refs/starred-changes/XX/YYYYXX/ZZZZ</code>. This is how Gerrit\nstores starred changes <img src=\"https://tylercipriani.com/smileys/neutral.png\" alt=\":|\" /></p>\n<p>I don’t know if that’s normal or sane: there are no rules out here in\ngit-is-your-database-now land.</p>\n<p>All of the above background about NoteDB is to say that any knowledge\nyou might have about how reviews might disappear from a database don’t\nhold in Gerrit. All the lovely persistence guarantees about RDBMS mean\nfuck all. This is a pop quiz about git knowledge.</p>\n</section>\n<section id=\"how-reviews-are-stored\" class=\"level2\">\n<h2>How reviews are stored</h2>\n<p>OK, so Gerrit doesn’t use an RDBMS, so we’ll need to know how reviews\nare stored in order to understand how they might disappear.</p>\n<p>Gerrit stores patchsets for review in refs. Gerrit uses the “changes”\nref namespace for all changes. For example, the first revision for the\nfirst change for the repo “foo” would be stored in\n<code>/srv/gerrit/git/foo.git</code> under the ref\n<code>refs/changes/01/0001/1</code>. The next revision for the first\nchange would be stored on <code>refs/changes/01/0001/2</code>. Any\ncommentary about the first change is also stored in a special ref in the\nchanges namespace in git in <code>refs/changes/01/0001/meta</code>.</p>\n</section>\n<section id=\"how-refs-are-stored\" class=\"level2\">\n<h2>How refs are stored</h2>\n<p>Git refs are stored in the <code>refs</code> directory inside a\nrepository’s git directory. A Gerrit change stored in loose refs on disk\nmight look like:</p>\n<pre><code>refs/changes\n└── 01\n    └── 0001\n        ├── 1\n        └── meta</code></pre>\n<p>Each file there points to a commit (or a tree or a blob, but in\npractice it’s usually a commit).</p>\n<p>Periodically (i.e., whenever git runs a garbage collection cycle)\nthat directory is emptied out and the info is shoved into a\n<code>packed-refs</code> file.</p>\n<p>But what happens when there are <em>both</em>? When there is a\n<code>refs/heads/foo</code> and a <code>packed-refs</code> that\nreferences a <code>refs/heads/foo</code>? When you do\n<code>git rev-parse</code> which one “wins”? This is a common scenario\nand happens whenever you update a ref:</p>\n<pre><code>$ git init\nInitialized empty Git repository in /home/thcipriani/tmp/git-pack/.git/\n$ echo &quot;foo&quot; &gt; README\n$ git add . &amp;&amp; git commit -m &#39;Initial commit&#39;\n[main (root-commit) 8c1ba31] Initial commit\n 1 file changed, 1 insertion(+)\n  create mode 100644 README\n$ git update-ref refs/changes/1 HEAD\n$ cat .git/refs/changes/1\n  8c1ba312abe6b25948011d05e0ded8bc581b6bb0\n$ echo &#39;bar&#39; &gt; README\n$ git commit -a -m &#39;update&#39;\n  [main 93791e4] update\n   1 file changed, 1 insertion(+), 1 deletion(-)\n$ git gc\n   Enumerating objects: 6, done.\n   Counting objects: 100% (6/6), done.\n   Delta compression using up to 4 threads\n   Compressing objects: 100% (2/2), done.\n   Writing objects: 100% (6/6), done.\n   Total 6 (delta 0), reused 0 (delta 0), pack-reused 0\n$ ls -lh .git/refs/changes/\ntotal 0\n$ git update-ref refs/changes/1 HEAD\n$ cat .git/refs/changes/1\n93791e4e3fbf39cd2d90d678eb2530ce03e5eaf4\n$ cat .git/packed-refs\n# pack-refs with: peeled fully-peeled sorted\n8c1ba312abe6b25948011d05e0ded8bc581b6bb0 refs/changes/1\n93791e4e3fbf39cd2d90d678eb2530ce03e5eaf4 refs/heads/main</code></pre>\n</section>\n<section id=\"the-punchline\" class=\"level2\">\n<h2>The punchline</h2>\n<p>OK, so what happened to our changes? Trying to be cautious we used\nthe rsync command:</p>\n<pre><code>rsync --archive --verbose &lt;dir1&gt; &lt;dir2&gt;</code></pre>\n<p>We purposely omitted <code>--delete</code> because objects in git are\ndeterministic: who cares if they were packed? Why risk deleting things?\nWe knew we didn’t lose any objects in the transfer. The problem was\n<strong>we didn’t lose any of the unpacked refs either</strong>. This\nmeant that when we seeded the git directories on the new server a month\nbefore the maintenance window, some of these repositories had loose refs\nthat were subsequently packed into <code>packed-refs</code>. Since the\n<em>newer</em> refs ended up in <code>packed-refs</code> while the\n<em>older</em> refs were on disk it made the Gerrit interface appear to\nbe in an older state.</p>\n<p>The moral of the story here is to <strong>never omit\n<code>--delete</code></strong> from rsync if you’re trying to keep repos\nin sync.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/09/04/buying-a-house-in-2020/",

    "title": "Buying a house &#x1F3E0; in 2020 ",
    "url": "https://tylercipriani.com/blog/2020/09/04/buying-a-house-in-2020/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2020-09-04T19:48:03Z",
    "date_modified": "2020-09-05T18:55:45Z",


    "content_html": "<p>My significant other and I bought our very first home in July. We\njust finished moving. I learned a lot during this process. I’m writing\nit down while it’s still fresh in my mind.</p>\n<section id=\"why-not-rent\" class=\"level2\">\n<h2>Why not rent?</h2>\n<p>I’ve always rented and thought I would continue to rent forever. When\nI was still in high school I read <a\nhref=\"https://www.worldcat.org/title/rich-dad-poor-dad/oclc/48065436\"><em>Rich\nDad, Poor Dad</em></a> which repeatedly makes the point that your house\nis a liability. I have been, and still am, convinced by the arguments in\nthat book.</p>\n<p>While I was renting I liked that I wasn’t responsible the furnace or\nthe fence or the stove – those were all someone else’s problem.</p>\n<p>Except our fence was falling down; our stove was crappy and there was\nnothing we could do about it; and our furnace hadn’t even had a filter\nchange in…a while.</p>\n<p>We had the freedom to move, but not freedom to create our own space\nas we wanted. In the end the desire for our own space won out.</p>\n</section>\n<section id=\"buying-a-house-in-2020\" class=\"level2\">\n<h2>Buying a house in 2020</h2>\n<p>Sometime in 2018 we decided we wanted to buy instead of rent. At the\ntime people were predicting an <a\nhref=\"https://www.advisorperspectives.com/articles/2018/10/08/a-roadmap-for-the-upcoming-u-s-treasury-bull-market-1\">upcoming\nrecession</a> and I felt like the <a\nhref=\"https://www.bloomberg.com/news/articles/2019-09-11/trump-calls-on-fed-to-cut-interest-rates-to-zero-or-less\">fed\nlowering the interest rate</a> could only artificially inflate the\neconomy for so long.</p>\n<p>Summer 2020 seemed like a good target. Housing prices were <a\nhref=\"https://www.dailycamera.com/2019/06/12/housing-prices-arent-moving-up-in-boulder-county/\">pretty\nflat</a> in 2019. By summer 2020, I predicted, there would be some slack\nin the local housing market and low interest rates for mortgages. In\nsome ways, I guess, I was right, but I really could not have predicted\nmuch of anything about 2020 (I mean, murder hornets? What even?).</p>\n</section>\n<section id=\"our-process\" class=\"level2\">\n<h2>Our process</h2>\n<p>Back in January, Blazey and I sat down with a big stack of post-it\nnotes and sharpies to try to determine what we wanted in a house. We\neach wrote down everything we could think of wanting in a house; one\nitem per post-it. Once we wrote down everything, we took a step back and\ngrouped all our post-its into <a\nhref=\"https://tools.ietf.org/html/rfc2119\">“MUST”, “SHOULD”</a>, and\n“nice to have”.</p>\n<p>We ended up with a list of 25 things with 5 “MUST”s.</p>\n<p><strong>Must</strong></p>\n<ol type=\"1\">\n<li>Not in flood zone (this came from witnessing the <a\nhref=\"https://www.climate.gov/news-features/event-tracker/historic-rainfall-and-floods-colorado\">2013\nflood</a>)</li>\n<li>Can cook macaroni on <em>day one</em></li>\n<li>3+ Bedroom / 2+ Bath (one office each, one bathroom each)</li>\n<li>Private outdoor space</li>\n<li>Walkability</li>\n</ol>\n<p>The “macaroni” bit was one I came up with. The idea behind\n<em>day-one macaroni</em> is that, while I’m looking forward to being\nable to work on our shared space, I shouldn’t <em>need to</em> work on\nour shared space to move in.</p>\n<p>We had increasingly esoteric needs father down the list. Things like,\n“Pre-World War II era/Craftsman/Bungalow” with “Access to <a\nhref=\"https://www.longmontcolorado.gov/departments/departments-e-m/longmont-power-communications/broadband-service\">NextLight™\nmunicipal gigabit fiber</a> internet service”.</p>\n<p>As unlikely as it seems to find a 1910 craftsman house with municipal\ngigabit internet, we got it. In the end, we got 20 our of our 25 things.\nWe sacrificed indoor space for location. Given that the pandemic has\nmade location largely irrelevant, I’m hoping that was the right choice\n😅</p>\n</section>\n<section id=\"moving\" class=\"level2\">\n<h2>Moving</h2>\n<p>We closed on the 3rd of July and informed our landlords that August\nwould be our last month – 2 months to move.</p>\n<p>During that time we:</p>\n<ul>\n<li>Sanded and painted the cabinetry in the kitchen and installed new\npulls</li>\n<li>Replaced the base of a few cabinets</li>\n<li>Painted the dining room and living room</li>\n<li>Removed the wallpaper in the library (yeah, there’s a library)</li>\n<li>Skim coated a couple of walls that we have every intention of\nwallpapering Soon™</li>\n</ul>\n<p>This left us with about 6 days to move from our ~3,000 square foot\nrental house to our new 1,300 square foot home. By dint of several truly\nheroic days of hauling and cleaning we managed to haphazardly move all\nof our crap from one place to the other and dispose of a good amount of\nthe <em>true</em> crap in the process (How does one <em>get rid of</em>\nold computers? 🤔 I still have my laptop from college it seems…).</p>\n<p>Things I learned during this move:</p>\n<ol type=\"1\">\n<li>If you buy a new thing, get rid of the thing you are replacing. This\nis particularly easy to forget when you’re caught up in an ever\nexpanding hobby. Selling the old thing should be part of your\nconsideration about getting the new shiny thing.</li>\n<li>Just because the box is fancy, doesn’t mean you have to keep the\nbox. I had a whole cabinet full of boxes for fancy electronics: cameras,\nlenses, drones, laptops, networking equipment, weather station. What is\nwrong with me‽</li>\n<li>Deadlines are good. Renting a u-haul is a good artificial deadline\nyou can give yourself. I woke up the morning I rented the u-haul ready\nto haul things and spent 8 hours doing that. It was the most productive\nday of the whole move for me.</li>\n<li>Just buy moving boxes. We tried to save our amazon boxen, but it\nwasn’t enough. I ended up buying a ton of boxes at Lowes. I should have\nbought those from the get go.</li>\n<li>Even though the move is short, treat it like a long move. As a\nfriend of Blazey’s said recently: you don’t forget your toothbrush if\nyou’re moving cross-country. We were moving 5 blocks from our old place.\nThe short relocation distance resulted in countless exchanges along the\nlines of, “Where’s the tape measure?” “Oh, I left it at the old place,\nI’ll be right back” – it turns out, those add up quickly.</li>\n<li>Prioritize pre-move tasks. We had a long list of things we wanted to\ndo before moving and I’m glad we did them before we moved in (we\nprobably never would have painted the kitchen cabinets otherwise), but\nwe grossly underestimated the amount of work needed. The end result was\nthat we wasted a lot of time that we couldn’t make up later.</li>\n</ol>\n</section>\n<section id=\"final-thoughts\" class=\"level2\">\n<h2>Final thoughts</h2>\n<p>Summer 2020 is either a genius time to buy a house or a really\nfucking stupid time to buy a house.</p>\n<p>We took a lot of precautions. Managing the process thoughtfully\nduring a pandemic was a key interview question for all of our buyer’s\nagents. Still.</p>\n<p>The whole process was strange and fraught with problems I’d never\nthought I’d have. This also describes 2020 for me.</p>\n<p>On the plus side, we locked in a very low interest rate – we’re\npaying 3% on a 30 year fixed mortgage. On the negative side, I have no\nidea if what I love about this neighborhood will survive the\npandemic.</p>\n<p>The neighborhood I want to live in is a neighborhood with a diversity\nof use – there are offices and restaurants and houses and stores and\nbars all within walking distance. There are parks. There are eyes on the\nstreet at all times of day and night. The presence of people makes this\nneighborhood strong. If main street collapses then demand to live near\nmain street will collapse, and so will the neighborhoods near main\nstreet. Quoting Jane Jacobs, “When a city heart stagnates or\ndisintegrates, a city as a social neighborhood of the whole begins to\nsuffer.” I worry about this.</p>\n<p>Also I worry about having signed a document agreeing to pay a <a\nhref=\"https://xkcd.com/1894/\">staggering amount of money</a> with the\ndate “2050” on it 🙈</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/05/18/humaning-a-bowie-dog/",

    "title": "Humaning a Bowie Dog",
    "url": "https://tylercipriani.com/blog/2020/05/18/humaning-a-bowie-dog/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2020-05-18T22:33:24Z",
    "date_modified": "2020-06-12T15:39:55Z",


    "content_html": "<p>Bowie, my dog, will turn 1 on the 13th of June this year.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/31/44fb29592bd8ef27d492494bf1d96f/xlarge.jpg\"\nalt=\"Bowie 2020-05-22\" />\n<figcaption aria-hidden=\"true\">Bowie 2020-05-22</figcaption>\n</figure>\n<p>His name was Bowie before we got him. All his littermates were named\nafter musicians that a rebellious tween might list as bands they like:\nMötley (as in <em>Crüe</em>), KISS, Zepplin (as in <em>Led</em>). Bowie\n(as in <em>David</em>) was both a conspicuous name and dog.</p>\n<p>The first David Bowie song I ever heard was <em>Ziggy Stardust</em>\nand it was sung in Portuguese by <a\nhref=\"https://bandcamp.com/tag/seu-jorge\">not David Bowie</a>. After\nlistening to the <a\nhref=\"https://www.youtube.com/watch?v=GzkXuHu-xYc&amp;list=PLu8MK5TJVpCq2srPHNoMLg0gMzojDao3v\">Life\nAquatic Studio Sessions</a> on repeat for many weeks, I learned who\nDavid Bowie was and started to collect his catalog. <em>Hunky Dory</em>\nis one of my favorite albums. I bought <em>Blackstar</em> (his 25th\nalbum) a few weeks after his death of liver cancer in 2016. I’ve seen\nhis most acclaimed and infamous movies: <a\nhref=\"https://en.wikipedia.org/wiki/The_Hunger_(1983_film)\"><em>The\nHunger</em></a> with Cathrine Deneuve; <a\nhref=\"https://en.wikipedia.org/wiki/The_Man_Who_Fell_to_Earth\"><em>The\nMan Who Fell to Earth</em></a> where he plays a space alien; <a\nhref=\"https://en.wikipedia.org/wiki/Labyrinth_(1986_film)\"><em>Labyrinth</em></a>.</p>\n<p>None of this was a deciding factor for getting a dog named Bowie, or\nfor keeping his name “Bowie” after we got him. I kept his name Bowie\nbecause he has 2 different colored eyes: one blue, one brown. “Two\ndifferent colored eyes! Just like David Bowie!” I thought, ignorantly. I\nsubsequently learned that, although David Bowie’s pupils were different\nsizes, his eyes were the same color.</p>\n<p>All this is to say: bringing home a dog has been a learning\nexperience.</p>\n<section id=\"rationale\" class=\"level2\">\n<h2>Rationale</h2>\n<p>Blazey has wanted a dog forever. At least part of her motivation for\ngetting a dog was to get me out of the house. I’ve worked from home for\n5½ years now and I have a tendency to sit at my computer an alarming\namount (for those who care about my health and well-being anyway) – her\ntheory was that I would have to get out, if only to walk the dog in my\nafternoon. Honestly, I also found this idea appealing and, having never\nhad a dog, totally plausible.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/e1/fb8d55a7be35641fb988e0c27d77ca/xlarge.jpg\"\nalt=\"4 week old Bowie\" />\n<figcaption aria-hidden=\"true\">4 week old Bowie</figcaption>\n</figure>\n</section>\n<section id=\"how-to-get-a-dog\" class=\"level2\">\n<h2>How to get a dog</h2>\n<p>After deciding to get a dog, the next step to dog companionship is\n<em>actually getting</em> a dog. I, naively, assumed this would be the\neasy part. Shelters are filled with dogs and cats that people have\nsurrendered because they can no longer care for them, I reasoned.\nSurely, a grateful world will be glad to have a responsible adult such\nas myself relieve them of the burden of care for one of these\nanimals.</p>\n<p>It was time for us to rescue a dog! …Or so I thought.</p>\n<p>Adopting a dog from a rescue is – for good reason – difficult. Many\nrescues refuse to consider people who rent, people who don’t have a\nfully enclosed backyard, or people who have never cared for a dog (we\ntick all of those boxes). The rescues that are flexible want to have an\ninterview and a home inspection. They want references. One rescue\ninsisted on an egregious web form that asked for all of my personal\ninformation on a non-https page.</p>\n<p>As much as I’d have liked to rescue a dog, it was much simpler to\nfind a reputable breeder. We found a breeder that was a short drive from\nour house. We were able to visit all the puppies several times. We met\nthe parents. The breeder kept excellent records going back several\ngenerations and was very knowledgable. We signed a contract to the\neffect that if we were ever to surrender the dog it would be into the\nbreeder’s care: and that was that.</p>\n<p>We were selective when we met the puppies: carefully observing their\ndemeanor. Being new dog caregivers, we felt that a low-key,\neven-tempered dog would be best for us and our new canine companion.\nBowie seemed like the calmest puppy of the whole litter – he adorably\nfell asleep in our laps – twice. The day we were going to pick Bowie up\nand take him home, we were greeted by a Bowie I’d not seen in our visits\nto that point – running around the house at full speed! Shaking his toys\nwith no small amount of faux puppy violence! Prancing! It never occurred\nto me until that moment that a puppy’s demeanor could vary so\ndrastically from one hour of the day to the next.</p>\n<figure class=\"narrow-figure\">\n    <video src=\"https://photos.tylercipriani.com/videos/2019-09-16_bowie.mp4\" webkit-playsinline=\"true\" playsinline=\"true\" autoplay=\"true\" muted=\"true\" loop=\"true\"></video>\n    <figcaption>What. A. Monster.</figcaption>\n</figure>\n</section>\n<section id=\"training\" class=\"level2\">\n<h2>Training</h2>\n<p>Puppies are assholes.</p>\n<p>A puppy’s cuteness is directly proportional to its propensity for\nassholishness; survival would be impossible were it otherwise. Bowie was\nthe cutest puppy I’ve ever seen, his temperament was proportionally\nassholish – he once pulled my pajama bottoms down in the front yard\nduring an early morning potty break while two elderly neighbor women\nstrolled passed us.</p>\n<p>Socializing a puppy is critical to their success. There is a\n“critical socialization period” between 8-weeks and 16-weeks (give or\ntake) during which you need to start to introduce them to the world they\nare expected to navigate: other humans, other dogs, cars, bikes,\nskateboards, rain, side-walks, gravel, car-rides, cats, etc. Strangely,\nthis is also the time in a puppy’s life where they’re not fully\nvaccinated: there is a risk of them contracting parvo just from going to\nplaces that other perfectly healthy adult dogs have been. Fortunately,\nthere are many places that offer “puppy kindergarten” to help socialize\ndogs whose immune systems are not fully formed.</p>\n<p>Bowie is what is known as a “reactive” dog. That is: he reacts. From\na behaviorist point of view it is incorrect to say he’s “excited” or\n“fearful” all you can say with certainty is that he is reacting. Bowie\nis reactive to other dogs. I can incorrectly say that he’s excited about\nother dogs. He’s been that way since early on in puppy kindergarten. He\nwould strain and bark and jump to get to other dogs.</p>\n<p>He’s also what the woman who ran our kindergarten called a “big\nplayer” which means, really, he’s a scary player. He plays too rough for\na lot of puppies.</p>\n<p>Outside of puppy kindergarten, Bowie was similarly hard to handle.\nBefore they lose their baby teeth, puppy’s teeth are incredibly sharp. A\nfavorite Bowie maneuver was running to you and jumping up to nip your\nhands, or grabbing onto your ankle – not letting you walk through the\nhouse. On a walk once he bit a guy on the nose. Made him bleed.</p>\n<p>I think that Bowie, in particular, may have special needs. A woman at\nthe dog training place once told us that Bowie is lucky to have us.\nLucky that we have the patience to work with him. Lucky that we have the\nmoney and resources to pay for training and treats. She told us this on\nhis last day of puppy kindergarten when he was too out-of-control to go\ninside – he was getting too big and he was too excited.</p>\n<p>This was a hard time for me: it’s hard to have a poorly behaved dog.\nIt feels like a personal failing – it’s frustrating – it’s embarrassing.\nMy work suffered. My relationships suffered. I understand why shelters\ndon’t let the uninitiated take home dogs – it’s nothing like my\nidealized version of living with a dog. All those <em>Air Bud</em>\nmovies are a fucking lie.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/9d/8370d023b846b579e5449c67ada8fe/xlarge.jpg\"\nalt=\"5 Month old Bowie\" />\n<figcaption aria-hidden=\"true\">5 Month old Bowie</figcaption>\n</figure>\n<p>I read a <a href=\"https://tylercipriani.com/books/2019/\">bunch of books</a> about dog\ntraining. I watched youtube videos. I learned about animal behavior; dog\nbody signals. I found more classes beyond puppy kindergarten. I took him\nto obedience class. Agility class. We paid for 1-on-1 training to\naddress his leash reactivity on walks. I bought special pouches to carry\ntreats. I bought training aids, “pet professional workshops”, a feeder\nwith a bluetooth remote.</p>\n<p>If it were not in Bowie’s nature to bite my ankles I probably\nwouldn’t have bothered with all of his training. Also, the training\ndidn’t even make him stop biting my ankles – at some point he just\nstopped.</p>\n<p>I worked with him. I trained with him. I learned with him. He’s still\ngot a long way to go. He still mouths at my hands and arms – not hard –\njust because, well, how else do you get my attention away from the\ncomputer? I’ve taken to calling these bites “mouth hugs”.</p>\n<p>Training, as I subsequently learned, is not about having a\nwell-behaved dog. Maybe that’s the end game – time will tell – but the\nreal purpose of training is to help you and your dog communicate.</p>\n</section>\n<section id=\"now\" class=\"level2\">\n<h2>Now</h2>\n<p>Now he’s a year old.</p>\n<p>All this training has paid dividends. He’s not perfect – he probably\nwon’t be – but we can communicate now. I know how he’s feeling before he\nreacts. I’ve probably become a better dog companion more than he’s\nbecome a better dog.</p>\n<p>Every morning, at 6:30am, he bounds onto the bed where I’m sleeping.\nHurling himself at top speeds – 50 lbs of fur and enthusiasm – excited\nto see me after 8 hours of only seeing the backs of his eyelids. We take\na nice long walk around the park every morning after my coffee and\nbefore my breakfast. He still barks at dogs sometimes – he’s very into\nsquirrels. When we get back, he sleeps by my desk or in the living room\nuntil around noon. We’ll go play frisbee in the backyard for a bit.\nWe’ll come back inside and he’ll eat a stuffed kong and hang out. He’ll\nwonder around, chew on his chew toys, and play by himself until 3pm or\n4pm – then it’s time for more time in the backyard. More time to\nplay.</p>\n<p>I think that I would have been completely awed by his behavior if I’d\nhave somehow been able to glimpse my life today during the struggles of\nthe past year. He’s a real dog. I’m a real dog owner. It’s just taken a\ngood while to establish these basic facts.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/3f/2ca22b6fd8223dcb2e217d75fb2fd4/xlarge.jpg\"\nalt=\"Bowie the real dog\" />\n<figcaption aria-hidden=\"true\">Bowie the real dog</figcaption>\n</figure>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/05/16/polymorphism/",

    "title": "polymorphism",
    "url": "https://tylercipriani.com/blog/2020/05/16/polymorphism/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2020-05-16T18:55:36Z",
    "date_modified": "2020-05-23T04:48:28Z",


    "content_html": "<p><strong>Polymorphism</strong> is when two types implement the same\ninterface.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2020/01/12/unix-permissions-for-dummies/",

    "title": "UNIX Permissions for Dummies",
    "url": "https://tylercipriani.com/blog/2020/01/12/unix-permissions-for-dummies/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2020-01-12T04:32:19Z",
    "date_modified": "2020-01-13T14:45:59Z",


    "content_html": "<p>(“Dummies”, AKA, <em>future me</em>)</p>\n<p>I know all this information for some value of the word “know”.\nEpistemologically speaking, “knowing” in the age of ubiquitous broadband\nis tantamount to knowing what search term will find the answer you\nneed.</p>\n<p>In a hypothetical post-apocalyptic dystopia where search engines are\na distant memory and esoteric UNIX knowledge is worth more than gold –\nI’d like to still “know” this information.</p>\n<p>As such, I’ve dutifully stared at lots of <a\nhref=\"https://man7.org\">man pages</a>, I’ve done a bunch of DuckDuckGo\nsearches, and I’ve amalgamated basically everything that I think I\nkinda/sorta <em>know</em> about permissions and dumped it all into this\npost.</p>\n<p>Some of this is information is undoubtedly wrong and dumb. I find\nthat writing down all the wrong and dumb information that I currently\nbelieve to be right and correct is a useful step in rough-hewing that\ninformation towards correctness.</p>\n<section id=\"basics\" class=\"level2\">\n<h2>Basics</h2>\n<p>There are 3 permissions:</p>\n<ul>\n<li>Read</li>\n<li>Write</li>\n<li>Execute</li>\n</ul>\n<p>These permissions are self-explanatory.</p>\n<p>OK – maybe “execute” is actually not at all self-explanatory – it’s a\nseverely overloaded term in the UNIX permissions model. In the basic\nsense “execute” means that a file (such as a binary executable) can be\nrun as a program. It can also mean that the operating system can invoke\nan interpreter to run the script . If a directory has the execute\npermission <strike>it can be searched and have its contents listed\n(i.e., <code>ls directory</code>)</strike> a user can traverse into the\ndirectory and access its contents.</p>\n<blockquote>\n    <p>\n        <strong>Edit Sun, 12 Jan 2020 16:28:38 -0700</strong>\n    </p>\n    <p>\n        <a href=\"https://www.reddit.com/user/mistralol\">/u/mistral</a> on\n        reddit points out that the e<code>x</code>ecute permission on a directory does NOT\n        allow a user to list a directory\'s contents. It does allow a user to\n        enter a directory and access its contents; however, without the <code>r</code>ead\n        permission a user cannot list the entries in a directory.\n    </p>\n    <p>\n        Oddly, the <a\n        href=\"http://man7.org/linux/man-pages/man2/chmod.2.html\"><code>chmod</code>\n        man page</a> calls this ability \"<code>search</code>\".\n    </p>\n</blockquote>\n<p>Those 3 permissions can be granted to 3 different sets of users:</p>\n<ul>\n<li>The user that owns the file</li>\n<li>The file’s group</li>\n<li>Others</li>\n</ul>\n</section>\n<section id=\"reading-permissions\" class=\"level2\">\n<h2>Reading permissions</h2>\n<p>File permissions are represented by 9 letters – 3 sets of 3 letters\neach. Each set of letters is for a different set of users: the user who\nowns a file, the file’s group, and others; Each user can be granted any\ncombination of the 3 permissions: <code>r</code>ead, <code>w</code>rite,\nand e<code>x</code>ecute. When a set of users doesn’t have a permission\nit’s represented with a <code>-</code>.</p>\n<pre><code>rwx/rw-/r--  foo\n|   |   +-------&gt; Others can read the file &quot;foo&quot;\n|   +-----------&gt; Group can read and write the file &quot;foo&quot;\n+---------------&gt; User that owns can read, write, and execute the file &quot;foo&quot;</code></pre>\n</section>\n<section id=\"octal-permissions\" class=\"level2\">\n<h2>Octal permissions</h2>\n<p>Permissions can also be represented as succinct – if somewhat\nconfusing, but totally awesome – octal representations.</p>\n<p>Each permission has an octal representation:</p>\n<ul>\n<li>e<code>x</code>ecute: 1</li>\n<li><code>w</code>rite: 2</li>\n<li><code>r</code>ead: 4</li>\n</ul>\n<p>It should be noted that these numbers are all powers of 2\n(2<sup>0</sup> = 1; 2<sup>1</sup> = 2; 2<sup>2</sup> = 4), meaning that\neach permission represents a 0 or 1 in a place in binary. The binary\nformat and the human readable format have a nice symmetry:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>octal</th>\n<th>binary</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>1</td>\n<td>001</td>\n<td><code>--x</code></td>\n</tr>\n<tr class=\"even\">\n<td>2</td>\n<td>010</td>\n<td><code>-w-</code></td>\n</tr>\n<tr class=\"odd\">\n<td>4</td>\n<td>100</td>\n<td><code>r--</code></td>\n</tr>\n</tbody>\n</table>\n<p>Three binary digits can be used to represent 8 numbers (2<sup>3</sup>\n== 8) which represents all possible states of read, write, and\nexecute.</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>octal</th>\n<th>binary</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>0</td>\n<td>000</td>\n<td><code>---</code></td>\n</tr>\n<tr class=\"even\">\n<td>1</td>\n<td>001</td>\n<td><code>--x</code></td>\n</tr>\n<tr class=\"odd\">\n<td>2</td>\n<td>010</td>\n<td><code>-w-</code></td>\n</tr>\n<tr class=\"even\">\n<td>3</td>\n<td>011</td>\n<td><code>-wx</code></td>\n</tr>\n<tr class=\"odd\">\n<td>4</td>\n<td>100</td>\n<td><code>r--</code></td>\n</tr>\n<tr class=\"even\">\n<td>5</td>\n<td>101</td>\n<td><code>r-x</code></td>\n</tr>\n<tr class=\"odd\">\n<td>6</td>\n<td>110</td>\n<td><code>rw-</code></td>\n</tr>\n<tr class=\"even\">\n<td>7</td>\n<td>111</td>\n<td><code>rwx</code></td>\n</tr>\n</tbody>\n</table>\n<p>Each digit of the octal, just as for the 3 blocks in a human-readable\npermission, represent a set of users. From left-to-right the 3 digits\nrepresent owner, group, and others.</p>\n<pre><code>7/6/4  foo\n| | +-----&gt; Others can read the file (Binary: 100, Human-readable: r--)\n| +-------&gt; Group can read and write the file (Binary: 110, Human-readable: rw-)\n+---------&gt; User that owns can read, write, and execute the file (Binary: 111, Human-readable: rwx)</code></pre>\n</section>\n<section id=\"viewing-permissions\" class=\"level2\">\n<h2>Viewing permissions</h2>\n<p>You can see permissions for files and directories using the\n<code>stat(1)</code> command. Passing <code>%A</code> to the\n<code>--format</code> argument shows “human-readable” output:</p>\n<pre><code>$ stat --format &#39;Permissions: %A Filename: %n&#39; foo  # %n is filename\nPermissions: -rwxrw-r-- Filename: foo</code></pre>\n<p>“human-readable” output is represented by 10 letters. The left-most\nletter is for node-type which is one of:</p>\n<ul>\n<li><code>-</code>: normal file</li>\n<li><code>d</code>: directory</li>\n<li><code>l</code>: symbolic link</li>\n<li><code>c</code> character device</li>\n<li><code>p</code> pseudo-terminal</li>\n<li><code>b</code> for a block device</li>\n<li><code>s</code> for a socket</li>\n</ul>\n<p>The remaining 9 letters are <code>r</code>ead, <code>w</code>rite,\nand e<code>x</code>ecute for user that owns the file, file’s group, and\nother users; same as above.</p>\n<p>We can see an octal representation using the command\n<code>stat --format %a</code></p>\n<pre><code>$ stat -c &#39;Octal: %a Filename: %n&#39; foo  # Octal (%n is filename)\nOctal: 764 Filename: foo</code></pre>\n</section>\n<section id=\"reading-the-setuid-setgid-and-sticky-bit\" class=\"level2\">\n<h2>Reading the setuid, setgid, and sticky bit</h2>\n<p>Both the human-readable and the octal representation above are\nsimplified. Aside from normal UNIX permissions, there are three extra\nbits of information: setuid, setgid, and the sticky bit. If one of these\nbits of information is set you can see it using the <code>stat(1)</code>\ncommand.</p>\n<pre><code>$ stat -c &#39;Octal: %a Filename: %n&#39; foo  # Octal (%n is filename)\nOctal: 4764 Filename: foo</code></pre>\n<p>The left-most digit that has been prepended onto the normal\npermissions is the setuid/setgid/sticky bit.</p>\n<p>Again, each of the states – setuid, setgid, sticky – can be\nrepresented in combination and alone as octal digits that map to 3 bits\nof information:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>name</th>\n<th>octal</th>\n<th>binary</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td></td>\n<td>0</td>\n<td>000</td>\n</tr>\n<tr class=\"even\">\n<td>sticky</td>\n<td>1</td>\n<td>001</td>\n</tr>\n<tr class=\"odd\">\n<td>setgid</td>\n<td>2</td>\n<td>010</td>\n</tr>\n<tr class=\"even\">\n<td>sticky+setgid</td>\n<td>3</td>\n<td>011</td>\n</tr>\n<tr class=\"odd\">\n<td>setuid</td>\n<td>4</td>\n<td>100</td>\n</tr>\n<tr class=\"even\">\n<td>setuid+sticky</td>\n<td>5</td>\n<td>101</td>\n</tr>\n<tr class=\"odd\">\n<td>setuid+setgid</td>\n<td>6</td>\n<td>110</td>\n</tr>\n<tr class=\"even\">\n<td>sticky+setuid+setgid</td>\n<td>7</td>\n<td>111</td>\n</tr>\n</tbody>\n</table>\n<p>The octal permission for <code>foo</code> translates as:</p>\n<pre><code>4/7/6/4  foo\n| | | +-------&gt; Others can read the file (Binary: 100)\n| | +---------&gt; Group can read and write the file (Binary: 110)\n| +-----------&gt; User that owns can read, write, and execute the file (Binary: 111)\n+-------------&gt; setuid-bit is set (Binary: 100)</code></pre>\n<p>The human-readable representation of the sticky/setuid/setgid bit is\nnot given its own column of 3 letters but is – for some awful reason –\noverlaid on the 10 letter human-readable output:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>name</th>\n<th>octal</th>\n<th>binary</th>\n<th style=\"text-align: right;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td></td>\n<td>0</td>\n<td>000</td>\n<td style=\"text-align: right;\"><code>---------</code></td>\n</tr>\n<tr class=\"even\">\n<td>sticky</td>\n<td>1</td>\n<td>001</td>\n<td style=\"text-align: right;\"><code>--------T</code></td>\n</tr>\n<tr class=\"odd\">\n<td>setgid</td>\n<td>2</td>\n<td>010</td>\n<td style=\"text-align: right;\"><code>-----S---</code></td>\n</tr>\n<tr class=\"even\">\n<td>sticky+setgid</td>\n<td>3</td>\n<td>011</td>\n<td style=\"text-align: right;\"><code>-----S--T</code></td>\n</tr>\n<tr class=\"odd\">\n<td>setuid</td>\n<td>4</td>\n<td>100</td>\n<td style=\"text-align: right;\"><code>--S------</code></td>\n</tr>\n<tr class=\"even\">\n<td>setuid+sticky</td>\n<td>5</td>\n<td>101</td>\n<td style=\"text-align: right;\"><code>--S-----T</code></td>\n</tr>\n<tr class=\"odd\">\n<td>setuid+setgid</td>\n<td>6</td>\n<td>110</td>\n<td style=\"text-align: right;\"><code>--S--S---</code></td>\n</tr>\n<tr class=\"even\">\n<td>sticky+setuid+setgid</td>\n<td>7</td>\n<td>111</td>\n<td style=\"text-align: right;\"><code>--S--S--T</code></td>\n</tr>\n</tbody>\n</table>\n<p>Because this additional bit is not given its own column in the\nhuman-readable permission representation it hides the normal executable\nbit. That is, in each of the 3 blocks representing each of the 3 sets of\nusers, the right-most column of each block represents BOTH whether or\nnot a particular user set has the execute permission AND the\nsticky/setuid/setgid bits.</p>\n<p>When the executable bit is set for a group of users, the\nhuman-readable output uses a lowercase <code>s</code> for setuid/setgid\nand a lowercase <code>t</code> for the sticky bit.</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th>name</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td>setuid</td>\n<td><code>--S------</code></td>\n</tr>\n<tr class=\"even\">\n<td>setuid+user can execute</td>\n<td><code>--s------</code></td>\n</tr>\n<tr class=\"odd\">\n<td>setgid</td>\n<td><code>-----S---</code></td>\n</tr>\n<tr class=\"even\">\n<td>setgid+group can execute</td>\n<td><code>-----s---</code></td>\n</tr>\n<tr class=\"odd\">\n<td>sticky</td>\n<td><code>--------T</code></td>\n</tr>\n<tr class=\"even\">\n<td>sticky+others can execute</td>\n<td><code>--------t</code></td>\n</tr>\n</tbody>\n</table>\n<p>We can see the human-readable permissions for <code>foo</code> using\nthe <code>stat(1)</code> command with the <code>%A</code> format\noption:</p>\n<pre><code>$ stat -c &#39;Permissions: %A Filename: %n&#39; foo  # (%n is filename)\nPermissions: -rwsrw-r-- Filename: foo</code></pre>\n<p>The lowercase <code>s</code> instead of the normal <code>x</code> in\nthe fourth column from the left indicates two things:</p>\n<ol type=\"1\">\n<li>the user that owns the file has the e<code>x</code>ecute\npermission</li>\n<li>the setuid bit is set</li>\n</ol>\n<p>The setuid/setgid/sticky bit have different effects based on\noperating system; whether they’re set on a file or a directory; whether\na file has the executable bit set; and whether a file with an executable\nbit is binary or a script.</p>\n</section>\n<section id=\"setuid\" class=\"level2\">\n<h2>setuid</h2>\n<section id=\"setuid-on-an-executable-binary\" class=\"level3\">\n<h3>setuid on an executable binary</h3>\n<p>If an executable binary with the setuid bit is run, the effective\nuser id of the running process will be the owner of the file.</p>\n<p>For example, a Go file that contains:</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre class=\"sourceCode go\"><code class=\"sourceCode go\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">// user.go</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">package</span> main</span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">import</span> <span class=\"op\">(</span></span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;os&quot;</span></span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;os/user&quot;</span></span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;strconv&quot;</span></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;fmt&quot;</span></span>\n<span id=\"cb8-9\"><a href=\"https://tylercipriani.com/blog/#cb8-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">)</span></span>\n<span id=\"cb8-10\"><a href=\"https://tylercipriani.com/blog/#cb8-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-11\"><a href=\"https://tylercipriani.com/blog/#cb8-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">func</span> main<span class=\"op\">()</span> <span class=\"op\">{</span></span>\n<span id=\"cb8-12\"><a href=\"https://tylercipriani.com/blog/#cb8-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    u<span class=\"op\">,</span> _ <span class=\"op\">:=</span> user<span class=\"op\">.</span>LookupId<span class=\"op\">(</span>strconv<span class=\"op\">.</span>Itoa<span class=\"op\">(</span>os<span class=\"op\">.</span>Getuid<span class=\"op\">()))</span></span>\n<span id=\"cb8-13\"><a href=\"https://tylercipriani.com/blog/#cb8-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    e<span class=\"op\">,</span> _ <span class=\"op\">:=</span> user<span class=\"op\">.</span>LookupId<span class=\"op\">(</span>strconv<span class=\"op\">.</span>Itoa<span class=\"op\">(</span>os<span class=\"op\">.</span>Geteuid<span class=\"op\">()))</span></span>\n<span id=\"cb8-14\"><a href=\"https://tylercipriani.com/blog/#cb8-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>    fmt<span class=\"op\">.</span>Printf<span class=\"op\">(</span><span class=\"st\">&quot;User: %s</span><span class=\"ch\">\\n</span><span class=\"st\">Effective User: %s</span><span class=\"ch\">\\n</span><span class=\"st\">&quot;</span><span class=\"op\">,</span> u<span class=\"op\">.</span>Username<span class=\"op\">,</span> e<span class=\"op\">.</span>Username<span class=\"op\">)</span></span>\n<span id=\"cb8-15\"><a href=\"https://tylercipriani.com/blog/#cb8-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">}</span></span></code></pre></div>\n<p>Once built, with the setuid bit set, outputs:</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; user\n4775 thcipriani:wikidev user\n$ ./user\nUser: thcipriani\nEffective User: thcipriani\n$ sudo -u 💩 ./user\nUser: 💩\nEffective User: thcipriani</code></pre>\n</section>\n<section id=\"setuid-on-an-executable-script\" class=\"level3\">\n<h3>setuid on an executable script</h3>\n<p>The setuid bit has no effect on executable scripts; e.g., python\nscripts, shell scripts, ruby scripts. That is, it will not change the\neffective user id of the person running the script to the owner of the\nfile:</p>\n<div class=\"sourceCode\" id=\"cb10\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env python3</span></span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">user.py</span></span>\n<span id=\"cb10-4\"><a href=\"https://tylercipriani.com/blog/#cb10-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb10-5\"><a href=\"https://tylercipriani.com/blog/#cb10-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb10-6\"><a href=\"https://tylercipriani.com/blog/#cb10-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> os, pwd</span>\n<span id=\"cb10-7\"><a href=\"https://tylercipriani.com/blog/#cb10-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb10-8\"><a href=\"https://tylercipriani.com/blog/#cb10-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">print</span>(<span class=\"st\">&#39;User: </span><span class=\"sc\">{}</span><span class=\"ch\">\\n</span><span class=\"st\">Effective User: </span><span class=\"sc\">{}</span><span class=\"st\">&#39;</span>.<span class=\"bu\">format</span>(</span>\n<span id=\"cb10-9\"><a href=\"https://tylercipriani.com/blog/#cb10-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    pwd.getpwuid(os.getuid()).pw_name,</span>\n<span id=\"cb10-10\"><a href=\"https://tylercipriani.com/blog/#cb10-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>    pwd.getpwuid(os.geteuid()).pw_name))</span></code></pre></div>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; user.py\n4775 thcipriani:wikidev user.py\n$ ./user.py\nUser: thcipriani\nEffective User: thcipriani\n$ sudo -u 💩 ./user.py\nUser: 💩\nEffective User: 💩</code></pre>\n</section>\n<section id=\"setuid-on-a-non-executable-file\" class=\"level3\">\n<h3>setuid on a non-executable file</h3>\n<p>AFAIK, the setuid bit has no effect on files no one can execute.</p>\n<p>There is a pedantic exception of a file with setuid and no executable\nbits set for any of the 3 sets of users (i.e., owner, group, or other\nusers), BUT the file is on a file system that supports ACL mounting and\nhas special ACL permissions setup. If the file has ACL permissions that\nallow a user or group to execute the file, the file will execute\nfollowing setuid rules for files with executable bits set.</p>\n<p>This exception, it should be noted, is not actually an exception\nsince it is in practice the same scenario as an executable file with\nsetuid set – we’ve just dragged ACLs into it for fun and pedantry.</p>\n</section>\n<section id=\"setuid-on-a-directory\" class=\"level3\">\n<h3>setuid on a directory</h3>\n<p>AFAIK, the setuid bit has no effect directories. I’ve heard tell of a\nfew systems where the setuid bit on a directory will cause files created\ninside that directory to have the same owner as the parent\ndirectory.</p>\n<p>This seems insane to me from a security perspective.</p>\n</section>\n</section>\n<section id=\"setgid\" class=\"level2\">\n<h2>setgid</h2>\n<section id=\"setgid-on-an-executable-binary\" class=\"level3\">\n<h3>setgid on an executable binary</h3>\n<p>If the setgid bit is set on an executable binary, the effective group\nid of the process during execution is set to the group of of the file\nitself. For example:</p>\n<div class=\"sourceCode\" id=\"cb12\"><pre\nclass=\"sourceCode go\"><code class=\"sourceCode go\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">// group.go</span></span>\n<span id=\"cb12-2\"><a href=\"https://tylercipriani.com/blog/#cb12-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">package</span> main</span>\n<span id=\"cb12-3\"><a href=\"https://tylercipriani.com/blog/#cb12-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb12-4\"><a href=\"https://tylercipriani.com/blog/#cb12-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">import</span> <span class=\"op\">(</span></span>\n<span id=\"cb12-5\"><a href=\"https://tylercipriani.com/blog/#cb12-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;fmt&quot;</span></span>\n<span id=\"cb12-6\"><a href=\"https://tylercipriani.com/blog/#cb12-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;os&quot;</span></span>\n<span id=\"cb12-7\"><a href=\"https://tylercipriani.com/blog/#cb12-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;os/user&quot;</span></span>\n<span id=\"cb12-8\"><a href=\"https://tylercipriani.com/blog/#cb12-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;strconv&quot;</span></span>\n<span id=\"cb12-9\"><a href=\"https://tylercipriani.com/blog/#cb12-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">)</span></span>\n<span id=\"cb12-10\"><a href=\"https://tylercipriani.com/blog/#cb12-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb12-11\"><a href=\"https://tylercipriani.com/blog/#cb12-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">func</span> main<span class=\"op\">()</span> <span class=\"op\">{</span></span>\n<span id=\"cb12-12\"><a href=\"https://tylercipriani.com/blog/#cb12-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    g<span class=\"op\">,</span> _ <span class=\"op\">:=</span> user<span class=\"op\">.</span>LookupGroupId<span class=\"op\">(</span>strconv<span class=\"op\">.</span>Itoa<span class=\"op\">(</span>os<span class=\"op\">.</span>Getgid<span class=\"op\">()))</span></span>\n<span id=\"cb12-13\"><a href=\"https://tylercipriani.com/blog/#cb12-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    e<span class=\"op\">,</span> _ <span class=\"op\">:=</span> user<span class=\"op\">.</span>LookupGroupId<span class=\"op\">(</span>strconv<span class=\"op\">.</span>Itoa<span class=\"op\">(</span>os<span class=\"op\">.</span>Getegid<span class=\"op\">()))</span></span>\n<span id=\"cb12-14\"><a href=\"https://tylercipriani.com/blog/#cb12-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>    fmt<span class=\"op\">.</span>Printf<span class=\"op\">(</span><span class=\"st\">&quot;Group: %s</span><span class=\"ch\">\\n</span><span class=\"st\">Effective Group: %s</span><span class=\"ch\">\\n</span><span class=\"st\">&quot;</span><span class=\"op\">,</span> g<span class=\"op\">.</span>Name<span class=\"op\">,</span> e<span class=\"op\">.</span>Name<span class=\"op\">)</span></span>\n<span id=\"cb12-15\"><a href=\"https://tylercipriani.com/blog/#cb12-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">}</span></span></code></pre></div>\n<p>Once built, with the setgid bit set, outputs:</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; group\n2775 thcipriani:wikidev group\n$ ./group\nGroup: thcipriani\nEffective Group: wikidev\n$ sudo -u 💩 ./group\nGroup: 💩\nEffective Group: wikidev</code></pre>\n</section>\n<section id=\"setgid-on-a-script\" class=\"level3\">\n<h3>setgid on a script</h3>\n<p>The setgid bit has no effect on executable scripts; e.g., python\nscripts, shell scripts, ruby scripts. That is, it will not change the\neffective group id of the person running the script to the file’s\ngroup:</p>\n<div class=\"sourceCode\" id=\"cb14\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env python3</span></span>\n<span id=\"cb14-2\"><a href=\"https://tylercipriani.com/blog/#cb14-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb14-3\"><a href=\"https://tylercipriani.com/blog/#cb14-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">group.py</span></span>\n<span id=\"cb14-4\"><a href=\"https://tylercipriani.com/blog/#cb14-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb14-5\"><a href=\"https://tylercipriani.com/blog/#cb14-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb14-6\"><a href=\"https://tylercipriani.com/blog/#cb14-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> os, grp</span>\n<span id=\"cb14-7\"><a href=\"https://tylercipriani.com/blog/#cb14-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb14-8\"><a href=\"https://tylercipriani.com/blog/#cb14-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">print</span>(<span class=\"st\">&#39;Group: </span><span class=\"sc\">{}</span><span class=\"ch\">\\n</span><span class=\"st\">Effective Group: </span><span class=\"sc\">{}</span><span class=\"st\">&#39;</span>.<span class=\"bu\">format</span>(</span>\n<span id=\"cb14-9\"><a href=\"https://tylercipriani.com/blog/#cb14-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    grp.getgrgid(os.getgid()).gr_name,</span>\n<span id=\"cb14-10\"><a href=\"https://tylercipriani.com/blog/#cb14-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>    grp.getgrgid(os.getegid()).gr_name))</span></code></pre></div>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; group.py\n2775 thcipriani:wikidev group.py\n$ ./group.py\nGroup: thcipriani\nEffective Group: thcipriani\n$ sudo -u 💩 ./group.py\nGroup: 💩\nEffective Group: 💩</code></pre>\n</section>\n<section id=\"setgid-on-a-file\" class=\"level3\">\n<h3>setgid on a file</h3>\n<p>If the setgid bit is set WITHOUT the group executable bit being set;\ne.g., <code>rwxrwS---</code> some file systems use that as an indicator\nthat the file uses <a\nhref=\"https://www.kernel.org/doc/Documentation/filesystems/mandatory-locking.txt\">mandatory\nfile locking</a>. Caveat emptor – the 0th item in the Linux kernel\ndocumentation on mandatory file locking is, “Why you should avoid\nmandatory locking” – this, to me, makes it seems like a bit of a fraught\nendeavour.</p>\n</section>\n<section id=\"setgid-on-a-directory\" class=\"level3\">\n<h3>setgid on a directory</h3>\n<p>The setgid bit on a directory will cause files and subdirectories\ncreated inside the directory to have the same group as the parent\ndirectory – even if the user creating the file is <em>not</em> in the\nparent directory’s group.</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; setgid\n2775 thcipriani:wikidev setgid\n$ touch setgid/thcipriani\n$ sudo -u mwdeploy touch setgid/mwdeploy\n stat --format &#39;%a %U:%G %n&#39; setgid/thcipriani\n664 thcipriani:wikidev setgid/thcipriani\n$ stat --format &#39;%a %U:%G %n&#39; setgid/mwdeploy\n644 mwdeploy:wikidev setgid/mwdeploy</code></pre>\n<p>Users not within the directory’s group will not be able to create\nfiles unless the directory is writable by others:</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; setgid\n2775 thcipriani:wikidev setgid\n$ sudo -u 💩 touch setgid/💩  # Not a user in wikidev\ntouch: cannot touch &#39;setgid/💩&#39;: Permission denied\n$ chmod o+w setgid\n$ sudo -u 💩 touch setgid/💩  # Not a user in wikidev\n$ stat --format &#39;%A %U:%G %n&#39; setgid/💩\n644 💩:wikidev setgid/💩</code></pre>\n</section>\n</section>\n<section id=\"sticky-bit\" class=\"level2\">\n<h2>Sticky bit</h2>\n<section id=\"sticky-bit-on-an-executable-binary\" class=\"level3\">\n<h3>Sticky bit on an executable binary</h3>\n<p>AFAIK, the sticky bit has no effect on file execution. In older\nsystems, setting the sticky bit on a file caused the file to remain in\nswap after execution. Since swap images were contiguous sectors of disk\non older systems, this was faster than re-reading an executable from\ndisk – or so stackoverflow<a href=\"https://tylercipriani.com/blog/#fn1\" class=\"footnote-ref\"\nid=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a> tells me.</p>\n</section>\n<section id=\"sticky-bit-on-a-directory-aka-restricted-deletion-flag\"\nclass=\"level3\">\n<h3>Sticky bit on a directory (AKA, restricted-deletion flag)</h3>\n<p>If the sticky bit is set on a directory, no one can delete files in\nthat directory except <code>root</code>, the owner of the directory, or\nthe owner of the file in the directory. Even a member of the directory’s\ngroup cannot delete a file put there by someone not in that group who\nalso has write permission on the directory.</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; stickybit\n1777 thcipriani:wikidev stickybit\n$ sudo -u 💩 touch stickybit/💩\n$ sudo -u mwdeploy rm stickybit/💩\nrm: remove write-protected regular empty file &#39;stickybit/💩&#39;? y\nrm: cannot remove &#39;stickybit/💩&#39;: Operation not permitted</code></pre>\n<p>Under normal conditions anyone with <code>w</code>rite permission to\na directory could delete files in that directory.</p>\n<pre><code>$ stat --format &#39;%a %U:%G %n&#39; stickybit\n777 thcipriani:wikidev stickybit\n$ sudo -u 💩 touch nostickybit/💩\n$ sudo -u mwdeploy rm nostickybit/💩\nrm: remove write-protected regular empty file &#39;nostickybit/💩&#39;? y\n# File is removed</code></pre>\n<p>The standard <code>/tmp</code> directory on a Linux system has the\nsticky bit set for this exact reason. No one besides <code>root</code>\nand the owner of the file in <code>/tmp/</code> should be able to remove\na file from <code>/tmp</code>.</p>\n</section>\n</section>\n<section id=\"bitwise-operations\" class=\"level2\">\n<h2>Bitwise operations</h2>\n<p>Every permission can be represented as binary bits: <code>1</code> or\n<code>0</code>. These bits can be combined using bitwise operations.\nBitwise operations are a bit of Jedi-level black magic. I have to lookup\nbitwise operations more often than not. Each time I look this stuff up,\nI’m positive that it’ll stick, but my brain is Teflon™ for bit-twiddling\nit seems.</p>\n<p>Bitwise operations are often used in low-level computer programs\nbecause they execute quickly. A simple bitwise operation might be a\nlogical <code>OR</code>, represented by the symbol <code>|</code> which\nhas some simple rules for how to combine 1s and 0s:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: center;\">Logical OR <code>|</code></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>0 | 0 == 0</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>0 | 1 == 1</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>1 | 0 == 1</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>1 | 1 == 1</code></td>\n</tr>\n</tbody>\n</table>\n<p>If either bit passed to a logical <code>OR</code> is <code>1</code>,\nthe output is <code>1</code>; otherwise the output is\n<code>0</code>.</p>\n<p>There is a complementary bitwise function called logical\n<code>AND</code> (<code>&amp;</code>) that works in the exact\nopposite-ish way:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: center;\">Logical AND <code>&amp;</code></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>0 &amp; 0 == 0</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>0 &amp; 1 == 0</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>1 &amp; 0 == 0</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>1 &amp; 1 == 1</code></td>\n</tr>\n</tbody>\n</table>\n<p>That is, if either of the bits passed as arguments to a logical\n<code>AND</code> is <code>0</code>, the output is <code>0</code>. Only\nwhen both bits are <code>1</code> is the output <code>1</code>.</p>\n<p>There are other ways to change the bits in a bit field that don’t\ninvolve combining two binary numbers. A unary operation operates on a\nsingle argument. For example, you can find the complement of a binary\nnumber by flipping all the bits. This is called a logical\n<code>NOT</code> (or logical complement) and is represented by the\nsymbol <code>~</code>.</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: center;\">Logical Complement <code>~</code></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>~0 == 1</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>~1 == 0</code></td>\n</tr>\n</tbody>\n</table>\n<p>If you combine these two functions – you can take the logical\n<code>AND</code> of a bit and another bit’s <code>NOT</code>. This is\ncalled the <em>abjunction</em>:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: center;\">Logical AND <code>&amp;</code> with\nLogical Complement <code>~</code> (abjunction)</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>0 &amp; ~0 == 0</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>0 &amp; ~1 == 0</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: center;\"><code>1 &amp; ~0 == 1</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: center;\"><code>1 &amp; ~1 == 0</code></td>\n</tr>\n</tbody>\n</table>\n<p>Internally, bitwise functions are used to set the modes for a file.\nFor example, if I wanted the file’s user to be able to read\n(<code>4</code>) and write (<code>2</code>) a file I could\n<code>OR</code> those individual permissions together in code:</p>\n<pre><code>&gt;&gt;&gt; 4 | 2  # S_IRUSR | S_IWUSR\n6</code></pre>\n<p>It’s a bit easier to see what’s happening by looking at the\npermissions’ binary representations:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th>binary</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">2</td>\n<td>010</td>\n<td><code>-w-</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">OR <code>|</code></td>\n<td style=\"text-align: left;\">4</td>\n<td>100</td>\n<td><code>r--</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">6</td>\n<td>110</td>\n<td><code>rw-</code></td>\n</tr>\n</tbody>\n</table>\n<p>If I now decide: I’d like to have the file’s user <em>also</em>\nexecute the file, I can <code>OR</code> the existing permission, with\nthe execute permission (<code>1</code>):</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th>binary</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">6</td>\n<td>110</td>\n<td><code>rw-</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">OR <code>|</code></td>\n<td style=\"text-align: left;\">1</td>\n<td>001</td>\n<td><code>--x</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">7</td>\n<td>111</td>\n<td><code>rwx</code></td>\n</tr>\n</tbody>\n</table>\n</section>\n<section id=\"setting-permissions\" class=\"level2\">\n<h2>Setting Permissions</h2>\n<p>You can set any permissions (AKA, the file <em>mode</em>) via the\n<code>chmod</code> (i.e., <code>ch</code>ange <code>mod</code>e)\ncommand. You can use either an octal mode in <code>chmod</code> or you\ncan use human-readable permissions along with <code>u</code>,\n<code>g</code>, <code>o</code>, and <code>a</code> to refer to\n<code>u</code>ser that owns the file, users in the file’s\n<code>g</code>roup, <code>o</code>thers, and <code>a</code>ll to refer\nto all 3. With <code>chmod</code> you can add (<code>+</code>)\npermissions, remove permissions (<code>-</code>), or set permissions\ndirectly (<code>=</code>) for any set of users. The format of that\ncommand is:</p>\n<pre><code>chmod [options] [[ugoa][+-=][human-readable],...] &lt;file&gt;</code></pre>\n<p>For example, to remove all permissions from a file, you could mark\nall sets of users as having no permissions:</p>\n<pre><code>$ chmod u=,g=,o= tmp/foo\n$ stat --format &#39;%A&#39; tmp/foo\n----------</code></pre>\n<p>Then you could add back read for the file’s <code>u</code>ser:</p>\n<pre><code>$ chmod u+r foo\n$ stat --format &#39;%A&#39; foo\n-r--------</code></pre>\n<p>When adding permissions, <code>chmod</code> uses the logical\n<code>OR</code> to combine file permissions with additional permissions\nyou <em>add</em>. In the example above, we added the read\npermission:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th>binary</th>\n<th>human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">0</td>\n<td>000</td>\n<td><code>---</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">OR <code>|</code></td>\n<td style=\"text-align: left;\">4</td>\n<td>100</td>\n<td><code>r--</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">4</td>\n<td>100</td>\n<td><code>r--</code></td>\n</tr>\n</tbody>\n</table>\n<p>We could have achieved the same result by specifying the octal mode\nfor <code>r</code>ead for the user that owns the file,\ni.e. <code>400</code>:</p>\n<pre><code>$ chmod 400 foo\n$ stat --format &#39;%A&#39; foo\n-r--------</code></pre>\n<p>You can also remove permissions from sets of users with\n<code>chmod</code>. For instance, to remove the ability of\n<code>a</code>ll users to e<code>x</code>ecute a file we could use\n<code>a-x</code>; i.e.:</p>\n<pre><code>$ stat --format &#39;%A&#39; foo\n-rwxr-xr-x\n$ chmod a-x foo\n$ stat --format &#39;%A&#39; foo\n-rw-r--r--</code></pre>\n<p>Removing permissions is done via a logical abjunction:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th style=\"text-align: left;\">binary</th>\n<th style=\"text-align: left;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">NOT <code>~</code></td>\n<td style=\"text-align: left;\">111</td>\n<td style=\"text-align: left;\">001 001 001</td>\n<td style=\"text-align: left;\"><code>u=--x,g=--x,o=--x</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">666</td>\n<td style=\"text-align: left;\">110 110 110</td>\n<td style=\"text-align: left;\"><code>u=rw-,g=rw-,o=rw-</code></td>\n</tr>\n</tbody>\n</table>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th style=\"text-align: left;\">binary</th>\n<th style=\"text-align: left;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">755</td>\n<td style=\"text-align: left;\">111 101 101</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=r-x,o=r-x</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">AND <code>&amp;</code></td>\n<td style=\"text-align: left;\">666</td>\n<td style=\"text-align: left;\">110 110 110</td>\n<td style=\"text-align: left;\"><code>u=rw-,g=rw-,o=rw-</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">644</td>\n<td style=\"text-align: left;\">110 100 100</td>\n<td style=\"text-align: left;\"><code>u=rw-,g=r--,o=r--</code></td>\n</tr>\n</tbody>\n</table>\n</section>\n<section id=\"umask\" class=\"level2\">\n<h2>Umask</h2>\n<p>Another aspect of permissions to consider is the umask of a process.\nUmask is a per-process value that tells <code>mkdir</code>,\n<code>open</code>, and other file-creation calls what permissions to\n<em>take-away</em>.</p>\n<p>Umask is defined in POSIX as both a built-in for the shell<a\nhref=\"https://tylercipriani.com/blog/#fn2\" class=\"footnote-ref\" id=\"fnref2\"\nrole=\"doc-noteref\"><sup>2</sup></a> and a function<a href=\"https://tylercipriani.com/blog/#fn3\"\nclass=\"footnote-ref\" id=\"fnref3\" role=\"doc-noteref\"><sup>3</sup></a>.\nBoth are used to read and set a umask.</p>\n<p>The <code>umask</code> for a system is typically set in\n<code>/etc/profile</code> and may optionally be overridden in various\ninitialization files or in process using a call to the\n<code>umask</code> utility or function.</p>\n<p>There are 3 octal digits in a umask and the default umask for many\nsystems is <code>022</code>.</p>\n<p>To determine the permissions that a file or directory will be created\nwith we take the logical abjunction of the default creation mode for\nfiles or directories and the umask.</p>\n<p>For directories, the default creation mode is <code>777</code>. When\n<code>mkdir</code> is called, the logical abjunction of <code>777</code>\nand <code>022</code> determines the new directory’s permissions:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th style=\"text-align: left;\">binary</th>\n<th style=\"text-align: left;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">NOT <code>~</code></td>\n<td style=\"text-align: left;\">022</td>\n<td style=\"text-align: left;\">000 010 010</td>\n<td style=\"text-align: left;\"><code>u=,g=w,o=w</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">755</td>\n<td style=\"text-align: left;\">111 101 101</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=rx,o=rx</code></td>\n</tr>\n</tbody>\n</table>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th style=\"text-align: left;\">binary</th>\n<th style=\"text-align: left;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">755</td>\n<td style=\"text-align: left;\">111 101 101</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=rx,o=rx</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">AND <code>&amp;</code></td>\n<td style=\"text-align: left;\">777</td>\n<td style=\"text-align: left;\">111 111 111</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=rwx,o=rwx</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">755</td>\n<td style=\"text-align: left;\">111 101 101</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=rx,o=rx</code></td>\n</tr>\n</tbody>\n</table>\n<p>For files, the default creation mode is <code>666</code>. When a user\ncreates a file using <code>touch</code>, the logical abjunction of\n<code>666</code> and <code>022</code> determines the new file’s\npermissions:</p>\n<table>\n<thead>\n<tr class=\"header\">\n<th style=\"text-align: right;\">bitwise</th>\n<th style=\"text-align: left;\">octal</th>\n<th style=\"text-align: left;\">binary</th>\n<th style=\"text-align: left;\">human-readable</th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"odd\">\n<td style=\"text-align: right;\"></td>\n<td style=\"text-align: left;\">755</td>\n<td style=\"text-align: left;\">111 101 101</td>\n<td style=\"text-align: left;\"><code>u=rwx,g=rx,o=rx</code></td>\n</tr>\n<tr class=\"even\">\n<td style=\"text-align: right;\">AND <code>&amp;</code></td>\n<td style=\"text-align: left;\">666</td>\n<td style=\"text-align: left;\">110 110 110</td>\n<td style=\"text-align: left;\"><code>u=rw,g=rw,o=rw</code></td>\n</tr>\n<tr class=\"odd\">\n<td style=\"text-align: right;\">=</td>\n<td style=\"text-align: left;\">644</td>\n<td style=\"text-align: left;\">110 100 100</td>\n<td style=\"text-align: left;\"><code>u=rw,g=r,o=r</code></td>\n</tr>\n</tbody>\n</table>\n</section>\n<section id=\"history\" class=\"level2\">\n<h2>History</h2>\n<p>Basic permissions for file owners and other users of a system were\nin-place in UNIX from the beginning – <a\nhref=\"https://minnie.tuhs.org/cgi-bin/utree.pl?file=PDP7-Unix\">PDP-7\nera</a> – circa 1970. Owner and other-user permissions actually pre-date\nUNIX and were a part of Multics. According to <a\nhref=\"https://minnie.tuhs.org/pipermail/tuhs/2019-August/018193.html\">McIlroy</a>\nthe concepts of a file owner and other users acting on files were common\n10 years prior to the first UNIX.</p>\n<p>In late 1973, version 4 of UNIX was released. This release is when\ngroup file permissions first show up in the <a\nhref=\"https://minnie.tuhs.org/cgi-bin/utree.pl?file=V4/man/man2/chmod.2\">chmod\nman page</a>.</p>\n<p>Oddly (to me anyway) the setuid concept pre-dates the concept of\ngroup permissions by 3 years or so – it’s described by <a\nhref=\"https://web.archive.org/web/20160304043429/http://www.tuhs.org/Archive/PDP-11/Distributions/research/McIlroy_v0/UnixEditionZero.txt\">Ritchie</a>\nin early UNIX manuals – and goes all the way back to PDP-7 UNIX. Dennis\nRitchie was granted a <a\nhref=\"https://patents.google.com/patent/US4135240A/en\">patent</a> for\nsetuid in 1973.</p>\n</section>\n<section id=\"summary\" class=\"level2\">\n<h2>Summary</h2>\n<p>There are 3 permissions and 3 sets of users. The setuid and setgid\nbits set effective users and groups (respectively) for binaries only –\nnot for scripts. The setgid bit on a directory means that files and\nsub-directories created inside that directory will have the same group\nas the parent. The sticky bit limits who can delete files inside a\ndirectory.</p>\n<p>Everything else inside this post is stuff I forget constantly and am\nalmost certainly wrong about in some material way. In practice, this is\nthe mental model of UNIX permissions that has served me for my 10 or so\nyears of desktop Linux usage and a few jobs twiddling these particular\nbits.</p>\n<p>I published this post as a challenge for myself and my understand and\nas a useful reference manual for dummies – that is to say <em>me</em>\nafter I, once-again, forget all that esoteric shit about\n<em>abjunctions</em> for the <em>N</em>th time.</p>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p><a\nhref=\"https://unix.stackexchange.com/questions/79395/how-does-the-sticky-bit-work#comment395032_79401\"\nclass=\"uri\">https://unix.stackexchange.com/questions/79395/how-does-the-sticky-bit-work#comment395032_79401</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p><a\nhref=\"https://pubs.opengroup.org/onlinepubs/9699919799/utilities/umask.html\"\nclass=\"uri\">https://pubs.opengroup.org/onlinepubs/9699919799/utilities/umask.html</a><a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p><a\nhref=\"https://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html\"\nclass=\"uri\">https://pubs.opengroup.org/onlinepubs/9699919799/functions/umask.html</a><a\nhref=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2019/12/31/the-square-knot/",

    "title": "The Square Knot",
    "url": "https://tylercipriani.com/blog/2019/12/31/the-square-knot/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "TIL",

     "knots"

    ],

    "date_published": "2019-12-31T17:37:58Z",
    "date_modified": "2019-12-31T18:38:37Z",


    "content_html": "<p>TIL how to tie my shoes 😐.</p>\n<p>I figured this out today – the last day of 2019 – while I was tying\ntogether two ends of <a\nhref=\"https://www.knotandrope.com/products/1-4-solid-braid-cotton\">cotton\nsash cord</a> to make a loop. I suddenly noticed my square knot didn’t\nlook like the cover of the <a\nhref=\"https://www.scoutshop.org/knots-and-how-to-tie-them-33170.html\">Boy\nScouts knot book</a>.</p>\n<p>I looked up the square knot on <a\nhref=\"https://www.animatedknots.com/square-knot\">animatedknots.com</a> –\nwhich is an amazing site with step-by-step instructions for all kinds of\nknots. Sure enough, I had been doing wrong – left-over-right,\nleft-over-right – a <em>granny</em> knot vs a <em>square</em> knot.</p>\n<figure>\n    <img src=\"https://photos.tylercipriani.com/thumbs/98/35fdab9623b1a33494ae7288baa1e9/large.jpg\" title=\"Loose Granny Knot\" alt=\"Granny Knot\">\n    <figcaption>Loose Granny Knot</figcaption>\n</figure>\n<figure>\n    <img src=\"https://photos.tylercipriani.com/thumbs/20/1930bb79419f3618b660d77414b9c3/large.jpg\" title=\"Loose Square/Reef Knot\" alt=\"Square Knot\">\n    <figcaption>Loose Square/Reef Knot</figcaption>\n</figure>\n<p>This was satisfying, if a little embarassing – I somehow made it\nthrough Cub Scouts without learning to tie a square knot. As I kept\nreading animatedknots.com I learned something else:</p>\n<blockquote>\n<p>The Square (Reef) Knot […] is usually learned when we tie the laces\non our first pair of shoes. Admittedly it is usually a bow that we tie –\nbut the underlying knot is a Square (Reef) Knot.</p>\n</blockquote>\n<p>I quickly untied and retied my shoes – left-over-right,\nleft-over-right – damnit – a granny knot. It’s especially frustrating\ngiven that I’d seen <a\nhref=\"https://www.fieggen.com/shoelace/grannyknot.htm\">Ian’s Shoelace\nSite’s page on Granny Knots</a> forever ago and dismissed it because my\nshoelace bows weren’t askew.</p>\n<p>So here I am – a living cautionary tale. It’s the last day of 2019.\nI’m 33. And I <em>just</em> learned to tie my shoes 🌠.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2019/12/10/be-kind-code-review/",

    "title": "Be Kind in Code Review",
    "url": "https://tylercipriani.com/blog/2019/12/10/be-kind-code-review/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "rambling",

     "software"

    ],

    "date_published": "2019-12-10T17:29:31Z",
    "date_modified": "2019-12-10T19:31:02Z",


    "content_html": "<p>We have a “book” club at work. I say “book” because it’s more of a\nmedia club – we discuss books, articles, videos – anything that’s topic\nis related to engineering productivity. We recently read Google’s\nEngineering Practices doc <a\nhref=\"https://google.github.io/eng-practices/review/reviewer/\"><em>How\nto do a code review</em></a>.</p>\n<p>The guiding principles of this document were excellent:</p>\n<ul>\n<li>Default to merging code</li>\n<li>Don’t merge anything that doesn’t improve code health</li>\n<li>Focus on speed and time to first comment</li>\n</ul>\n<p>One part of this document I’ve been ruminating on is the first\nsummary item for <a\nhref=\"https://google.github.io/eng-practices/review/reviewer/comments.html\">how\nto give comments</a> – <strong>Be Kind</strong>.</p>\n<p>There weren’t many instructions for <em>how</em> to be kind, and\nthere was no discussion about <em>why</em> it’s important to be\nkind.</p>\n<section id=\"how-to-be-kind\" class=\"level2\">\n<h2>How to Be Kind</h2>\n<p>Being kind is not seen as very expedient. In code review, we’re told,\nspeed is important. A kind code review can be an expedient code review\nby following simple heuristics, the first of which is listed in Google’s\ncode review guidelines as a means of courteous review, “Make comments\nabout code and not about the developer”. I think a few additional\nheuristics may give a fuller list:</p>\n<ul>\n<li><a\nhref=\"https://en.wikipedia.org/wiki/Wikipedia:Assume_good_faith\">Assume\ngood faith</a></li>\n<li>Make comments about code and not about the developer</li>\n<li>Never use the words “obviously” or “clearly” – if it were obvious or\nclear it wouldn’t need to be said</li>\n<li>Be explicit and assume a low-context culture</li>\n</ul>\n<p>This final point requires some unpacking. Much time is lost by\ncontributors meditating on comments of reviewers – be kind to\ncontributors – tell them what you mean as clearly as you can.</p>\n<p>In the Google code review guidelines they say, “If you ask a\ndeveloper to explain a piece of code that you don’t understand, that\nshould usually result in them rewriting the code more clearly.” This is\nan example of a code review expectation in a <a\nhref=\"https://en.wikipedia.org/wiki/High-context_and_low-context_cultures\">high-context</a>\nculture like Google – it’s implicitly understood that asking for\nclarification means a rewrite or a comment – your code is unclear!</p>\n<p>At my work, I may receive changelists from folks with whom I share\nvery little context. Rather than use a less-direct message that may have\nmore meaning to me I can be more explicit and say, “This function\ndoesn’t make sense to me, could you rework it a bit to clarify its\nfunction?”</p>\n</section>\n<section id=\"why-be-kind\" class=\"level2\">\n<h2>Why Be Kind?</h2>\n<p>Being kind in code review directly affects the health of your\nproject.</p>\n<p>There’s a imbalanced power dynamic in code review between reviewer\nand developer. This imbalance of power is by design – one of the\nfunctions of code review is to serve as a pedagogical tool – bringing\ndevelopers up-to-speed on a project’s standards quickly. Power\nimbalances in code review, if unchecked and persistent:</p>\n<ul>\n<li>Demotivate existing contributors</li>\n<li>Repel new contributions</li>\n<li>Have a chilling effect on contributions in review</li>\n</ul>\n<p>These outcomes all result in:</p>\n<ul>\n<li>Fewer new contributors</li>\n<li>Fewer contributions from existing contributors</li>\n<li>A lower diversity of contributors</li>\n<li>An overall slower pace of change</li>\n</ul>\n<p>One point in Google’s documentation that bears repeating, “there is\nno such thing as perfect code, only better code”. Improving code is an\niterative process; the fewer contributors and the few the iterations,\nthe fewer and slower the improvements. In short, persistently uncivil\ncode review is an existential threat to a project.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2019/11/14/maintaining-wiki-userscripts-via-git/",

    "title": "Maintaining MediaWiki User Scripts via Git",
    "url": "https://tylercipriani.com/blog/2019/11/14/maintaining-wiki-userscripts-via-git/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "Wikipedia",

     "computing",

     "wikimedia"

    ],

    "date_published": "2019-11-14T01:25:48Z",
    "date_modified": "2019-12-10T19:31:02Z",


    "content_html": "<p>This week I’m at the <a\nhref=\"https://www.mediawiki.org/wiki/Wikimedia_Technical_Conference/2019\">Wikimedia\nTechnical Conference</a> in Atlanta, Georgia. I’ve attended a bunch of\ngreat sessions and I’m getting a lot out of my attendance. Today I\nattended a session about “user scripts” that piqued my interest.</p>\n<p><a href=\"https://en.wikipedia.org/wiki/WP:US\">MediaWiki user\nscripts</a> are powerful user-customizations, written in JavaScript,\nthat themselves exists as pages <em>on</em> the wiki and are used to\nmodify a user’s view of MediaWiki page. There are many <a\nhref=\"https://en.wikipedia.org/wiki/WP:USL\">available user scripts</a>,\nand you can also write your own directly in your <a\nhref=\"https://en.wikipedia.org/wiki/Special:MyPage/common.js\">common.js\nuser page</a> (or in any lowercase user page).</p>\n<p>I’m enamoured by all of this. Going into this session, I wasn’t too\nterribly familiar with gadgets and user scripts – but I learned a ton!\nThe folks in the community know best the kinds of customizations that\nwill improve their lives, and here’s the mechanism by which they’re\nempowered to make that happen. There are, however, some issues with this\napproach.</p>\n<p>I love wikipages, but I was, long-ago, crippled by Vim and I can’t\nedit any long-form text outside of Vim and a wikipage is not Vim.\nFurther, code review for user scripts seems, from what I’m told anyway,\na bit ad hoc.</p>\n<p>One of the projects I spend a lot of time digging in is <a\nhref=\"https://github.com/git/git\">git</a>; particularly in the\n<code>contrib</code> folder of the project. There are all sorts of\nstrange and wonderful scripts there. One contrib script that I’ve been\naware of for years is <a\nhref=\"https://github.com/git/git/blob/master/contrib/mw-to-git/git-remote-mediawiki.txt\"><code>mw-to-git</code></a>\nwhich is a perl module that provides a custom MediaWiki remote for git\nrepos. This, to me, seems like a potential solution to this problem.</p>\n<section id=\"setup-and-usage\" class=\"level2\">\n<h2>Setup and usage</h2>\n<p>After you’ve installed <code>git-mediawiki</code> and have that in\nyour path and the perl module installed, the process is not too\ninvolved.</p>\n<p>First, you initialize a git repo setting the “pages” variable on the\nremote to limit it only to the pages you’re interested in. In this\ninstance, I’m interested in my user’s <code>common.js</code> file:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git init</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Initialized</span> empty Git repository in /home/thcipriani/Projects/User:Thcipriani/.git/</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git remote add origin mediawiki::https://en.wikipedia.org/w</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git config remote.origin.pages <span class=\"st\">&#39;User:Thcipriani/common.js&#39;</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git pull</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Searching</span> revisions...</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">No</span> previous mediawiki revision found, fetching from beginning.</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Fetching</span> <span class=\"kw\">&amp;</span> <span class=\"ex\">writing</span> export data by pages...</span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Listing</span> pages on remote wiki...</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1</span> pages found.</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">page</span> 1/1: User:Thcipriani/common.js</span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">Found</span> 2 revision<span class=\"er\">(</span><span class=\"ex\">s</span><span class=\"kw\">)</span><span class=\"bu\">.</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Namespace</span> User not found in cache, querying the wiki ...</span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1/2:</span> Revision <span class=\"co\">#926066306 of User:Thcipriani%2Fcommon.js</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">2/2:</span> Revision <span class=\"co\">#926066361 of User:Thcipriani%2Fcommon.js</span></span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Searching</span> revisions...</span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">No</span> previous mediawiki revision found, fetching from beginning.</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Fetching</span> <span class=\"kw\">&amp;</span> <span class=\"ex\">writing</span> export data by pages...</span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Listing</span> pages on remote wiki...</span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1</span> pages found.</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">page</span> 1/1: User:Thcipriani/common.js</span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">Found</span> 2 revision<span class=\"er\">(</span><span class=\"ex\">s</span><span class=\"kw\">)</span><span class=\"bu\">.</span></span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1/2:</span> Revision <span class=\"co\">#926066306 of User:Thcipriani%2Fcommon.js</span></span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">2/2:</span> Revision <span class=\"co\">#926066361 of User:Thcipriani%2Fcommon.js</span></span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git checkout master</span></code></pre></div>\n<p>Now I have a file in that directory,\n<code>User:Thcipriani%2Fcommon.js.mw</code>, that contains the contents\nof my <code>common.js</code> page. From here I can make slight\nmodifications to the page and push it backup via the same git\nremote.</p>\n<pre><code>$ chmod 600 .git/config  # Since we&#39;ll end up with a password in there\n$ git config remote.origin.mwUser &#39;Thcipriani&#39;\n$ git config remote.origin.mwPassword &#39;NotMyPassword1234&#39;\n$ git push\nLast local mediawiki revision found is 926066361.\nLogged in mediawiki user &quot;thcipriani&quot;.\nListing pages on remote wiki...\n1 pages found.\nGetting last revision id on tracked pages...\nLast remote revision found is 926066361.\nComputing path from local to remote ...\nNamespace User:Thcipriani/common.js.mw not found in cache, querying the wiki ...\nNo such namespace User:Thcipriani/common.js.mw on MediaWiki, known namespaces: Book Book_talk Category Category_talk Draft Draft_talk Education_Progra$\n Education_Program_talk File File_talk Gadget Gadget_definition Gadget_definition_talk Gadget_talk Help Help_talk Media MediaWiki MediaWiki_talk Modul$\n Module_talk Portal Portal_talk Project Project_talk Special Talk Template Template_talk TimedText TimedText_talk User User_talk Wikipedia Wikipedia_t$\nlk\nPushed file: 3f1cfc54f8c831f47aff3f05d33e5e12fd9d3df8 - User:Thcipriani/common.js\nTo mediawiki::https://en.wikipedia.org/w\n * [new branch]      master -&gt; master</code></pre>\n<p>I also added a <a\nhref=\"https://github.com/thcipriani/common.js\">github remote</a> for\nthis repo. I could see, for example (if I had a popular user script)\nallowing pull-requests via github, code reviewing on github, merging,\nand pushing back up to Wikipedia post-merge.</p>\n<p>There are undoubtedly issues here, but I had this idea kicking around\nmy head and wanted to get it committed to pixels before it slipped out\nof my mind.</p>\n<blockquote style=\"background: rgba(255, 0, 0, 0.1); border: 1px solid tomato; text-align: center;\">\n<h3>BIG GIANT DISCLAIMER OF DOOM</h3>\n\nMy views are my own. My views do not represent the views of any employer I\'ve had/have: past, present, or future. I\'m probably not even qualified to have these views. I am an egg.\n</blockquote>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2019/06/05/reese-the-cat/",

    "title": "Reese the Cat",
    "url": "https://tylercipriani.com/blog/2019/06/05/reese-the-cat/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2019-06-05T22:14:34Z",
    "date_modified": "2019-10-14T22:25:40Z",


    "content_html": "<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/95/042d33e4ac03c3a15b40436f20c078/large.jpg\"\ntitle=\"35mm f/1.4 2018-01-09 22:06:10\" alt=\"Reese the Cat (Jan 2018)\" />\n<figcaption aria-hidden=\"true\">Reese the Cat (Jan 2018)</figcaption>\n</figure>\n<p>My good friend Reese the Cat died on the last day of May 2019. She\nwas 13 years old – still a young cat, by cat standards. She had a tumor\non her tongue and couldn’t swallow and couldn’t eat or drink. We took\nher to a vet clinic within walking distance of our house on a sunny\nFriday morning to have her put to sleep – there were few options\nremaining for us and this seemed like the right one. We stayed with her\nthe whole time.</p>\n<p>I’ve worked from home for about 4.5 years now. I’ve spent much of\nthat time alone in my home office – furiously hammering at my keyboard\nand sighing loudly. Reese the Cat has been there, too. Walking across my\ndesk; threatening to take down production servers by flopping down on my\nkeyboard to get my attention.</p>\n<p>She spent much of her time alerting me of the activity of various\nanimals she tracked outside our house. This meant running from the\nwindow in my office to the laundry room upstairs to get a wider view of\nthe neighborhood cats, birds, and squirrels in the backyard. I’ve since\nmade the assertion that there seem to be fewer cats wandering around the\nneighborhood, but that’s probably not true.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/41/978f71184905da00b1e04ec1444877/large.jpg\"\ntitle=\"24mm f/8 2016-09-22 15:25:35\"\nalt=\"A blurry Reese sitting in my office chair (Sep 2016)\" />\n<figcaption aria-hidden=\"true\">A blurry Reese sitting in my office chair\n(Sep 2016)</figcaption>\n</figure>\n<p>Whenever I closed a door in the house Reese took exception. She’d sit\noutside the door caterwauling, scratching at the carpet, generally\nmaking herself a nuisance. She often made a point of darting through\ndoors as soon as they were opened – without regard for why a door had\nbeen shut or what may be on the other side. I’ve come to expect Reese to\nbe behind doors. The past few days I keep opening doors expecting her to\nbe there.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/21/4c234edbc4e3ca24fbe29b288d52dc/large.jpg\"\ntitle=\"35mm f/8 2017-07-09 12:29:58\" alt=\"Reese (Jul 2017)\" />\n<figcaption aria-hidden=\"true\">Reese (Jul 2017)</figcaption>\n</figure>\n<p>I call her, “Reese the Cat” as that’s her <em>proper</em> name. When\nwe first moved to Colorado we lived in an apartment building and one of\nour neighbors was a woman named “Reese”. One day Blazey casually\nmentioned that Reese had been in the closet all day. I was confused. Are\nthere locks on the closet? Did she not have a phone? She lived with her\npartner: where was he during all of this? We realized we needed to\ndisambiguate: Reese the Cat and Reese the Person. It started as a subtle\njoke, and then it became her name. When I talked to her (as I frequently\ndid when working from home) I called her “Reese the Cat” and often\naddressed her by her longer title: “My good friend Reese the Cat”.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/48/91df119ca3064e966f31810f3f00a7/large.jpg\"\ntitle=\"Me &amp; Reese playing a game that made her crazy and excited (2013-06-15 12:40:47)\"\nalt=\"Me &amp; Reese playing (Jun 2013)\" />\n<figcaption aria-hidden=\"true\">Me &amp; Reese playing (Jun\n2013)</figcaption>\n</figure>\n<p>I wrote most of the above on the 5th of June. Now it’s the 14th of\nOctober and I still haven’t actually published it. I have excuses: I\nwanted to amalgamate some photos; I wanted to re-read after some time\nhad passed; overall, this post was just too sad to complete.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/b4/4b3056531cba0e1bd722ed14adf055/large.jpg\"\ntitle=\"14mm photo of Reese taken 2017-05-08 08:47:35\"\nalt=\"Reese on a bench (May 2017)\" />\n<figcaption aria-hidden=\"true\">Reese on a bench (May 2017)</figcaption>\n</figure>\n<p>It’s been a while. We’ve given her expensive, uneaten food to the\nhumane society. I’ve stopped expecting to see her around the house. I\nstill miss Reese.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2019/03/11/of-git-commits-github-and-gerrit/",

    "title": "Of Git Commits, GitHub, and Gerrit",
    "url": "https://tylercipriani.com/blog/2019/03/11/of-git-commits-github-and-gerrit/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "gerrit",

     "git"

    ],

    "date_published": "2019-03-11T16:50:36Z",
    "date_modified": "2019-03-21T15:53:53Z",


    "content_html": "<p>Impassioned ranting about the format of commit messages<a href=\"https://tylercipriani.com/blog/#fn1\"\nclass=\"footnote-ref\" id=\"fnref1\" role=\"doc-noteref\"><sup>1</sup></a>\noften feels like cringe-inducing gatekeeping. Many times such rants seem\nto be written using language both bombastic and bellicose – the message\nis: fuck off if you don’t agree.</p>\n<p>The fact that the authors of many of these rants tend to be respected\nin the software community is confounding to many. Defense of these rants\nis commonplace and, likewise, is swift, absolute, and equally,\nseemingly, meant as a giant middle-finger to the uninitiated.</p>\n<p>Explaining new concepts to people unfamiliar with them is a good way\nof testing your understanding. Explaining new concepts repeatedly, in a\nseemingly unending cycle, is a good test of your patience. Neither lack\nof understanding or lack of patience excuse the bad behavior that is\nall-too-typical of the software hegemony.</p>\n<p>This post is meant to explain when and why commit messages matter.\nAdditionally, it explains a few thoughts about the Gerrit code review\nsystem.</p>\n<section id=\"pull-request-vs-commit\" class=\"level2\">\n<h2>Pull Request vs Commit</h2>\n<p>The common wisdom is that commit messages don’t matter on GitHub.\nWhen I collaborate on GitHub I commit often and my commit messages\nfrequently contain “.gif”, <code>¯\\_(ツ)_/¯</code>, various curse words,\nand copious emoji. This is because the <a\nhref=\"https://zachholman.com/posts/git-commit-history/\">unit of change\nin GitHub is the pull request</a>. My pull requests are thoughtful, and\nattempt to explain why I developed this particular patch, and try to\nprovide means of testing for this change. When trying to bisect history\nin a repository developed on GitHub the merges of pull requests are the\nthing; i.e., <code>Merge pull request #763</code> is meaningful. Pull\nrequest #763 probably has an explanation for what changed (even if your\ngit log doesn’t).</p>\n<p>The information contained in a pull request is useful, but is – by\ndesign – only accessible online with a web browser through\ngithub.com.</p>\n<p>My current job uses <a\nhref=\"https://gerrit.wikimedia.org/\">Gerrit</a> instead of GitHub.\nGerrit doesn’t have pull requests, it has patches. The code review\ninterface is arguably not as good as GitHub <strike>– I can’t set a\nunified diff view by default in my preferences, for instance.</strike>\n(edit 2019-03-21. unified diff is available in top-level preferences) <a\nhref=\"https://gerrit.googlesource.com/gitiles\">Gitiles</a> is no\nsubstitute for using GitHub as a repo browser – you can’t link to blocks\nof code, for instance. Gerrit/Gitiles URLs are hard to remember, unlike\nGitHub’s. There is little in the way of a “prescribed workflow”. You as\na developer must decide how to split patches meaningfully, and how to do\nthat in such a way that adheres with any shared agreements about\nparticular branches (e.g., <code>master</code> must be deployable).</p>\n<p>Despite its flaws, I really like Gerrit.</p>\n<p>Gerrit’s use of git aligns well with git’s design. The git history\nthat Gerrit produces is beautiful, available offline, distributed, and\nuseable via the git command line interface (more usable than in the\nbrowser, unfortunately). This is partially because the unit of change in\nGerrit is a commit. As a result, <code>git log --oneline</code> is\ntotally readable and totally useful!</p>\n<p>I prefer the repo produced by Gerrit to the repo produced by GitHub\nfor reasons that relate to development, operations, and values.</p>\n</section>\n<section id=\"development\" class=\"level2\">\n<h2>Development</h2>\n<p>If I’m considering making a change in a repository, especially when\nthis change is an obvious or simple one, I worry. I worry: why wasn’t\nthis approach chosen in the first place? Is there a bug that is being\nworked around by using a non-obvious approach? Am I in an area of code\nthat is used in many areas of the code base, or is it used very seldom?\nIs there test coverage for this function that I can use to ensure I am\nnot creating a regression? A good commit message would answer all of\nthese questions, and maybe more I haven’t thought of yet.</p>\n<p>This information in Gerrit lives with the repository, in GitHub the\ninformation lives on github.com. It’s very important that the\ninformation exist <em>somewhere</em>.</p>\n<p>I like the freedom to work on code when I’m on an airplane or\nsomewhere else without WiFi. There may be software that can make this\nhappen for GitHub. In Gerrit the unit-of-change is the Commit, so the\ncommit has most information that I want. With the addition of the <a\nhref=\"https://gerrit.wikimedia.org/r/Documentation/config-plugins.html#reviewnotes\">review-notes</a>\nGerrit plugin, code reviews live in a special git note namespace\n(<code>/refs/notes/review</code>) and are also available with the\nrepository offline.</p>\n<p>Gerrit makes no recommendations whatsoever about how you develop, and\nnothing in the patch interface aligns with your local view of your\nchanges necessarily. I feel like this is confusing for people new to\nusing Gerrit, but it is also, after initiation to the concept, not a bad\nway to develop.</p>\n</section>\n<section id=\"operations\" class=\"level2\">\n<h2>Operations</h2>\n<p>An appreciable portion of my job is <code>grep</code>ing through git\nhistory in the shaky moments following an embarrassing production\noutage. This exercise has given me a deep appreciation for well\nformatted git commit messages. I need to know: what changed, who changed\nit (not just who merged it), why it was changed, and why a particular\napproach was chosen.</p>\n<p>Good commit message information helps me determine what to do with a\nchange: do I need to wake up the person who made this commit, or can I\nsimply revert it? Is this change merely setting an unused variable, or\nis it a feature flag that will unleash new functionality?</p>\n<p>Having all this information at my fingertips, rather than having to\ndig through the 188(!) different repositories that are composed to\ncreate a production deployment of MediaWiki and extensions for all 933\nwikis that exist in Wikimedia’s production infrastructure is important –\nI already have too many browser tabs open without having to dig through\nGitHub for repository histories.</p>\n</section>\n<section id=\"values\" class=\"level2\">\n<h2>Values</h2>\n<p>This section speaks more to my feelings about Gerrit vs GitHub as\nprojects more than Gerrit vs GitHub repositories. In the case of\nGitHub’s use of pull requests, I feel like the two are inextricably\nlinked – GitHub has opted out of the open source implementation of git\nusing proprietary software to implement this feature and the resultant\nrepository is less usable as an artifact on its own because of this\ndecision.</p>\n<p>The essay <a href=\"https://mako.cc/writing/hill-free_tools.html\">Free\nsoftware needs Free tools</a> is probably a better summary of this topic\nthan anything I could write here; however, the short version of this is:\nwithout the freedom to run, modify, study, and redistribute the software\non which your project depends, your project is at the mercy of corporate\ncaprice.</p>\n<p>Corporations are beholden to shareholders, not to users. When a\ncorporation pivots away from the customers that made it a success to\nserve a different market that it perceives as more valuable that is not\nan uncommon or remarkable event: that is the design of a\ncorporation.</p>\n<p>If you are working on a software project that’s important – if your\nsoftware provides an essential service, or essential infrastructure that\nis meant to last many years (even beyond a single human lifetime) – you\ncannot afford to lose a part of your infrastructure in the event that a\n(possibly erroneous) business analysis has identified a more efficient\nprofit-center for a business.</p>\n<p>There are many counter-arguments to the ones I’ve made above;\nhowever, to summarize a few counter-arguments (possibly unfairly) they\nare:</p>\n<ol type=\"1\">\n<li><code>&lt;Closed Source/Hosted provider&gt;</code>‘s core business\nis acting in their customers’ best interest, if its goal is to provide\nvalue to shareholders then to do so means being a better service for its\nexisting customers. Our interests and the business’s interests are\naligned.</li>\n<li><code>&lt;Closed Source/Hosted provider&gt;</code> is based on an\nopen standard, so the information is portable, if they become a bad\nactor, we can port information to a different solution.</li>\n</ol>\n<p>To argument one: there are myriad examples of business decisions made\nat the expense of customers. This is particularly true once a business\nentity becomes a monopoly power as so many tech companies are at this\nmoment. I think anyone would concede the example of large cable\ncompanies offering poor service to customers despite the fact that\ncustomers provide their revenue. Business interests and customer\ninterests, even when they are currently aligned, may not always be.</p>\n<p>To argument two: in the instance of GitHub above (and this is\napplicable to other services as well) they have proprietary features\n(i.e., “pull requests”) that make them incompatible with portability. In\nother instances, the compatibility with a portable solution is\ninvalidated by the point of business caprice.</p>\n</section>\n<section id=\"how-i-commit-now\" class=\"level2\">\n<h2>How I commit now</h2>\n<p>If commit messages are important (as I argue above), then it is a\nvaluable exercise to evaluate the way in which you write your commit\nmessages.</p>\n<p>Earlier this year I came across Vicky Lai’s post “<a\nhref=\"https://vickylai.com/verbose/git-commit-practices-your-future-self-will-thank-you-for/\">Git\nCommit Practices Your Future Self Will Thank You For</a>” Which (for me\nanyway) highlighted the use of the git <code>commit.template</code>.\nVicky provided an example in the post that I’ve been refining for\nmyself.</p>\n<p>I’ve followed git commit best practices<a href=\"https://tylercipriani.com/blog/#fn2\"\nclass=\"footnote-ref\" id=\"fnref2\" role=\"doc-noteref\"><sup>2</sup></a><a\nhref=\"https://tylercipriani.com/blog/#fn3\" class=\"footnote-ref\" id=\"fnref3\"\nrole=\"doc-noteref\"><sup>3</sup></a><a href=\"https://tylercipriani.com/blog/#fn4\" class=\"footnote-ref\"\nid=\"fnref4\" role=\"doc-noteref\"><sup>4</sup></a> for years, so initially\nthe template wasn’t proving too useful. I started to think about what\nwas missing from my commit messages, where I could improve formatting,\nand where I could save myself some time searching.</p>\n<p>The first issue I identified is that I can’t remember the names of\ncommit message fields like <code>Signed-off-by</code> or\n<code>Requested-by</code>. Also, my capitalization and ordering of those\nfields was all over the place. What are the best-practices for using\nthese fields? I could never remember. I put all these fields in my\ntemplate. Along with a link to the kernel patch submission guidelines\nfor easy reference.</p>\n<p>The next issue I had was that there are myriad schools of thought\nabout commit message bodies. Bullet points vs Problem/Solution vs\n“answers the following questions”. The basic questions of “What is wrong\nwith the code that this patch fixes?” sometimes hindered my ability to\nwrite a commit message that made sense. I wanted options. I wanted\nexamples. I wanted links in case I felt like reading more. I added all\nthis to my template.</p>\n<p>Finally, I noticed that vim does some syntax highlighting in the\ncommit screen. Specifically, lines that end with <code>:</code>. So I\nmade sure that the only lines that ended with <code>:</code> were\nimportant sections.</p>\n<p>I think I have a template I can live with for a while. It’s verbose.\nProbably too verbose, really. But my mind works in ways I don’t\nunderstand sometimes. To keep it on track, I need all the information it\ncraves at my fingertips in a context-dependant way. I think this\ntemplate is ideal for that.</p>\n</section>\n<section id=\"git-commit-zomg1\" class=\"level2\">\n<h2>Git Commit ZOMG!!1!</h2>\n<p>The <code>commit.template</code> below is in my dotfiles as\n<code>.git-commit-zomg</code>. I install the template using the command\n<code>git config --global commit.template ~/.git-commit-zomg</code>.</p>\n<p>I named this template <code>.git-commit-zomg</code> because I have\nmixed feelings about commit messages. I think a lot about commit\nmessages. I think they’re important. I evidently feel that they’re “rant\nworthy” in some context. I still, however, know people will decide the\nvalue of commit messages on their own. You can tell people the value you\nthink commit messages will have, and they’ll maybe ackowledge your\nconcerns are valid. Maybe they’ll even make changes in their process.\nBut no one groks to fullness.</p>\n<p>Someday production will be down. Rollback will have failed with an\nopaque error. Your mind will be screaming too loud for you to think\nclearly. You’ll frantically <code>grep</code> <code>git log</code>\noutput for the error message – something, anything – and you’ll come\nface-to-face with a commit (probably authored by you) that reads,\nsimply, <code>¯\\_(ツ)_/¯</code>. To paraphrase Jack Handy: when this\nmoment comes, if you’re drinking milk, I bet it will make milk come out\nyour nose.</p>\n<pre><code>\n# ^^ Subject: summary of your change:\n# * 50 Characters is a soft limit (aim for &lt; 80)\n# * &quot;If applied, this commit will...&quot;\n# * Use the imperative mood; e.g.,\n#   (Change/Add/Fix/Remove/Update/Refactor/Document)\n# * Do not end the subject with a period (full stop)\n# * Optionally, prefix the subject with the relevant component\n#   (the general area of code being modified)\n#\n# Example[0]\n#\n#     jquery.badge: Add ability to display the number zero\n#\n# [0]. &lt;https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines#Subject&gt;\n#\n# Leave this blank line below your subject:\n\n# Body: Additional information about a commit:\n\n# Think about these questions\n#\n# * Why should this change should be made?\n#   What is wrong with the current code?\n# * Why should it be changed in this way?\n#   Are there other ways?\n# * How can a reviewer confirm that your change works as intended?[0]\n#\n# * An alternative format maybe a problem/solution commit as used in\n#   ZeroMQ[1]; e.g.\n#\n#       * Problem: Windows build script requires edit of VS version\n#       * Solution: Use CMD.EXE environment variable to extract\n#         DevStudio version number and build using it.\n#\n# [0]. &lt;https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines#Body&gt;\n# [1]. &lt;http://zeromq.org/docs:contributing#toc3&gt;\n\n# ---\n#\n# Bug number:\n#\n# Bug: TXXXXXX\n#\n# ---\n#\n# Gerrit specific:\n#\n# Change-Id: IXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n# Depends-On: IXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n#\n# ---\n#\n# Sign your work:\n#\n# &gt; The sign-off is a simple line at the end of the explanation for the\n# &gt; patch, which certifies that you wrote it or otherwise have the right to\n# &gt; pass it on as a open-source patch [0]\n#\n# Signed-off-by: Example User &lt;user@example.com&gt;\n#\n# [0]. &lt;https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/SubmittingPatches?id=4e8a2372f9255a1464ef488ed925455f53fbdaa1&gt;\n#\n# ---\n#\n# Other Nice Things:\n#\n# If you worked on a patch with others it&#39;s nice to credit them for\n# their contributions; however, these tags should not be added without\n# your collaborator&#39;s permission!\n\n# Acked-by: Example User &lt;user@example.com&gt;\n# Cc: Example User &lt;user@example.com&gt;\n# Co-Authored-by: Example User &lt;user@example.com&gt;\n# Requested-by: Example User &lt;user@example.com&gt;\n# Reported-by: Example User &lt;user@example.com&gt;\n# Reviewed-by: Example User &lt;user@example.com&gt;\n# Suggested-by: Example User &lt;user@example.com&gt;\n# Tested-by: Example User &lt;user@example.com&gt;\n# Thanks: Example User &lt;user@example.com&gt;\n#\n# ---\n#        _ _                                   _ _\n#   __ _(_) |_    ___ ___  _ __ ___  _ __ ___ (_) |_   _______  _ __ ___   __ _\n#  / _` | | __|  / __/ _ \\| &#39;_ ` _ \\| &#39;_ ` _ \\| | __| |_  / _ \\| &#39;_ ` _ \\ / _` |\n# | (_| | | |_  | (_| (_) | | | | | | | | | | | | |_   / / (_) | | | | | | (_| |\n#  \\__, |_|\\__|  \\___\\___/|_| |_| |_|_| |_| |_|_|\\__| /___\\___/|_| |_| |_|\\__, |\n#  |___/                                                                  |___/\n#\n# Save to `~/.git-commit-zomg` Then run:\n#\n#     git config --global commit.template ~/.git-commit-zomg\n#\n# The idea for this template came from Vicky Lai[0]\n#\n# [0]. &lt;https://vickylai.com/verbose/git-commit-practices-your-future-self-will-thank-you-for/&gt;</code></pre>\n</section>\n<section class=\"footnotes footnotes-end-of-document\"\nrole=\"doc-endnotes\">\n<hr />\n<ol>\n<li id=\"fn1\" role=\"doc-endnote\"><p><a\nhref=\"https://github.com/torvalds/linux/pull/17#issuecomment-5654674\"\nclass=\"uri\">https://github.com/torvalds/linux/pull/17#issuecomment-5654674</a><a\nhref=\"https://tylercipriani.com/blog/#fnref1\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn2\" role=\"doc-endnote\"><p><a\nhref=\"https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html\"\nclass=\"uri\">https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html</a><a\nhref=\"https://tylercipriani.com/blog/#fnref2\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn3\" role=\"doc-endnote\"><p><a\nhref=\"https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines\"\nclass=\"uri\">https://www.mediawiki.org/wiki/Gerrit/Commit_message_guidelines</a><a\nhref=\"https://tylercipriani.com/blog/#fnref3\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n<li id=\"fn4\" role=\"doc-endnote\"><p><a\nhref=\"https://juffalow.com/other/write-good-git-commit-message\"\nclass=\"uri\">https://juffalow.com/other/write-good-git-commit-message</a><a\nhref=\"https://tylercipriani.com/blog/#fnref4\" class=\"footnote-back\" role=\"doc-backlink\">↩︎</a></p></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/12/02/ci-files-in-their-own-namespace/",

    "title": "CI Files in Their Own Namespace",
    "url": "https://tylercipriani.com/blog/2018/12/02/ci-files-in-their-own-namespace/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-12-02T18:35:29Z",
    "date_modified": "2018-12-30T19:29:57Z",


    "content_html": "<p>I recently had a random idea to fix a problem that evidently only\nbothers me. It has become de rigueur to litter every project with a\nrandom smattering of top-level dotfiles. I’m thinking of the\n<code>.travis.yaml</code>-type files that are regarded as a necessary\nevil to perform some kind of testing or deployment in a particular\nrepo.</p>\n<p>I have designed several systems that use this trope. Yes, I feel\nappropriately ashamed.</p>\n<p>My problem is simple: dotfiles clutter my work tree. Given all of the\nmyriad problems with the current state of software “engineering” this\nparticular issue may seem a relatively minor one; however, if this issue\nis minor, a minor fix may well be all that’s needed.</p>\n<p>The idea I had recently is to use a <code>ref</code> namespace in git\nfor these files.</p>\n<p>Something like:</p>\n<pre><code>$ git checkout --orphan CI\n$ git rm -rf .\n$ mkdir travis\n$ cat &gt; travis/config.yaml\nlanguage: ruby\nrvm:\n - 2.2\n - jruby\n\n$ git commit -a -m &#39;Add travis config for testing&#39;\n$ git push origin refs/heads/CI:refs/meta/ci</code></pre>\n<p>In GitHub, using the example above, <code>refs/meta/ci</code> doesn’t\nappear in the branch dropdown in the web UI, but the ref is stored on\nthe server and accessible by people fetching the repo.</p>\n<p>In CI (or any tooling hoping to use these configuration files) this\nnamespace can be easily accessed via:</p>\n<pre><code>$ git fetch origin refs/meta/ci:refs/meta/ci\n$ git show refs/meta/ci:travis/config.yaml\nlanguage: ruby\nrvm:\n - 2.2\n - jruby</code></pre>\n<p>A whole <code>refs/meta/ci</code> namespace with folders for each\nservice seems so much nicer to me.</p>\n<p>There are a few downsides I can think of to this method. Firstly,\nit’s git-specific; however, I am sure the concept of a branch is not\nentirely foreign to most version control systems and it could be\nsupported to some degree. In practical terms, supporting git seems to be\ngood enough for most tools.</p>\n<p>Another downside is opacity. That is, CI files are less discoverable\nusing this method; however, if this style of configuration file were to\nbecome the de facto standard then much tooling could be written to\nsurface interfaces for these files and their namespaces.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/10/30/halloween-nerd-projects/",

    "title": "Halloween Nerd Projects &#x1F47B;",
    "url": "https://tylercipriani.com/blog/2018/10/30/halloween-nerd-projects/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-10-30T21:10:30Z",
    "date_modified": "2020-06-12T15:39:55Z",


    "content_html": "<p>Last year I got 229 trick-or-treaters at my house.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/7e/0e0d506c3bfe2ff4bf6743191ce05f/large.jpg\"\ntitle=\"Why, yes, actually, this is 1,200(!) pieces of candy.\"\nalt=\"Candy, yo!\" />\n<figcaption aria-hidden=\"true\">Candy, yo!</figcaption>\n</figure>\n<p>The previous year it was 194. The year before that it was 176. The\nyear before that I lived in a duplex that was roughly two blocks from my\ncurrent house; that year I didn’t think to track how many\ntrick-or-treaters showed up at my door – it was less than 10.</p>\n<p>The only logical conclusion we can draw from the above data is that\nour current house is imbued with dark Halloween voodoo. We’ve made every\nattempt to decorate accordingly. The first year it was spider webs and a\nblack light. For every subsequent year we’ve tried to out-do our\nprevious selves.</p>\n<section id=\"it-begins\" class=\"level2\">\n<h2>It begins</h2>\n<p>In order to create an authentic movie-experience at home I own a\nprojector (enjoy with <a\nhref=\"https://www.amazon.com/Gold-Medal-Prod-Flavacol-Seasoning/dp/B004W8LT10\">flavacol</a>\nfor extra authenticity). In 2015 I discovered <a\nhref=\"https://atmosfx.com/\">AtmosFearFX</a> which is a company that\nproduces content meant to be projected onto walls or out of windows or\nonto curtains. For our front-room I project a ghostly apparition onto a\nsheer curtain so that it roughly looks like it’s walking around inside.\nThis has been a big hit with trick-or-treaters, so much so that I bought\na(n extremely crappy) <a\nhref=\"https://www.amazon.com/gp/product/B01EOXLC5K/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1\">mini\nprojector</a> that I would never be able to use for movies, but –\nnone-the-less – works great for projecting weird zombie hands groping\nfor freedom on the window of our porch.</p>\n<p>This was the same year I began incorporating microcontrollers to\ntrigger effects. I built a project with a <a\nhref=\"https://www.particle.io/\">Particle core</a> attached to a <a\nhref=\"https://www.adafruit.com/product/375\">reed switch</a> on my front\ndoor. The Particle board sent a web request to my <a\nhref=\"https://www2.meethue.com/en-us\">hue</a> light bulb on the porch\n(scream sound warning):</p>\n<figure class=\"narrow-figure\">\n    <video controls=true>\n        <source src=\"https://photos.tylercipriani.com/videos/halloween-2015-particle-lights.mp4\" type=\"video/mp4\">\n        <source src=\"https://photos.tylercipriani.com/videos/halloween-2015-particle-lights.ogv\" type=\"video/ogg\">\n    </video>\n<figcaption>Halloween 2015: Controlling Hue bulbs with a Particle and Reed Switch</figcaption>\n</figure>\n</section>\n<section id=\"now\" class=\"level2\">\n<h2>Now</h2>\n<p>Fast-forward a few years and my setup has become even more elaborate.\nSometime around 2016 I began fooling around with pneumatic pop-ups.\nAfter a few DuckDuckGos I stumbled on <a\nhref=\"https://www.frightprops.com/\">FrightProps</a> and subsequently\nbegan spending too much money there.</p>\n<p>My big project this year is a pneumatic pop-up that uses an\nair-compressor. This is controlled by a motion-sensing Raspberry Pi.</p>\n<p>The key component is the solenoid:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/46/314f9a0c3f88ad65288dcc7a7c354e/large.jpg\"\nalt=\"3-way solenoid with 1/4” ports\" />\n<figcaption aria-hidden=\"true\">3-way solenoid with 1/4”\nports</figcaption>\n</figure>\n<p>This controls the 30PSI (or so) coming from my air compressor to a\npneumatic cylinder. The solenoid is controlled via 12V. This is more\nthan my Raspberry Pi is capable of pushing out over GPIO. Fortunately, I\nhave an <a href=\"https://www.adafruit.com/product/2348\">Adafruit\nMotorHAT</a>. The MotorHAT has its own 12V power supply and can be\ncontrolled by a Raspberry Pi. I also used a <a\nhref=\"https://www.adafruit.com/product/189\">PIR sensor</a> to detect\nmotion and trigger my popup.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/2d/bc1481da196c3d4d494fdbadc29717/large.jpg\"\ntitle=\"Raspberry Pi with MotorHAT\" alt=\"Raspberry Pi with MotorHAT\" />\n<figcaption aria-hidden=\"true\">Raspberry Pi with MotorHAT</figcaption>\n</figure>\n<p>The pop-up dummy itself is made out of 1/2” PVC tubing, zip ties, a\nskeleton I bought at Home Depot, and love.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/ad/e44b4a3d0455c209b797ff201eb0a4/large.jpg\"\nalt=\"PVC and love\" />\n<figcaption aria-hidden=\"true\">PVC and love</figcaption>\n</figure>\n<p>I control the whole contraption with some <a\nhref=\"https://github.com/thcipriani/halloween-2017\">python code</a>\nrunning on the Pi. I’ve wrapped the Adafruit MotorHAT code in (what I\nthink is) a nicer interface for this project:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">from</span> Adafruit_MotorHAT <span class=\"im\">import</span> Adafruit_MotorHAT</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">class</span> Pneumatic(<span class=\"bu\">object</span>):</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Abstraction for Adafruit MotorHAT that I&#39;m using as a weird way to drive</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    a pneumatic pop-up.</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    UP <span class=\"op\">=</span> Adafruit_MotorHAT.FORWARD</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>    DOWN <span class=\"op\">=</span> Adafruit_MotorHAT.RELEASE</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>, motor<span class=\"op\">=</span><span class=\"dv\">4</span>):</span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">        :motor: Integer - 1-4. Motor output to use on the MotorHAT</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">        &quot;&quot;&quot;</span></span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>        mh <span class=\"op\">=</span> Adafruit_MotorHAT(addr<span class=\"op\">=</span><span class=\"bn\">0x60</span>)</span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.pop_up <span class=\"op\">=</span> mh.getMotor(motor)</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\"># Max motor speed is 255</span></span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.pop_up.setSpeed(<span class=\"dv\">255</span>)</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> is_up(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> <span class=\"va\">self</span>.status <span class=\"op\">==</span> UP</span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-26\"><a href=\"https://tylercipriani.com/blog/#cb1-26\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> up(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-27\"><a href=\"https://tylercipriani.com/blog/#cb1-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.status <span class=\"op\">=</span> UP</span>\n<span id=\"cb1-28\"><a href=\"https://tylercipriani.com/blog/#cb1-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.pop_up.run(<span class=\"va\">self</span>.UP)</span>\n<span id=\"cb1-29\"><a href=\"https://tylercipriani.com/blog/#cb1-29\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-30\"><a href=\"https://tylercipriani.com/blog/#cb1-30\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> down(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-31\"><a href=\"https://tylercipriani.com/blog/#cb1-31\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.status <span class=\"op\">=</span> DOWN</span>\n<span id=\"cb1-32\"><a href=\"https://tylercipriani.com/blog/#cb1-32\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.pop_up.run(<span class=\"va\">self</span>.DOWN)</span></code></pre></div>\n<p>Which lets me test-drive the setup pretty easily via ipython:</p>\n<pre><code>&gt;&gt;&gt; from scary import Pneumatic\n&gt;&gt;&gt; motor_output = 4\n&gt;&gt;&gt; popup = Pneumatic()\n&gt;&gt;&gt; popup.up()\n&gt;&gt;&gt; popup.is_up\nTrue\n&gt;&gt;&gt; popup.down()</code></pre>\n<figure class=\"narrow-figure\">\n    <video controls=true>\n        <source src=\"https://photos.tylercipriani.com/videos/2018-10-30_halloween-fun_popup.mp4\" type=\"video/mp4\">\n        <source src=\"https://photos.tylercipriani.com/videos/2018-10-30_halloween-fun_popup.ogv\" type=\"video/ogg\">\n    </video>\n    <figcaption>Halloween 2018: Controlling a pneumatic with python</figcaption>\n</figure>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/07/31/git-advice/",

    "title": "Git Advice",
    "url": "https://tylercipriani.com/blog/2018/07/31/git-advice/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-07-31T17:53:02Z",
    "date_modified": "2019-05-07T23:44:19Z",


    "content_html": "<p>Git can be\n<a href=\"https://tylercipriani.com/blog/2016/03/21/Visualizing-Git-Merkle-DAG-with-D3.js/\">confusing</a>.\nIt’s more confusing fumbling with git under pressure. As a release\nengineer fumbling with git under pressure is a appreciable chunk of my\njob; as such, I’ve learned a trick or two.</p>\n<p>Recently I added some general <a\nhref=\"https://wikitech.wikimedia.org/wiki/SWAT_deploys/Deployers#git\">git\nadvice</a> to our shared wiki page for deployers. I am reproducing this\nadvice here for posterity. The goal of this advice is to ensure that\ndeployers are seeing all the information they need to make smart\ndecisions about the current state of a git repository. There are times\nwhen this advice has allowed me to figure out a problem with a git\nrepository simply by <code>cd</code>-ing into its worktree.</p>\n<ol type=\"1\">\n<li><p><strong>Use a git-aware prompt.</strong> The <a\nhref=\"https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh\">git-prompt.sh</a>\nscript that is included in git’s contrib tree is my preferred prompt.\nThere are instructions for use in <a\nhref=\"https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh#L10-L31\">comments</a>\nat the beginning of the file. One simple way to use it (on Debian\nmachines anyway) is to add the following to your shell initialization\nfile:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">GIT_PS1_SHOWUNTRACKEDFILES</span><span class=\"op\">=</span>1</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">GIT_PS1_SHOWDIRTYSTATE</span><span class=\"op\">=</span>1</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">GIT_PS1_SHOWUPSTREAM</span><span class=\"op\">=</span><span class=\"st\">&quot;auto verbose&quot;</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">.</span> /etc/bash_completion.d/git-prompt</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">PS1</span><span class=\"op\">=</span><span class=\"st\">&#39;[\\u@\\h \\W$(__git_ps1 &quot; (%s)&quot;)]\\$ &#39;</span></span></code></pre></div></li>\n<li><p><strong>Set <code>status.submoduleSummary</code>.</strong> By\ndefault submodules have limited visibility in <code>git status</code>\nwhich makes it easy to miss a <code>git submodule update</code> step.\nAfter adding <code>status.submoduleSummary</code> to your\n<code>~/.gitconfig</code>, git will show you a short summary of\nsubmodule changes in the output of <code>git status</code>. Set it by\nexecuting:</p>\n<pre class=\"shell-session\"><code>you@computer:~$ git config --global status.submoduleSummary true</code></pre></li>\n</ol>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/06/18/reverse-polish-notation-lambdas-and-curry/",

    "title": "Reverse Polish Notation, Lambdas, and Currying in Python",
    "url": "https://tylercipriani.com/blog/2018/06/18/reverse-polish-notation-lambdas-and-curry/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-06-18T03:35:22Z",
    "date_modified": "2018-12-30T19:29:57Z",


    "content_html": "<p>I just finished reading <em>The Python Corner</em>’s post “<a\nhref=\"http://www.thepythoncorner.com/2018/05/lambdas-and-functions-in-python.html\">Lambdas\nand Functions in Python</a>.” The post acts as an introduction to the\nuse of functions as first-class objects in python. The demo code is the\nimplementation of a “Reverse Polish Notation” calculator.</p>\n<p>I had never heard of <a\nhref=\"https://en.wikipedia.org/wiki/Reverse_Polish_notation\">reverse\npolish notation</a>(RPN) before this post. The short explanation of RPN\nis available on Wikipedia:</p>\n<blockquote>\n<p>In reverse Polish notation, the operators follow their operands; for\ninstance, to add 3 and 4, one would write 3 4 + rather than 3 + 4.</p>\n</blockquote>\n<p>In that blog post RPN is implemented as a stack of operands and after\nan operator is pushed onto the stack, the <code>compute()</code> method\nis called which triggers the evaluation of the <code>lambda</code>\nspecified by the operator. Like this:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>rpn <span class=\"op\">=</span> rpn_engine()</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>rpn.push(<span class=\"dv\">2</span>)</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>rpn.push(<span class=\"dv\">2</span>)</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">print</span>(rpn.compute(<span class=\"st\">&#39;+&#39;</span>))  <span class=\"co\"># Prints 4</span></span></code></pre></div>\n<p>The point of the post is to show a python dict using operands as keys\nwith lambdas as values; this demonstrates that lambdas are functions and\nfunctions are first-class objects. This allows the <code>compute</code>\nmethod of the <code>RPNEngine</code> class to look up a lambda in a\ndict, and <code>pop()</code> off the stack using the\n<code>signature</code> function of the <code>inspect</code> module to\ndetermine how many arguments are needed for a particular lambda. From\nthere, lambda evaluation is handed off to helper functions named, for\ninstance, <code>compute_operation_with_two_operands</code> and\n<code>compute_operation_with_one_operand</code></p>\n<section id=\"currying\" class=\"level2\">\n<h2>Currying</h2>\n<p>One other functional concept that could have helped the example code\nis that of <em>currying</em>. <a\nhref=\"https://en.wikipedia.org/wiki/Currying\">Currying</a> involves\nchanging a function with multiple arity into a series of evaluations of\nmultiple functions each with an arity of 1.</p>\n<p>This is a fancy way to say:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>add <span class=\"op\">=</span> <span class=\"kw\">lambda</span> x, y: x <span class=\"op\">+</span> y</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>add_curried <span class=\"op\">=</span> <span class=\"kw\">lambda</span> x: <span class=\"kw\">lambda</span> y: x <span class=\"op\">+</span> y</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">assert</span>(add(<span class=\"dv\">2</span>, <span class=\"dv\">2</span>) <span class=\"op\">==</span> add_curried(<span class=\"dv\">2</span>)(<span class=\"dv\">2</span>))</span></code></pre></div>\n<p>By turning the\n<code>compute_operation_with_</code><em>n</em><code>_operands</code>-type\nfunctions into curried functions, the code gets much cleaner. That is,\ninstead of a switch like:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">if</span> number_of_operands <span class=\"op\">==</span> <span class=\"dv\">2</span>:</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">self</span>.compute_operation_with_two_operands(<span class=\"va\">self</span>.catalog[operation])</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">if</span> number_of_operands <span class=\"op\">==</span> <span class=\"dv\">1</span>:</span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">self</span>.compute_operation_with_one_operand(<span class=\"va\">self</span>.catalog[operation])</span></code></pre></div>\n<p>You can implement a curried function using a callable python object\nand do something like:</p>\n<pre><code>func = self.catalog[operation]\n\nwhile not func.resolved:\n    func(self.pop())</code></pre>\n<p>This gets rid of the clunky\n<code>compute_operation_with_</code><em>n</em><code>_operands</code>\nfunctions. Here is the full code for a solution using currying:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env python3</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">Engine class for RPN Calculator</span></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> math</span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">from</span> functools <span class=\"im\">import</span> partial</span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">from</span> inspect <span class=\"im\">import</span> signature</span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-11\"><a href=\"https://tylercipriani.com/blog/#cb5-11\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-12\"><a href=\"https://tylercipriani.com/blog/#cb5-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">class</span> Curry(<span class=\"bu\">object</span>):</span>\n<span id=\"cb5-13\"><a href=\"https://tylercipriani.com/blog/#cb5-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb5-14\"><a href=\"https://tylercipriani.com/blog/#cb5-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Curry a callable</span></span>\n<span id=\"cb5-15\"><a href=\"https://tylercipriani.com/blog/#cb5-15\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-16\"><a href=\"https://tylercipriani.com/blog/#cb5-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Given a callable, returns a an object that can be used like a curried</span></span>\n<span id=\"cb5-17\"><a href=\"https://tylercipriani.com/blog/#cb5-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    callable.</span></span>\n<span id=\"cb5-18\"><a href=\"https://tylercipriani.com/blog/#cb5-18\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-19\"><a href=\"https://tylercipriani.com/blog/#cb5-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; c1 = Curry(lambda x, y: x + y)</span></span>\n<span id=\"cb5-20\"><a href=\"https://tylercipriani.com/blog/#cb5-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; c2 = Curry(lambda x, y: x + y)</span></span>\n<span id=\"cb5-21\"><a href=\"https://tylercipriani.com/blog/#cb5-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; c1(2, 2) == c2(2)(2)</span></span>\n<span id=\"cb5-22\"><a href=\"https://tylercipriani.com/blog/#cb5-22\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    True</span></span>\n<span id=\"cb5-23\"><a href=\"https://tylercipriani.com/blog/#cb5-23\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-24\"><a href=\"https://tylercipriani.com/blog/#cb5-24\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    :func: callable</span></span>\n<span id=\"cb5-25\"><a href=\"https://tylercipriani.com/blog/#cb5-25\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb5-26\"><a href=\"https://tylercipriani.com/blog/#cb5-26\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>, func):</span>\n<span id=\"cb5-27\"><a href=\"https://tylercipriani.com/blog/#cb5-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.func <span class=\"op\">=</span> func</span>\n<span id=\"cb5-28\"><a href=\"https://tylercipriani.com/blog/#cb5-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.argc <span class=\"op\">=</span> <span class=\"bu\">len</span>(signature(<span class=\"va\">self</span>.func).parameters)</span>\n<span id=\"cb5-29\"><a href=\"https://tylercipriani.com/blog/#cb5-29\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.resolved <span class=\"op\">=</span> <span class=\"va\">False</span></span>\n<span id=\"cb5-30\"><a href=\"https://tylercipriani.com/blog/#cb5-30\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.answer <span class=\"op\">=</span> <span class=\"va\">None</span></span>\n<span id=\"cb5-31\"><a href=\"https://tylercipriani.com/blog/#cb5-31\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-32\"><a href=\"https://tylercipriani.com/blog/#cb5-32\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__call__</span>(<span class=\"va\">self</span>, <span class=\"op\">*</span>args):</span>\n<span id=\"cb5-33\"><a href=\"https://tylercipriani.com/blog/#cb5-33\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> <span class=\"bu\">len</span>(args) <span class=\"op\">==</span> <span class=\"va\">self</span>.argc:</span>\n<span id=\"cb5-34\"><a href=\"https://tylercipriani.com/blog/#cb5-34\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"va\">self</span>.answer <span class=\"op\">=</span> <span class=\"va\">self</span>.func(<span class=\"op\">*</span>args)</span>\n<span id=\"cb5-35\"><a href=\"https://tylercipriani.com/blog/#cb5-35\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"va\">self</span>.resolved <span class=\"op\">=</span> <span class=\"va\">True</span></span>\n<span id=\"cb5-36\"><a href=\"https://tylercipriani.com/blog/#cb5-36\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-37\"><a href=\"https://tylercipriani.com/blog/#cb5-37\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">for</span> arg <span class=\"kw\">in</span> args:</span>\n<span id=\"cb5-38\"><a href=\"https://tylercipriani.com/blog/#cb5-38\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"va\">self</span>.func <span class=\"op\">=</span> partial(<span class=\"va\">self</span>.func, arg)</span>\n<span id=\"cb5-39\"><a href=\"https://tylercipriani.com/blog/#cb5-39\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"va\">self</span>.argc <span class=\"op\">=</span> <span class=\"bu\">len</span>(signature(<span class=\"va\">self</span>.func).parameters)</span>\n<span id=\"cb5-40\"><a href=\"https://tylercipriani.com/blog/#cb5-40\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-41\"><a href=\"https://tylercipriani.com/blog/#cb5-41\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> <span class=\"va\">self</span></span>\n<span id=\"cb5-42\"><a href=\"https://tylercipriani.com/blog/#cb5-42\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-43\"><a href=\"https://tylercipriani.com/blog/#cb5-43\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-44\"><a href=\"https://tylercipriani.com/blog/#cb5-44\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">class</span> RPNEngine(<span class=\"bu\">object</span>):</span>\n<span id=\"cb5-45\"><a href=\"https://tylercipriani.com/blog/#cb5-45\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb5-46\"><a href=\"https://tylercipriani.com/blog/#cb5-46\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Reverse Polish Notation (RPN) Engine</span></span>\n<span id=\"cb5-47\"><a href=\"https://tylercipriani.com/blog/#cb5-47\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-48\"><a href=\"https://tylercipriani.com/blog/#cb5-48\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    A RPN calculator</span></span>\n<span id=\"cb5-49\"><a href=\"https://tylercipriani.com/blog/#cb5-49\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn = RPNEngine()</span></span>\n<span id=\"cb5-50\"><a href=\"https://tylercipriani.com/blog/#cb5-50\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.push(2)</span></span>\n<span id=\"cb5-51\"><a href=\"https://tylercipriani.com/blog/#cb5-51\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.push(2)</span></span>\n<span id=\"cb5-52\"><a href=\"https://tylercipriani.com/blog/#cb5-52\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.compute(&#39;+&#39;) == 4</span></span>\n<span id=\"cb5-53\"><a href=\"https://tylercipriani.com/blog/#cb5-53\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    True</span></span>\n<span id=\"cb5-54\"><a href=\"https://tylercipriani.com/blog/#cb5-54\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.compute(&#39;AC&#39;)</span></span>\n<span id=\"cb5-55\"><a href=\"https://tylercipriani.com/blog/#cb5-55\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.push(2)</span></span>\n<span id=\"cb5-56\"><a href=\"https://tylercipriani.com/blog/#cb5-56\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &gt;&gt;&gt; rpn.compute(&#39;^2&#39;) == 4</span></span>\n<span id=\"cb5-57\"><a href=\"https://tylercipriani.com/blog/#cb5-57\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    True</span></span>\n<span id=\"cb5-58\"><a href=\"https://tylercipriani.com/blog/#cb5-58\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb5-59\"><a href=\"https://tylercipriani.com/blog/#cb5-59\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>):</span>\n<span id=\"cb5-60\"><a href=\"https://tylercipriani.com/blog/#cb5-60\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.stack <span class=\"op\">=</span> []</span>\n<span id=\"cb5-61\"><a href=\"https://tylercipriani.com/blog/#cb5-61\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.functions <span class=\"op\">=</span> <span class=\"va\">self</span>._get_functions()</span>\n<span id=\"cb5-62\"><a href=\"https://tylercipriani.com/blog/#cb5-62\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-63\"><a href=\"https://tylercipriani.com/blog/#cb5-63\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> _get_functions(<span class=\"va\">self</span>):</span>\n<span id=\"cb5-64\"><a href=\"https://tylercipriani.com/blog/#cb5-64\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> {</span>\n<span id=\"cb5-65\"><a href=\"https://tylercipriani.com/blog/#cb5-65\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&#39;+&#39;</span>: Curry(<span class=\"kw\">lambda</span> x, y: x <span class=\"op\">+</span> y),</span>\n<span id=\"cb5-66\"><a href=\"https://tylercipriani.com/blog/#cb5-66\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&#39;-&#39;</span>: Curry(<span class=\"kw\">lambda</span> x, y: x <span class=\"op\">-</span> y),</span>\n<span id=\"cb5-67\"><a href=\"https://tylercipriani.com/blog/#cb5-67\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&#39;*&#39;</span>: Curry(<span class=\"kw\">lambda</span> x, y: x <span class=\"op\">*</span> y),</span>\n<span id=\"cb5-68\"><a href=\"https://tylercipriani.com/blog/#cb5-68\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&#39;/&#39;</span>: Curry(<span class=\"kw\">lambda</span> x, y: x <span class=\"op\">/</span> y),</span>\n<span id=\"cb5-69\"><a href=\"https://tylercipriani.com/blog/#cb5-69\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&#39;^2&#39;</span>: Curry(<span class=\"kw\">lambda</span> x: x <span class=\"op\">*</span> x),</span>\n<span id=\"cb5-70\"><a href=\"https://tylercipriani.com/blog/#cb5-70\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&quot;SQRT&quot;</span>: Curry(<span class=\"kw\">lambda</span> x: math.sqrt(x)),</span>\n<span id=\"cb5-71\"><a href=\"https://tylercipriani.com/blog/#cb5-71\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&quot;C&quot;</span>: Curry(<span class=\"kw\">lambda</span>: <span class=\"va\">self</span>.stack.pop()),</span>\n<span id=\"cb5-72\"><a href=\"https://tylercipriani.com/blog/#cb5-72\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"st\">&quot;AC&quot;</span>: Curry(<span class=\"kw\">lambda</span>: <span class=\"va\">self</span>.stack.clear()),</span>\n<span id=\"cb5-73\"><a href=\"https://tylercipriani.com/blog/#cb5-73\" aria-hidden=\"true\" tabindex=\"-1\"></a>        }</span>\n<span id=\"cb5-74\"><a href=\"https://tylercipriani.com/blog/#cb5-74\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-75\"><a href=\"https://tylercipriani.com/blog/#cb5-75\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> push(<span class=\"va\">self</span>, item):</span>\n<span id=\"cb5-76\"><a href=\"https://tylercipriani.com/blog/#cb5-76\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.stack.append(item)</span>\n<span id=\"cb5-77\"><a href=\"https://tylercipriani.com/blog/#cb5-77\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-78\"><a href=\"https://tylercipriani.com/blog/#cb5-78\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> pop(<span class=\"va\">self</span>):</span>\n<span id=\"cb5-79\"><a href=\"https://tylercipriani.com/blog/#cb5-79\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">try</span>:</span>\n<span id=\"cb5-80\"><a href=\"https://tylercipriani.com/blog/#cb5-80\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">return</span> <span class=\"va\">self</span>.stack.pop()</span>\n<span id=\"cb5-81\"><a href=\"https://tylercipriani.com/blog/#cb5-81\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">except</span> <span class=\"pp\">IndexError</span>:</span>\n<span id=\"cb5-82\"><a href=\"https://tylercipriani.com/blog/#cb5-82\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">pass</span></span>\n<span id=\"cb5-83\"><a href=\"https://tylercipriani.com/blog/#cb5-83\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-84\"><a href=\"https://tylercipriani.com/blog/#cb5-84\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> compute(<span class=\"va\">self</span>, operation):</span>\n<span id=\"cb5-85\"><a href=\"https://tylercipriani.com/blog/#cb5-85\" aria-hidden=\"true\" tabindex=\"-1\"></a>        func <span class=\"op\">=</span> <span class=\"va\">self</span>.functions.get(operation)</span>\n<span id=\"cb5-86\"><a href=\"https://tylercipriani.com/blog/#cb5-86\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-87\"><a href=\"https://tylercipriani.com/blog/#cb5-87\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> <span class=\"kw\">not</span> func:</span>\n<span id=\"cb5-88\"><a href=\"https://tylercipriani.com/blog/#cb5-88\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">raise</span> <span class=\"pp\">BaseException</span>(<span class=\"st\">&#39;</span><span class=\"sc\">%s</span><span class=\"st\"> not a valid function&#39;</span> <span class=\"op\">%</span> operation)</span>\n<span id=\"cb5-89\"><a href=\"https://tylercipriani.com/blog/#cb5-89\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-90\"><a href=\"https://tylercipriani.com/blog/#cb5-90\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> <span class=\"bu\">len</span>(<span class=\"va\">self</span>.stack) <span class=\"op\">&lt;</span> func.argc:</span>\n<span id=\"cb5-91\"><a href=\"https://tylercipriani.com/blog/#cb5-91\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">raise</span> <span class=\"pp\">BaseException</span>(</span>\n<span id=\"cb5-92\"><a href=\"https://tylercipriani.com/blog/#cb5-92\" aria-hidden=\"true\" tabindex=\"-1\"></a>                <span class=\"st\">&#39;</span><span class=\"sc\">%s</span><span class=\"st\"> requires </span><span class=\"sc\">%d</span><span class=\"st\"> operands, </span><span class=\"sc\">%d</span><span class=\"st\"> given&#39;</span> <span class=\"op\">%</span> (</span>\n<span id=\"cb5-93\"><a href=\"https://tylercipriani.com/blog/#cb5-93\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    operation,</span>\n<span id=\"cb5-94\"><a href=\"https://tylercipriani.com/blog/#cb5-94\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    func.argc,</span>\n<span id=\"cb5-95\"><a href=\"https://tylercipriani.com/blog/#cb5-95\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    <span class=\"bu\">len</span>(<span class=\"va\">self</span>.stack)</span>\n<span id=\"cb5-96\"><a href=\"https://tylercipriani.com/blog/#cb5-96\" aria-hidden=\"true\" tabindex=\"-1\"></a>                )</span>\n<span id=\"cb5-97\"><a href=\"https://tylercipriani.com/blog/#cb5-97\" aria-hidden=\"true\" tabindex=\"-1\"></a>            )</span>\n<span id=\"cb5-98\"><a href=\"https://tylercipriani.com/blog/#cb5-98\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-99\"><a href=\"https://tylercipriani.com/blog/#cb5-99\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> func.argc <span class=\"op\">==</span> <span class=\"dv\">0</span>:</span>\n<span id=\"cb5-100\"><a href=\"https://tylercipriani.com/blog/#cb5-100\" aria-hidden=\"true\" tabindex=\"-1\"></a>            func()</span>\n<span id=\"cb5-101\"><a href=\"https://tylercipriani.com/blog/#cb5-101\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-102\"><a href=\"https://tylercipriani.com/blog/#cb5-102\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">while</span> <span class=\"kw\">not</span> func.resolved:</span>\n<span id=\"cb5-103\"><a href=\"https://tylercipriani.com/blog/#cb5-103\" aria-hidden=\"true\" tabindex=\"-1\"></a>            func(<span class=\"va\">self</span>.pop())</span>\n<span id=\"cb5-104\"><a href=\"https://tylercipriani.com/blog/#cb5-104\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-105\"><a href=\"https://tylercipriani.com/blog/#cb5-105\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> func.answer</span></code></pre></div>\n<p>Reading the final code in the <em>Python Corner</em> post made me me\nreally itchy to implement the solution I posted here.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/06/07/bloop-audible-error-logs/",

    "title": "Bloop! Audible Error Logs",
    "url": "https://tylercipriani.com/blog/2018/06/07/bloop-audible-error-logs/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-06-07T20:14:32Z",
    "date_modified": "2018-12-30T19:29:57Z",


    "content_html": "<p>As a frequent deployer of software, I’m usually watching several\ndifferent flavors of system monitoring all at the same time. A few\nlogstash dashboards in a few browser windows, a few grafana dashboards,\na few different logs being tailed in a few different tmux windows.</p>\n<p>If it all goes wrong during a deployment – if the error log suddenly\nexplodes – I want to know. Even if I’m looking at another metric, or at\nIRC, or at my email – I want to know about log explosion\nimmediately.</p>\n<p>So I made a thing that plays a little noise whenever a new line is\nrecieved on stdin. I call it <a\nhref=\"https://fossil.tylercipriani.com/bloop\">Bloop!</a></p>\n<p>And I’ve been using it to tail logs like:</p>\n<pre><code>ssh logsever -- tail -f /var/log/important/error.log | bloop -s</code></pre>\n<p>So now my stomach drops when I hear,\n“bloop…bloop…blobloopboopbloop”.</p>\n<p>I’m sure this thing has been build a million times because it’s a\nbraindead-simple idea, but I couldn’t find the right words to search for\nit so I made new one. Now all I need is an EKG monitor so I can see how\nmuch this bloop thing makes my heart rate match the overall error\nrate.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2018/05/06/using-awk-like-grep-with-envvars/",

    "title": "Using AWK like grep with envvars",
    "url": "https://tylercipriani.com/blog/2018/05/06/using-awk-like-grep-with-envvars/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2018-05-06T00:00:00Z",
    "date_modified": "2018-05-06T18:15:42Z",


    "content_html": "<p>This is a little tip that was impossible for me to DuckDuckGo (that’s\nright, I use DuckDuckGo like a verb). Like everyone who lives the daily\njoy (and, frequently, deep frustration) of using the command line to\naccomplish day-to-day tasks I am a fairly deft manipulator of strings.\nOften, I turn to AWK to achieve powerful results quickly.</p>\n<section id=\"using-awk-like-grep\" class=\"level2\">\n<h2>Using AWK like grep</h2>\n<p>There is usually <a\nhref=\"http://blog.jpalardy.com/posts/skip-grep-use-awk/\">no reason to\nuse grep with AWK</a>. AWK lets you use <code>/[whatever]/</code> to\nsearch for lines containing <code>[whatever]</code>. You can also use\n<code>/! [whatever]/</code> to search for the opposite of\n<code>[whatever]</code>. After you’ve found the line you want to act\nupon, you can manipulate it further using the powerful functionality of\nAWK.</p>\n<p>Today, however, I wanted to use AWK to find the rotation of my\ncurrent display using <code>xrandr</code>. The name of current display\ndevice was stored in the environment variable\n<code>$DISPLAY_DEVICE</code> (and in this instance was\n<code>LVDS-1</code>). I could not figure out, nor could I find the right\nwords to search for, how to do this.</p>\n<p>I tried:</p>\n<pre><code>xrandr -q | awk -v device=&quot;$DISPLAY_DEVICE&quot; &#39;/device/ {print}&#39;</code></pre>\n<p>I tried</p>\n<pre><code>xrandr -q | awk &#39;/&#39;&quot;$DISPLAY_DEVICE&quot;&#39;/ {print}&#39;</code></pre>\n<p>Finally, I figured it out! This is something I thought I should\ndocument for others using the same search terms (and for myself in a\nmonth):</p>\n</section>\n<section id=\"the-magic\" class=\"level2\">\n<h2>The Magic</h2>\n<pre><code>awk -v device=&quot;$DISPLAY_DEVICE&quot; &#39;$0 ~ device {print}&#39;</code></pre>\n<p>To get the rotation of a device from <code>xrandr</code> if you know\nthe device name it’s:</p>\n<pre><code>xrandr -q | awk -v device=&#39;LVDS-1&#39; &#39;$0 ~ device {gsub(&quot;([()]| primary)&quot;, &quot;&quot;); print $4}&#39;</code></pre>\n<p>&lt;3 AWK so darn much.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/12/31/2017-by-the-numbers/",

    "title": "2017 by the numbers",
    "url": "https://tylercipriani.com/blog/2017/12/31/2017-by-the-numbers/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2017-12-31T22:43:42Z",
    "date_modified": "2017-12-31T23:05:25Z",


    "content_html": "<p>These are some meaningless numbers.</p>\n<ul>\n<li>Books read: 34 (goal 50)\n<ol type=\"1\">\n<li><a\nhref=\"https://openlibrary.org/works/OL17360507W/White_trash\">White\ntrash: the 400-year untold history of class in America</a> by Nancy\nIsenberg</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL13716955W/Harry_Potter_and_the_Order_of_the_Phoenix\">Harry\nPotter and the Order of the Phoenix</a> by J.K. Rowling</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL13716954W/Harry_Potter_and_the_Half-Blood_Prince\">Harry\nPotter and the Half-Blood Prince</a> by J.K. Rowling</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL64468W/Brave_New_World\">Brave New\nWorld</a> by Aldous Huxley</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL82586W/Harry_Potter_and_the_Deathly_Hallows\">Harry\nPotter and the Deathly Hallows</a> by J.K. Rowling</li>\n<li><a href=\"https://openlibrary.org/works/OL79132W/The_camera\">The\nCamera</a> by Ansel Adams</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL8532656W/Learning_to_See_Creatively\">Learning\nto See Creatively</a> by Bryan Peterson</li>\n<li>Bitch Planet, Vol. 1: Extraordinary Machine by Kelly Sue\nDeConnick</li>\n<li>Black Panther .1 by Ta-Nehisi Coates</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL675783W/The_handmaid&#39;s_tale\">The\nHandmaid’s Tale</a> by Margaret Atwood</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL9200964W/The_Sandman_Vol._1\">The\nSandman, Vol. 1: Preludes and Nocturnes</a> by Neil Gaiman</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL15449786W/The_Sandman_Volume_2\">The\nSandman, Vol. 2: The Doll’s House</a> by Neil Gaiman</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL14975232W/The_Sandman_Vol._3\">The\nSandman, Vol. 3: Dream Country</a> by Neil Gaiman</li>\n<li>The Sandman, Vol. 4: Season of Mists by Neil Gaiman</li>\n<li>The Sandman, Vol. 5: A Game of You by Neil Gaiman</li>\n<li>The Sandman, Vol. 6: Fables and Reflections by Neil Gaiman</li>\n<li>The Sandman, Vol. 7: Brief Lives by Neil Gaiman</li>\n<li>Continental Pilsner by David Miller</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL679308W/The_Sandman_Vol._8\">The\nSandman, Vol. 8: The World’s End</a> by Neil Gaiman</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL14975250W/The_Sandman_Vol._9\">The\nSandman, Vol. 9: The Kindly Ones</a> by Neil Gaiman</li>\n<li>The Sandman, Vol. 10: The Wake</li>\n<li>Brewing Local: American-Grown Beer by Stan Hieronymus</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL59863W/The_dispossessed\">The\nDispossessed</a> by Ursula K. Le Guin</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL17554076W/Neptunes_Brood\">Neptune’s\nBrood</a> by Charles Stross</li>\n<li><a href=\"https://openlibrary.org/works/OL81634W/Misery\">Misery</a>\nby Stephen King</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL5961779W/Storm_Front_%5BThe_Dresden_Files_Book_1%5D_%5BDresden_Files%5D\">Storm\nFront (The Dresden Files, Book 1)</a> by Jim Butcher</li>\n<li><a href=\"https://openlibrary.org/works/OL5961788W/Fool_Moon\">Fool\nMoon (The Dresden Files, Book 2)</a> by Jim Butcher</li>\n<li><a href=\"https://openlibrary.org/works/OL58717W/The_Postman\">The\nPostman</a> by David Brin</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL98474W/Slaughterhouse-five\">Slaughterhouse-five:\nor, The children’s crusade, a duty-dance with death</a> by Kurt\nVonnegut</li>\n<li>Turtles All The Way Down by John Green</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL98488W/Breakfast_of_Champions\">Breakfast\nof Champions: or, Goodbye blue Monday!</a> by Kurt Vonnegut</li>\n<li><a href=\"https://openlibrary.org/works/OL17095216W/El_Deafo\">El\nDeafo</a> by Cece Bell</li>\n<li><a href=\"http://diggercomic.com/\">Digger</a> by Ursula Vernon</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL15839230W/Pride_and_Prejudice\">Pride\nand Prejudice</a> by Jane Austen</li>\n</ol></li>\n<li>Miles run: 124.57 (goal 100)</li>\n<li>Meditation sessions: 47 (goal 100)</li>\n<li>Commits (on github): 445</li>\n<li>Deployments to Wikimedia production: 377</li>\n<li>Trick-or-treaters on Halloween: 229</li>\n<li>Gallons of beer brewed: 70 (14x5 gallon batches)</li>\n<li>Medals won for brewing: 3\n<ul>\n<li>Gold - Colorado State Fair - Mild</li>\n<li>Gold - Rocky Mountain Homebrew Challenge - Hefeweizen</li>\n<li>Bronze - Hoppy Halloween - Mild</li>\n</ul></li>\n<li>Beer competitions entered: 3</li>\n<li>Beers entered into competitions: 8</li>\n<li>Body fat % difference: -0.2</li>\n<li>Raw photos added to my computer: 2,995</li>\n<li>Roughly, number of photos taken: 12,782 (via\n<code>exiftool -ShutterCount</code>)</li>\n<li>FCC licenses received: 2 (technician and general)</li>\n</ul>\n<p>I felt pretty powerless against the rising tide of horribleness that\nseemingly permeated every aspect of 2017 – that is not captured by these\nnumbers.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/09/26/ssh-key-fingerprints-identicons-and-ascii-art/",

    "title": "Ssh Key Fingerprints, Identicons, and ASCII art",
    "url": "https://tylercipriani.com/blog/2017/09/26/ssh-key-fingerprints-identicons-and-ascii-art/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-09-26T14:00:15Z",
    "date_modified": "2017-10-09T16:19:46Z",


    "content_html": "<blockquote>\n<p>Security at the expense of usability comes at the expense of\nsecurity.</p>\n<p>– <a\nhref=\"https://security.stackexchange.com/questions/6095/xkcd-936-short-complex-password-or-long-dictionary-passphrase/6116#6116\">AviD</a></p>\n</blockquote>\n<p>Public key authentication is confusing, even for “<a\nhref=\"https://arstechnica.com/information-technology/2017/09/in-spectacular-fail-adobe-security-team-posts-private-pgp-key-on-blog/\">professionals</a>”.\nPart of the confusion is that base64-encoded public keys and private\nkeys are just huge globs of meaningless letters and numbers. Even the\nhashed fingerprints of these keys are just slightly smaller meaningless\nglobs of letters and numbers.</p>\n<blockquote>\n<p>It is a known fact in psychology that people are slow and unreliable\nat processing or memorizing meaningless strings</p>\n<p>– <a\nhref=\"http://www.netsec.ethz.ch/publications/papers/validation.pdf\">Hash\nVisualization: a New Technique to improve Real-World Security</a></p>\n</blockquote>\n<p>Ensuring that two keys are the same means comparing key hashes—\n<em>fingerprints</em>. When using the <code>md5</code> hash algorithm,\ncomparing a key fingerprint means comparing 16, 16-bit numbers (and for\nthe uninitiated that means blankly staring at 32 meaningless letters and\nnumbers). In practice, that usually means <em>not</em> comparing 32\nmeaningless letters and numbers except when strictly necessary:\n<em>Security at the expense of usability comes at the expense of\nsecurity</em>.</p>\n<section id=\"ssh-tricks\" class=\"level2\">\n<h2>SSH Tricks</h2>\n<p>I am constantly troubleshooting ssh. I spend a lot of time looking at\nthe authlog and comparing keys.</p>\n<p>I’ve learned some fun tricks that I use constantly:</p>\n<dl>\n<dt><em>Get fingerprint from public key\n<code>ssh-keygen(1)</code></em></dt>\n<dd>\n<code>ssh-keygen -l [-E md5] -f [public key]</code>\n</dd>\n<dt><em>Generate a public key given a private key\n<code>ssh-keygen(1)</code></em></dt>\n<dd>\n<code>ssh-keygen -y -f [private key]</code>\n</dd>\n<dt><em>Automatically add server key to <code>known_hosts</code> file\n<code>ssh-keyscan(1)</code>:</em></dt>\n<dd>\n<code>ssh-keyscan -H [hostname] &gt;&gt; ~/.ssh/known_hosts</code>\n</dd>\n<dt><em>List key fingerprints in ssh-agent\n<code>ssh-agent(1)</code></em></dt>\n<dd>\n<code>ssh-add [-E md5] -l</code>\n</dd>\n</dl>\n<p>When I get the message, <code>Permission denied (publickey)</code>, I\nhave a protocol.</p>\n<ol type=\"1\">\n<li>Find the fingerprint of the key being used by the authenticating\nhost. This will either be in <code>ssh-agent</code> or I may have to use\n<code>ssh-keygen -l -E md5 -f [publickey]</code> on the authenticating\nhost.</li>\n<li>Find the <code>authorized_keys</code> file on the target machine:\n<code>grep \'AuthorizedKeysFile\' /etc/ssh/sshd_config</code></li>\n<li>Compare the fingerprint of the public key from the authenticating\nhost is among the fingerprints listed in the\n<code>authorized_keys</code> file.</li>\n</ol>\n<p>Most ssh problems are caused by (SURPRISE!) the public key of the\nauthenticating host not being present in the\n<code>AuthorizedKeysFile</code> on the target.</p>\n</section>\n<section id=\"the-worm-bishop\" class=\"level2\">\n<h2>The Worm Bishop</h2>\n<p>Most of the time when I “compare fingerprints” of keys, I copy, I\npaste, and finally I use the time-honored <a\nhref=\"https://medium.com/@rualthanzauva/grep-was-a-private-command-of-mine-for-quite-a-while-before-i-made-it-public-ken-thompson-a40e24a5ef48\">global\nregular expression print</a> command. This is insecure behavior for <a\nhref=\"https://security.love/Pastejacking/\">myriad</a> reasons. The\nsecure way to compare keys is by manually comparing fingerprints, but\nmeaningless string comparison is hard, which makes security hard, and,\nso, most folks simply aren’t secure. <em>Security at the expense of\nusability comes at the expense of security</em>.</p>\n<p>In the release announcement for OpenSSH 5.1 a different approach to\ncomparing fingerprints was announced:</p>\n<blockquote>\n<p>Visual fingerprinnt [sic] display is controlled by a new\nssh_config(5) option “VisualHostKey”. The intent is to render SSH host\nkeys in a visual form that is amenable to easy recall and rejection of\nchanged host keys.</p>\n<p>– <a\nhref=\"https://lists.mindrot.org/pipermail/openssh-unix-dev/2008-July/026693.html\">Announce:\nOpenSSH 5.1 released</a></p>\n</blockquote>\n<p>The “VisualHostKey” is the source of the randomart ascii that you see\nif you add the <code>-v</code> flag to the <code>ssh-keygen</code>\ncommand from above:</p>\n<pre class=\"f9 b9\">\n$ ssh-keygen -lv -E md5 -f ~/.ssh/id_rsa.old.pub\n2048 MD5:b2:c7:2a:77:84:3a:62:97:56:d0:95:49:63:fd:5d:2b tyler@tylercipriani.com (RSA)\n+---[RSA 2048]----+\n|       .++       |\n|       .+..     .|\n|     . .   . . ..|\n|    . .     .E.. |\n|     ...S     .  |\n|      o+.        |\n|     +..o        |\n|  o B .o.        |\n| . + +..         |\n+------[MD5]------+\n</pre>\n<p>This is something like an <a\nhref=\"https://blog.docuverse.com/2011/07/29/what-is-identicon/\">identicon</a>\nfor your ssh key:</p>\n<blockquote>\n<p>Identicons’ intended applications are in helping users recognize or\ndistinguish textual information units in context of many.</p>\n<p>– Don Park</p>\n</blockquote>\n<p>Although it is important to note that while the intent of an\nidenticon is to distinguish against many, the intent of the\n<code>VisualHostKey</code> is more ambiguous.</p>\n<p>The work to add this randomart was based on the paper <a\nhref=\"http://www.netsec.ethz.ch/publications/papers/validation.pdf\"><em>Hash\nVisualization: a New Technique to improve Real-World Security</em></a>,\nand the algorithm that generates these bits of art is discussed in\ndetail in the paper <a\nhref=\"http://www.dirk-loss.de/sshvis/drunken_bishop.pdf\">The drunken\nbishop: An analysis of the OpenSSH fingerprint visualization\nalgorithm</a>. Also, interestingly, while the above paper contains a\nreference to the apocryphal drunken bishop leaving stacks of coins in\neach square he’s visited, the code <a\nhref=\"https://github.com/openssh/openssh-portable/blob/master/sshkey.c#L1005-L1010\">comments</a>\nin OpenSSH refer to a “worm crawling over a discrete plane leaving a\ntrace […] everywhere it goes”.</p>\n<p>Regardless of whether the algorithm’s protagonist is a worm or a\nbishop the story is similar. There is a discrete plane (or an atrium),\nthe protagonist is in the middle (and possibly drunk), and moves around\nthe room leaving a trail (either because they are slimy or because they\nare…drunk? and dropping coins because they’re drunk? I guess.), the more\ntimes they visit a particular part of the plane/atrium, the\nslimier/more-coin-filled it becomes. The direction of movement is\ndetermined by the little-endian processing of each word in the md5\nchecksum, so each run should create the same unique randomart for the\nsame unique checksum.</p>\n<p>I wrote a simple <a\nhref=\"https://github.com/thcipriani/slime-bishop\">python version</a>\nthat visualizes the algorithm step-by-step which may be a better\nexplainer than any meaningless strings I can group together:</p>\n<figure>\n<img src=\"https://photos.tylercipriani.com/thumbs/slime-bishop.gif\"\nalt=\"The Drunken Slime Bishop\" />\n<figcaption aria-hidden=\"true\">The Drunken Slime Bishop</figcaption>\n</figure>\n</section>\n<section id=\"ascii-art-is-meaningless-characters\" class=\"level2\">\n<h2>ASCII Art is meaningless characters</h2>\n<p>Confession time: I have never used randomart even when copying and\npasting is impossible—I just compare strings. I have\n<code>VisualHostKey yes</code> in my <code>~/.ssh/config</code>, but I\nalmost never look at since OpenSSH warns me if a host-key has changed,\nso mostly it’s just taking up vertical space.</p>\n<p>But why?</p>\n<p>I think the reason I don’t use <code>VisualHostKey</code> to help\ndistinguish between public-keys is that it failed to meet the\n<em>regularity</em> property of hash visualization:</p>\n<blockquote>\n<p>Humans are good at identifying geometric objects (such as circles,\nrectangles, triangles, and lines), and shapes in general. We call\nimages, which contain mostly recognizable shapes, regular images. If an\nimage is not regular, i.e. does not contain identifiable objects or\npatterns, or is too chaotic (such as white noise), it is difficult for\nhumans to compare or recall it.</p>\n<p>– <a\nhref=\"http://www.netsec.ethz.ch/publications/papers/validation.pdf\">Hash\nVisualization: a New Technique to improve Real-World Security</a></p>\n</blockquote>\n<p>Randomized ASCII art that is composed of common letters and\nfrequently used symbols is very nearly the same as a string. The\nconstituent parts are the same. This is the first problem: while Unicode\ncontains symbols that are more recognizable, ASCII contains a very\nlimited set of characters. This is a property that makes ASCII as an\nart-medium so charming, but makes abstract ASCII-art hard to remember as\nit fails to form geometric patterns that are easily distinguished from\nnoise.</p>\n<p>Secondly, ASCII randomart lacks any color, which is a property\nmentioned for hash visualizations as well as one of the more\ndistinguishing features of identicons:</p>\n<blockquote>\n<p>humans are very good at identifying geometrical shapes, patterns, and\ncolors, and they can compare two images efficiently</p>\n<p>– <a\nhref=\"http://www.netsec.ethz.ch/publications/papers/validation.pdf\">Hash\nVisualization: a New Technique to improve Real-World Security</a></p>\n</blockquote>\n</section>\n<section id=\"can-i-do-better\" class=\"level2\">\n<h2>Can I do better?</h2>\n<p>No. Probably not if I had to work under the constraint that these\nhash visualizations need to work everywhere OpenSSH works. OpenSSH is an\namazing piece of software and they are solving Hard™ problems while\nfolks like me write blogs about ASCII art.</p>\n<p><a href=\"https://www.openssh.com/donations.html\">Donate to them\nnow</a>…I’ll wait.</p>\n<p>For the purposes of differentiation, under the constraint that it\nmust work on all terminals, I like the current solution. My liking the\nsolution didn’t, of course, stop me from fiddling with the existing\nsolution.</p>\n</section>\n<section id=\"add-color\" class=\"level2\">\n<h2>Add color</h2>\n<p>The first stab I took at this was to add color. As an initial try I\nsimply used the first 6 hex digits of the md5 checksum, converted those\nto rgb, and converted those to true-color ansi output:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> to_rgb(color):</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> <span class=\"bu\">int</span>(color[:<span class=\"dv\">2</span>], <span class=\"dv\">16</span>), <span class=\"bu\">int</span>(color[<span class=\"dv\">2</span>:<span class=\"dv\">4</span>], <span class=\"dv\">16</span>), <span class=\"bu\">int</span>(color[<span class=\"dv\">4</span>:], <span class=\"dv\">16</span>)</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> to_ansi_rgb(color):</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    r, g, b <span class=\"op\">=</span> to_rgb(color)</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> <span class=\"st\">&#39;</span><span class=\"ch\">\\x1b</span><span class=\"st\">[38;2;</span><span class=\"sc\">{}</span><span class=\"st\">;</span><span class=\"sc\">{}</span><span class=\"st\">;</span><span class=\"sc\">{}</span><span class=\"st\">m&#39;</span>.<span class=\"bu\">format</span>(r, g, b)</span></code></pre></div>\n<p>This actually makes a huge difference in my ability to quickly\ndifferentiate between on key and another:</p>\n<pre class=\"f9 b9\">\nb2c72a77843a629756d0954963fd5d2b\n<span class=\"f2\">+-----------------+</span>\n<span class=\"f2\">|       .++       |</span>\n<span class=\"f2\">|       .+..     .|</span>\n<span class=\"f2\">|     . .   . . ..|</span>\n<span class=\"f2\">|    . .     .E.. |</span>\n<span class=\"f2\">|     ...S     .  |</span>\n<span class=\"f2\">|      o+.        |</span>\n<span class=\"f2\">|     +..o        |</span>\n<span class=\"f2\">|  o B .o.        |</span>\n<span class=\"f2\">| . + +..         |</span>\n<span class=\"f2\">+-----------------+</span>\n</pre>\n<p>vs</p>\n<pre class=\"f9 b9\">\n161bc25962da8fed6d2f59922fb642aa\n<span class=\"ef140\">+-----------------+</span>\n<span class=\"ef140\">|      o .        |</span>\n<span class=\"ef140\">|     = +         |</span>\n<span class=\"ef140\">|    . = o        |</span>\n<span class=\"ef140\">|       = +       |</span>\n<span class=\"ef140\">|      . S  .     |</span>\n<span class=\"ef140\">|       o..o .    |</span>\n<span class=\"ef140\">|       o. o=     |</span>\n<span class=\"ef140\">|      . ..=..    |</span>\n<span class=\"ef140\">|    E.   o.+.    |</span>\n<span class=\"ef140\">+-----------------+</span>\n</pre>\n<p>Becomes <span class=\"ef140\">purple-ish</span> vs <span\nclass=\"f2\">green</span>, which is easy for me, but probably less easy\nfor a sizable portion of the population. Further, while this solution\nworks in terminals that support true-color output, I didn’t even take\nthe time to make it fail gracefully to 8-bit color. Of course, with\n8-bit color there are fewer means to differentiate via color. While\ncolor is visually distinctive to me, it is likely infeasible to\nimplement, or unhelpful to a large portion of the population. Fair\nenough.</p>\n</section>\n<section id=\"different-charsets\" class=\"level2\">\n<h2>Different Charsets</h2>\n<p>Unicode encodes some interesting characters to represent slime\nnowadays. There is the <a\nhref=\"https://en.wikipedia.org/wiki/Block_Elements\">block element\nset</a>, the <a href=\"https://en.wikipedia.org/wiki/Box_Drawing\">drawing\nset</a>, and even a <a\nhref=\"https://en.wikipedia.org/wiki/Miscellaneous_Symbols\">micellaneous\nsymbols</a> set. I’m on linux so obviously some of these sets just look\nlike empty boxes to me. But in my <a\nhref=\"https://github.com/thcipriani/slime-bishop\">slime-bishop</a> repo\nI did add support for a few symbols.</p>\n<p>Oddly, I don’t think the symbols add too much to help\ndifferentiation.</p>\n<pre class=\"f9 b9\">\nb2c72a77843a629756d0954963fd5d2b\n<span class=\"f2\">+-----------------+</span>\n<span class=\"f2\">|       ░▓▓       |</span>\n<span class=\"f2\">|       ░▓░░     ░|</span>\n<span class=\"f2\">|     ░ ░   ░ ░ ░░|</span>\n<span class=\"f2\">|    ░ ░     ░E░░ |</span>\n<span class=\"f2\">|     ░░░S     ░  |</span>\n<span class=\"f2\">|      ▒▓░        |</span>\n<span class=\"f2\">|     ▓░░▒        |</span>\n<span class=\"f2\">|  ▒ ▆ ░▒░        |</span>\n<span class=\"f2\">| ░ ▓ ▓░░         |</span>\n<span class=\"f2\">+-----------------+</span>\n</pre>\n<p>I think the problem of memory persists (sensible-chuckle.gif). We’re\ngood at remembering regular pictures, but do abstract pictures count as\nregular?</p>\n</section>\n<section id=\"final-thoughts\" class=\"level2\">\n<h2>Final thoughts</h2>\n<p>Visual hash algorithms are a novel concept, and may become more\nuseful over time. At the very least the ability to quickly reject that\ntwo keys match at a glance is a step in the right direction. The drunken\nbishop is certainly a fun algorithm to try to improve (while paying\nabsolutely no attention to reasonable constrains like “terminal\nbackground color” or “POSIX compatibility”). The drunken slimy worm\nbishop, with their coins and/or their slime trails is certainly useful\nfor <em>differentiation</em> (just like identicons), but it is not\nuseful for <em>identification</em>. I hope that the distinction between\n<em>differentiation</em> and <em>identification</em> is clear for users\nof OpenSSH, but I’m not entirely sure that it is.</p>\n<p>Improving the usability of security tooling is as important as it’s\never been; however, the corollary of, “security at the expense of\nusability comes at the expense of security.” is: usability that creates\na false sense of security is at the expense of security. And we must\nremain mindful that we are not providing usability that is meaningless\nor (worse) usability that widens the attack surface without providing\nany real security benefit. Part of that comes from a shared\nunderstanding of the available features in the tools we already\ncollectively use. In this way we can build on the work of one another,\neach bringing a unique perspective, and ultimately, maybe (just maybe)\ncreate tools that are <em>usable</em> and <em>secure</em>.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/09/13/topographical-sorting-in-golang/",

    "title": "Topographical Sorting in Golang",
    "url": "https://tylercipriani.com/blog/2017/09/13/topographical-sorting-in-golang/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-09-14T03:09:52Z",
    "date_modified": "2017-09-21T21:25:19Z",


    "content_html": "<p>I own a fair number of computer books that I have never read from\ncover-to-cover (and a slim few that I have). I tend to dip in-and-out of\nprogramming books—absorbing a chapter here and a chapter there. One of\nthe books I pick up with some frequency is <a\nhref=\"https://en.wikipedia.org/wiki/Algorithms_Unlocked\"><em>Algorithms\nUnlocked</em></a> by Thomas H. Cormen, who is one of the authors of the\noften cited <a\nhref=\"https://en.wikipedia.org/wiki/Introduction_to_Algorithms\">CLRS</a>\nwhich is a hugely comprehensive textbook covering the topic of\nalgorithms.</p>\n<p><em>Algorithms Unlocked</em>, in contrast to its massive textbook\ncounterpart, is a slim and snappy little book filled with all kinds of\nneat algorithms. It doesn’t focus on any specific language\nimplementations, but rather describes algorithms in pseudo-code and\nplain English. After an algorithm is introduced, there is a discussion\nof the Big-O and Big-Θ run-times.</p>\n<p>One of the things I like to do is read about a particular algorithm\nand test my understanding by implementing the pseudo code in some\nprogramming language. Since I recently ran into a graph problem while\nworking on <a\nhref=\"https://phabricator.wikimedia.org/source/blubber/\">blubber</a>\n—which is a Go project—I figured I’d implement the first algorithm in\nthe Directed Acyclic Graph (DAG) chapter in Go.</p>\n<p>Also, since I haven’t written anything on my blog in a while, I\nfigured I’d write up my adventure!</p>\n<section id=\"directed-graphs-represented-in-go\" class=\"level2\">\n<h2>Directed Graphs Represented in Go</h2>\n<p>The first problem when attempting to create a topographic sort of a\ngraph in any programming language is figuring out how to represent a\ngraph. I chose a <code>map</code> with an <code>int</code> as a key\n(which seems pretty much like a <code>slice</code> but the use of a\n<code>map</code> makes this implementation type agnostic). Each vertex\n<em>n</em> is represented with a key in the <code>map</code>, each\nvertex that adjacent to <em>n</em>—<em>m</em>—is stored as a\n<code>slice</code> in the <code>map</code> referenced by the key\n<em>n</em>.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre class=\"sourceCode go\"><code class=\"sourceCode go\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">package</span> main</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">import</span> <span class=\"st\">&quot;fmt&quot;</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">func</span> main<span class=\"op\">()</span> <span class=\"op\">{</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// Directed Acyclic Graph</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    vertices <span class=\"op\">:=</span> <span class=\"kw\">map</span><span class=\"op\">[</span><span class=\"dt\">int</span><span class=\"op\">][]</span><span class=\"dt\">int</span><span class=\"op\">{</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">1</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">4</span><span class=\"op\">},</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">2</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">3</span><span class=\"op\">},</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">3</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">4</span><span class=\"op\">,</span> <span class=\"dv\">5</span><span class=\"op\">},</span></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">4</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">6</span><span class=\"op\">},</span></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">5</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">6</span><span class=\"op\">},</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">6</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">7</span><span class=\"op\">,</span> <span class=\"dv\">11</span><span class=\"op\">},</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">7</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">8</span><span class=\"op\">},</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">8</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">14</span><span class=\"op\">},</span></span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">9</span><span class=\"op\">:</span>  <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">10</span><span class=\"op\">},</span></span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">10</span><span class=\"op\">:</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">11</span><span class=\"op\">},</span></span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">11</span><span class=\"op\">:</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">12</span><span class=\"op\">},</span></span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">13</span><span class=\"op\">:</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{</span><span class=\"dv\">13</span><span class=\"op\">},</span></span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dv\">14</span><span class=\"op\">:</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{},</span></span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">}</span></span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// As yet unimplemented topographicalSort</span></span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\" aria-hidden=\"true\" tabindex=\"-1\"></a>    fmt<span class=\"op\">.</span>Println<span class=\"op\">(</span>topographicalSort<span class=\"op\">(</span>vertices<span class=\"op\">))</span></span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">}</span></span></code></pre></div>\n</section>\n<section id=\"topographical-sort\" class=\"level1\">\n<h1>Topographical Sort</h1>\n<p>I implemented the algorithm in a function named\n<code>topographicalSort</code>. The inline comments are the pseudo-code\nfrom the book—also noteworthy I stuck with the unfortunate variable\nnames from the book (although somewhat adapted to camelCase to stick, a\nbit, to Go conventions):</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre class=\"sourceCode go\"><code class=\"sourceCode go\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">// topographicalSort Input: g: a directed acyclic graph with vertices number 1..n</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">// Output: a linear order of the vertices such that u appears before v</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">// in the linear order if (u,v) is an edge in the graph.</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">func</span> topographicalSort<span class=\"op\">(</span>g <span class=\"kw\">map</span><span class=\"op\">[</span><span class=\"dt\">int</span><span class=\"op\">][]</span><span class=\"dt\">int</span><span class=\"op\">)</span> <span class=\"op\">[]</span><span class=\"dt\">int</span> <span class=\"op\">{</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    linearOrder <span class=\"op\">:=</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{}</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 1. Let inDegree[1..n] be a new array, and create an empty linear array of</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">//    verticies</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    inDegree <span class=\"op\">:=</span> <span class=\"kw\">map</span><span class=\"op\">[</span><span class=\"dt\">int</span><span class=\"op\">]</span><span class=\"dt\">int</span><span class=\"op\">{}</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 2. Set all values in inDegree to 0</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">for</span> n <span class=\"op\">:=</span> <span class=\"kw\">range</span> g <span class=\"op\">{</span></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>        inDegree<span class=\"op\">[</span>n<span class=\"op\">]</span> <span class=\"op\">=</span> <span class=\"dv\">0</span></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">}</span></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 3. For each vertex u</span></span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">for</span> _<span class=\"op\">,</span> adjacent <span class=\"op\">:=</span> <span class=\"kw\">range</span> g <span class=\"op\">{</span></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\">// A. For each vertex *v* adjacent to *u*:</span></span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">for</span> _<span class=\"op\">,</span> v <span class=\"op\">:=</span> <span class=\"kw\">range</span> adjacent <span class=\"op\">{</span></span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"co\">//  i. increment inDegree[v]</span></span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>            inDegree<span class=\"op\">[</span>v<span class=\"op\">]++</span></span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"op\">}</span></span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">}</span></span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-25\"><a href=\"https://tylercipriani.com/blog/#cb2-25\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 4. Make a list next consisting of all vertices u such that</span></span>\n<span id=\"cb2-26\"><a href=\"https://tylercipriani.com/blog/#cb2-26\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">//    in-degree[u] = 0</span></span>\n<span id=\"cb2-27\"><a href=\"https://tylercipriani.com/blog/#cb2-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>    next <span class=\"op\">:=</span> <span class=\"op\">[]</span><span class=\"dt\">int</span><span class=\"op\">{}</span></span>\n<span id=\"cb2-28\"><a href=\"https://tylercipriani.com/blog/#cb2-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">for</span> u<span class=\"op\">,</span> v <span class=\"op\">:=</span> <span class=\"kw\">range</span> inDegree <span class=\"op\">{</span></span>\n<span id=\"cb2-29\"><a href=\"https://tylercipriani.com/blog/#cb2-29\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> v <span class=\"op\">!=</span> <span class=\"dv\">0</span> <span class=\"op\">{</span></span>\n<span id=\"cb2-30\"><a href=\"https://tylercipriani.com/blog/#cb2-30\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">continue</span></span>\n<span id=\"cb2-31\"><a href=\"https://tylercipriani.com/blog/#cb2-31\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"op\">}</span></span>\n<span id=\"cb2-32\"><a href=\"https://tylercipriani.com/blog/#cb2-32\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-33\"><a href=\"https://tylercipriani.com/blog/#cb2-33\" aria-hidden=\"true\" tabindex=\"-1\"></a>        next <span class=\"op\">=</span> <span class=\"bu\">append</span><span class=\"op\">(</span>next<span class=\"op\">,</span> u<span class=\"op\">)</span></span>\n<span id=\"cb2-34\"><a href=\"https://tylercipriani.com/blog/#cb2-34\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">}</span></span>\n<span id=\"cb2-35\"><a href=\"https://tylercipriani.com/blog/#cb2-35\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-36\"><a href=\"https://tylercipriani.com/blog/#cb2-36\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 5. While next is not empty...</span></span>\n<span id=\"cb2-37\"><a href=\"https://tylercipriani.com/blog/#cb2-37\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">for</span> <span class=\"bu\">len</span><span class=\"op\">(</span>next<span class=\"op\">)</span> <span class=\"op\">&gt;</span> <span class=\"dv\">0</span> <span class=\"op\">{</span></span>\n<span id=\"cb2-38\"><a href=\"https://tylercipriani.com/blog/#cb2-38\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\">// A. delete a vertex from next and call it vertex u</span></span>\n<span id=\"cb2-39\"><a href=\"https://tylercipriani.com/blog/#cb2-39\" aria-hidden=\"true\" tabindex=\"-1\"></a>        u <span class=\"op\">:=</span> next<span class=\"op\">[</span><span class=\"dv\">0</span><span class=\"op\">]</span></span>\n<span id=\"cb2-40\"><a href=\"https://tylercipriani.com/blog/#cb2-40\" aria-hidden=\"true\" tabindex=\"-1\"></a>        next <span class=\"op\">=</span> next<span class=\"op\">[</span><span class=\"dv\">1</span><span class=\"op\">:]</span></span>\n<span id=\"cb2-41\"><a href=\"https://tylercipriani.com/blog/#cb2-41\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-42\"><a href=\"https://tylercipriani.com/blog/#cb2-42\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\">// B. Add u to the end of the linear order</span></span>\n<span id=\"cb2-43\"><a href=\"https://tylercipriani.com/blog/#cb2-43\" aria-hidden=\"true\" tabindex=\"-1\"></a>        linearOrder <span class=\"op\">=</span> <span class=\"bu\">append</span><span class=\"op\">(</span>linearOrder<span class=\"op\">,</span> u<span class=\"op\">)</span></span>\n<span id=\"cb2-44\"><a href=\"https://tylercipriani.com/blog/#cb2-44\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-45\"><a href=\"https://tylercipriani.com/blog/#cb2-45\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\">// C. For each vertex v adjacent to u</span></span>\n<span id=\"cb2-46\"><a href=\"https://tylercipriani.com/blog/#cb2-46\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">for</span> _<span class=\"op\">,</span> v <span class=\"op\">:=</span> <span class=\"kw\">range</span> g<span class=\"op\">[</span>u<span class=\"op\">]</span> <span class=\"op\">{</span></span>\n<span id=\"cb2-47\"><a href=\"https://tylercipriani.com/blog/#cb2-47\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"co\">// i. Decrement inDegree[v]</span></span>\n<span id=\"cb2-48\"><a href=\"https://tylercipriani.com/blog/#cb2-48\" aria-hidden=\"true\" tabindex=\"-1\"></a>            inDegree<span class=\"op\">[</span>v<span class=\"op\">]--</span></span>\n<span id=\"cb2-49\"><a href=\"https://tylercipriani.com/blog/#cb2-49\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-50\"><a href=\"https://tylercipriani.com/blog/#cb2-50\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"co\">// ii. if inDegree[v] = 0, then insert v into next list</span></span>\n<span id=\"cb2-51\"><a href=\"https://tylercipriani.com/blog/#cb2-51\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">if</span> inDegree<span class=\"op\">[</span>v<span class=\"op\">]</span> <span class=\"op\">==</span> <span class=\"dv\">0</span> <span class=\"op\">{</span></span>\n<span id=\"cb2-52\"><a href=\"https://tylercipriani.com/blog/#cb2-52\" aria-hidden=\"true\" tabindex=\"-1\"></a>                next <span class=\"op\">=</span> <span class=\"bu\">append</span><span class=\"op\">(</span>next<span class=\"op\">,</span> v<span class=\"op\">)</span></span>\n<span id=\"cb2-53\"><a href=\"https://tylercipriani.com/blog/#cb2-53\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"op\">}</span></span>\n<span id=\"cb2-54\"><a href=\"https://tylercipriani.com/blog/#cb2-54\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"op\">}</span></span>\n<span id=\"cb2-55\"><a href=\"https://tylercipriani.com/blog/#cb2-55\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">}</span></span>\n<span id=\"cb2-56\"><a href=\"https://tylercipriani.com/blog/#cb2-56\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-57\"><a href=\"https://tylercipriani.com/blog/#cb2-57\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">// 6. Return the linear order</span></span>\n<span id=\"cb2-58\"><a href=\"https://tylercipriani.com/blog/#cb2-58\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> linearOrder</span>\n<span id=\"cb2-59\"><a href=\"https://tylercipriani.com/blog/#cb2-59\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">}</span></span></code></pre></div>\n<p>In our <code>vertices</code> DAG, the only vertices with an\n<code>inDegree</code> of 0 are <code>1</code>, <code>2</code>, and\n<code>9</code>, so in a topographic sort one of those number would be\nfirst. Running this code seems to support that assertion:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre class=\"sourceCode sh\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> go build <span class=\"at\">-o</span> topo_sort</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ./topo_sort</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">[9</span> 1 2 10 3 4 5 6 7 11 8 12 14]</span></code></pre></div>\n<p>In fact, all the vertices with no <code>inDegrees</code> ended up\nright at the beginning of this slice.</p>\n<section id=\"can-you-dig-it\" class=\"level2\">\n<h2>Can you dig it?</h2>\n<p>DAGs are ubiquitous and have\n<a href=\"https://tylercipriani.com/blog/2016/03/21/Visualizing-Git-Merkle-DAG-with-D3.js/\">many\nuses</a> both inside and outside of computers. I keep running into them\nagain and again: I stare this dad-joke cold in the face, once again,\nthis evening.</p>\n<p><em>Algorithms Unlocked</em> talks in approachable language about\nusing a DAG to graph and understand things like the order of operations\nfor cooking a meal or for putting on hockey goalie equipment—I find the\nplain-spoken explanations charming and helpful. I dig this book, and\nthis is far from the first exercise I’ve hacked through out of it. I’m\nsure I’ll be picking up this book again sometime in the near future–who\nknows?–I might even finish it!</p>\n</section>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/08/14/offline-spelling-with-aspell/",

    "title": "Offline spellcheck",
    "url": "https://tylercipriani.com/blog/2017/08/14/offline-spelling-with-aspell/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-08-14T16:22:07Z",
    "date_modified": "2021-04-30T21:01:49Z",


    "content_html": "<p>In which I futilely attempt to use <code>aspell</code> to stop using\nGoogle as spellcheck.</p>\n<p>I am embarrassingly atrocious at spelling. In Vim, which I use for\nemail via Mutt, I can use <code>:set spell</code>. In Emacs I can use\n<code>flyspell-mode</code>. Browsers all have spellcheck now, seemingly.\nStill… sometimes I find myself just Googling™ (or DDGing™) individual\nwords as I flail through the darkness that is spelling in the English\nlanguage. This is stupid and ridiculous for myriad reasons that I don’t\nreally want to talk about.</p>\n<p>As is my wont, through force of will, by might of <code>awk</code>,\nand by glory of <code>xsel</code>: I have written a function in my\ndotfiles that solves this problem for me. It <em>might</em> even be\ngenerally useful, bask in its awesomeness:</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/od/46c92a641342553f36e77e406e1613/original.gif\"\nalt=\"spell function in action\" />\n<figcaption aria-hidden=\"true\">spell function in action</figcaption>\n</figure>\n<pre><code>spell() {\n    local candidates oldifs word array_pos\n    oldifs=&quot;$IFS&quot;\n    IFS=&#39;:&#39;\n\n    # Parse the apsell format and return a list of &quot;:&quot; separated words\n    read -a candidates &lt;&lt;&lt; &quot;$(printf &quot;%s\\n&quot; &quot;$1&quot; \\\n        | aspell -a \\\n        | awk -F&#39;:&#39; &#39;/^&amp;/ {\n            split($2, a, &quot;,&quot;)\n            result=&quot;&quot;\n            for (x in a) {\n                gsub(/^[ \\t]/, &quot;&quot;, a[x])\n                result = a[x] &quot;:&quot; result\n            }\n            gsub(/:$/, &quot;&quot;, result)\n            print result\n        }&#39;)&quot;\n\n    # Reverse number and print the parsed bash array because the list comes\n    # out of gawk backwards\n    for item in &quot;${candidates[@]}&quot;; do\n        printf &#39;%s\\n&#39; &quot;$item&quot;\n    done \\\n        | tac \\\n        | nl \\\n        | less -FirSX\n\n    printf &quot;[ $(tput setaf 2)?$(tput sgr0) ]\\t%s&quot; \\\n        &#39;Enter the choice (empty to cancel, 0 for input): &#39;\n    read index\n\n    [[ -z &quot;$index&quot; ]] &amp;&amp; return\n    [[  &quot;$index&quot; == 0 ]] &amp;&amp; word=&quot;$1&quot;\n\n    [[ -z &quot;$word&quot; ]] &amp;&amp; {\n        array_pos=$(( ${#candidates[@]} - index ))\n        word=&quot;${candidates[$array_pos]}&quot;\n    }\n\n    [[ -n &quot;$word&quot; ]] &amp;&amp; {\n        printf &quot;$word&quot; | xsel -p\n        printf &quot;Copied &#39;%s&#39; to clipboard!\\n&quot; &quot;$word&quot;\n    } || printf &quot;[ $(tput setaf 1):($(tput sgr0) ] %s\\n&quot; &#39;No match found&#39;\n\n\n    IFS=&quot;$oldifs&quot;\n}</code></pre>\n<p>Maybe someone can use this <code>¯\\_(ツ)_/¯</code></p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/07/09/the-rsync-algorithm-in-python/",

    "title": "The Rsync Algorithm in Python",
    "url": "https://tylercipriani.com/blog/2017/07/09/the-rsync-algorithm-in-python/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-07-10T02:08:50Z",
    "date_modified": "2017-07-10T14:35:08Z",


    "content_html": "<p>I’ve often pondered this great and terrible beast –\n<code>rsync</code>. It’s spiny, nearly impenetrable command-line\ninterface. Its majestic and wonderful efficiency. The depths of its man\npage, and the heights of its use-cases.</p>\n<p>Leaving aside the confusing implications of trailing slashes,\n<code>rsync</code> is amazing. The Wikimedia deployment tooling – <a\nhref=\"https://phabricator.wikimedia.org/source/scap\">scap</a> (which at\nthis point has been iterated on for over a decade) – still makes heavy\nuse of <code>rsync</code>. At <code>$DAYJOB - 3</code>,\n<code>rsync</code> is used to manage a library of hundreds of thousands\nof <code>flac</code>, <code>mp3</code>, and <code>ogg</code> files. It’s\nhard to argue with <code>rsync</code>. The amount of network traffic\ngenerated via <code>rsync</code> is really hard to beat with any other\nprogram.</p>\n<section id=\"but-whats-it-doing\" class=\"level2\">\n<h2>But what’s it doing?</h2>\n<p><code>rsync</code> is fast. <code>rsync</code> is ubiquitous.\n<code>rsync</code> uses few client resources, and little network IO.\nOK…Why?</p>\n<p>I started reading about the <code>rsync</code> algorithm when a <a\nhref=\"https://github.com/20after4\">fellow I work alongside</a> began\nespousing the relative superiority of <a\nhref=\"http://zsync.moria.org.uk/\">zsync</a> for the case of our\ndeployment server. Currently <code>scap</code> has a built-in (and quite\nfancy) fan-out system so as not to put too high of a load on only 1\nserver; however, <code>zsync</code> flips the <code>rsync</code>\nalgorithm on its head, running the <code>rsync</code> algorithm on the\nclient rather than the server. What exactly is <code>rsync</code> doing\nthat makes the load on the server so high?</p>\n</section>\n<section id=\"the-meat\" class=\"level2\">\n<h2>The Meat</h2>\n<p>For the purposes of explanation, let’s say you ran the command:\n<code>rsync α β</code>.</p>\n<p>The <code>rsync</code> algorithm boils down to <a\nhref=\"https://rsync.samba.org/tech_report/node2.html\">5 steps</a> –</p>\n<ol type=\"1\">\n<li>Split file β into chunks of length <em>n</em>.</li>\n<li>Calculate a weak (adler32) and strong (md4) checksum for each chunk\nof file β.</li>\n<li>Send those checksums to the rsync server (where file α is)</li>\n<li>Find all the chunks of length <em>n</em> in α that are in β by\ncomparing checksums</li>\n<li>Create a list of instructions to recreate α from β</li>\n</ol>\n<p>Easy.</p>\n</section>\n<section id=\"do-it-then\" class=\"level2\">\n<h2>Do it then</h2>\n<p>I actually think it would have been easier for me to understand a bad\npython implementation of the <code>rsync</code> algorithm, than to read\na tech report on <code>rsync</code>. So with that in mind, here’s a bad\npython implementation of the <code>rsync</code> algorithm.</p>\n</section>\n<section id=\"pythonic\" class=\"level2\">\n<h2>Pythonic!</h2>\n<p>First it might be helpful to define my block size, and create a\ncouple of helper functions to create the rolling checksums.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> collections</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> hashlib</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> zlib</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>BLOCK_SIZE <span class=\"op\">=</span> <span class=\"dv\">4096</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Helper functions</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ----------------</span></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> md5_chunk(chunk):</span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Returns md5 checksum for chunk</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>    m <span class=\"op\">=</span> hashlib.md5()</span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>    m.update(chunk)</span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> m.hexdigest()</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> adler32_chunk(chunk):</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Returns adler32 checksum for chunk</span></span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> zlib.adler32(chunk)</span></code></pre></div>\n<p>I’ll also need a function that creates a rolling checksum of a file.\nThe <code>checksums_file</code> function will read in\n<code>BLOCK_SIZE</code> bytes through to the end of the file, calculate\nboth the <code>adler32</code> checksum and the <code>md5</code> checksum\nfor those chunks, and then put those chunks in a data structure.</p>\n<p>I’d like a nice interface beyond primitives for both the signatures\nand the list of checksums – I’ll create 2 objects <code>Signature</code>\nand <code>Chunks</code> to make that interface. <code>Chunks</code> is\nbasically a list of <code>Signatures</code> with a few other methods for\nfanciness.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Checksum objects</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ----------------</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>Signature <span class=\"op\">=</span> collections.namedtuple(<span class=\"st\">&#39;Signature&#39;</span>, <span class=\"st\">&#39;md5 adler32&#39;</span>)</span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">class</span> Chunks(<span class=\"bu\">object</span>):</span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Data stucture that holds rolling checksums for file B</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>):</span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.chunks <span class=\"op\">=</span> []</span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.chunk_sigs <span class=\"op\">=</span> {}</span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> append(<span class=\"va\">self</span>, sig):</span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.chunks.append(sig)</span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.chunk_sigs.setdefault(sig.adler32, {})</span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"va\">self</span>.chunk_sigs[sig.adler32][sig.md5] <span class=\"op\">=</span> <span class=\"bu\">len</span>(<span class=\"va\">self</span>.chunks) <span class=\"op\">-</span> <span class=\"dv\">1</span></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> get_chunk(<span class=\"va\">self</span>, chunk):</span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>        adler32 <span class=\"op\">=</span> <span class=\"va\">self</span>.chunk_sigs.get(adler32_chunk(chunk))</span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">if</span> adler32:</span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">return</span> adler32.get(md5_chunk(chunk))</span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-25\"><a href=\"https://tylercipriani.com/blog/#cb2-25\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> <span class=\"va\">None</span></span>\n<span id=\"cb2-26\"><a href=\"https://tylercipriani.com/blog/#cb2-26\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-27\"><a href=\"https://tylercipriani.com/blog/#cb2-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__getitem__</span>(<span class=\"va\">self</span>, idx):</span>\n<span id=\"cb2-28\"><a href=\"https://tylercipriani.com/blog/#cb2-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> <span class=\"va\">self</span>.chunks[idx]</span>\n<span id=\"cb2-29\"><a href=\"https://tylercipriani.com/blog/#cb2-29\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-30\"><a href=\"https://tylercipriani.com/blog/#cb2-30\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__len__</span>(<span class=\"va\">self</span>):</span>\n<span id=\"cb2-31\"><a href=\"https://tylercipriani.com/blog/#cb2-31\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> <span class=\"bu\">len</span>(<span class=\"va\">self</span>.chunks)</span>\n<span id=\"cb2-32\"><a href=\"https://tylercipriani.com/blog/#cb2-32\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-33\"><a href=\"https://tylercipriani.com/blog/#cb2-33\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-34\"><a href=\"https://tylercipriani.com/blog/#cb2-34\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Build Chunks from a file</span></span>\n<span id=\"cb2-35\"><a href=\"https://tylercipriani.com/blog/#cb2-35\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ------------------------</span></span>\n<span id=\"cb2-36\"><a href=\"https://tylercipriani.com/blog/#cb2-36\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> checksums_file(fn):</span>\n<span id=\"cb2-37\"><a href=\"https://tylercipriani.com/blog/#cb2-37\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb2-38\"><a href=\"https://tylercipriani.com/blog/#cb2-38\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Returns object with checksums of file</span></span>\n<span id=\"cb2-39\"><a href=\"https://tylercipriani.com/blog/#cb2-39\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb2-40\"><a href=\"https://tylercipriani.com/blog/#cb2-40\" aria-hidden=\"true\" tabindex=\"-1\"></a>    chunks <span class=\"op\">=</span> Chunks()</span>\n<span id=\"cb2-41\"><a href=\"https://tylercipriani.com/blog/#cb2-41\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">with</span> <span class=\"bu\">open</span>(fn) <span class=\"im\">as</span> f:</span>\n<span id=\"cb2-42\"><a href=\"https://tylercipriani.com/blog/#cb2-42\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">while</span> <span class=\"va\">True</span>:</span>\n<span id=\"cb2-43\"><a href=\"https://tylercipriani.com/blog/#cb2-43\" aria-hidden=\"true\" tabindex=\"-1\"></a>            chunk <span class=\"op\">=</span> f.read(BLOCK_SIZE)</span>\n<span id=\"cb2-44\"><a href=\"https://tylercipriani.com/blog/#cb2-44\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">if</span> <span class=\"kw\">not</span> chunk:</span>\n<span id=\"cb2-45\"><a href=\"https://tylercipriani.com/blog/#cb2-45\" aria-hidden=\"true\" tabindex=\"-1\"></a>                <span class=\"cf\">break</span></span>\n<span id=\"cb2-46\"><a href=\"https://tylercipriani.com/blog/#cb2-46\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-47\"><a href=\"https://tylercipriani.com/blog/#cb2-47\" aria-hidden=\"true\" tabindex=\"-1\"></a>            chunks.append(</span>\n<span id=\"cb2-48\"><a href=\"https://tylercipriani.com/blog/#cb2-48\" aria-hidden=\"true\" tabindex=\"-1\"></a>                Signature(</span>\n<span id=\"cb2-49\"><a href=\"https://tylercipriani.com/blog/#cb2-49\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    adler32<span class=\"op\">=</span>adler32_chunk(chunk),</span>\n<span id=\"cb2-50\"><a href=\"https://tylercipriani.com/blog/#cb2-50\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    md5<span class=\"op\">=</span>md5_chunk(chunk)</span>\n<span id=\"cb2-51\"><a href=\"https://tylercipriani.com/blog/#cb2-51\" aria-hidden=\"true\" tabindex=\"-1\"></a>                )</span>\n<span id=\"cb2-52\"><a href=\"https://tylercipriani.com/blog/#cb2-52\" aria-hidden=\"true\" tabindex=\"-1\"></a>            )</span>\n<span id=\"cb2-53\"><a href=\"https://tylercipriani.com/blog/#cb2-53\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-54\"><a href=\"https://tylercipriani.com/blog/#cb2-54\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">return</span> chunks</span></code></pre></div>\n<p>Now I need a couple of methods to complete the algorithm – one that\nwill find the <code>BLOCK_SIZE</code> chunks in file β that are in file\nα, and one that will produce instructions that can be used to assemble\nthe new and improved β from the β we’ve already got.</p>\n<p>The <code>_get_block_list</code> function will return a list of chunk\nindices and bytes. The chunk indices are indices of chunks already\npresent in file β (we know from the <code>checksums_file</code>\nfunction), the bytes are raw bytes that are in α but may not be in β. If\na chunk is found in α that is not in β then the first byte of that chunk\nis appended to the output list and a checksum is calculated for the next\n<code>BLOCK_SIZE</code> chunk.</p>\n<p>This is why network IO for <code>rsync</code> is so efficient – the\nonly raw data that is sent is the information missing from the remote.\nThis is also why <code>rsync</code> causes higher load on the server\nthan the client – it’s not just checksumming files, it’s checksumming,\ncomparing, and building a diff. And it’s doing that process for every\nmachine to which it is attempting to sync.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> _get_block_list(file_one, file_two):</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    The good stuff.</span></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    1. create rolling checksums file_two</span></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    2. for each chunk in file one, determine if chunk is already in file_two</span></span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">        a. If so:</span></span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">            i. return the index of that chunk</span></span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">            ii. move the read head by the size of a chunk</span></span>\n<span id=\"cb3-10\"><a href=\"https://tylercipriani.com/blog/#cb3-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">        b. If not:</span></span>\n<span id=\"cb3-11\"><a href=\"https://tylercipriani.com/blog/#cb3-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">            i. return the next byte</span></span>\n<span id=\"cb3-12\"><a href=\"https://tylercipriani.com/blog/#cb3-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">            ii. move the read head by 1 byte</span></span>\n<span id=\"cb3-13\"><a href=\"https://tylercipriani.com/blog/#cb3-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    3. start over at 2 until you&#39;re out of file to read</span></span>\n<span id=\"cb3-14\"><a href=\"https://tylercipriani.com/blog/#cb3-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb3-15\"><a href=\"https://tylercipriani.com/blog/#cb3-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>    checksums <span class=\"op\">=</span> checksums_file(file_two)</span>\n<span id=\"cb3-16\"><a href=\"https://tylercipriani.com/blog/#cb3-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>    blocks <span class=\"op\">=</span> []</span>\n<span id=\"cb3-17\"><a href=\"https://tylercipriani.com/blog/#cb3-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>    offset <span class=\"op\">=</span> <span class=\"dv\">0</span></span>\n<span id=\"cb3-18\"><a href=\"https://tylercipriani.com/blog/#cb3-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">with</span> <span class=\"bu\">open</span>(file_one) <span class=\"im\">as</span> f:</span>\n<span id=\"cb3-19\"><a href=\"https://tylercipriani.com/blog/#cb3-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">while</span> <span class=\"va\">True</span>:</span>\n<span id=\"cb3-20\"><a href=\"https://tylercipriani.com/blog/#cb3-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>            chunk <span class=\"op\">=</span> f.read(BLOCK_SIZE)</span>\n<span id=\"cb3-21\"><a href=\"https://tylercipriani.com/blog/#cb3-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">if</span> <span class=\"kw\">not</span> chunk:</span>\n<span id=\"cb3-22\"><a href=\"https://tylercipriani.com/blog/#cb3-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>                <span class=\"cf\">break</span></span>\n<span id=\"cb3-23\"><a href=\"https://tylercipriani.com/blog/#cb3-23\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-24\"><a href=\"https://tylercipriani.com/blog/#cb3-24\" aria-hidden=\"true\" tabindex=\"-1\"></a>            chunk_number <span class=\"op\">=</span> checksums.get_chunk(chunk)</span>\n<span id=\"cb3-25\"><a href=\"https://tylercipriani.com/blog/#cb3-25\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-26\"><a href=\"https://tylercipriani.com/blog/#cb3-26\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">if</span> chunk_number <span class=\"kw\">is</span> <span class=\"kw\">not</span> <span class=\"va\">None</span>:</span>\n<span id=\"cb3-27\"><a href=\"https://tylercipriani.com/blog/#cb3-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>                offset <span class=\"op\">+=</span> BLOCK_SIZE</span>\n<span id=\"cb3-28\"><a href=\"https://tylercipriani.com/blog/#cb3-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>                blocks.append(chunk_number)</span>\n<span id=\"cb3-29\"><a href=\"https://tylercipriani.com/blog/#cb3-29\" aria-hidden=\"true\" tabindex=\"-1\"></a>                <span class=\"cf\">continue</span></span>\n<span id=\"cb3-30\"><a href=\"https://tylercipriani.com/blog/#cb3-30\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">else</span>:</span>\n<span id=\"cb3-31\"><a href=\"https://tylercipriani.com/blog/#cb3-31\" aria-hidden=\"true\" tabindex=\"-1\"></a>                offset <span class=\"op\">+=</span> <span class=\"dv\">1</span></span>\n<span id=\"cb3-32\"><a href=\"https://tylercipriani.com/blog/#cb3-32\" aria-hidden=\"true\" tabindex=\"-1\"></a>                blocks.append(chunk[<span class=\"dv\">0</span>])</span>\n<span id=\"cb3-33\"><a href=\"https://tylercipriani.com/blog/#cb3-33\" aria-hidden=\"true\" tabindex=\"-1\"></a>                f.seek(offset)</span>\n<span id=\"cb3-34\"><a href=\"https://tylercipriani.com/blog/#cb3-34\" aria-hidden=\"true\" tabindex=\"-1\"></a>                <span class=\"cf\">continue</span></span>\n<span id=\"cb3-35\"><a href=\"https://tylercipriani.com/blog/#cb3-35\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-36\"><a href=\"https://tylercipriani.com/blog/#cb3-36\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> blocks</span></code></pre></div>\n<p>The poorly named <code>file</code> function (but it’s in the\n<code>rsync.py</code> module, so <code>rsync.file</code> is good…right?\nNo? OK.) takes the list of chunk indices and raw bytes from\n<code>_get_block_list</code>, finds the chunks in β referenced by the\nindex, combines those chunks with the raw bytes from α and returns a\nstring that is the same as file α – it just took a weird route to get\nthere :)</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">def</span> <span class=\"bu\">file</span>(file_one, file_two):</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    Essentially this returns file one, but in a fancy way :)</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    The output from get_block_list is a list of either chunk indexes or data as</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    strings.</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    If it&#39;s a chunk index, then read that chunk from the file and append it to</span></span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    output. If it&#39;s not a chunk index, then it&#39;s actual data and should just be</span></span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    appended to output directly.</span></span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">    &quot;&quot;&quot;</span></span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    output <span class=\"op\">=</span> <span class=\"st\">&#39;&#39;</span></span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">with</span> <span class=\"bu\">open</span>(file_two) <span class=\"im\">as</span> ft:</span>\n<span id=\"cb4-14\"><a href=\"https://tylercipriani.com/blog/#cb4-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"cf\">for</span> block <span class=\"kw\">in</span> _get_block_list(file_one, file_two):</span>\n<span id=\"cb4-15\"><a href=\"https://tylercipriani.com/blog/#cb4-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">if</span> <span class=\"bu\">isinstance</span>(block, <span class=\"bu\">int</span>):</span>\n<span id=\"cb4-16\"><a href=\"https://tylercipriani.com/blog/#cb4-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>                ft.seek(block <span class=\"op\">*</span> BLOCK_SIZE)</span>\n<span id=\"cb4-17\"><a href=\"https://tylercipriani.com/blog/#cb4-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>                output <span class=\"op\">+=</span> ft.read(BLOCK_SIZE)</span>\n<span id=\"cb4-18\"><a href=\"https://tylercipriani.com/blog/#cb4-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>            <span class=\"cf\">else</span>:</span>\n<span id=\"cb4-19\"><a href=\"https://tylercipriani.com/blog/#cb4-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>                output <span class=\"op\">+=</span> block</span>\n<span id=\"cb4-20\"><a href=\"https://tylercipriani.com/blog/#cb4-20\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-21\"><a href=\"https://tylercipriani.com/blog/#cb4-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">return</span> output</span></code></pre></div>\n<p>Creating a python file that imports this script as a module, and\ninvokes <code>file</code> is all you need to actually run it. I wrote a\nbunch of tests to help me write the script. The core of the test file\nwas simply:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"im\">import</span> rsync</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">if</span> <span class=\"va\">__name__</span> <span class=\"op\">==</span> <span class=\"st\">&#39;__main__&#39;</span>:</span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    rsync.<span class=\"bu\">file</span>(<span class=\"st\">&#39;fixtures/foo.txt&#39;</span>, <span class=\"st\">&#39;fixtures/bar.txt&#39;</span>)</span></code></pre></div>\n<p>And at the end of our python-ing, we came to see the\n<code>rsync</code> beast in a new light – not a beast at all, just a\nmisunderstood algorithm with a lot of command line flags. The End.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/06/14/literate-vimrc/",

    "title": "Literate Vimrc",
    "url": "https://tylercipriani.com/blog/2017/06/14/literate-vimrc/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-06-14T14:46:30Z",
    "date_modified": "2018-12-30T19:29:57Z",


    "content_html": "<section id=\"literate-.vimrc\" class=\"level1\">\n<h1>Literate <code>~/.vimrc</code></h1>\n<p>This blog post is my <code>~/.vimrc</code> now.</p>\n<p>Hold on, let me explain.</p>\n<section id=\"why-would-anyone-do-a-thing-like-this\" class=\"level2\">\n<h2>Why would anyone do a thing like this?</h2>\n<p>I have tons of comments in my <code>~/.vimrc</code> file. I try to\nleave a lot of comments because everything in my Vim configuration is\nhard-won knowledge. My <code>~/.vimrc</code> is accumulated knowledge\nfrom the day I first opened the editor and couldn’t figure out how to\nleave until now, many years later, when I open my editor and don’t have\nany reason to leave. I have tweaked, cajoled, and tamed this beast\ncalled Vim. I think a lot of folks have configuration kind of like that\n– it’s knowledge that is locked-away, not privately or purposefully,\njust badly-documented and ubiquitous. This is a problem.</p>\n<p>So I made a thing.</p>\n<p>This is an experiment that seeks to answer: can my\n<code>~/.vimrc</code> be a page on my website?</p>\n</section>\n<section id=\"literate-programming\" class=\"level2\">\n<h2>Literate programming</h2>\n<p>Literate programming is the idea that your code should work as a\nnarrative as well as a functional piece of software. This is a practice\nthat was popularized by <a href=\"https://cs.stanford.edu/~uno/\">Donald\nKnuth</a> and was utilized in writing the <a\nhref=\"https://www.tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web\">source\ncode for TeX</a>.</p>\n<p>The are times when <a\nhref=\"http://harryrschwartz.com/2016/05/19/when-is-literate-programming-appropriate.html\">literate\nprogramming may not be appropriate</a>; however, in this instance – the\ncase of a <code>.vimrc</code> – I feel like literate programming will be\nhelpful to remind me what a setting is and why I applied it. This also\nmay mean that my accumulated Vim knowledge (however limited it may be)\nis more generally accessible than if it were just a plaintext documents\nsitting in my <a\nhref=\"https://github.com/thcipriani/dotfiles\">dotfiles</a>.</p>\n</section>\n<section id=\"literate-vimscript\" class=\"level2\">\n<h2>Literate Vimscript</h2>\n<p>My resolve to make a literate <code>~/.vimrc</code> led to some\nsearching on DuckDuckGo and a slow, settling realization that I was\ngoing to have to write the plugin that does this. Keeping your Emacs\nconfiguration as a literate document written in <a\nhref=\"http://orgmode.org/\">org-mode</a> is pretty common practice at\nthis point, so I made the faulty assumption that a Vim configuration\nwritten in Markdown would be a common aspiration as well.</p>\n<p>I was wrong and thus was the genesis of <a\nhref=\"https://github.com/thcipriani/literate-vimrc\">LiterateVimrc</a>.</p>\n<p>“Literate” Vimrc is more than a bit of a misnomer. It, unlike Donald\nKnuth’s vision of Literate Programming, does not support a loosely\ncoupled web of macros – instead it just lets you write a file in\nMarkdown that has codeblocks (as defined by <a\nhref=\"http://spec.commonmark.org/0.27/\">v0.27 of the CommonMark\nspec</a>) containing Vimscript as your <code>~/.vimrc</code> file.</p>\n<section id=\"install\" class=\"level3\">\n<h3>Install</h3>\n<p>To install LiterateVimsrc copy the\n<code>autoload/literavevimrc.vim</code> file into your\n<code>~/.vim/autoload</code> directory, move your current\n<code>~/.vimrc</code> to <code>~/.vimrc.md</code> and add\n<code>~~~</code> to to first and last lines of that file (to create\nfenced codeblock). Inside your (now empty) <code>~/.vimrc</code> add the\nline <code>execute literatevim#load(\"~/.vimrc.md\")</code> and everything\nshould remain the same.</p>\n<p>Now you are free to add text explaining your configuration and divide\nyour configuration into blocks. This blog post is currently acting as my\n<code>~/.vimrc</code> file, as of this writing. This may be a bad idea.\nI do expect to update it somewhat regularly, but his frontmatter should\nremain the same.</p>\n</section>\n</section>\n</section>\n<section id=\"my-.vimrc\" class=\"level1\">\n<h1>My <code>~/.vimrc</code></h1>\n<p>This begins the content of my <code>~/.vimrc</code> file. It includes\nvarious explanations and links that may only make sense to me. Here be\ndragons. You have been warned.</p>\n<p>The first lines that should be in every <code>~/.vimrc</code> –\ndisabling arrow keys – because it’s not enough to use vim, you’ve got to\n<a href=\"https://tylercipriani.com/vim.html\">live it</a>.</p>\n<pre class=\"vim\"><code>noremap &lt;up&gt; &lt;nop&gt;\ninoremap &lt;up&gt; &lt;nop&gt;\n\nnoremap &lt;down&gt; &lt;nop&gt;\ninoremap &lt;down&gt; &lt;nop&gt;\n\nnoremap &lt;left&gt; &lt;nop&gt;\nnoremap &lt;right&gt; &lt;nop&gt;\ninoremap &lt;left&gt; &lt;nop&gt;\ninoremap &lt;right&gt; &lt;nop&gt;\n&quot; B A start</code></pre>\n<section id=\"what-is-this-vee-eye-of-which-you-speak\" class=\"level2\">\n<h2>What is this ‘Vee-Eye’ of which you speak?</h2>\n<p>Vim’s <code>compatible</code> mode means lots of plugins won’t work.\nIt evidently means that you can’t use <code>\\</code> in vim scripts to\nbreak a command across a few lines. <code>nocompatible</code> is also\nnecessary for <a\nhref=\"https://github.com/VundleVim/Vundle.vim\">Vundle</a> which is my\nvim packagemanager of choice.</p>\n<pre class=\"vim\"><code>set nocompatible</code></pre>\n</section>\n<section id=\"plugins\" class=\"level2\">\n<h2>Plugins</h2>\n<p>All of my plugins. To install all of my plugins on a brand new\nmachine I can run <code>vim +PluginInstall +qall</code>, which is pretty\nneat.</p>\n<pre class=\"vim\"><code>filetype off &quot; required\nset rtp+=~/.vim/bundle/Vundle.vim\ncall vundle#begin()\n\n&quot; let Vundle manage Vundle, required\nPlugin &#39;gmarik/Vundle.vim&#39;\n\n&quot; Other plugins\nPlugin &#39;vim-pandoc/vim-pandoc-syntax&#39;\nPlugin &#39;tpope/vim-surround&#39;\nPlugin &#39;groenewege/vim-less&#39;\nPlugin &#39;kien/ctrlp.vim&#39;\nPlugin &#39;Lokaltog/vim-easymotion&#39;\nPlugin &#39;jistr/vim-nerdtree-tabs&#39;\nPlugin &#39;scrooloose/syntastic&#39;\nPlugin &#39;godlygeek/tabular&#39;\nPlugin &#39;majutsushi/tagbar&#39;\nPlugin &#39;goldfeld/vim-seek&#39;\nPlugin &#39;altercation/vim-colors-solarized&#39;\nPlugin &#39;ajgrf/parchment&#39;\nPlugin &#39;chriskempson/base16-vim&#39;\nPlugin &#39;joonty/vdebug&#39;\nPlugin &#39;vim-airline/vim-airline&#39;\n&quot; BOOO!\nPlugin &#39;vim-airline/vim-airline-themes&#39;\nPlugin &#39;scrooloose/nerdtree&#39;\nPlugin &#39;sheerun/vim-polyglot&#39;\nPlugin &#39;Shougo/neocomplete&#39;\nPlugin &#39;Shougo/neosnippet&#39;\nPlugin &#39;juvenn/mustache&#39;\nPlugin &#39;nathanaelkane/vim-indent-guides&#39;\nPlugin &#39;tpope/vim-fugitive&#39;\nPlugin &#39;tpope/vim-rsi&#39;\nPlugin &#39;airblade/vim-gitgutter&#39;\n\n\ncall vundle#end()            &quot; required\nfiletype plugin indent on    &quot; required</code></pre>\n</section>\n<section id=\"a-random-solution-to-a-random-problem\" class=\"level2\">\n<h2>A Random solution to a random problem</h2>\n<p>This disables Background Color Erase (BCE) when the\n<code>$TERM</code> env var contains the text <code>256color</code>. The\nproblem I was seeing is summarized on Suraj N. Kurapati’s <a\nhref=\"http://snk.tuxfamily.org/log/vim-256color-bce.html\">blog\npost</a>.</p>\n<p>This may, in fact, not be necessary. At least according to <a\nhref=\"http://www.reddit.com/r/vim/comments/1a29vk/fixing_vims_background_color_erase_for_256color/c8thqe7\">reddit</a></p>\n<pre class=\"vim\"><code>if &amp;term =~ &#39;256color&#39;\n   set t_ut=\nendif</code></pre>\n</section>\n<section id=\"basic-options\" class=\"level2\">\n<h2>Basic options</h2>\n<pre><code>let mapleader=&#39;,&#39;\nset t_Co=256              &quot; My terminal&#39;s got all those colors, yo\n\nset title                 &quot; Change the terminal title\nset encoding=utf-8        &quot; Show utf-8 chars\nset showcmd               &quot; count highlighted\nset ruler                 &quot; Show where I am in the command area\nset showmode              &quot; -- INSERT (appreciation)-- :)\nset laststatus=2          &quot; always show the status line\n                          &quot; ↪ (0 = never, 1 = default [multi-window only])\nset mouse=                &quot; Use the mouse\n\nset modelines=0           &quot; Don&#39;t read first/last lines of file for settings\nset hidden                &quot; Stash unwritten files in buffer\nset vb                    &quot; Don&#39;t beep at me\nset cursorline            &quot; Highlight current line\nset scrolloff=3           &quot; Start scrolling when I&#39;m 3 lines from top/bottom\nset history=1000          &quot; Remember commands and search history\nset backspace=2           &quot; Backspace over indent, eol, and insert\nset mousehide             &quot; Hide the mouse pointer while typing\n\nset number                &quot; Show linenumbers\nset nowrap                &quot; Turn off linewrap\nset list                  &quot; Show invisible chars\nset tabstop=4             &quot; 4 spaces\nset shiftwidth=4          &quot; 4 spaces\nset softtabstop=4         &quot; 4 spaces\nset expandtab             &quot; Expand tabs to spaces\n\nset hlsearch              &quot; highlight my search\nset incsearch             &quot; incremental search\nset wrapscan              &quot; Set the search scan to wrap around the file\n\nset ignorecase            &quot; when searching\nset smartcase             &quot; …unless I use an uppercase character</code></pre>\n</section>\n<section id=\"syntax\" class=\"level2\">\n<h2>Syntax</h2>\n<p>I have actually been considering what it would be like to work\nwithout syntax highlighting. I may be too far gone to start trying, but\nit’d certainly make me more attune to various code problems rather than\ncode colors. In any event, with some of the huge files I view the\n<code>syntax sync minline</code> option and the\n<code>synmaxcol=2048</code> are lifesavers.</p>\n<pre><code>syntax on                 &quot; Syntax highlighting\nsyntax sync minlines=256  &quot; Makes big files slow\nset synmaxcol=2048        &quot; Also long lines are slow\nset autoindent            &quot; try your darndest to keep my indentation\nset smartindent           &quot; Be smarter about indenting dummy</code></pre>\n</section>\n<section id=\"format-options\" class=\"level2\">\n<h2>Format options</h2>\n<blockquote>\n<p><code>c</code> - Auto-wrap comments using textwidth, inserting the\ncurrent comment leader automatically.</p>\n<p><code>o</code> - Automatically insert the current comment leader\nafter hitting ‘o’ or ‘O’ in Normal mode.</p>\n<p><code>t</code> - Auto-wrap text using textwidth</p>\n<p><code>q</code> - Allow formatting of comments with “gq”.</p>\n<p><code>r</code> - Automatically insert the current comment leader\nafter hitting <Enter> in Insert mode.</p>\n</blockquote>\n<p>I have a different setting for format options when emailing in mutt.\nThere I use <code>set formatoptions=aw</code> which works for <a\nhref=\"https://joeclark.org/ffaq.html\">format-flowed</a> emails.</p>\n<pre><code>set formatoptions=cotqr  &quot; I like smart comments</code></pre>\n</section>\n<section id=\"folding\" class=\"level2\">\n<h2>Folding</h2>\n<p>At some point in the past I used to use the <code>marker</code> for\nfolding (which was opened with <code>{{{</code> and closed by\n<code>}}}</code>) I found this a nice way to divide up things like my\n<code>~/.vimrc</code> for instance; however, what’s even nicer is\nfolding on indent. It makes reading <code>yaml</code> files super easy.\nI read lots of very (VERY) large <code>yaml</code> files. I suppose I\ncould do this with an <code>autocmd</code>, but I set it globally\ninstead <code>¯\\_(ツ)_/¯</code>.</p>\n<pre><code>&quot; set foldmethod=marker     &quot; Fold on 3x{\nset foldmethod=indent\nset nofoldenable          &quot; But turn it off initially</code></pre>\n</section>\n<section id=\"fishshell\" class=\"level2\">\n<h2>Fishshell</h2>\n<p>I needed this for running some commands in Vim inside <a\nhref=\"https://fishshell.com/\">fishshell</a> which I used for a time and\nthen abandoned. I think that fishshell is really great (and it’s an\nactual programming language), the problem with it is two-fold:</p>\n<ol type=\"1\">\n<li>Nobody wants to push fishshell on a server – which I understand</li>\n<li>Using it requires a million little hacks like the one below</li>\n</ol>\n<p>This is the flip side of fixing all the dumb decisions of the bourne\nshell – everyone else has already worked around them (<a\nhref=\"https://xkcd.com/1172/\">obligatory xkcd</a>).</p>\n<pre><code>&quot; set shell=/bin/bash\\ --login\n&quot; set shell=bash            &quot; Needed if using fishshell</code></pre>\n</section>\n<section id=\"backup-and-swap-files\" class=\"level2\">\n<h2>Backup and Swap files</h2>\n<p>I hate all the little backup and swap files all over the place. There\nhas been 1 time when these would have come in handy in the past decade\nas far as I can remember.</p>\n<pre><code>set nobackup\nset nowritebackup\nset noswapfile</code></pre>\n</section>\n<section id=\"colorschemes\" class=\"level2\">\n<h2>Colorschemes</h2>\n<pre><code>&quot; Colorscheme\nif filereadable(expand(&quot;~/.vimrc_background&quot;))\n    let base16colorspace=256\n    source ~/.vimrc_background\nelse\n    colorscheme Tomorrow-Night\nendif\n\n&quot; GUI Font (same as my gnome-terminal font)\n&quot; https://github.com/adobe/source-code-pro\nset guifont=Source\\ Code\\ Pro\\ 14\n\n&quot; Use the same symbols as TextMate for tabstops and EOLs\nset listchars=tab:▸\\ ,eol:¬\\,trail:·</code></pre>\n</section>\n<section id=\"vim-7.0.3-new-features\" class=\"level2\">\n<h2>Vim 7.0.3 new features</h2>\n<p>Maybe I should update the stuff that hedges on a machine not having\nVim 7.0.3 since version 8 is out now. This is a project for later.</p>\n<pre><code>if v:version &gt;= 703\n  set colorcolumn=75\n  set undodir=~/.vim-undo\n  set undofile\n  set undolevels=1000 &quot;max number of changes that can be undone\n  set undoreload=10000 &quot;max number lines to save for undo on buffer reload\n\n  &quot; Toggle line numbers in normal mode, set by default\n  set number relativenumber\n  function! NumberToggle()\n    if(&amp;relativenumber == 1)\n      set number norelativenumber\n    else\n      set number relativenumber\n    endif\n  endfunc\n\n  nnoremap &lt;leader&gt;n :call NumberToggle()&lt;cr&gt;\nendif</code></pre>\n</section>\n<section id=\"osx\" class=\"level2\">\n<h2>OSX</h2>\n<p>I don’t really know why I still have OSX hacks in all my dotfiles.\nMaybe someday I’ll be forced to jump off the Linux ship. I assume I’ll\nbe jumping to a BSD or something at that point though.</p>\n<pre><code>if has(&quot;unix&quot;)\n    let s:uname = system(&quot;uname&quot;)\n    if s:uname == &quot;Darwin\\n&quot;\n        set clipboard=unnamed\n    endif\nendif</code></pre>\n</section>\n<section id=\"very-magic\" class=\"level2\">\n<h2>Very Magic</h2>\n<p>I’m not sure if I should turn this off. Half the time I think it’s\ngreat, the other half it’s a pain. I guess leaving it on for now seems\nfine.</p>\n<pre><code>nnoremap / /\\v</code></pre>\n</section>\n<section id=\"mappings\" class=\"level2\">\n<h2>Mappings</h2>\n<pre><code>&quot; Vimrc editing\nnnoremap &lt;silent&gt;&lt;leader&gt;ev :vsplit $MYVIMRC&lt;cr&gt;\nnnoremap &lt;silent&gt;&lt;leader&gt;sv :source $MYVIMRC&lt;cr&gt;\n\n&quot; un-highlight search results\nnnoremap &lt;silent&gt;&lt;leader&gt;&lt;space&gt; :noh&lt;cr&gt;\n\n&quot; Toggle auto-indent before clipboard paste\nset pastetoggle=&lt;leader&gt;p\n\n&quot; Shortcut to rapidly toggle `set list`\nnnoremap &lt;silent&gt;&lt;leader&gt;l :set list!&lt;cr&gt;\n\n&quot; Normal/Visual tab for bracket pairs\nnnoremap &lt;tab&gt; %\nvnoremap &lt;tab&gt; %\n\n&quot;Opens a vertical split and switches over (,v)\nnnoremap &lt;leader&gt;v &lt;C-w&gt;v&lt;C-w&gt;l\n\n&quot;Moves around split windows\nnnoremap &lt;leader&gt;w &lt;C-w&gt;&lt;C-w&gt;\n\n&quot;Close a window\nnnoremap &lt;silent&gt;&lt;leader&gt;q :q&lt;cr&gt;\n\n&quot; Close buffer\nnoremap &lt;silent&gt;&lt;leader&gt;d :bd&lt;cr&gt;\n\n&quot; Buffer previous\nnoremap &lt;silent&gt;&lt;leader&gt;z :bp&lt;CR&gt;\n\n&quot; Buffer next\nnoremap &lt;silent&gt;&lt;leader&gt;x :bn&lt;CR&gt;\n\nnnoremap &lt;S-Tab&gt; gT\nnnoremap &lt;silent&gt; &lt;S-t&gt; :tabnew %&lt;CR&gt;\n\n&quot; Set working directory\nnnoremap &lt;leader&gt;. :lcd %:p:h&lt;CR&gt;\n\n&quot; Vmap for maintain Visual Mode after shifting &gt; and &lt;, prevents the use of\n&quot; &#39;.&#39; to repeat\n&quot; vmap &lt; &lt;gv\n&quot; vmap &gt; &gt;gv\n\n&quot; Better use of folding\n&quot; nnoremap &lt;leader&gt;z za</code></pre>\n</section>\n<section id=\"status-line\" class=\"level2\">\n<h2>Status Line</h2>\n<p>I leave this status line here more as a reference than anything.\nCurrently (as can be seen in the <a href=\"https://tylercipriani.com/blog/#plugins\">Plugins</a> section)\nI’m using <a\nhref=\"https://github.com/vim-airline/vim-airline\">vim-airline</a> for my\nstatusbar.</p>\n<pre><code>augroup ft_statuslinecolor\n    au!\n    au InsertEnter * hi StatusLine ctermfg=196 guifg=#FF3145\n    au InsertLeave * hi StatusLine ctermfg=130 guifg=#CD5907\naugroup END\nset statusline=%f    &quot; Path.\nset statusline+=%m   &quot; Modified flag.\nset statusline+=%r   &quot; Readonly flag.\nset statusline+=%w   &quot; Preview window flag.\nset statusline+=\\    &quot; Space.\nset statusline+=%=   &quot; Right align.\n&quot; Line and column position and counts.\nset statusline+=\\ %l\\/%L\\ \\/\\/\\ %03c)</code></pre>\n</section>\n<section id=\"autocmds\" class=\"level2\">\n<h2>Autocmds</h2>\n<p>Don’t expand tabs in <code>Makefile</code>s or php files</p>\n<pre><code>autocmd FileType make setlocal noexpandtab\nautocmd Filetype php setlocal noexpandtab\nautocmd Filetype go setlocal noexpandtab</code></pre>\n<p>Highlight any trailing whitespace in red</p>\n<pre><code>highlight ExtraWhitespace ctermbg=red guibg=red\nmatch ExtraWhitespace /\\s\\+$/\nautocmd BufWinEnter * match ExtraWhitespace /\\s\\+$/\nautocmd InsertEnter * match ExtraWhitespace /\\s\\+\\%#\\@&lt;!$/\nautocmd InsertLeave * match ExtraWhitespace /\\s\\+$/\nautocmd BufWinLeave * call clearmatches()</code></pre>\n<p>Ensure that puppet files are handled properly in Vim. IIRC I pulled\nthis line from the office wiki somewhere…</p>\n<pre><code>&quot; detect puppet filetype\nautocmd BufRead,BufNewFile *.pp set filetype=puppet\nautocmd BufRead,BufNewFile *.pp setlocal tabstop=4 shiftwidth=4 softtabstop=4 expandtab textwidth=80 smarttab</code></pre>\n<p>These are the settings I use for my email. I try to send\n<code>format=flowed</code> emails that sill look good in terminal\nreaders like Mutt.</p>\n<pre><code>augroup mail_filetype\n    autocmd!\n    autocmd VimEnter /tmp/mutt* set formatoptions=aw tw=72\naugroup END</code></pre>\n</section>\n<section id=\"plugin-settings\" class=\"level2\">\n<h2>Plugin settings</h2>\n<pre><code>&quot; Tagbar (requires Exuberant ctags 5.5+)\nnnoremap &lt;silent&gt;&lt;leader&gt;c :TagbarToggle&lt;cr&gt;</code></pre>\n<p>It’s kind of insane that you can use Vim to drive a debugger like\nXDebug. As evidenced by the path maps here, I haven’t used this in a\nwhile and it was a pain to setup when I did. Kept here as a reminder\nthat Vim is amazing.</p>\n<pre><code>&quot; Xdebug local debugger\nlet g:vdebug_options = {\n\\    &#39;server&#39;: &#39;33.33.33.1&#39;,\n\\    &#39;port&#39;: &#39;9000&#39;,\n\\    &#39;path_maps&#39; : {\n\\        &#39;/srv/www/local.people.dev&#39;: &#39;/Users/tyler/Development/upsync-vagrant/shared/people&#39;\n\\    }\n\\}</code></pre>\n<pre class=\"vim\"><code>let g:syntastic_javascript_jshint_conf=&quot;$HOME/.jshintrc&quot;\nlet g:syntastic_error_symbol = &#39;✘&#39;\nlet g:syntastic_warning_symbol = &quot;▲&quot;\n&quot; let g:syntastic_python_python_exec = &#39;/usr/bin/python3&#39;\nlet g:jedi#force_py_version=2</code></pre>\n<p>NERDTree was the first plugin I ever installed.</p>\n<pre><code>&quot; NERDTree Settings---------------------------------------------------- {{{\n&quot;map &lt;leader&gt;t :NERDTreeToggle&lt;cr&gt;\nnnoremap &lt;leader&gt;t :NERDTreeTabsToggle&lt;cr&gt;\n&quot; Close vim if NERDTree is the last thing standing\nautocmd bufenter * if (winnr(&quot;$&quot;) == 1 &amp;&amp; exists(&quot;b:NERDTreeType&quot;) &amp;&amp; b:NERDTreeType == &quot;primary&quot;) | q | endif\n&quot; }}}\n\n&quot; Included for Airline ------------------------------------------------ {{{\nlet g:airline_theme = &#39;tomorrow&#39;\nlet g:airline_powerline_fonts = 1\n&quot; let g:airline#extensions#tabline#enabled = 1\n&quot; }}}\n\n&quot; CtrlP --------------------------------------------------------------- {{{\nlet g:ctrlp_max_files = 0 &quot; Set no max file limit\nlet g:ctrlp_working_path_mode = 0 &quot; Search current directory not project root\nif executable(&quot;ag&quot;)\n  set grepprg=ag\\ --nogroup\\ --nocolor\n&quot;  let g:ctrlp_user_command = &#39;ag %s -l --nocolor -g &quot;&quot;&#39;\n  let g:ctrlp_user_command = {\n    \\ &#39;types&#39;: {\n      \\ 1: [&#39;.git&#39;, &#39;git --git-dir=%s/.git ls-files -oc --exclude-standard&#39;],\n      \\ 2: [&#39;.hg&#39;, &#39;hg --cwd %s locate -I .&#39;],\n      \\ },\n    \\ &#39;fallback&#39;: &#39;ag %s -l --nocolor -g &quot;&quot;&#39;\n    \\ }\n\nendif\n\nlet g:ctrlp_show_hidden = 1\n&quot;}}}</code></pre>\n<p>These are all settings for neocomplete and neosnippet which requires\nVim 7.0.4 or higher and <code>+lua</code> when you do\n<code>vim --version</code>.</p>\n<pre class=\"vim\"><code>if v:version &gt;= 704 &amp;&amp; has(&quot;lua&quot;)\n  &quot; Neocomplete.vim --------------------------------------------------- {{{\n  &quot; Disable AutoComplPop.\n  let g:acp_enableAtStartup = 0\n  &quot; Use neocomplete.\n  let g:neocomplete#enable_at_startup = 1\n  &quot; Use smartcase.\n  let g:neocomplete#enable_smart_case = 1\n  &quot; Set minimum syntax keyword length.\n  let g:neocomplete#sources#syntax#min_keyword_length = 3\n  let g:neocomplete#lock_buffer_name_pattern = &#39;\\*ku\\*&#39;\n  &quot; I will probably never hit &lt;TAB&gt; 10 times\n  let g:neocomplete#max_list = 10\n\n  &quot; Automatically open and close the popup menu / preview window\n  &quot; https://github.com/JessicaKMcIntosh/TagmaBufMgr/issues/8\n  au CursorMovedI,InsertLeave * if pumvisible() == 0|silent! pclose|endif\n  set completeopt=menuone,menu,longest\n\n  &quot; Define dictionary.\n  let g:neocomplete#sources#dictionary#dictionaries = {\n      \\ &#39;default&#39; : &#39;&#39;,\n      \\ &#39;vimshell&#39; : $HOME.&#39;/.vimshell_hist&#39;,\n      \\ &#39;scheme&#39; : $HOME.&#39;/.gosh_completions&#39;\n          \\ }\n\n  &quot; Define keyword.\n  if !exists(&#39;g:neocomplete#keyword_patterns&#39;)\n      let g:neocomplete#keyword_patterns = {}\n  endif\n  let g:neocomplete#keyword_patterns[&#39;default&#39;] = &#39;\\h\\w*&#39;\n\n  &quot; Plugin key-mappings.\n  inoremap &lt;expr&gt;&lt;C-g&gt;     neocomplete#undo_completion()\n  inoremap &lt;expr&gt;&lt;C-l&gt;     neocomplete#complete_common_string()\n\n  &quot; Recommended key-mappings.\n  &quot; &lt;CR&gt;: close popup and save indent.\n  inoremap &lt;silent&gt; &lt;CR&gt; &lt;C-r&gt;=&lt;SID&gt;my_cr_function()&lt;CR&gt;\n  function! s:my_cr_function()\n    return neocomplete#smart_close_popup() . &quot;\\&lt;CR&gt;&quot;\n    &quot; For no inserting &lt;CR&gt; key.\n    &quot;return pumvisible() ? neocomplete#close_popup() : &quot;\\&lt;CR&gt;&quot;\n  endfunction\n  &quot; &lt;TAB&gt;: completion.\n  inoremap &lt;expr&gt;&lt;TAB&gt;  pumvisible() ? &quot;\\&lt;C-n&gt;&quot; : &quot;\\&lt;TAB&gt;&quot;\n  &quot; &lt;C-h&gt;, &lt;BS&gt;: close popup and delete backword char.\n  inoremap &lt;expr&gt;&lt;C-h&gt; neocomplete#smart_close_popup().&quot;\\&lt;C-h&gt;&quot;\n  inoremap &lt;expr&gt;&lt;BS&gt; neocomplete#smart_close_popup().&quot;\\&lt;C-h&gt;&quot;\n  inoremap &lt;expr&gt;&lt;C-y&gt;  neocomplete#close_popup()\n  inoremap &lt;expr&gt;&lt;C-e&gt;  neocomplete#cancel_popup()\n\n  &quot; Close popup by &lt;Space&gt;.\n  &quot; inoremap &lt;expr&gt;&lt;Space&gt; pumvisible() ? neocomplete#close_popup() : &quot;\\&lt;Space&gt;&quot;\n\n  &quot; Enable omni completion.\n  autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS\n  autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags\n  autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS\n  autocmd FileType python setlocal omnifunc=pythoncomplete#Complete\n  autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags\n  autocmd FileType php set omnifunc=phpcomplete#CompletePHP\n\n  &quot; Enable heavy omni completion.\n  if !exists(&#39;g:neocomplete#sources#omni#input_patterns&#39;)\n    let g:neocomplete#sources#omni#input_patterns = {}\n  endif\n  let g:neocomplete#sources#omni#input_patterns.php = &#39;[^. \\t]-&gt;\\h\\w*\\|\\h\\w*::&#39;\n  let g:neocomplete#sources#omni#input_patterns.c = &#39;[^.[:digit:] *\\t]\\%(\\.\\|-&gt;\\)&#39;\n  let g:neocomplete#sources#omni#input_patterns.cpp = &#39;[^.[:digit:] *\\t]\\%(\\.\\|-&gt;\\)\\|\\h\\w*::&#39;\n\n  &quot; For perlomni.vim setting.\n  &quot; https://github.com/c9s/perlomni.vim\n  let g:neocomplete#sources#omni#input_patterns.perl = &#39;\\h\\w*-&gt;\\h\\w*\\|\\h\\w*::&#39;\n  &quot; }}}\n\n  &quot; Neosnippet.vim ------------------------------------------------------ {{{\n  &quot; Plugin key-mappings.\n  imap &lt;C-k&gt;     &lt;Plug&gt;(neosnippet_expand_or_jump)\n  smap &lt;C-k&gt;     &lt;Plug&gt;(neosnippet_expand_or_jump)\n  xmap &lt;C-k&gt;     &lt;Plug&gt;(neosnippet_expand_target)\n\n  &quot; SuperTab like snippets behavior.\n  imap &lt;expr&gt;&lt;TAB&gt; neosnippet#expandable_or_jumpable() ?\n  \\ &quot;\\&lt;Plug&gt;(neosnippet_expand_or_jump)&quot;\n  \\: pumvisible() ? &quot;\\&lt;C-n&gt;&quot; : &quot;\\&lt;TAB&gt;&quot;\n  smap &lt;expr&gt;&lt;TAB&gt; neosnippet#expandable_or_jumpable() ?\n  \\ &quot;\\&lt;Plug&gt;(neosnippet_expand_or_jump)&quot;\n  \\: &quot;\\&lt;TAB&gt;&quot;\n\n  &quot; For snippet_complete marker.\n  if has(&#39;conceal&#39;)\n    set conceallevel=2 concealcursor=i\n  endif\n\n  &quot; Enable snipMate compatibility feature.\n  let g:neosnippet#enable_snipmate_compatibility = 1\n\n  &quot; Tell Neosnippet about the other snippets\n  let g:neosnippet#snippets_directory=&#39;~/.vim/bundle/vim-snippets/snippets&#39;\n  &quot; }}}\nendif\n&quot; }}}</code></pre>\n<p>Indent guides are neat. I need to figure out a way to have the\n<code>ctermbg</code> vary with colorscheme though :<br />\n</p>\n<pre class=\"vim\"><code>&quot; Indent Guides ------------------------------------------------------- {{{\nlet g:indent_guides_enable_on_vim_startup = 1\n&quot; }}}</code></pre>\n</section>\n<section id=\"custom-functions\" class=\"level2\">\n<h2>Custom Functions</h2>\n<p><code>:BangOpen</code> lets you open the file that results from the\noutput of a command. I was sort of surprised I had to write a function\nthat did this. The most common use case would be:\n<code>:BangOpen which script_I_wrote_thats_in_my_path_but_I_forget_where</code>.</p>\n<p><code>SetSpaces</code> is a function that <a\nhref=\"http://stevebarbera.com/\">Steve Barbera</a> wrote that I think is\nkinda neat. It sets all of your spaces and things to the same value with\none command. This is kinda what <code>modelines</code> are for, but\n<code>modelines</code> have always struck me as weird and potentially\ndangerous (which is why I have them disabled in <a\nhref=\"https://tylercipriani.com/blog/#basic-options\">Basic Setting</a>).</p>\n<pre class=\"vim\"><code>&quot; BangOpen ------------------------------------------------------------ {{{\nfunction! BangOpen(arg)\n    execute &#39;tabe &#39; . system(a:arg)\nendfunction\n\ncommand! -nargs=1 BangOpen :call BangOpen(&lt;f-args&gt;)\n&quot; }}}\n\nfunction! SetSpaces(arg)\n    echo &quot;settings spaces to: &quot; . a:arg\n    execute &#39;set tabstop=&#39; . a:arg\n    execute &#39;set shiftwidth=&#39; . a:arg\n    execute &#39;set softtabstop=&#39; . a:arg\nendfunction\n\ncommand! -nargs=1 SetSpaces :call SetSpaces(&lt;f-args&gt;)</code></pre>\n<p>I must’ve been having some trouble with keycode mapping and added\nthese. I can’t remember the context of these.</p>\n<pre><code>set timeout\nset timeoutlen=2500\nset ttimeoutlen=10</code></pre>\n</section>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/05/31/deterministic-turing-machine-in-python/",

    "title": "Deterministic Turing Machine in Python",
    "url": "https://tylercipriani.com/blog/2017/05/31/deterministic-turing-machine-in-python/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-05-31T14:25:42Z",
    "date_modified": "2017-05-31T15:06:27Z",


    "content_html": "<p>Below is a Turing machine implementation based on the example in <a\nhref=\"http://computationbook.com/\"><em>Understanding\nComputation</em></a> by Tom Stuart. The Turing machine is an\nentertaining thought exercise that makes computer science feel a bit\nlike poetry. Most things I learn on about computers on a day-to-day\nbasis are decidedly unpoetic.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource python numberLines\"><code class=\"sourceCode python\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a><span class=\"co\">Deterministic Turing Machine</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a><span class=\"co\">~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a><span class=\"co\">This is a turing machine written in python. This code closely follows code from</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\"></a><span class=\"co\">chapter 5 of the book _Understanding Computation_ by Tom Stuart.</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\"></a><span class=\"co\">This is basically a Finite State Machine with a tape.</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\"></a><span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\"></a></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\"></a><span class=\"im\">import</span> collections</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\"></a></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\"></a></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\"></a>LEFT <span class=\"op\">=</span> <span class=\"st\">&#39;left&#39;</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\"></a>RIGHT <span class=\"op\">=</span> <span class=\"st\">&#39;right&#39;</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\"></a>BLANK <span class=\"op\">=</span> <span class=\"st\">&#39;_&#39;</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\"></a></span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\"></a></span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\"></a>Rule <span class=\"op\">=</span> collections.namedtuple(<span class=\"st\">&#39;Rule&#39;</span>, [</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\"></a>    <span class=\"st\">&#39;state&#39;</span>,</span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\"></a>    <span class=\"st\">&#39;head&#39;</span>,</span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\"></a>    <span class=\"st\">&#39;next_state&#39;</span>,</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\"></a>    <span class=\"st\">&#39;write&#39;</span>,</span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\"></a>    <span class=\"st\">&#39;move&#39;</span>])</span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\"></a></span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\"></a></span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\"></a><span class=\"kw\">def</span> rule_applies(rule, state, tape):</span>\n<span id=\"cb1-26\"><a href=\"https://tylercipriani.com/blog/#cb1-26\"></a>    <span class=\"co\">&quot;&quot;&quot;Determine whether a rule applies to a state.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-27\"><a href=\"https://tylercipriani.com/blog/#cb1-27\"></a>    correct_state <span class=\"op\">=</span> rule.state <span class=\"op\">==</span> state</span>\n<span id=\"cb1-28\"><a href=\"https://tylercipriani.com/blog/#cb1-28\"></a>    correct_read <span class=\"op\">=</span> rule.head <span class=\"op\">==</span> tape.head</span>\n<span id=\"cb1-29\"><a href=\"https://tylercipriani.com/blog/#cb1-29\"></a>    <span class=\"cf\">return</span> correct_state <span class=\"kw\">and</span> correct_read</span>\n<span id=\"cb1-30\"><a href=\"https://tylercipriani.com/blog/#cb1-30\"></a></span>\n<span id=\"cb1-31\"><a href=\"https://tylercipriani.com/blog/#cb1-31\"></a></span>\n<span id=\"cb1-32\"><a href=\"https://tylercipriani.com/blog/#cb1-32\"></a><span class=\"kw\">def</span> follow_rule(rule, state, tape):</span>\n<span id=\"cb1-33\"><a href=\"https://tylercipriani.com/blog/#cb1-33\"></a>    <span class=\"co\">&quot;&quot;&quot;Follows the current rule.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-34\"><a href=\"https://tylercipriani.com/blog/#cb1-34\"></a>    <span class=\"cf\">if</span> rule_applies(rule, state, tape):</span>\n<span id=\"cb1-35\"><a href=\"https://tylercipriani.com/blog/#cb1-35\"></a>        state <span class=\"op\">=</span> rule.next_state</span>\n<span id=\"cb1-36\"><a href=\"https://tylercipriani.com/blog/#cb1-36\"></a>        tape.middle <span class=\"op\">=</span> rule.write</span>\n<span id=\"cb1-37\"><a href=\"https://tylercipriani.com/blog/#cb1-37\"></a>        tape.move(rule.move)</span>\n<span id=\"cb1-38\"><a href=\"https://tylercipriani.com/blog/#cb1-38\"></a></span>\n<span id=\"cb1-39\"><a href=\"https://tylercipriani.com/blog/#cb1-39\"></a>    <span class=\"cf\">return</span> rule, state, tape</span>\n<span id=\"cb1-40\"><a href=\"https://tylercipriani.com/blog/#cb1-40\"></a></span>\n<span id=\"cb1-41\"><a href=\"https://tylercipriani.com/blog/#cb1-41\"></a></span>\n<span id=\"cb1-42\"><a href=\"https://tylercipriani.com/blog/#cb1-42\"></a><span class=\"kw\">class</span> Tape(<span class=\"bu\">object</span>):</span>\n<span id=\"cb1-43\"><a href=\"https://tylercipriani.com/blog/#cb1-43\"></a>    <span class=\"co\">&quot;&quot;&quot;Represents the tape in a turing machine.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-44\"><a href=\"https://tylercipriani.com/blog/#cb1-44\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>, left<span class=\"op\">=</span><span class=\"va\">None</span>, middle<span class=\"op\">=</span><span class=\"va\">None</span>, right<span class=\"op\">=</span><span class=\"va\">None</span>, blank<span class=\"op\">=</span>BLANK):</span>\n<span id=\"cb1-45\"><a href=\"https://tylercipriani.com/blog/#cb1-45\"></a>        <span class=\"co\">&quot;&quot;&quot;Initialize and show initial state.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-46\"><a href=\"https://tylercipriani.com/blog/#cb1-46\"></a>        <span class=\"va\">self</span>.left <span class=\"op\">=</span> left <span class=\"kw\">or</span> []</span>\n<span id=\"cb1-47\"><a href=\"https://tylercipriani.com/blog/#cb1-47\"></a>        <span class=\"va\">self</span>.right <span class=\"op\">=</span> right <span class=\"kw\">or</span> []</span>\n<span id=\"cb1-48\"><a href=\"https://tylercipriani.com/blog/#cb1-48\"></a></span>\n<span id=\"cb1-49\"><a href=\"https://tylercipriani.com/blog/#cb1-49\"></a>        <span class=\"va\">self</span>.middle <span class=\"op\">=</span> middle</span>\n<span id=\"cb1-50\"><a href=\"https://tylercipriani.com/blog/#cb1-50\"></a>        <span class=\"cf\">if</span> <span class=\"va\">self</span>.middle <span class=\"kw\">is</span> <span class=\"va\">None</span>:</span>\n<span id=\"cb1-51\"><a href=\"https://tylercipriani.com/blog/#cb1-51\"></a>            <span class=\"va\">self</span>.middle <span class=\"op\">=</span> blank</span>\n<span id=\"cb1-52\"><a href=\"https://tylercipriani.com/blog/#cb1-52\"></a></span>\n<span id=\"cb1-53\"><a href=\"https://tylercipriani.com/blog/#cb1-53\"></a>        <span class=\"va\">self</span>.blank <span class=\"op\">=</span> blank</span>\n<span id=\"cb1-54\"><a href=\"https://tylercipriani.com/blog/#cb1-54\"></a></span>\n<span id=\"cb1-55\"><a href=\"https://tylercipriani.com/blog/#cb1-55\"></a>    <span class=\"kw\">def</span> move_right(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-56\"><a href=\"https://tylercipriani.com/blog/#cb1-56\"></a>        <span class=\"co\">&quot;&quot;&quot;Move tape one unit right, add blanks as needed.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-57\"><a href=\"https://tylercipriani.com/blog/#cb1-57\"></a>        <span class=\"va\">self</span>.left <span class=\"op\">=</span> <span class=\"va\">self</span>.left <span class=\"op\">+</span> [<span class=\"va\">self</span>.middle]</span>\n<span id=\"cb1-58\"><a href=\"https://tylercipriani.com/blog/#cb1-58\"></a>        <span class=\"cf\">if</span> <span class=\"va\">self</span>.right:</span>\n<span id=\"cb1-59\"><a href=\"https://tylercipriani.com/blog/#cb1-59\"></a>            <span class=\"va\">self</span>.middle <span class=\"op\">=</span> <span class=\"va\">self</span>.right.pop(<span class=\"dv\">0</span>)</span>\n<span id=\"cb1-60\"><a href=\"https://tylercipriani.com/blog/#cb1-60\"></a>        <span class=\"cf\">else</span>:</span>\n<span id=\"cb1-61\"><a href=\"https://tylercipriani.com/blog/#cb1-61\"></a>            <span class=\"va\">self</span>.middle <span class=\"op\">=</span> <span class=\"va\">self</span>.blank</span>\n<span id=\"cb1-62\"><a href=\"https://tylercipriani.com/blog/#cb1-62\"></a></span>\n<span id=\"cb1-63\"><a href=\"https://tylercipriani.com/blog/#cb1-63\"></a>    <span class=\"kw\">def</span> move_left(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-64\"><a href=\"https://tylercipriani.com/blog/#cb1-64\"></a>        <span class=\"co\">&quot;&quot;&quot;Move tape one unit left, add blanks as needed.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-65\"><a href=\"https://tylercipriani.com/blog/#cb1-65\"></a>        <span class=\"va\">self</span>.right <span class=\"op\">=</span> [<span class=\"va\">self</span>.middle] <span class=\"op\">+</span> <span class=\"va\">self</span>.right</span>\n<span id=\"cb1-66\"><a href=\"https://tylercipriani.com/blog/#cb1-66\"></a>        <span class=\"cf\">if</span> <span class=\"va\">self</span>.left:</span>\n<span id=\"cb1-67\"><a href=\"https://tylercipriani.com/blog/#cb1-67\"></a>            <span class=\"va\">self</span>.middle <span class=\"op\">=</span> <span class=\"va\">self</span>.left.pop()</span>\n<span id=\"cb1-68\"><a href=\"https://tylercipriani.com/blog/#cb1-68\"></a>        <span class=\"cf\">else</span>:</span>\n<span id=\"cb1-69\"><a href=\"https://tylercipriani.com/blog/#cb1-69\"></a>            <span class=\"va\">self</span>.middle <span class=\"op\">=</span> <span class=\"va\">self</span>.blank</span>\n<span id=\"cb1-70\"><a href=\"https://tylercipriani.com/blog/#cb1-70\"></a></span>\n<span id=\"cb1-71\"><a href=\"https://tylercipriani.com/blog/#cb1-71\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-72\"><a href=\"https://tylercipriani.com/blog/#cb1-72\"></a>    <span class=\"kw\">def</span> head(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-73\"><a href=\"https://tylercipriani.com/blog/#cb1-73\"></a>        <span class=\"cf\">return</span> <span class=\"bu\">str</span>(<span class=\"va\">self</span>.middle)</span>\n<span id=\"cb1-74\"><a href=\"https://tylercipriani.com/blog/#cb1-74\"></a></span>\n<span id=\"cb1-75\"><a href=\"https://tylercipriani.com/blog/#cb1-75\"></a>    <span class=\"kw\">def</span> move(<span class=\"va\">self</span>, direction):</span>\n<span id=\"cb1-76\"><a href=\"https://tylercipriani.com/blog/#cb1-76\"></a>        <span class=\"co\">&quot;&quot;&quot;Move tape left or right.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-77\"><a href=\"https://tylercipriani.com/blog/#cb1-77\"></a>        <span class=\"cf\">if</span> <span class=\"kw\">not</span> direction <span class=\"kw\">in</span> [LEFT, RIGHT]:</span>\n<span id=\"cb1-78\"><a href=\"https://tylercipriani.com/blog/#cb1-78\"></a>            <span class=\"cf\">raise</span> <span class=\"pp\">RuntimeError</span>(<span class=\"st\">&#39;Unrecognized direction &quot;</span><span class=\"sc\">%s</span><span class=\"st\">&quot;&#39;</span> <span class=\"op\">%</span> direction)</span>\n<span id=\"cb1-79\"><a href=\"https://tylercipriani.com/blog/#cb1-79\"></a></span>\n<span id=\"cb1-80\"><a href=\"https://tylercipriani.com/blog/#cb1-80\"></a>        <span class=\"cf\">if</span> direction <span class=\"op\">==</span> LEFT:</span>\n<span id=\"cb1-81\"><a href=\"https://tylercipriani.com/blog/#cb1-81\"></a>            <span class=\"cf\">return</span> <span class=\"va\">self</span>.move_left()</span>\n<span id=\"cb1-82\"><a href=\"https://tylercipriani.com/blog/#cb1-82\"></a></span>\n<span id=\"cb1-83\"><a href=\"https://tylercipriani.com/blog/#cb1-83\"></a>        <span class=\"cf\">if</span> direction <span class=\"op\">==</span> RIGHT:</span>\n<span id=\"cb1-84\"><a href=\"https://tylercipriani.com/blog/#cb1-84\"></a>            <span class=\"cf\">return</span> <span class=\"va\">self</span>.move_right()</span>\n<span id=\"cb1-85\"><a href=\"https://tylercipriani.com/blog/#cb1-85\"></a></span>\n<span id=\"cb1-86\"><a href=\"https://tylercipriani.com/blog/#cb1-86\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__repr__</span>(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-87\"><a href=\"https://tylercipriani.com/blog/#cb1-87\"></a>        <span class=\"co\">&quot;&quot;&quot;Tape state with current head in parens, like _12(3)4.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-88\"><a href=\"https://tylercipriani.com/blog/#cb1-88\"></a>        out <span class=\"op\">=</span> <span class=\"st\">&#39;</span><span class=\"sc\">{}</span><span class=\"st\">(</span><span class=\"sc\">{}</span><span class=\"st\">)</span><span class=\"sc\">{}</span><span class=\"st\">&#39;</span>.<span class=\"bu\">format</span>(</span>\n<span id=\"cb1-89\"><a href=\"https://tylercipriani.com/blog/#cb1-89\"></a>            <span class=\"st\">&#39;&#39;</span>.join(<span class=\"bu\">map</span>(<span class=\"bu\">str</span>, <span class=\"va\">self</span>.left)),</span>\n<span id=\"cb1-90\"><a href=\"https://tylercipriani.com/blog/#cb1-90\"></a>            <span class=\"va\">self</span>.middle,</span>\n<span id=\"cb1-91\"><a href=\"https://tylercipriani.com/blog/#cb1-91\"></a>            <span class=\"st\">&#39;&#39;</span>.join(<span class=\"bu\">map</span>(<span class=\"bu\">str</span>, <span class=\"va\">self</span>.right)))</span>\n<span id=\"cb1-92\"><a href=\"https://tylercipriani.com/blog/#cb1-92\"></a>        <span class=\"cf\">return</span> out</span>\n<span id=\"cb1-93\"><a href=\"https://tylercipriani.com/blog/#cb1-93\"></a></span>\n<span id=\"cb1-94\"><a href=\"https://tylercipriani.com/blog/#cb1-94\"></a></span>\n<span id=\"cb1-95\"><a href=\"https://tylercipriani.com/blog/#cb1-95\"></a><span class=\"kw\">class</span> DeterministicTuringMachine(<span class=\"bu\">object</span>):</span>\n<span id=\"cb1-96\"><a href=\"https://tylercipriani.com/blog/#cb1-96\"></a>    <span class=\"co\">&quot;&quot;&quot;This is a turing machine.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-97\"><a href=\"https://tylercipriani.com/blog/#cb1-97\"></a>    <span class=\"kw\">def</span> <span class=\"fu\">__init__</span>(<span class=\"va\">self</span>, state, tape, accept_states, rules):</span>\n<span id=\"cb1-98\"><a href=\"https://tylercipriani.com/blog/#cb1-98\"></a>        <span class=\"co\">&quot;&quot;&quot;</span></span>\n<span id=\"cb1-99\"><a href=\"https://tylercipriani.com/blog/#cb1-99\"></a><span class=\"co\">        Initialize machine</span></span>\n<span id=\"cb1-100\"><a href=\"https://tylercipriani.com/blog/#cb1-100\"></a><span class=\"co\">        :state: - integer - that represents the current state of the machine</span></span>\n<span id=\"cb1-101\"><a href=\"https://tylercipriani.com/blog/#cb1-101\"></a><span class=\"co\">        :tape: - Tape - the machine&#39;s tape</span></span>\n<span id=\"cb1-102\"><a href=\"https://tylercipriani.com/blog/#cb1-102\"></a><span class=\"co\">        :accept_states: - [integer] - represents states when the machine has</span></span>\n<span id=\"cb1-103\"><a href=\"https://tylercipriani.com/blog/#cb1-103\"></a><span class=\"co\">                                      exited successfully</span></span>\n<span id=\"cb1-104\"><a href=\"https://tylercipriani.com/blog/#cb1-104\"></a><span class=\"co\">        :rules: - [Rule] - list of rules for the machine to follow</span></span>\n<span id=\"cb1-105\"><a href=\"https://tylercipriani.com/blog/#cb1-105\"></a><span class=\"co\">        &quot;&quot;&quot;</span></span>\n<span id=\"cb1-106\"><a href=\"https://tylercipriani.com/blog/#cb1-106\"></a>        <span class=\"va\">self</span>.state <span class=\"op\">=</span> state</span>\n<span id=\"cb1-107\"><a href=\"https://tylercipriani.com/blog/#cb1-107\"></a>        <span class=\"va\">self</span>.tape <span class=\"op\">=</span> tape</span>\n<span id=\"cb1-108\"><a href=\"https://tylercipriani.com/blog/#cb1-108\"></a>        <span class=\"va\">self</span>.accept_states <span class=\"op\">=</span> accept_states</span>\n<span id=\"cb1-109\"><a href=\"https://tylercipriani.com/blog/#cb1-109\"></a>        <span class=\"va\">self</span>.rules <span class=\"op\">=</span> rules</span>\n<span id=\"cb1-110\"><a href=\"https://tylercipriani.com/blog/#cb1-110\"></a></span>\n<span id=\"cb1-111\"><a href=\"https://tylercipriani.com/blog/#cb1-111\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-112\"><a href=\"https://tylercipriani.com/blog/#cb1-112\"></a>    <span class=\"kw\">def</span> accepting(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-113\"><a href=\"https://tylercipriani.com/blog/#cb1-113\"></a>        <span class=\"cf\">return</span> <span class=\"va\">self</span>.state <span class=\"kw\">in</span> <span class=\"va\">self</span>.accept_states</span>\n<span id=\"cb1-114\"><a href=\"https://tylercipriani.com/blog/#cb1-114\"></a></span>\n<span id=\"cb1-115\"><a href=\"https://tylercipriani.com/blog/#cb1-115\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-116\"><a href=\"https://tylercipriani.com/blog/#cb1-116\"></a>    <span class=\"kw\">def</span> stuck(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-117\"><a href=\"https://tylercipriani.com/blog/#cb1-117\"></a>        <span class=\"co\">&quot;&quot;&quot;Stuck when we have no next rule.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-118\"><a href=\"https://tylercipriani.com/blog/#cb1-118\"></a>        <span class=\"cf\">return</span> <span class=\"kw\">not</span> <span class=\"va\">self</span>.next_rule</span>\n<span id=\"cb1-119\"><a href=\"https://tylercipriani.com/blog/#cb1-119\"></a></span>\n<span id=\"cb1-120\"><a href=\"https://tylercipriani.com/blog/#cb1-120\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-121\"><a href=\"https://tylercipriani.com/blog/#cb1-121\"></a>    <span class=\"kw\">def</span> working(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-122\"><a href=\"https://tylercipriani.com/blog/#cb1-122\"></a>        <span class=\"co\">&quot;&quot;&quot;Working when not done and we still have rules to apply.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-123\"><a href=\"https://tylercipriani.com/blog/#cb1-123\"></a>        <span class=\"cf\">return</span> <span class=\"kw\">not</span> (<span class=\"va\">self</span>.accepting <span class=\"kw\">or</span> <span class=\"va\">self</span>.stuck)</span>\n<span id=\"cb1-124\"><a href=\"https://tylercipriani.com/blog/#cb1-124\"></a></span>\n<span id=\"cb1-125\"><a href=\"https://tylercipriani.com/blog/#cb1-125\"></a>    <span class=\"at\">@property</span></span>\n<span id=\"cb1-126\"><a href=\"https://tylercipriani.com/blog/#cb1-126\"></a>    <span class=\"kw\">def</span> next_rule(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-127\"><a href=\"https://tylercipriani.com/blog/#cb1-127\"></a>        <span class=\"co\">&quot;&quot;&quot;Get next rule.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-128\"><a href=\"https://tylercipriani.com/blog/#cb1-128\"></a>        rules <span class=\"op\">=</span> <span class=\"va\">self</span>._find_rules()</span>\n<span id=\"cb1-129\"><a href=\"https://tylercipriani.com/blog/#cb1-129\"></a></span>\n<span id=\"cb1-130\"><a href=\"https://tylercipriani.com/blog/#cb1-130\"></a>        <span class=\"cf\">if</span> rules:</span>\n<span id=\"cb1-131\"><a href=\"https://tylercipriani.com/blog/#cb1-131\"></a>            <span class=\"cf\">return</span> rules[<span class=\"dv\">0</span>]</span>\n<span id=\"cb1-132\"><a href=\"https://tylercipriani.com/blog/#cb1-132\"></a></span>\n<span id=\"cb1-133\"><a href=\"https://tylercipriani.com/blog/#cb1-133\"></a>        <span class=\"cf\">return</span> rules</span>\n<span id=\"cb1-134\"><a href=\"https://tylercipriani.com/blog/#cb1-134\"></a></span>\n<span id=\"cb1-135\"><a href=\"https://tylercipriani.com/blog/#cb1-135\"></a>    <span class=\"kw\">def</span> _find_rules(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-136\"><a href=\"https://tylercipriani.com/blog/#cb1-136\"></a>        <span class=\"co\">&quot;&quot;&quot;Find a rules we can apply.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-137\"><a href=\"https://tylercipriani.com/blog/#cb1-137\"></a>        applicable_rules <span class=\"op\">=</span> [rule <span class=\"cf\">for</span> rule <span class=\"kw\">in</span> <span class=\"va\">self</span>.rules</span>\n<span id=\"cb1-138\"><a href=\"https://tylercipriani.com/blog/#cb1-138\"></a>                            <span class=\"cf\">if</span> rule_applies(rule, <span class=\"va\">self</span>.state, <span class=\"va\">self</span>.tape)]</span>\n<span id=\"cb1-139\"><a href=\"https://tylercipriani.com/blog/#cb1-139\"></a></span>\n<span id=\"cb1-140\"><a href=\"https://tylercipriani.com/blog/#cb1-140\"></a>        <span class=\"cf\">return</span> applicable_rules</span>\n<span id=\"cb1-141\"><a href=\"https://tylercipriani.com/blog/#cb1-141\"></a></span>\n<span id=\"cb1-142\"><a href=\"https://tylercipriani.com/blog/#cb1-142\"></a>    <span class=\"kw\">def</span> step(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-143\"><a href=\"https://tylercipriani.com/blog/#cb1-143\"></a>        <span class=\"co\">&quot;&quot;&quot;Apply any rules we can find.&quot;&quot;&quot;</span></span>\n<span id=\"cb1-144\"><a href=\"https://tylercipriani.com/blog/#cb1-144\"></a>        _, <span class=\"va\">self</span>.state, <span class=\"va\">self</span>.tape <span class=\"op\">=</span> follow_rule(</span>\n<span id=\"cb1-145\"><a href=\"https://tylercipriani.com/blog/#cb1-145\"></a>            <span class=\"va\">self</span>.next_rule, <span class=\"va\">self</span>.state, <span class=\"va\">self</span>.tape)</span>\n<span id=\"cb1-146\"><a href=\"https://tylercipriani.com/blog/#cb1-146\"></a></span>\n<span id=\"cb1-147\"><a href=\"https://tylercipriani.com/blog/#cb1-147\"></a>    <span class=\"kw\">def</span> run(<span class=\"va\">self</span>):</span>\n<span id=\"cb1-148\"><a href=\"https://tylercipriani.com/blog/#cb1-148\"></a>        <span class=\"cf\">while</span> <span class=\"va\">self</span>.working:</span>\n<span id=\"cb1-149\"><a href=\"https://tylercipriani.com/blog/#cb1-149\"></a>            <span class=\"va\">self</span>.step()</span></code></pre></div>\n<p>This machine contains objects for a tape (<code>Tape</code>), rules\nfor a machine to follow (<code>Rule</code>), and an object representing\nthe state of the Turing machine itself\n(<code>DeterministicTuringMachine</code>).</p>\n<section id=\"incrementing-binary-numbers\" class=\"level2\">\n<h2>Incrementing binary numbers</h2>\n<p>Given the appropriate set of rules, this machine can perform general\ncomputing tasks. In the book, the rules for incrementing a binary number\nare used as an example.</p>\n<p>We start with the number <code>10111</code> (A.K.A, 23), which we’d\nlike to increment by 1 to get <code>11000</code> (A.K.A., 24). To begin\nwe set the tape with the number we’d like to increment with the read\nhead of the tape resting on right-most digit of the binary number:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Tape looks like: 1011(1)</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Where () represents the read/write head</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>t <span class=\"op\">=</span> Tape(left<span class=\"op\">=</span>[<span class=\"dv\">1</span>,<span class=\"dv\">0</span>,<span class=\"dv\">1</span>,<span class=\"dv\">1</span>], middle<span class=\"op\">=</span><span class=\"dv\">1</span>)</span></code></pre></div>\n<p>This machine will have three available machine “states” that help to\ndefine the rules for the Turing machine to follow. When the machine is\nin a particular state, and encounters a particular condition (i.e., the\nread head is over a particular number) it will follow a particular rule\n– that is, it will write either a <code>1</code> or a <code>0</code>,\nmove the read head either <code>LEFT</code> or <code>RIGHT</code>, and,\npossibly, change machine state. These rules are based on machine state\nin combination with a read condition.</p>\n<p>The machine will start in state <code>1</code>. When the machine\nenters into one of the <code>accept_states</code>, the machine will stop\nprocessing. The only accept_state for this machine is\n<code>3</code>.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Availale states in this example are 1, 2, 3</span></span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>initial_state <span class=\"op\">=</span> <span class=\"dv\">1</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>m <span class=\"op\">=</span> DeterministicTuringMachine(</span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    state<span class=\"op\">=</span>initial_state, tape<span class=\"op\">=</span>t, accept_states<span class=\"op\">=</span>[<span class=\"dv\">3</span>], rules<span class=\"op\">=</span>[</span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\"># if the state is 1 and the read head is ... etc</span></span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">1</span>, head<span class=\"op\">=</span><span class=\"st\">&#39;0&#39;</span>, next_state<span class=\"op\">=</span><span class=\"dv\">2</span>, write<span class=\"op\">=</span><span class=\"st\">&#39;1&#39;</span>, move<span class=\"op\">=</span>RIGHT),</span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">1</span>, head<span class=\"op\">=</span><span class=\"st\">&#39;1&#39;</span>, next_state<span class=\"op\">=</span><span class=\"dv\">1</span>, write<span class=\"op\">=</span><span class=\"st\">&#39;0&#39;</span>, move<span class=\"op\">=</span>LEFT),</span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">1</span>, head<span class=\"op\">=</span>BLANK, next_state<span class=\"op\">=</span><span class=\"dv\">2</span>, write<span class=\"op\">=</span><span class=\"st\">&#39;1&#39;</span>, move<span class=\"op\">=</span>RIGHT),</span>\n<span id=\"cb3-10\"><a href=\"https://tylercipriani.com/blog/#cb3-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-11\"><a href=\"https://tylercipriani.com/blog/#cb3-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"co\"># if the state is 2 and the read head is ... etc</span></span>\n<span id=\"cb3-12\"><a href=\"https://tylercipriani.com/blog/#cb3-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">2</span>, head<span class=\"op\">=</span><span class=\"st\">&#39;0&#39;</span>, next_state<span class=\"op\">=</span><span class=\"dv\">2</span>, write<span class=\"op\">=</span><span class=\"st\">&#39;0&#39;</span>, move<span class=\"op\">=</span>RIGHT),</span>\n<span id=\"cb3-13\"><a href=\"https://tylercipriani.com/blog/#cb3-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">2</span>, head<span class=\"op\">=</span><span class=\"st\">&#39;1&#39;</span>, next_state<span class=\"op\">=</span><span class=\"dv\">2</span>, write<span class=\"op\">=</span><span class=\"st\">&#39;1&#39;</span>, move<span class=\"op\">=</span>RIGHT),</span>\n<span id=\"cb3-14\"><a href=\"https://tylercipriani.com/blog/#cb3-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>        Rule(state<span class=\"op\">=</span><span class=\"dv\">2</span>, head<span class=\"op\">=</span>BLANK, next_state<span class=\"op\">=</span><span class=\"dv\">3</span>, write<span class=\"op\">=</span>BLANK, move<span class=\"op\">=</span>LEFT)</span>\n<span id=\"cb3-15\"><a href=\"https://tylercipriani.com/blog/#cb3-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>    ]</span>\n<span id=\"cb3-16\"><a href=\"https://tylercipriani.com/blog/#cb3-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>)</span></code></pre></div>\n<p>If we call the <code>step</code> method of the state machine we can\ntrace how it follows rules.</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> m.tape</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">1011</span>(<span class=\"dv\">1</span>)</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> m.step()</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.state)</span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">1</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.tape)</span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">101</span>(<span class=\"dv\">1</span>)<span class=\"dv\">0</span></span></code></pre></div>\n<p>Since it was in state <code>1</code> and the read head was over a\n<code>1</code> it followed rule\n<code>Rule(state=1, head=\'1\', next_state=1, write=\'0\', move=LEFT)</code>\n– it wrote <code>0</code> in its current location, it moved the read\nhead <code>LEFT</code>, and stayed in the <code>1</code> state. Since\nthe state is still <code>1</code> and the read head is once-again over a\n<code>1</code>, the same rule will be followed again:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> m.tape</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">101</span>(<span class=\"dv\">1</span>)<span class=\"dv\">0</span></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> m.step()</span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.state)</span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">1</span></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.tape)</span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">10</span>(<span class=\"dv\">1</span>)<span class=\"dv\">00</span></span></code></pre></div>\n<p>Calling the <code>run</code> method of the machine will continue to\nfollow the defined rules until state <code>3</code> is reached:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode python\"><code class=\"sourceCode python\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> m.run()</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.state)</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">3</span></span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&gt;&gt;&gt;</span> <span class=\"bu\">print</span>(m.tape)</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">1100</span>(<span class=\"dv\">0</span>)_</span></code></pre></div>\n<p>Turing machines are magic, I guess is what I’m saying.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/05/08/what-i-told-the-fcc/",

    "title": "What I Told the FCC",
    "url": "https://tylercipriani.com/blog/2017/05/08/what-i-told-the-fcc/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2017-05-08T00:00:00Z",
    "date_modified": "2017-07-28T22:41:41Z",


    "content_html": "<p>I think that new FCC proposal for “<a\nhref=\"https://www.fcc.gov/ecfs/search/proceedings?q=name:17-108\">Restoring\nInternet Freedom</a>” would completely destroy the internet. Should this\nproposal go any further, the internet will no longer be recognizable\nwithin a very short amount of time. I’m worried that I will no longer\nhave a place on the internet because my internet activity and work isn’t\ndesigned to invade people’s homes and privacy to sell them things they\ndon’t need. Non-profits on the internet are dead.</p>\n<p>This proposal is entirely rent-seeking by big ISPs. ISPs will make\nmore money without providing any additional service for users, and the\nFCC would be enabling it all.</p>\n<blockquote>\n<h2 style=\"color: red\">Big Disclaimer</h2>\n<p>This is a post where I feel it is important to make absolutely clear\nthat my views are my own and do not represent the views of my employer(s\npast or present)</p>\n</blockquote>\n<section id=\"my-comments-to-the-fcc\" class=\"level2\">\n<h2>My comments to the FCC</h2>\n<p>The FCC has opened their proposal to <a\nhref=\"https://www.fcc.gov/ecfs/search/proceedings?q=name:17-108\">public\ncomment</a> and I encourage you to do so.</p>\n<p>Here’s what I wrote:</p>\n<blockquote>\n<p>I am a Colorado resident and I’ve worked as an internet engineer for\nmy entire professional career (small disclaimer that my views are my own\nand do not represent those of my employer), and I’m worried that new FCC\nrules may allow large ISPs to destroy the internet.</p>\n<p>The current state of the internet is possible because ISPs aren’t\nselling tiers of websites to their users. If we create internet\nfast-lanes, then we create a tiered internet. This is currently the way\ncable channels already work: if you just want CNN and ESPN you can pay\none amount, but if you want HBO you pay a little more. The problem is\nthat the internet is constantly in flux, there are constantly new\nwebsites being built. This is a major driver of economic growth and is\ngood for everyone who uses the internet.</p>\n<p>If you start offering internet fast-lanes, internet tiers become\npossible: if you just want Facebook and Google then you pay one amount,\nbut if you want Wikipedia you pay a little more. Ipso facto, Wikipedia\nis unavailable to a portion of the internet population.</p>\n<p>There may be those who make the argument that this is how the free\nmarket works: if Wikipedia were good, people would be willing to pay\nmore for it; however, this artificial choice between Google and\nWikipedia is only made possible by a perversion of the design of the\ninternet. Bits of information are bits of information, an ISP is arguing\nthat websites should pay more while it offers the same service. ISPs\nwant Netflix to pay more than Google for them to move 100 bytes from the\ninternet backbone to your house. Moving 100 bytes from the backbone to\nsomeone’s house, the so-called “last mile”, is same amount of work\nwhether those bytes are from Google or Netflix so why should Netflix\nhave to pay more?</p>\n<p>Meanwhile, large ISPs that move bits from the internet backbone over\nthe “last mile” do not compete with one another by means of designed but\nunspoken collusion. The suggestion that an internet user should have to\nchoose between Google and my blog is being made by companies that make\nall of their money by rent-seeking and now demand more money for less\nservice. Consumers are not being protected, only ISP shareholders\nare.</p>\n<p>This proposal has the net-effect of censoring the internet so that\nonly websites that have enough money to pay protection fees to ISPs will\nbe available to people. This proposal is censorship that stifles freedom\nand innovation and will destroy the internet.</p>\n</blockquote>\n<p>/me drops mic.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2017/01/26/yearly-reading-done-and-todo/",

    "title": "Yearly Reading: Done and To Do",
    "url": "https://tylercipriani.com/blog/2017/01/26/yearly-reading-done-and-todo/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2017-01-26T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>Reading fiction is not that dissimilar from watching a movie in your\nbrain. The ways in which audio-visual consumption of fiction and reading\nfiction diverge is in their demand on engagement – when reading I must\nlearn new words, I struggle to find meaning, I use my imagination, I\nslowly strengthen understanding – I meet books more than half-way in my\nmind’s eye.</p>\n<p>Movies and television, in contrast, demand less engagement from the\nviewer – much of the vision and interpretation is handed (or forced) on\nthe audience. As popular movies and TV demand less, they also seem more\napt to acquiesce to popular whim – mirroring the culture that consumes\nthem rather than challenging it. The level of engagement demanded by\naudio-visual entertainment is also subject to a shifting baseline – that\nis, it’s gotten less challenging over time.</p>\n<p>This is not a knock on <em>all</em> television and movies as a form\nof art. Often television, movies, and documentaries are the perfect\nmedium to convey a particular message. Also, there are many movies and\ntelevision programs which are, in fact, very challenging to their\naudience in addition to being very enjoyable.</p>\n<p>Also, it is noteworthy that I tend to read mass-market crap – the\nbook-equivalent of high-fructose corn syrup. I’ve come to terms with\nthis fact. I read some crap, I read some good things, occasionally I’ll\nread a few great (and nominally “great”) things. I end up with a greater\nsense of accomplishment and satisfaction from reading crap rather than\nwatching crap – YMMV.</p>\n<p>This is a long way of saying – I think that reading is a Good Thing™\nand I want to do more of it. To enforce more of a habit, I set reading\ngoals for myself at the start of each year. In 2015 I wanted to read a\nbook a month. In 2016 I wanted to read 2 books a month. In both 2015 and\n2016 my grasp has exceeded my reach – which is not how goals are\nsupposed to work.</p>\n<section id=\"books-read-in-2016\" class=\"level2\">\n<h2>Books read in 2016</h2>\n<ol type=\"1\">\n<li><a href=\"https://openlibrary.org/books/OL7500496M/Stranger_in_a_Strange_Land\">Stranger\nin a Strange Land</a> by Robert A. Heinlein</li>\n<li><a href=\"https://openlibrary.org/works/OL573448W/Black_hole\">Black\nHole</a> by Charles Burns</li>\n<li><a href=\"https://openlibrary.org/works/OL17314347W/Fun_Home\">Fun\nHome</a> by Alison Bechdel</li>\n<li><a href=\"https://openlibrary.org/works/OL17112428W/The_Girl_on_the_Train\">The\nGirl on the Train</a> by Paula Hawkins</li>\n<li><a href=\"https://openlibrary.org/works/OL59740W/Starship_Troopers\">Starship\nTroopers</a> by Robert A. Heinlein</li>\n<li><a href=\"https://openlibrary.org/works/OL15936512W/Ready_Player_One\">Ready\nPlayer One</a> by Ernest Cline</li>\n<li><a href=\"https://openlibrary.org/works/OL16808654W/The_Circle\">The\nCircle</a> by Dave Eggers</li>\n<li><a href=\"https://openlibrary.org/works/OL17318135W/Notorious_RBG\">Notorious\nRBG</a> by Irin Carmon and Shana Knizhnik</li>\n<li><a href=\"https://openlibrary.org/works/OL17335914W/The_Three_Body_Problem \">The\nThree-Body Problem</a> by Cixin Liu</li>\n<li><a href=\"https://openlibrary.org/works/OL59852W/A_wizard_of_Earthsea\">A\nWizard of Earthsea</a> by Ursula K. Le Guin</li>\n<li><a href=\"https://openlibrary.org/works/OL271675W/Stoner\">Stoner</a>\nby John Williams</li>\n<li><a href=\"https://openlibrary.org/works/OL2670584W/Prost\">Prost! The\nStory of German Beer</a> by Horst D. Dornbusch</li>\n<li><a href=\"https://openlibrary.org/works/OL3673999W/Bock\">Bock</a> by\nDarryl Richman</li>\n<li><a href=\"https://openlibrary.org/works/OL2172532W/Do_Androids_Dream_of_Electric_Sheep\">Do\nAndroids Dream of Electric Sheep</a> by Philip K. Dick</li>\n<li><a href=\"https://openlibrary.org/works/OL15536410W/Room\">Room</a> by\nEmma Donoghue</li>\n<li><a href=\"https://openlibrary.org/works/OL3348011W/Kitchen_Confidential\">Kitchen\nConfidential: adventures in the culinary underbelly</a> by Anthony\nBourdain</li>\n<li><a href=\"https://openlibrary.org/works/OL17110026W/H_Is_for_Hawk\">H\nis for Hawk</a> by Helen Macdonald</li>\n<li><a href=\"https://openlibrary.org/works/OL497198W/Watchers\">Watchers</a>\nby Dean Koontz</li>\n<li><a href=\"https://openlibrary.org/works/OL59862W/The_Tombs_of_Atuan_(The_Earthsea_Cycle_Book_2)\">The\nTombs of Atuan</a> by Ursula K. Le Guin</li>\n<li><a href=\"https://openlibrary.org/works/OL3501731W/A_confederacy_of_dunces\">A\nConfederacy of Dunces</a> by John Kennedy Toole</li>\n<li><a href=\"https://openlibrary.org/works/OL17595809W/Everything_but_Espresso\">Everything\nbut Espresso</a> by Scott Rao</li>\n<li><a href=\"https://openlibrary.org/works/OL82592W/Harry_Potter_and_the_Sorcerer\'s_Stone\">Harry\nPotter and the Sorcerer’s Stone</a> by J.K. Rowling</li>\n<li><a href=\"https://openlibrary.org/works/OL16313123W/Harry_Potter_and_the_Chamber_of_Secrets\">Harry\nPotter and the Chamber of Secrets</a> by J.K. Rowling</li>\n<li><a href=\"https://openlibrary.org/works/OL13716956W/Harry_Potter_and_the_prisoner_of_Azkaban\">Harry\nPotter and the Prisoner of Azkaban</a> by J.K. Rowling</li>\n<li><a href=\"https://openlibrary.org/works/OL483571W/Naked_Lunch\">Naked\nLunch</a> by William S. Burroughs</li>\n<li><a href=\"https://openlibrary.org/works/OL1972516W/Code\">CODE: The\nHidden Language of Computer Hardware and Software</a> by Charles\nPetzold</li>\n<li><a href=\"https://openlibrary.org/works/OL2636674W/The_crying_of_lot_49\">The\nCrying of Lot 49</a> by Thomas Pynchon</li>\n<li><a href=\"https://openlibrary.org/works/OL15434618W/The_Best_Christmas_Pageant_Ever\">The\nBest Christmas Pageant Ever</a> by Barbara Robinson</li>\n<li><a href=\"https://openlibrary.org/works/OL82589W/Harry_Potter_and_the_goblet_of_fire\">Harry\nPotter and the Goblet of Fire</a> by J.K. Rowling</li>\n</ol>\n<p>I also <a href=\"https://tylercipriani.com/tags/books/\">reviewed</a> a couple of these books\nover the course of 2016, hopefully I can continue down that path in the\nyear to come.</p>\n</section>\n<section id=\"goals-for-2017\" class=\"level2\">\n<h2>Goals for 2017</h2>\n<p>I’m going to try to read roughly a book a week in 2017 – 50 books for\nthe year. Hopefully 50 books is an ambitious enough goal. Additionally,\nI’d like to try to do 6 book reviews on this blog as a means of:</p>\n<ul>\n<li>Tracking what I’ve read</li>\n<li>Checking my understanding</li>\n<li>Engaging and owning what I’ve read</li>\n</ul>\n<p>I’d also like to lay claim to my crazy ambitious plan to read 4\nwhole, real, grown-up (i.e., not beer- or computer-related) non-fiction\nbooks this year.</p>\n<p>As I’m proclaiming these goals publicly for the first time, I’m sure\nI’ll come up woefully and shamefully short – yay blogging! <img src=\"https://tylercipriani.com/smileys/smile.png\" alt=\":)\" /></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/12/12/book-review--code-by-charles-petzold/",

    "title": "Book Review: CODE by Charles Petzold",
    "url": "https://tylercipriani.com/blog/2016/12/12/book-review--code-by-charles-petzold/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2016-12-12T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p><a href=\"https://openlibrary.org/works/OL1972516W/Code\">CODE: The\nHidden Language of Computer Hardware and Software</a> by Charles\nPetzold</p>\n<p>The language of computer hardware and software is not particularly\nwell hidden in my experience. The more I interact with software, the\nmore those interactions reflect their makers and materials. This fact is\nslowly permeating the zeitgeist as we all, collectively, realize that <a\nhref=\"http://bits.blogs.nytimes.com/2015/03/16/facebook-explains-what-it-bans-and-why/\">facebook\nis not the</a> <a\nhref=\"https://act.eff.org/action/dear-facebook-authentic-names-are-authentically-dangerous-for-your-users\">open</a>\n<a\nhref=\"http://www.nytimes.com/2016/09/10/technology/facebook-vietnam-war-photo-nudity.html?_r=0\">internet</a>\n(no matter how much it may <a\nhref=\"https://info.internet.org/en/\">insist on its own benevolence</a>),\nand that the current state of AI is simply one of <a\nhref=\"http://idlewords.com/talks/sase_panel.htm\">money laundering for\nbias</a>. While it is increasingly true that our high-level interactions\nwith machines are <a\nhref=\"https://twitter.com/internetofshit\">broken</a>, it’s important to\nrecall that we haven’t fixed any of the low-level problems either (tried\nsubtracting <code>399999999999998</code> from\n<code>399999999999999</code> in Google’s calculator <a\nhref=\"https://blog.codinghorror.com/why-do-computers-suck-at-math/\">lately</a>?).</p>\n<p>These incredible Rube Goldberg, hacks-all-the-way-down, leaking piles\nof abstractions that are modern computers are fascinating and powerful.\nThe modern computer reveals its own history – each layer of abstraction\nrepresenting a previous geologic era. The <a\nhref=\"http://www.dave.org/oldplans.html\">ancient <code>.plan</code></a>\nfiles of the Sumerians and Hittites.</p>\n<p><em>CODE</em> builds forward through time. Revealing each innovation\nnecessary to create a fully functioning computer. It works its way\ntowards the modern computer starting with binary data representation\nusing <a href=\"https://www.morsecode.io/\">morse code</a>. From there it\ncovers non-base-10 number systems, telegraphs, electromagnets and the\ninvention of the relay, the flip-flop switch that allows temporary\nstorage of a single bit. All of this background culminates in a truly\nwonderful chapter in which you use this technology to build a fully\nfunctional computer in your mind’s eye.</p>\n<p>The book goes on to explain the <a\nhref=\"https://en.wikipedia.org/wiki/Von_Neumann_architecture\">Von\nNeumann architecture</a> and from there moves into topics with which I\nam more familiar – high level programming languages, object-oriented\nprogramming languages, and “The Graphical Revolution”. In these later\nchapters, an evident object-oriented/graphical/IDE as the logical\nend-point for computing bias rears its ugly head, but in a book\npublished by Microsoft Press it’s a surprisingly light touch.</p>\n<p><em>CODE</em> is one of the more interesting technical books I have\never read, and also one of the few that I read cover-to-cover over the\ncourse of a few reading sessions. It is a story rather than a series of\nideas surrounding a theme. It is a history book, not a handbook.</p>\n<p>My one critique is that the chapters after the climactic computer\nconstruction feel a bit disjointed. There is no real conclusion to the\nbook – I expected a more satisfying wrap-up than I was given. Instead of\na tying-up of loose-ends we move on to topics like object-oriented\nprogramming, and <a\nhref=\"https://en.wikipedia.org/wiki/IEEE_754-1985\">IEEE 754\nfloating-point numbers</a>. While the treatment this book provides these\ntopics is interesting, the organization is somewhat lacking.</p>\n<p>To spite the lack of organization towards the end of the book, I\nfound <em>CODE</em> a wonderful read and would have no qualms\nrecommending it to anyone at any level of computer literacy.</p>\n<p><em>Rating: 9/10</em></p>\n<blockquote>\n<p><em>Meta Note</em>:</p>\n<p>As part of my effort to delve more deeply into reading, I will be\nfeaturing more review-type content. I will be tagging it all with the\n“books” tag. If you hate this, you can subscribe to the RSS feed for\n“computing” to continue to read my insights on something I’m perhaps\neven the slightest bit qualified to talk about in any sort of informed\nway.</p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/11/13/coreboot-on-the-thinkpad-x220-with-a-raspberry-pi/",

    "title": "Coreboot on the ThinkPad X220 with a Raspberry Pi",
    "url": "https://tylercipriani.com/blog/2016/11/13/coreboot-on-the-thinkpad-x220-with-a-raspberry-pi/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "coreboot",

     "hardware",

     "notes"

    ],

    "date_published": "2016-11-13T00:00:00Z",
    "date_modified": "2019-02-21T20:59:13Z",


    "content_html": "<p>My work laptop is terrible. About a year and a half ago, when I\nstarted my current gig, I received an Asus Zenbook that has been the\nbane of my existence ever since. First, it is impossible to work outside\non this shiny monstrosity: all you see is your own dumb face squinting\nback at you, slightly obscured by very noticeable fingerprints from its\nmirror-like screen. Why are there fingerprints on the screen? Because,\noh yeah, it’s a terrible touchscreen for no real reason. While the\nkeyboard is serviceable, it is far from being a joy to use. There are no\nphysical mouse buttons which, on a Linux install, means I’m forever\nflailing, trying to get middle-click paste to work (LPT: I setup an\n<code>xdotool</code> shortcut to paste – doesn’t work in Emacs though…).\nThe Asus has also succumb to the Apple-esque use of dongles to replace\nall necessary ports (like Ethernet, FFS).</p>\n<p>The final straw for this ridiculous machine was, for a reason that is\nbeyond me, UEFI occasionally loses track of the boot drives and\n(although you can still <em>see</em>(!) the <code>.efi</code> file on\ndisk via the UEFI interface) it won’t let you add it as a boot drive\nuntil you’ve sweated enough and/or there is a sufficiently powerful\ncosmic ray to flip the bits necessary to allow you to continue your\nlife. This problem pretty much killed my productivity at my last offsite\n– as a result I decided to drop $500 and get a refurb ThinkPad X220 with\nmore RAM and a bigger SSD than the ($1800) Zenbook.</p>\n<section id=\"x-series-thinkpads-are-niiiiice\" class=\"level2\">\n<h2>X-Series ThinkPads are niiiiice</h2>\n<p>I have been using a ThinkPad X230t for the past 3 years, and,\nalthough the tablet is a little bulky, it has been everything I need in\na work laptop – matte screen, physical buttons for all the things, an\nEthernet port – it’s basically <em>not</em> an unbelievably stupid\nlaptop design (which is the bar now, evidently). The X220 I purchased\nfor work is even better – it’s slightly smaller (since it’s not also a\nWacom tablet), plus the X220 has a <em>nice</em> keyboard – which – holy\nshit! – remember when anyone actually cared about laptop keyboards‽</p>\n</section>\n<section id=\"i-am-become-hacker-destroyer-of-laptops\" class=\"level2\">\n<h2>I am become hacker, destroyer of laptops</h2>\n<p>One of the other reasons for buying the X220 is that I’ve heard-tell\n(A.K.A, did a quick DDG search) that it supports Coreboot (although,\nsadly, not Libreboot, yet). The actual incantations for flashing the ROM\non the X220 are spread over a few sources, with some sizable gaps in\nprocess.</p>\n<p>I spent the past 2 days pretty lost, flailing in the dark, booting my\nfreshly flashed laptop to a momentary flicker of the green power-light,\nno fans, nothing, sighing, and compiling again. Now I stand victorious,\nDebian stable (8.6 as of November 2016) is booting from SeaBIOS.</p>\n<p>I kept a lot of notes on the process. Hopefully, these notes save\nsomeone some frustration, or make this process a tiny bit more\napproachable.</p>\n<p><strong>Caveat Emptor</strong> – I’m terrible at hardware stuff and\nwriting, so follow these steps at your own peril!</p>\n</section>\n<section id=\"things-you-need\" class=\"level2\">\n<h2>Things you need</h2>\n<ul>\n<li>Lonovo ThinkPad X220</li>\n<li><a href=\"https://www.adafruit.com/products/954\">USB to TTY Serial\nCable</a></li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B01CD5VC92/ref=oh_aui_detailpage_o00_s00?ie=UTF8&amp;psc=1\">Raspberry\nPi 3 Model B</a></li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B00HHH65T4/ref=oh_aui_detailpage_o01_s00?ie=UTF8&amp;psc=1\">Pomona\nSOIC8 5250 Test Clip</a></li>\n<li>8x <a href=\"https://www.adafruit.com/products/266\">Female Jumper\nWire</a></li>\n<li>An HDMI monitor and external keyboard (possibly, you may be able to\nfigure out how to do this without one)</li>\n<li>Another computer that will act as your Raspberry Pi terminal via the\nUSB to TTY serial cable (is what I did anyway)</li>\n</ul>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/13/0a884ef61214ae613c739a1460245b6da8c506/x220-spi-raspberry-pi-in-screen-1280.jpg\"\nalt=\"What the whole flashing setup looked like for me X230 -&gt; USB-to-TTY -&gt; Raspberry Pi -&gt; Pomona Clip -&gt; X220\" />\n<figcaption aria-hidden=\"true\"><a\nhref=\"https://photos.tylercipriani.com/thumbs/13/0a884ef61214ae613c739a1460245b6da8c506/x220-spi-raspberry-pi-in-screen-original.jpg\">What\nthe whole flashing setup looked like for me X230 -&gt; USB-to-TTY -&gt;\nRaspberry Pi -&gt; Pomona Clip -&gt; X220</a></figcaption>\n</figure>\n</section>\n<section id=\"thinkpad-x220-disassembly\" class=\"level2\">\n<h2>ThinkPad X220 Disassembly</h2>\n<ol type=\"1\">\n<li>Remove Keyboard and palmrest (follow <a\nhref=\"https://support.lenovo.com/us/en/videos/pd022683\">Lonovo’s\nGuide</a>)\n<ul>\n<li>Power down and remove battery</li>\n<li>I removed the keyboard and palm rest in 2 separate steps.</li>\n<li>Flip over and remove the 7 screws holding the keyboard and palmrest\nin place (they all have a picture of a square with 3 buttons [trackpad,\nI guess] near them).</li>\n<li><strong>WARNING</strong> – 2 of these screws are different sizes\nthan the other 5! The ones closest to the front-edge of the laptop are\nshorter, keep them seperate.</li>\n<li>Locations Diagram:</li>\n</ul>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">Bottom</span> of the ThinkPad <span class=\"at\">--</span> <span class=\"st\">&#39;X&#39;</span> marks screws to be removed</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">+-----------------------------------------------------------+</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>   <span class=\"ex\">xxxxxxxxxxxx</span> Battery xxxxxxxxxxxxxxxxxxxxxxxxx          <span class=\"kw\">|</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>   <span class=\"ex\">xxxxxxxxxxxxx</span> Area xxxxxxxxxxxxxxxxxxxxxxxxxxx          <span class=\"kw\">|</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>                                                           <span class=\"kw\">|</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>                                                           <span class=\"kw\">|</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>                                                           <span class=\"kw\">|</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>              <span class=\"ex\">+----X----------------+</span>                      <span class=\"kw\">|</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>              <span class=\"kw\">|</span>                     <span class=\"kw\">|</span>                      <span class=\"kw\">|</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>              <span class=\"kw\">|</span>      <span class=\"ex\">Memory</span>         <span class=\"kw\">|</span>                      <span class=\"kw\">|</span></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>              <span class=\"kw\">|</span>       <span class=\"ex\">Door</span>          <span class=\"kw\">|</span>                      <span class=\"kw\">|</span></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>   <span class=\"ex\">X</span>          <span class=\"kw\">|</span>        <span class=\"ex\">X</span>            <span class=\"kw\">|</span>             <span class=\"ex\">X</span>        <span class=\"kw\">|</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>      <span class=\"ex\">X</span>       +---------------------+                      <span class=\"kw\">|</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>                  <span class=\"ex\">X</span>               X                        <span class=\"kw\">|</span></span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">+-----------------------------------------------------------+</span></span></code></pre></div>\n<ul>\n<li>Flip it over, push the keyboard back, pull up the tabs near the\npalmrest.</li>\n<li>Rest the removed keyboard on the palmrest and remove ribbon cable\nfrom the motherboard.</li>\n<li>Flip palmrest up, and click the ribbon cable holding it in place,\nremove it.</li>\n<li>Lift tape on the left side of motherboard covering the chip you’re\nlooking for.</li>\n<li>The BIOS chip you are looking for is <strong>right there</strong> –\nthe left-front of the motherboard if the screen is facing you.</li>\n</ul></li>\n</ol>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/de/8c2006845e8c04acda39da8c1ff39b6330175e/pomona-clip-on-x220-1280.jpg\"\nalt=\"Pomona 5250 attached to BIOS clip on ThinkPad X220\" />\n<figcaption aria-hidden=\"true\"><a\nhref=\"https://photos.tylercipriani.com/thumbs/de/8c2006845e8c04acda39da8c1ff39b6330175e/pomona-clip-on-x220-original.jpg\">Pomona\n5250 attached to BIOS clip on ThinkPad X220</a></figcaption>\n</figure>\n</section>\n<section id=\"setup-your-pi-as-a-flasher\" class=\"level2\">\n<h2>Setup Your Pi as a Flasher</h2>\n<p>Now that you have access to the BIOS chip, you should setup your\nRaspberry Pi, and attach it to the Pomona 5250 clip via the SPI pins.\nUnfortunately, you do seem to need a monitor with HDMI to setup the Pi\n(someone better at Raspberry Pi things may know better).</p>\n<p>After the initial setup I was able to switch to using a serial cable\ninterface.</p>\n<blockquote>\n<p><strong>GIANT HUGE WARNING OF DOOM</strong>: Hook your Pomona clip to\nyour motherboard <strong>ONLY WITH THE BATTERY REMOVED, THE X220\nUNPLUGGED, AAAANNDDD THE RASPBERRY PI OFF!!!!</strong> You could\nprobably fry this chip. I don’t actually know, but I was paranoid about\nit throughout the process. Power on the Raspberry Pi only when you’re\ncertain the Pomona clip is secure.</p>\n</blockquote>\n<ol type=\"1\">\n<li><p>Download the <a\nhref=\"https://www.raspberrypi.org/downloads/raspbian/\">Raspbian Lite</a>\ntorrent</p></li>\n<li><p>Unzip the rasbian zip file and copy to an sd card</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">dd</span> bs=4M if=rasbian-lite.img of=/dev/<span class=\"op\">&lt;</span>partition of sd card<span class=\"op\">&gt;</span></span></code></pre></div></li>\n<li><p>Hook up your Raspberry Pi to a monitor and boot</p></li>\n<li><p>Change password using <code>passwd</code> (default user/pass:\n<code>pi</code>/<code>raspberry</code>)</p></li>\n<li><p>Setup wifi by editing\n<code>/etc/wpa_supplicant/wpa_supplicant.conf</code></p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">network</span><span class=\"op\">=</span>{</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">ssid</span><span class=\"op\">=</span><span class=\"st\">&quot;YOUR_SSID&quot;</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"va\">psk</span><span class=\"op\">=</span><span class=\"st\">&quot;YOUR_PASSWORD&quot;</span></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"er\">}</span></span></code></pre></div></li>\n<li><p>Edit <code>/boot/config.txt</code></p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">dtparam</span><span class=\"op\">=</span>spi=on</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">enable_uart</span><span class=\"op\">=</span>1</span></code></pre></div></li>\n<li><p>Now you can reboot and hook to a serial cable:</p>\n<p>Serial cable hookup diagram:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">Edge</span> of pi <span class=\"er\">(</span><span class=\"ex\">furthest</span> from you<span class=\"kw\">)</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">L</span>    PWR       GND  TXD  RXD</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span>      <span class=\"kw\">|</span>         <span class=\"kw\">|</span>    <span class=\"kw\">|</span>    <span class=\"kw\">|</span></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">F</span> +----v---------v----v----v-------------------------------------------------------------------------------+</span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">T</span> <span class=\"kw\">|</span>    <span class=\"ex\">x</span>    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    <span class=\"kw\">|</span></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>    <span class=\"ex\">x</span>    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    <span class=\"kw\">|</span></span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span> +--------------------------------------------------------------------------------------------------------+</span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">D</span></span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">G</span></span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span></span>\n<span id=\"cb5-11\"><a href=\"https://tylercipriani.com/blog/#cb5-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">Body</span> of Pi <span class=\"er\">(</span><span class=\"ex\">closest</span> to you<span class=\"kw\">)</span></span></code></pre></div></li>\n<li><p>Install all the pre-req software working mostly from github wiki\npage <a\nhref=\"https://github.com/bibanon/Coreboot-ThinkPads/wiki/Hardware-Flashing-with-Raspberry-Pi\">Hardware\nFlashing with Raspberry Pi</a></p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get update <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">sudo</span> apt-get dist-upgrade <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">sudo</span> reboot</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get update <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">sudo</span> apt-get install libftdi1 libftdi-dev libusb-dev libpci-dev subversion</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get install build-essential pciutils usbutils libpci-dev libusb-dev libftdi1 libftdi-dev zlib1g-dev subversion</span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">svn</span> co svn://flashrom.org/flashrom/trunk flashrom</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> flashrom</span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> make install</span></code></pre></div>\n<p>Add the SPI kernal modules to <code>/etc/modules</code> so they\npersist between boots.</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> modprobe spi_bcm2835</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> modprobe spidev</span></code></pre></div></li>\n<li><p>Power down the Pi, Hook your Pi to your Pomona clip, then hook\nthe Pomona clip to the motherboard, and power back up.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/1f/2067e7cd72a601f189c9cd60f17c3ecbac0039/pomona-clip-to-raspberry-pi-1280.jpg\"\nalt=\"Raspberry Pi 3 attached to ThinkPad X220 Pomona Clip\" />\n<figcaption aria-hidden=\"true\"><a\nhref=\"https://photos.tylercipriani.com/thumbs/1f/2067e7cd72a601f189c9cd60f17c3ecbac0039/pomona-clip-to-raspberry-pi-original.jpg\">Raspberry\nPi 3 attached to ThinkPad X220 Pomona Clip</a></figcaption>\n</figure>\n<p>X220 BIOS Chip pinout</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Screen</span> <span class=\"er\">(</span><span class=\"ex\">furthest</span> from you<span class=\"kw\">)</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>             <span class=\"ex\">__</span></span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">MOSI</span>  5 <span class=\"at\">--</span><span class=\"kw\">|</span>  <span class=\"kw\">|</span><span class=\"ex\">--</span> 4  GND</span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">CLK</span>  6 <span class=\"at\">--</span><span class=\"kw\">|</span>  <span class=\"kw\">|</span><span class=\"ex\">--</span> 3  N/C</span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">N/C</span>  7 <span class=\"at\">--</span><span class=\"kw\">|</span>  <span class=\"kw\">|</span><span class=\"ex\">--</span> 2  MISO</span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">VCC</span>  8 <span class=\"at\">--</span><span class=\"kw\">|</span><span class=\"ex\">__</span><span class=\"kw\">|</span><span class=\"ex\">--</span> 1  CS</span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">Edge</span> <span class=\"er\">(</span><span class=\"ex\">closest</span> to you<span class=\"kw\">)</span></span></code></pre></div>\n<p>PI Pinout</p>\n<p><strong>WARNING!!!</strong> This is the pinout for the\n<strong>RASPBERRY PI 3 MODEL B V1.2</strong> it has 40 pins rather than\n26</p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">Edge</span> of pi <span class=\"er\">(</span><span class=\"ex\">furthest</span> from you<span class=\"kw\">)</span></span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">L</span>                                                             CS</span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span>                                                             <span class=\"kw\">|</span></span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">F</span> +--------------------------------------------------------------------------------------------------------+</span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">T</span> <span class=\"kw\">|</span>    <span class=\"ex\">x</span>    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    <span class=\"kw\">|</span></span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"kw\">|</span>    <span class=\"ex\">x</span>    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    x    <span class=\"kw\">|</span></span>\n<span id=\"cb9-7\"><a href=\"https://tylercipriani.com/blog/#cb9-7\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span> +--------------------------------------------^----^----^----^---------------------------------------^----+</span>\n<span id=\"cb9-8\"><a href=\"https://tylercipriani.com/blog/#cb9-8\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">D</span>                                              <span class=\"kw\">|</span>    <span class=\"kw\">|</span>    <span class=\"kw\">|</span>    <span class=\"kw\">|</span>                                       <span class=\"kw\">|</span></span>\n<span id=\"cb9-9\"><a href=\"https://tylercipriani.com/blog/#cb9-9\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">G</span>                                             3.3V  MOSI MISO <span class=\"kw\">|</span>                                      <span class=\"ex\">GND</span></span>\n<span id=\"cb9-10\"><a href=\"https://tylercipriani.com/blog/#cb9-10\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">E</span>                                           <span class=\"er\">(</span><span class=\"ex\">VCC</span><span class=\"kw\">)</span>            <span class=\"ex\">CLK</span></span>\n<span id=\"cb9-11\"><a href=\"https://tylercipriani.com/blog/#cb9-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">Body</span> of Pi <span class=\"er\">(</span><span class=\"ex\">closest</span> to you<span class=\"kw\">)</span></span></code></pre></div></li>\n<li><p>See if <code>flashrom</code> can detect your chipset (if you see\n<code>No EEPROM/flash device found.</code> double check your connections\nand the pins for your pi – I realized I had my pins setup as if I were\non the 26-GPIO pin Raspberry Pi rather than the 40-GPIO pin model 3)</p>\n<blockquote>\n<p><strong>NOTE</strong>: 2018-04-06</p>\n<p>One person emailed to indicate that the flashrom commands below\nrequired setting an <code>spispeed</code>, i.e.,\n<code>sudo flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=512</code></p>\n</blockquote>\n<div class=\"sourceCode\" id=\"cb10\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">pi@raspberrypi:~$</span> sudo flashrom <span class=\"at\">-p</span> linux_spi:dev=/dev/spidev0.0</span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">flashrom</span> v0.9.9-r1954 on Linux 4.4.26-v7+ <span class=\"er\">(</span><span class=\"ex\">armv7l</span><span class=\"kw\">)</span></span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">flashrom</span> is free software, get the source code at https://flashrom.org</span>\n<span id=\"cb10-4\"><a href=\"https://tylercipriani.com/blog/#cb10-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb10-5\"><a href=\"https://tylercipriani.com/blog/#cb10-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Calibrating</span> delay loop... OK.</span>\n<span id=\"cb10-6\"><a href=\"https://tylercipriani.com/blog/#cb10-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Found</span> Winbond flash chip <span class=\"st\">&quot;W25Q64.V&quot;</span> <span class=\"er\">(</span><span class=\"ex\">8192</span> kB, SPI<span class=\"kw\">)</span> <span class=\"ex\">on</span> linux_spi.</span>\n<span id=\"cb10-7\"><a href=\"https://tylercipriani.com/blog/#cb10-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">No</span> operations were specified.</span></code></pre></div></li>\n<li><p>Read your flashchip and verify that the md5sums match. If the\nmd5sums of your reads don’t match repeat steps 9 and 10 until they do.\nIf they never do, check your wiring with a multimeter (I had to do this\nat one point).</p>\n<div class=\"sourceCode\" id=\"cb11\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">pi@raspberrypi:~$</span> sudo flashrom <span class=\"at\">-p</span> linux_spi:dev=/dev/spidev0.0 <span class=\"at\">-r</span> flash01.bin</span>\n<span id=\"cb11-2\"><a href=\"https://tylercipriani.com/blog/#cb11-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">pi@raspberrypi:~$</span> sudo flashrom <span class=\"at\">-p</span> linux_spi:dev=/dev/spidev0.0 <span class=\"at\">-r</span> flash02.bin</span>\n<span id=\"cb11-3\"><a href=\"https://tylercipriani.com/blog/#cb11-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">pi@raspberrypi:~$</span> md5sum flash01.bin flash02.bin</span></code></pre></div></li>\n<li><p>Download coreboot on the Pi. Compile and use <code>ifdtool</code>\nto extract all the needed bits to all the right places in the coreboot\n<code>blobs</code> directory.</p>\n<div class=\"sourceCode\" id=\"cb12\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> clone http://review.coreboot.org/coreboot.git ~/coreboot</span>\n<span id=\"cb12-2\"><a href=\"https://tylercipriani.com/blog/#cb12-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/coreboot</span>\n<span id=\"cb12-3\"><a href=\"https://tylercipriani.com/blog/#cb12-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> submodule update <span class=\"at\">--init</span> <span class=\"at\">--recursive</span></span>\n<span id=\"cb12-4\"><a href=\"https://tylercipriani.com/blog/#cb12-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/coreboot/util/ifdtool</span>\n<span id=\"cb12-5\"><a href=\"https://tylercipriani.com/blog/#cb12-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span>\n<span id=\"cb12-6\"><a href=\"https://tylercipriani.com/blog/#cb12-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> make install</span>\n<span id=\"cb12-7\"><a href=\"https://tylercipriani.com/blog/#cb12-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~</span>\n<span id=\"cb12-8\"><a href=\"https://tylercipriani.com/blog/#cb12-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ifdtool</span> <span class=\"at\">-x</span> ~/flash01.bin</span>\n<span id=\"cb12-9\"><a href=\"https://tylercipriani.com/blog/#cb12-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> <span class=\"at\">-p</span> ~/coreboot/3rdparty/blobs/mainboard/lenovo/x220</span>\n<span id=\"cb12-10\"><a href=\"https://tylercipriani.com/blog/#cb12-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/coreboot/3rdparty/blobs/mainboard/lenovo/x220</span>\n<span id=\"cb12-11\"><a href=\"https://tylercipriani.com/blog/#cb12-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mv</span> ~/flashregion_0_flashdescriptor.bin descriptor.bin</span>\n<span id=\"cb12-12\"><a href=\"https://tylercipriani.com/blog/#cb12-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mv</span> ~/flashregion_2_intel_me.bin me.bin</span>\n<span id=\"cb12-13\"><a href=\"https://tylercipriani.com/blog/#cb12-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mv</span> ~/flashregion_3_gbe.bin gbe.bin</span></code></pre></div>\n<blockquote>\n<p><strong>NOTE</strong>: 2017-06-15</p>\n<p>Thomas Maulbeck emailed me and mentioned that\n<code>git submodule update --init --recursive</code> did not populate\nthe <code>3rdparty/blobs</code> directory. It seems that\n<code>.gitmodules</code> for coreboot has several urls that look in the\nparent directory for bare git repositories that don’t exist in the setup\nI’ve described in this post.</p>\n<p>Maulbeck was able to work around compilation errors by cloning\n<code>3rdparty/blobs</code> directly:</p>\n<div class=\"sourceCode\" id=\"cb13\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb13-1\"><a href=\"https://tylercipriani.com/blog/#cb13-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/coreboot/3rdparty</span>\n<span id=\"cb13-2\"><a href=\"https://tylercipriani.com/blog/#cb13-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> clone http://review.coreboot.org/p/blobs.git</span></code></pre></div>\n<p>If compilation fails with some mention of a missing\n<code>3rdparty/blobs/cpu/intel/model_206ax/microcode.bin</code> this may\nbe the root cause.</p>\n</blockquote></li>\n<li><p>Build coreboot on the Pi <a\nhref=\"https://www.coreboot.org/Build_HOWTO\">following the wiki\ninstructions</a></p>\n<ul>\n<li>configure via (<strong>note</strong> – this is completely\ncargo-culted bullshit and YMMV…a lot) <code>make nconfig</code></li>\n</ul>\n<div class=\"sourceCode\" id=\"cb14\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">general</span></span>\n<span id=\"cb14-2\"><a href=\"https://tylercipriani.com/blog/#cb14-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span> [<span class=\"pp\">*</span>] Compress ramstage with LZMA</span>\n<span id=\"cb14-3\"><a href=\"https://tylercipriani.com/blog/#cb14-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span> [<span class=\"pp\">*</span>] Include coreboot .config file into the ROM image</span>\n<span id=\"cb14-4\"><a href=\"https://tylercipriani.com/blog/#cb14-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span> [<span class=\"pp\">*</span>] Allow use of binary-only repository</span>\n<span id=\"cb14-5\"><a href=\"https://tylercipriani.com/blog/#cb14-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">mainboard</span></span>\n<span id=\"cb14-6\"><a href=\"https://tylercipriani.com/blog/#cb14-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  Mainboard vendor <span class=\"er\">(</span><span class=\"ex\">Lenovo</span><span class=\"kw\">)</span></span>\n<span id=\"cb14-7\"><a href=\"https://tylercipriani.com/blog/#cb14-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  Mainboard model <span class=\"er\">(</span><span class=\"ex\">ThinkPad</span> X220<span class=\"kw\">)</span></span>\n<span id=\"cb14-8\"><a href=\"https://tylercipriani.com/blog/#cb14-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  ROM chip size <span class=\"er\">(</span><span class=\"ex\">8192</span> KB <span class=\"er\">(</span><span class=\"ex\">8</span> MB<span class=\"kw\">))</span></span>\n<span id=\"cb14-9\"><a href=\"https://tylercipriani.com/blog/#cb14-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  <span class=\"er\">(</span><span class=\"ex\">0x100000</span><span class=\"kw\">)</span> <span class=\"ex\">Size</span> of CBFS filesystem in ROM</span>\n<span id=\"cb14-10\"><a href=\"https://tylercipriani.com/blog/#cb14-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">chipset</span></span>\n<span id=\"cb14-11\"><a href=\"https://tylercipriani.com/blog/#cb14-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span> [<span class=\"pp\">*</span>] Enable VMX for virtualization</span>\n<span id=\"cb14-12\"><a href=\"https://tylercipriani.com/blog/#cb14-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  Include CPU microcode in CBFS <span class=\"er\">(</span><span class=\"ex\">Generate</span> from tree<span class=\"kw\">)</span></span>\n<span id=\"cb14-13\"><a href=\"https://tylercipriani.com/blog/#cb14-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">-</span>  Flash ROM locking on S3 resume <span class=\"er\">(</span><span class=\"ex\">Don</span><span class=\"st\">&#39;t lock ROM sections on S3 resume)</span></span>\n<span id=\"cb14-14\"><a href=\"https://tylercipriani.com/blog/#cb14-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Add Intel descriptor.bin file</span></span>\n<span id=\"cb14-15\"><a href=\"https://tylercipriani.com/blog/#cb14-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">      (3rdparty/blobs/mainboard/$(MAINBOARDDIR)/descriptor.bin) Path and filename of the descriptor.bin file</span></span>\n<span id=\"cb14-16\"><a href=\"https://tylercipriani.com/blog/#cb14-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Add Intel ME/TXE firmware</span></span>\n<span id=\"cb14-17\"><a href=\"https://tylercipriani.com/blog/#cb14-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">      (3rdparty/blobs/mainboard/$(MAINBOARDDIR)/me.bin) Path to management engine firmware</span></span>\n<span id=\"cb14-18\"><a href=\"https://tylercipriani.com/blog/#cb14-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Add gigabit ethernet firmware</span></span>\n<span id=\"cb14-19\"><a href=\"https://tylercipriani.com/blog/#cb14-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">      (3rdparty/blobs/mainboard/$(MAINBOARDDIR)/gbe.bin) Path to gigabit ethernet firmware</span></span>\n<span id=\"cb14-20\"><a href=\"https://tylercipriani.com/blog/#cb14-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">devices</span></span>\n<span id=\"cb14-21\"><a href=\"https://tylercipriani.com/blog/#cb14-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Use native graphics initialization</span></span>\n<span id=\"cb14-22\"><a href=\"https://tylercipriani.com/blog/#cb14-22\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">display</span></span>\n<span id=\"cb14-23\"><a href=\"https://tylercipriani.com/blog/#cb14-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - (nothing checked)</span></span>\n<span id=\"cb14-24\"><a href=\"https://tylercipriani.com/blog/#cb14-24\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">generic drivers</span></span>\n<span id=\"cb14-25\"><a href=\"https://tylercipriani.com/blog/#cb14-25\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Support Intel PCI-e WiFi adapters</span></span>\n<span id=\"cb14-26\"><a href=\"https://tylercipriani.com/blog/#cb14-26\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] PS/2 keyboard init</span></span>\n<span id=\"cb14-27\"><a href=\"https://tylercipriani.com/blog/#cb14-27\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">console</span></span>\n<span id=\"cb14-28\"><a href=\"https://tylercipriani.com/blog/#cb14-28\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Squelch AP CPUs from early console.</span></span>\n<span id=\"cb14-29\"><a href=\"https://tylercipriani.com/blog/#cb14-29\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">      [*] Show POST codes on the debug console</span></span>\n<span id=\"cb14-30\"><a href=\"https://tylercipriani.com/blog/#cb14-30\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">system tables</span></span>\n<span id=\"cb14-31\"><a href=\"https://tylercipriani.com/blog/#cb14-31\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Generate SMBIOS tables</span></span>\n<span id=\"cb14-32\"><a href=\"https://tylercipriani.com/blog/#cb14-32\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">payload</span></span>\n<span id=\"cb14-33\"><a href=\"https://tylercipriani.com/blog/#cb14-33\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - Add a payload (SeaBIOS)</span></span>\n<span id=\"cb14-34\"><a href=\"https://tylercipriani.com/blog/#cb14-34\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - SeaBIOS version (master)</span></span>\n<span id=\"cb14-35\"><a href=\"https://tylercipriani.com/blog/#cb14-35\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - (3000) PS/2 keyboard controller initialization timeout (milliseconds)</span></span>\n<span id=\"cb14-36\"><a href=\"https://tylercipriani.com/blog/#cb14-36\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Harware init during option ROM execution</span></span>\n<span id=\"cb14-37\"><a href=\"https://tylercipriani.com/blog/#cb14-37\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Include generated option rom that implements legacy VGA BIOS compatibility</span></span>\n<span id=\"cb14-38\"><a href=\"https://tylercipriani.com/blog/#cb14-38\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - [*] Use LZMA compression for payloads</span></span>\n<span id=\"cb14-39\"><a href=\"https://tylercipriani.com/blog/#cb14-39\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">debugging</span></span>\n<span id=\"cb14-40\"><a href=\"https://tylercipriani.com/blog/#cb14-40\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">    - (nothing checked)</span></span></code></pre></div>\n<blockquote>\n<p><strong>NOTE</strong>: 2018-04-06</p>\n<p>One person emailed to mention that <code>make nconfig</code> may\nrequire a number of dependencies, see the <a\nhref=\"https://www.coreboot.org/Build_HOWTO#debian\">coreboot wiki</a> for\na complete list. As of this writing that list reads:\n<code>apt-get install git build-essential gnat flex bison libncurses5-dev wget zlib1g-dev</code></p>\n</blockquote>\n<ul>\n<li>Compile coreboot!</li>\n</ul>\n<div class=\"sourceCode\" id=\"cb15\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb15-1\"><a href=\"https://tylercipriani.com/blog/#cb15-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span> crossgcc-i386 CPUS=4</span>\n<span id=\"cb15-2\"><a href=\"https://tylercipriani.com/blog/#cb15-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span> iasl</span>\n<span id=\"cb15-3\"><a href=\"https://tylercipriani.com/blog/#cb15-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span></code></pre></div>\n<blockquote>\n<p><strong>EDIT – 2016-11-27</strong> Andreas Sinninger pointed out I\nwas missing the path to the Intel ME/TXE firmware – corrected.</p>\n</blockquote></li>\n<li><p>FINALLY! Flash your new <code>coreboot.rom</code> to your rom\nchip:\n<code>{.bash}     pi@raspberrypi:~$ sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -r flash01.bin     pi@raspberrypi:~$ sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -r flash02.bin     pi@raspberrypi:~$ md5sum flash01.bin flash02.bin  # if these don\'t match, stop, turn off the pi, fiddle with the Pomona clip, repeat this step     pi@raspberrypi:~$ sudo flashrom -p linux_spi:dev=/dev/spidev0.0 -w ~/coreboot/build/coreboot.rom</code></p></li>\n</ol>\n<p>If your laptop boots up to a SeaBIOS screen at this point: you win!\nIf not, don’t despair, you can flash <code>flash01.bin</code> to go back\nto your old BIOS, or, better yet, keep compiling until it works.</p>\n</section>\n<section id=\"resources\" class=\"level2\">\n<h2>Resources</h2>\n<p>These are some general resources without which my X220 would be a\npathetic pile of smashed up silicon by now.</p>\n<ul>\n<li><a href=\"https://www.coreboot.org/Board:lenovo/x220\">ThinkPad X220\non the coreboot wiki</a></li>\n<li><a\nhref=\"https://github.com/bibanon/Coreboot-ThinkPads/wiki/Hardware-Flashing-with-Raspberry-Pi\">GitHub\nCoreboot-ThinkPad wiki, Hardware Flashing with Raspberry Pi</a></li>\n<li><a href=\"https://blog.noq2.net/corebooting-thinkpad-x230.html\">noq2\n- Corebooting ThinkPad x230</a></li>\n<li><a href=\"https://www.ericholzbach.net/blog/x230_coreboot/\">Eric\nHolzback - Coreboot on the Lonovo X230</a></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/11/07/my-remote-desk/",

    "title": "My Remote Desk",
    "url": "https://tylercipriani.com/blog/2016/11/07/my-remote-desk/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2016-11-07T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<section id=\"remote-culture\" class=\"level2\">\n<h2>Remote Culture</h2>\n<section id=\"a-rant\" class=\"level3\">\n<h3>A rant</h3>\n<p>It doesn’t make sense to mandate that I sit in the same building as\nyou to work on things somewhat related to the things you work on. By\nrecognizing this fact, both employers and employees now have a great\ndeal of freedom (for some value of the word “freedom”). Employers can\nhire people from across the globe, and employees can live anywhere on\nsaid globe.</p>\n<p>When I tell people I work from home I rarely get any sympathy, but\nthe fact is that working remotely is harder than working in an office\nfor millions of little reasons. The in-office workplace is the default –\nif you’ve ever had a job chances are you went to a building some place\nto do that job with other folks that did a slightly different job who\nwere (at least nominally) working towards the same goals as you. And\noooh the things you took for granted in your cushy IRL job!</p>\n<p>That meeting that was loosely scheduled for 4pm? I’ve got some time\nnow, what if we just scrap project Foo? Work for you? Cool.\n<code>{{done}}</code>. No one updated their calendars. No one likely\nbothered to update the documentation for the project Foo. I can just\nwalk down the hall and talk to Jan faster than I can update the office\nwiki which is always hopelessly out-of-date anyway. Nobody checks the\nmailing list, everyone knows if there are project Foo questions, they\ncan just ask me. Problem. Solved.</p>\n<p>Remote companies cannot be this lazy.</p>\n<p>It’s not just that remote work is lonely (it is). It’s not just that\nit’s hard to find a good place to work when you’re remote (it is hard).\nIt’s a million little things – documenting the little decisions so that\nwhen someone on the other side of the world wakes up, they don’t have\nquestions (because you won’t be around to answer them), keeping the\noffice wiki up-to-date, making sure to post big changes to the mailing\nlist.</p>\n<p>Being “remote friendly” is not a thing, having a remote culture is.\nRemote culture is something that everyone has to cultivate\nconstantly.</p>\n</section>\n</section>\n<section id=\"remote-desks\" class=\"level2\">\n<h2>Remote Desks</h2>\n<p>The Wikimedia Foundation strives for a remote culture. There are\nconstant and seemingly innumerable challenges – both big and small, both\ntechnical and cultural.</p>\n<p>A couple of months ago there was an email thread on the staff mailing\nlist that attempted to assail one of the remaining bastions of privilege\nexclusive to the physical, IRL office-worker: seeing people’s desks!</p>\n<p>Walking around a physical office you see people’s personalities laid\nout in physical space. You may discover that you have similar interests\nor hobbies, you may learn about a new topic, or you may discover the\nvery key to existence simply by craning your neck slightly to take a\ngood, long, hard look at another person’s pile of accumulated doo-dads\nand brick-a-brack.</p>\n<p>Filled with this understanding, we shared our desks, and the things\non them.</p>\n</section>\n<section id=\"my-desk\" class=\"level2\">\n<h2>My Desk</h2>\n<p>This is what my desk looked like in September of 2016.</p>\n<figure>\n<img\nsrc=\"https://photos.tylercipriani.com/thumbs/30/2bd9e9e55c890d301f76822eec57656facd2d2/tyler-cipriani-desk-1280.jpg\"\nalt=\"My Desk\" />\n<figcaption aria-hidden=\"true\"><a\nhref=\"https://photos.tylercipriani.com/thumbs/30/2bd9e9e55c890d301f76822eec57656facd2d2/tyler-cipriani-desk-original.jpg\">My\nDesk</a></figcaption>\n</figure>\n<p>Some of the the things on my desk, and some of the reasons for some\nof the things on it (in no order):</p>\n<ol type=\"1\">\n<li><a href=\"http://shop.oreilly.com/product/0636920032823.do\">Data\nScience at the Command Line</a></li>\n<li><a\nhref=\"https://lostartpress.com/products/the-anarchists-design-book\">The\nAnarchist’s Design Book</a></li>\n<li><a href=\"https://archive.org/details/G0030009\">Phantom II Drone\n(with a GoPro Hero 3+)</a></li>\n<li><a\nhref=\"https://www.amazon.com/dp/B00D76RNLS/ref=cm_sw_su_dp\">Manfrotto\nMTPIXI-B PIXI Mini Tripod</a></li>\n<li><a href=\"http://joby.com/gorillapod/gorillapod-slr-zoom\">Joby\nGorillaPod SLR-Zoom Tripod</a></li>\n<li>Some rusty pliers</li>\n<li>A 12’ Tape measure</li>\n<li><a href=\"https://fi.google.com\">Google Fi powered Nexus 5x</a> - I\ndislike this phone</li>\n<li>2x <a\nhref=\"https://supporters.eff.org/shop/laptop-camera-cover-set\">EFF.org\nLaptop Camera Covers</a></li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B00406YZGK/ref=oh_aui_detailpage_o03_s01?ie=UTF8&amp;psc=1\">USB\nBarcode Reader</a> for my <a href=\"https://tylercipriani.com/tags/books/\">Library\nProject</a>.</li>\n<li><a href=\"https://www.lockpickshop.com/MPXS-14.html\">SouthOrd MPXS-14\nLock Pick Set</a> and a few MasterLocks for practice</li>\n<li><a href=\"https://en.wikipedia.org/wiki/Design_Patterns\">GoF\nBook</a></li>\n<li><a\nhref=\"https://www.amazon.com/gp/product/B00LZS5EEI/ref=oh_aui_search_detailpage?ie=UTF8&amp;psc=1\">Brother\nHL-L2340DW Compact Laser Printer</a> $99 – best printer ever.</li>\n<li>3M LX550 Notebook riser – no need for a monitor, works great.</li>\n<li><a\nhref=\"http://mechanicalkeyboards.com/shop/index.php?l=product_detail&amp;p=458\">Vortex\nPoker II (with Cherry MX-Blues)</a></li>\n<li>A barcode that says “HI” to test out the barcode scanner</li>\n<li><a href=\"https://evoluent.com/\">Evoluent VerticalMouse</a></li>\n<li>Fair casino dice to generate <a\nhref=\"http://world.std.com/~reinhold/diceware.html\">diceware\npassphrases</a></li>\n<li>A desktop background from <a\nhref=\"http://apod.nasa.gov/apod/\">NASA</a> (there’s a thing in my <a\nhref=\"https://github.com/thcipriani/dotfiles/blob/master/bin/nasapod\">dotfiles</a>\nto download a new one daily)</li>\n<li><a href=\"https://www.sparkfun.com/products/12016\">SparkFun Cerberus\nUSB Cable</a></li>\n<li>Vintage Kodak ad of a kid with a squirrel to liven-up the joint</li>\n<li>Renewal form for the <a\nhref=\"https://www.homebrewersassociation.org/\">American Homebrewer’s\nAssociation</a> which is a problematic organization for many\nreasons</li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/10/08/book-review--the-tombs-of-atuan-by-ursula-k-le-guin/",

    "title": "Book Review: The Tombs of Atuan by Ursula K Le Guin",
    "url": "https://tylercipriani.com/blog/2016/10/08/book-review--the-tombs-of-atuan-by-ursula-k-le-guin/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2016-10-08T16:36:10Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>\"Ahra\", the Eaten One, the high priestess of the Tombs of Atuan\nbelongs to the Nameless Ones. She is, herself, nameless. Her name along\nwith her family and future were taken from her in a ceremony on which\nthe novel opens. At the beginning of the novel, her 6-year-old life is\nspared so that she may live the remainder of her life serving the\nNameless Ones of Karg in the far East, outside of the Archipelago, in\nthe realm of EarthSea. So it has always been at Atuan and so it has\nalways been with \"Ahra\" – the high priestess is also The One Priestess\nin that she is continually reborn as herself. Within an hour of the old\npriestess\'s death, a new One Priestess – who is the same in essence – is\nborn.</p>\n<p>Ahra is under the often indifferent and sometimes cruel tutelage of\nKossil – High Priestess of the GodKing – the rulers of Autan, Thar –\npriestess of the Twin Gods, and (to some degree) Mannan – a eunuch and\nher life-long companion. Each often conveys their understanding of the\nTombs, the Nameless ones, and the appropriate place and behavior of the\nOne Priestess.</p>\n<p>Thar, though harsh, is often an ally to Ahra. After Thar\'s death,\nAhra\'s relationship with Kossil becomes increasingly strained. Kossil\nshows Ahra the Undertomb and Labyrinth that lay under the Tombs of Atuan\n– these are the dark realms of the One Priestess where the Nameless Ones\nhave their greatest strength. Ahra becomes increasingly obsessed with\nmemorizing all the twists and turns of the Undertomb and Labyrinth\nspending much of her time exploring their depths and learning the\nlocation of various spy-holes that look into the Labyrinth. Kossil makes\nmention of the ring of Erreth-Akbe that is the greatest and most magical\ntreasure of all the many treasures kept in the Labyrinth.</p>\n<p>Soon Ahra discovers Sparrowhawk, who\'s origin story is covered in <a\nhref=\"https://openlibrary.org/works/OL59852W/A_wizard_of_Earthsea\">A\nWizard of EarthSea</a>, wandering the Labyrinth in search of the ring of\nErreth-Akbe. Although Ahra has been taught to fear magic and sorcerers\nher curiosity about this intruder who has lived a life so different than\nher own dull existence leads her to imprison Sparrowhawk in the\nLabyrinth rather than kill him (as she told Kossil she would).</p>\n<p>Eventually, Ahra grows to trust Sparrowhawk, particularly after he\nreturns to her her name – Tenar, and after revealing his own true name –\nGed. In EarthSea learning something\'s true name gives you power over\nthat thing. Magic is just a recitation of the original language and\nmagic is enacted over objects and people by calling them by their\noriginal and true names.</p>\n<p>After being won-over by Ged when Kossil\'s intensity and treachery\nreach a fever pitch, Tenar decides to help Ged escape Autan which, along\nwith the her and Kossil\'s other indiscretions, leave the Nameless Ones a\nbit miffed.</p>\n<p>The Tombs of Atuan was a very readable and approachable novel,\nprobably owing to its young-adult target audience – it is short at only\n211 pages. This is the second book of the EarthSea series and it seems\nslightly more focused and, perhaps, less expansive than the first – A\nWizard of EarthSea. The themes of the power of names and places are\nmentioned throughout this book. It is interesting that the things over\nwhich no one has any control are nameless, specifically the Nameless\nOnes – the dark forces mentioned throughout the novel; however, it is\nonly after regaining her own name that Tenar is able to exert any\ncontrol over her own life.</p>\n<p>It\'s got a good beat and I can dance to it: 8/10.</p>\n<blockquote>\n<p><strong>Meta Note</strong>:</p>\n<p>As part of my effort to delve more deeply into reading, I will be\nfeaturing more review-type content. I will be tagging it all with the\n\"books\" tag. If you hate this, you can subscribe to the RSS feed for\n\"computing\" to continue to read my insights on something I\'m perhaps\neven the slightest bit qualified to talk about in any sort of informed\nway.</p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/28/git-annex-metadata-filtered-views/",

    "title": "Git Annex Metadata Filtered Views",
    "url": "https://tylercipriani.com/blog/2016/09/28/git-annex-metadata-filtered-views/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "git",

     "git-annex",

     "til"

    ],

    "date_published": "2016-09-29T03:30:55Z",
    "date_modified": "2017-10-12T03:25:12Z",


    "content_html": "<p>Git annex goes mindbogglingly deep.</p>\n<p>I use git annex to manage my photos – I have tons of RAW photos in\n<code class=\"verbatim\">~/Pictures</code> that are backed-up to a few git\nannex special remotes.</p>\n<p>Whenever I\'m done editing a set of raw files I go through this song\nand dance:</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> raw</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex add</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex copy <span class=\"at\">--to</span><span class=\"op\">=</span>s3</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex copy <span class=\"at\">--to</span><span class=\"op\">=</span>nas</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> commit <span class=\"at\">-m</span> <span class=\"st\">&#39;Added a bunch of files to s3&#39;</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> push origin master</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> push origin git-annex</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex drop</span></code></pre></div>\n<p>And magically my raw files are available on s3 and my home NAS.</p>\n<p>If I jump over to a different machine I can run:</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/Pictures</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> fetch</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> rebase</span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex get [new-raw-file]</span></code></pre></div>\n<p>Now that raw file is available on my new machine, I can open it in\nDarktable, I can do whatever I want to it: it\'s just a file.</p>\n<p>This is a pretty powerful extension of git.</p>\n<p>While I was reading the <a\nhref=\"https://git-annex.branchable.com/internals/\">git annex\ninternals</a> page today I stumbled across an even more powerful\nfeature: metadata. You can store and retrieve arbitrary metadata about\nany git annex file. For instance, if I wanted to store EXIF info for a\nparticular file, I could do:</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex metadata 20140118-BlazeyAndTyler.jpg <span class=\"at\">--set</span> exif=<span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"ex\">exiftool</span> <span class=\"at\">-S</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-filename</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-filetypeextensions</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-make</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-model</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-lensid</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-focallength</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-fnumber</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-iso</span> 20140118-BlazeyAndTyler.jpg<span class=\"va\">)</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>And I can drop that file and still retrieve the EXIF data</p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex drop 20140118-BlazeyAndTyler.jpg</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">drop</span> 20140118-BlazeyAndTyler.jpg <span class=\"er\">(</span><span class=\"ex\">checking</span> tylercipriani-raw...<span class=\"kw\">)</span> <span class=\"kw\">(</span><span class=\"ex\">checking</span> tylercipriani-raw...<span class=\"kw\">)</span> <span class=\"kw\">(</span><span class=\"ex\">checking</span> tylercipriani-raw...<span class=\"kw\">)</span> <span class=\"ex\">ok</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">recording</span> state in git...<span class=\"kw\">)</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex metadata <span class=\"at\">--get</span> exif !$</span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex metadata <span class=\"at\">--get</span> exif 20140118-BlazeyAndTyler.jpg</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FileName:</span> 20140118-BlazeyAndTyler.jpg</span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Make:</span> SAMSUNG</span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Model:</span> SPH-L720</span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FocalLength:</span> 4.2 mm</span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FNumber:</span> 2.2</span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ISO:</span> 125</span></code></pre></div>\n<p>This is pretty neat, but it can also be achieved with <a\nhref=\"https://tylercipriani.com/blog/2016/08/26/abusing-git-notes/\">git\nnotes</a> so it\'s nothing too spectacular.</p>\n<p>But git annex metadata doesn\'t quite stop there.</p>\n<section id=\"random-background\" class=\"level2\">\n<h2>Random background</h2>\n<p>My picture directory is laid out like this:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode txt\"><code class=\"sourceCode default\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>Pictures/</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>└── 2015</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    └── 2015-08-14_Project-name</span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>        ├── bin</span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>        │   └── convert-and-resize.sh</span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>        ├── edit</span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>        │   ├── 2015-08-14_Project-name_00001.jpg</span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        │   └── 2015-08-14_Project-name_00002.jpg</span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>        └── raw</span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>            └── 2015-08-14_Project-name_00001.NEF</span></code></pre></div>\n<p>I have directories for each year, under those directories I create\ndirectories that are prefixed with the <a\nhref=\"https://xkcd.com/1179/\">ISO 8601</a> import date for the photo,\nsome memorable project name (like <code\nclass=\"verbatim\">mom-birthday</code> or <code\nclass=\"verbatim\">rmnp-hike</code>). Inside that directory I have 2\ndirectories: <code class=\"verbatim\">raw</code> and <code\nclass=\"verbatim\">edit</code>. Inside each one of those directories, I\nhave photos that are named with ISO 8601 import date, project name, and\n5-digit import number and a file extension – raw files go in <code\nclass=\"verbatim\">raw</code> and edited/finished files <code\nclass=\"verbatim\">edit</code>.</p>\n<p>I got this system from <a\nhref=\"http://www.rileybrandt.com/lessons/\">Riley Brandt</a> (I can\'t\nrecommend the Open Source Photography Course enough – it\'s amazing!) and\nit\'s served me well. I can find stuff! But git annex really expands the\npossibilities of this system.</p>\n</section>\n<section\nid=\"fictional-real-world-totally-real-actually-happening-scenario\"\nclass=\"level2\">\n<h2>Fictional, real-world, totally real actually happening scenario</h2>\n<p>I go to Rocky Mountain National Park (RMNP) multiple times per year.\nI\'ve taken a lot of photos there. If I take a trip there in October I\nwill generally import those photos in October and create <code\nclass=\"verbatim\">2015/2015-10-05_RMNP-hike/{raw,edit}</code>, and then\nif I go there again next March I\'d create <code\nclass=\"verbatim\">2016/2016-03-21_RMNP-daytrip-with-blazey/{raw,edit}</code>.\nSo if I want to preview my RMNP edited photos from October I\'d go:</p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> 2015/2015-10-05_RMNP-hike/edit</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex get</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">geeqie</span> .</span></code></pre></div>\n<p>But what happens if I want to see all the photos I\'ve ever taken in\nRMNP? I could probably cook up some script to do this. Off the top of my\nhead I could do something like <code\nclass=\"verbatim\">find . -iname \'*rmnp*\' -type l</code>, but that would\nundoubtedly miss some files from a project in RMNP that I didn\'t name\nwith the string <code class=\"verbatim\">rmnp</code>. Git annex gives me a\ndifferent option: metadata tags.</p>\n</section>\n<section id=\"metadata-tags\" class=\"level2\">\n<h2>Metadata Tags</h2>\n<p>Git annex supports a special type of short metadata – <code\nclass=\"verbatim\">--tag</code>. With <code class=\"verbatim\">--tag</code>,\nyou can tag individual files in your repo.</p>\n<p>The WMF reading team offsite in 2016 was partially in RMNP, but I\ndidn\'t name any photos <code class=\"verbatim\">RMNP</code> because that\nwasn\'t the most memorable bit of information about those photos (<code\nclass=\"verbatim\">reading-team-offsite</code> seemed like a better\nproject name) nor did <code class=\"verbatim\">RMNP</code> represent all\nthe photos from the offsite. I should tag a few of those photos <code\nclass=\"verbatim\">rmnp</code> with git annex:</p>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd ./2016/2016-05-01_wikimedia-reading-offsite/edit/</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex metadata <span class=\"at\">--tag</span> rmnp Elk.jpg</span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">metadata</span> Elk.jpg </span>\n<span id=\"cb7-4\"><a href=\"https://tylercipriani.com/blog/#cb7-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">lastchanged</span><span class=\"op\">=</span>2016-09-29@04-14-44</span>\n<span id=\"cb7-5\"><a href=\"https://tylercipriani.com/blog/#cb7-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">tag</span><span class=\"op\">=</span>rmnp</span>\n<span id=\"cb7-6\"><a href=\"https://tylercipriani.com/blog/#cb7-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">tag-lastchanged=2016-09-29@04-14-44</span></span>\n<span id=\"cb7-7\"><a href=\"https://tylercipriani.com/blog/#cb7-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ok</span></span>\n<span id=\"cb7-8\"><a href=\"https://tylercipriani.com/blog/#cb7-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">recording</span> state in git...<span class=\"kw\">)</span></span>\n<span id=\"cb7-9\"><a href=\"https://tylercipriani.com/blog/#cb7-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex metadata <span class=\"at\">--tag</span> rmnp Reading<span class=\"dt\">\\ </span>folks<span class=\"dt\">\\ </span>bing<span class=\"dt\">\\ </span>higher<span class=\"dt\">\\ </span>up<span class=\"dt\">\\ </span>than<span class=\"dt\">\\ </span>it<span class=\"dt\">\\ </span>looks.jpg</span>\n<span id=\"cb7-10\"><a href=\"https://tylercipriani.com/blog/#cb7-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">metadata</span> Reading folks bing higher up than it looks.jpg </span>\n<span id=\"cb7-11\"><a href=\"https://tylercipriani.com/blog/#cb7-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">lastchanged</span><span class=\"op\">=</span>2016-09-29@04-14-57</span>\n<span id=\"cb7-12\"><a href=\"https://tylercipriani.com/blog/#cb7-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">tag</span><span class=\"op\">=</span>rmnp</span>\n<span id=\"cb7-13\"><a href=\"https://tylercipriani.com/blog/#cb7-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">tag-lastchanged=2016-09-29@04-14-57</span></span>\n<span id=\"cb7-14\"><a href=\"https://tylercipriani.com/blog/#cb7-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ok</span></span>\n<span id=\"cb7-15\"><a href=\"https://tylercipriani.com/blog/#cb7-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">recording</span> state in git...<span class=\"kw\">)</span></span></code></pre></div>\n<p>Also, when my old roommate came to town we went to RMNP, but I tagged\nthose photos <code class=\"verbatim\">cody-family-adventure-time</code>.\nSo let\'s tag a few of those <code class=\"verbatim\">rmnp</code>, too:</p>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd 2015/2016-01-25_cody-family-adventuretime/edit</span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex metadata <span class=\"at\">--tag</span> rmnp alberta-falls.jpg</span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">metadata</span> alberta-falls.jpg </span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">lastchanged</span><span class=\"op\">=</span>2016-09-29@04-17-48</span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"va\">tag</span><span class=\"op\">=</span>rmnp</span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">tag-lastchanged=2016-09-29@04-17-48</span></span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ok</span></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">recording</span> state in git...<span class=\"kw\">)</span></span></code></pre></div>\n</section>\n<section id=\"metadata-views\" class=\"level2\">\n<h2>Metadata views</h2>\n<p>Now the thing that was really surprising to me, you can filter the\nwhole pictures directory based on a particular tag with git annex by\nusing a <a\nhref=\"https://git-annex.branchable.com/tips/metadata_driven_views/\">metadata\ndriven view</a>.</p>\n<div class=\"sourceCode\" id=\"cb9\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> tree <span class=\"at\">-d</span> <span class=\"at\">-L</span> 1</span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">.</span></span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2011</span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2012</span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2013</span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2014</span>\n<span id=\"cb9-7\"><a href=\"https://tylercipriani.com/blog/#cb9-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2015</span>\n<span id=\"cb9-8\"><a href=\"https://tylercipriani.com/blog/#cb9-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> 2016</span>\n<span id=\"cb9-9\"><a href=\"https://tylercipriani.com/blog/#cb9-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> instagram</span>\n<span id=\"cb9-10\"><a href=\"https://tylercipriani.com/blog/#cb9-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> lib</span>\n<span id=\"cb9-11\"><a href=\"https://tylercipriani.com/blog/#cb9-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> lossy</span>\n<span id=\"cb9-12\"><a href=\"https://tylercipriani.com/blog/#cb9-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> nasa</span>\n<span id=\"cb9-13\"><a href=\"https://tylercipriani.com/blog/#cb9-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">└──</span> Webcam</span>\n<span id=\"cb9-14\"><a href=\"https://tylercipriani.com/blog/#cb9-14\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb9-15\"><a href=\"https://tylercipriani.com/blog/#cb9-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git annex view tag=rmnp</span>\n<span id=\"cb9-16\"><a href=\"https://tylercipriani.com/blog/#cb9-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">view</span>  <span class=\"er\">(</span><span class=\"ex\">searching...</span><span class=\"kw\">)</span> </span>\n<span id=\"cb9-17\"><a href=\"https://tylercipriani.com/blog/#cb9-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Switched</span> to branch <span class=\"st\">&#39;views/(tag=rmnp)&#39;</span></span>\n<span id=\"cb9-18\"><a href=\"https://tylercipriani.com/blog/#cb9-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ok</span></span>\n<span id=\"cb9-19\"><a href=\"https://tylercipriani.com/blog/#cb9-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ls</span>\n<span id=\"cb9-20\"><a href=\"https://tylercipriani.com/blog/#cb9-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">alberta-falls_%2015%2016-01-25_cody-family-adventuretime%edit%.jpg</span></span>\n<span id=\"cb9-21\"><a href=\"https://tylercipriani.com/blog/#cb9-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Elk_%2016%2016-05-01_wikimedia-reading-offsite%edit%.jpg</span></span>\n<span id=\"cb9-22\"><a href=\"https://tylercipriani.com/blog/#cb9-22\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Reading</span> folks bing higher up than it looks_%2016%2016-05-01_wikimedia-reading-offsite%edit%.jpg</span></code></pre></div>\n<p>I can even filter this view using other tags with\n<code>git annex vfilter tag=whatever</code>. And I can continue to edit,\nrefine, and work with the photo files from there.</p>\n<p>This feature absolutely blew my mind – I dropped what I was doing to\nwrite this – I\'m trying to think of a good way to work it into my photo\nworkflow <img src=\"https://tylercipriani.com/smileys/smile.png\" alt=\":)\" /></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/25/the-14kb-in-the-tcp-initial-window/",

    "title": "The 14KB in the TCP Initial Window",
    "url": "https://tylercipriani.com/blog/2016/09/25/the-14kb-in-the-tcp-initial-window/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "tcp",

     "til"

    ],

    "date_published": "2016-09-26T03:07:53Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Today I went to coffee with a buddy of mine from\n<code>$DAY_JOB - 2</code>. During coffee we were discussing all the folk\ntheories of “fast” websites. I made some off-the-cuff remark that I\ndidn’t really understand – that you should try to squeeze the most\nimportant bits of your website into the first <em>X</em> bytes\n(<em>X</em> being a value I didn’t remember) for an opaque reason that\nhas to do with TCP congestion algorithms that I’ve never understood.</p>\n<p>We spent a good chunk of time looking at Wireshark captures of an\nHTTP request. It got muddled and we got off-track because we were\nlooking at an HTTPS request and we started talking about TLS1.2,\nCLIENT-HELLO, and the TLS handshake in general.</p>\n<p>I eventually found the <a\nhref=\"https://developers.google.com/speed/docs/insights/mobile\">source</a>\nfor what I was yammering about.</p>\n<blockquote>\n<p>Due to how TCP estimates the capacity of a connection (i.e. TCP Slow\nStart), a new TCP connection cannot immediately use the full available\nbandwidth between the client and the server. Because of this, the server\ncan send up to 10 TCP packets on a new connection (~14KB) in first\nroundtrip, and then it must wait for client to acknowledge this data\nbefore it can grow its congestion window and proceed to deliver more\ndata.</p>\n</blockquote>\n<p>After I got home and ate some ice cream, I did some more reading\ntrying to understand this stuff. I think a lot of what was confusing\nabout the Wireshark stuff we were looking at is it also had TLS1.2 mixed\nin there. Requesting a plain-old HTTP, port 80 site made looking at\npackets a bit more sane.</p>\n<p>It seems like the size of a TCP packet is negotiated during the\n<code>SYN</code>, <code>SYN-ACK</code> phase of the TCP <a\nhref=\"http://www.tcpipguide.com/free/t_TCPConnectionEstablishmentProcessTheThreeWayHandsh-3.htm\">three-way\nhandshake</a>. In the <code>Options</code> section of the TCP segment\n(for a segment that has the <code>SYN</code>-flag set in the TCP segment\nheader) a sender or receiver may indicate a Max Segment Size (MSS). An\nMSS is derived from a machine’s Maximum Transmission Unit (MTU). In the\ncase of my machine the MTU is set to 1500. I found this via the\n<code>ip</code> command:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@magneto:~$</span> ip <span class=\"at\">-4</span> link show dev wlp3s0</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">2:</span> wlp3s0: <span class=\"op\">&lt;</span>BROADCAST,MULTICAST,UP,LOWER_UP<span class=\"op\">&gt;</span> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000</span></code></pre></div>\n<p>The MSS is derived from the MTU and is (at most?) the MTU minus the\n40 bytes used for the TCP header and the IP header, so my machine sent\nthe MSS size of 1460 to the server in the <code>Options</code> section\nof the SYN TCP segment that it initially sent my webserver.</p>\n<p><img src=\"https://tylercipriani.com/static/images/2016/mss.png\" alt=\"Client MSS\" /><br />\n</p>\n<p>So the data portion of a TCP segment sent in this particular\nconnection should never exceed 1460 bytes.</p>\n<p>While we were looking at Wireshark packet captures we kept noticing a\nTCP segment size of 1486 in the “length” column with a TCP segment data\nlength of 1432. I noticed that my webserver sent an MSS size of 1432,\nwhich I suppose became the limiting factor in how much data could be\nsent per segment (rather than the 1460 MSS sent by my client – the\nbrowser):</p>\n<p><img src=\"https://tylercipriani.com/static/images/2016/server-mss.png\"\nalt=\"Server MSS\" /><br />\n</p>\n<p>Each TCP segment had a header-size of 20 bytes, so that leaves 34\nunexplained bytes which (I guess) were part of the IP header.</p>\n<p>So why try to squeeze a website into ~14KB? Seems like you should be\ntrying to squeeze it into 1432 bytes.</p>\n<p>I found my answer in <a\nhref=\"https://tools.ietf.org/html/rfc6928\">IETF RFC 6928</a> – a\nproposal to increase the TCP Initial Window to 10 segments. The <a\nhref=\"https://en.wikipedia.org/wiki/Congestion_window#Congestion_window\">Initial\nCongestion Window</a> (<code>cwnd</code>) is the maximum number of bytes\nthat a server can send without receiving any acknowledgement that the\nbytes were received via a client ACK packet. This maximum number of\nbytes to send is calculated by multiplying <em>some number</em> by MSS.\nAs of RFC 6928 <em>some number</em> is equal to 10 (initially).</p>\n<p>I checked the value of <code>cwnd</code> on some established\nconnections on my server:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@magneto:~$</span> sudo ss <span class=\"at\">-ti</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">...cwnd:10...</span></span></code></pre></div>\n<p>And it is indeed set to 10.</p>\n<p>This means that my server can send <code>cwnd</code> * MSS bytes of\ninformation before the client has to acknowledge that anything has been\nreceieved. So, in the case of the Wireshark connection I recorded, my\nwebserver can send 1432 * 10 bytes, or 14320 bytes:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@magneto:~$</span> units</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Currency</span> exchange rates from www.timegenie.com on 2016-06-22</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">202926</span> units, 109 prefixes, 88 nonlinear units</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">You</span> have: 14320 bytes</span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">You</span> want: kilobytes</span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">*</span> 14.32</span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">/</span> 0.069832402</span></code></pre></div>\n<p><em>OR</em> around 14KB of data can be sent to a browser before\nanother round-trip from the client to the webserver has to happen.</p>\n<p>So, overall, a nice, relaxing coffee and catch-up session with an old\ncoworker.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/21/git-config-include-and-colors/",

    "title": "Git-Config Colors and Include",
    "url": "https://tylercipriani.com/blog/2016/09/21/git-config-include-and-colors/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "TIL",

     "git"

    ],

    "date_published": "2016-09-22T00:56:33Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>While I was looking through my <code\nclass=\"verbatim\">~/.gitconfig</code> today, I learned some new\ntricks.</p>\n<p>I\'ve had the <code class=\"verbatim\">color</code> section in my <code\nclass=\"verbatim\">~/.gitconfig</code> without really understanding\nit:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode ini\"><code class=\"sourceCode ini\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[color]</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    ui </span><span class=\"ot\">=</span><span class=\"st\"> </span><span class=\"kw\">true</span></span></code></pre></div>\n<p>First, it seems that <code\nclass=\"verbatim\">git config color.ui true</code> is superfluous as it\nhas been set to <code class=\"verbatim\">true</code> by default since Git\n1.8.4. More importantly, I learned that you can customize the colors of\n<code class=\"verbatim\">git-branch</code>, <code\nclass=\"verbatim\">git-diff</code>, <code\nclass=\"verbatim\">git-status</code>, <code\nclass=\"verbatim\">git log --decorate</code>, <code\nclass=\"verbatim\">git-grep</code>, and <code\nclass=\"verbatim\">git {add,clean} --interactive</code></p>\n<p>The easiest way I could find to view what properties are available to\ncolorize is to search for <code class=\"verbatim\">&lt;slot&gt;</code> on\nthe git-config man page.</p>\n<p>The other neat thing I learned is that you can include other config\nfiles by adding an <code class=\"verbatim\">include</code> section in your\n<code class=\"verbatim\">~/.gitconfig</code>:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode ini\"><code class=\"sourceCode ini\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[include]</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    path </span><span class=\"ot\">=</span><span class=\"st\"> ~/.config/git/colors.config</span></span></code></pre></div>\n<p>By combining these two tricks, you can create one colorscheme for a\nterminal that uses the <a\nhref=\"https://github.com/ChrisKempson/Tomorrow-Theme\">Tomorrow Theme</a>\nand one for the terminal that uses <a\nhref=\"http://ethanschoonover.com/solarized\">Solarized</a> and swap\nbetween them easily by swapping the symlink pointed at by <code\nclass=\"verbatim\">~/.config/git/color.config</code></p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode ini\"><code class=\"sourceCode ini\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Tomorrow Night Eighties in ~/.config/git/tomorrow-night-eighties.config</span></span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Included in ~/.gitconfig via:</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># [include]</span></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#     path = ~tyler/.config/git/tomorrow-night-eighties.config</span></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[color &quot;status&quot;]</span></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    header </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#999999&quot;</span></span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    added </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#99cc99&quot;</span></span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    changed </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#f2777a&quot;</span></span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    untracked </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#ffcc66&quot;</span></span>\n<span id=\"cb3-10\"><a href=\"https://tylercipriani.com/blog/#cb3-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    branch </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#2d2d2d&quot; &quot;#6699cc&quot;</span></span>\n<span id=\"cb3-11\"><a href=\"https://tylercipriani.com/blog/#cb3-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    </span><span class=\"co\"># Because the phrase &quot;Detached HEAD&quot; isn&#39;t unnerving enough</span></span>\n<span id=\"cb3-12\"><a href=\"https://tylercipriani.com/blog/#cb3-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    nobranch </span><span class=\"ot\">=</span><span class=\"st\"> bold ul blink &quot;#f99157&quot;</span></span>\n<span id=\"cb3-13\"><a href=\"https://tylercipriani.com/blog/#cb3-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[color &quot;diff&quot;]</span></span>\n<span id=\"cb3-14\"><a href=\"https://tylercipriani.com/blog/#cb3-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    meta </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#515151&quot;</span></span>\n<span id=\"cb3-15\"><a href=\"https://tylercipriani.com/blog/#cb3-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    func </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#cc99cc&quot;</span></span>\n<span id=\"cb3-16\"><a href=\"https://tylercipriani.com/blog/#cb3-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    frag </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#66cccc&quot;</span></span>\n<span id=\"cb3-17\"><a href=\"https://tylercipriani.com/blog/#cb3-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    context </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#999999&quot;</span></span>\n<span id=\"cb3-18\"><a href=\"https://tylercipriani.com/blog/#cb3-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    old </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#f2777a&quot; &quot;#393939&quot;</span></span>\n<span id=\"cb3-19\"><a href=\"https://tylercipriani.com/blog/#cb3-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">    new </span><span class=\"ot\">=</span><span class=\"st\"> &quot;#bef2be&quot; &quot;#515151&quot;</span></span></code></pre></div>\n<p>I wish the symlink swap didn\'t have to happen – I wish you could just\nuse environment variables.</p>\n<p>As far as I can tell the only variables that are expanded in <code\nclass=\"verbatim\">~/.gitconfig</code> are <code class=\"verbatim\">~</code>\nto point at the current user\'s home directory and <code\nclass=\"verbatim\">~[user]</code> points to <code\nclass=\"verbatim\">[user]</code>\'s home directory.</p>\n<p><code class=\"verbatim\">include</code> also fails silently by\ndesign.</p>\n<p>I feel like there are some other neat tricks to uncover here, but I\nhaven\'t quite grokked this to fullness just yet.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/18/why-i-will-continue-to-use-linode/",

    "title": "Why I Will Continue to Use Linode",
    "url": "https://tylercipriani.com/blog/2016/09/18/why-i-will-continue-to-use-linode/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2016-09-19T00:58:05Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I know that Linode has had its share of <a\nhref=\"https://slashdot.org/firehose.pl?op=view&amp;type=submission&amp;id=2603667\">problems</a>\nrecently, but it\'s a service I won\'t be leaving any time soon.</p>\n<p>In July of 2014, as part of the Electronic Frontier Foundation\'s <a\nhref=\"https://www.eff.org/torchallenge/\">Tor Challenge</a> I decided to\nbuild a Tor node. Not only did I decide to build a Tor node, I decided\nto build an <strong>exit node</strong>. Running an exit node means that\ninstead of passing traffic to another node on the Tor network, my node\nwill be where Tor traffic exits the network, so it\'ll be my IP address\nthat any end-points see as the source of traffic.</p>\n<p>When I decided to run an exit node, I was using Comcast as my\nISP—running a Tor exit node is definitely against Comcast\'s Terms of\nService (TOS). By this point, I had been using Linode for many years to\nhost a bunch of personal web projects, and I had no complaints. On a\nwhim I perused the <a href=\"https://www.linode.com/tos\">Linode\nTOS</a>:</p>\n<blockquote>\n<p>Linode does not prohibit the use of distributed, peer to peer network\nservices such as Tor, nor does Linode routinely monitor the network\ncommunications of customer Linodes as a normal business practice.</p>\n</blockquote>\n<p>So with that, I created <a\nhref=\"https://atlas.torproject.org/#details/2892073608985977DED33F98A9FA27A9C47C8B61\">intothetylerzone</a>\n(because naming things is hard). It\'s a fast (1MB/s), stable, exit node\nsupporting exits on a number of ports:</p>\n<div class=\"sourceCode\" id=\"/etc/tor/torrc\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"/etc/tor/torrc-1\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:22  <span class=\"co\"># ssh</span></span>\n<span id=\"/etc/tor/torrc-2\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:465 <span class=\"co\"># smtps (SMTP over SSL)</span></span>\n<span id=\"/etc/tor/torrc-3\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:993 <span class=\"co\"># imaps (IMAP over SSL)</span></span>\n<span id=\"/etc/tor/torrc-4\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:994 <span class=\"co\"># ircs (IRC over SSL)</span></span>\n<span id=\"/etc/tor/torrc-5\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:995 <span class=\"co\"># pop3s (POP3 over SSL)</span></span>\n<span id=\"/etc/tor/torrc-6\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:5222 <span class=\"co\"># xmpp</span></span>\n<span id=\"/etc/tor/torrc-7\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:6660-6697 <span class=\"co\"># allow irc ports, very widely</span></span>\n<span id=\"/etc/tor/torrc-8\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:443 <span class=\"co\"># http is dead</span></span>\n<span id=\"/etc/tor/torrc-9\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> accept <span class=\"pp\">*</span>:80 <span class=\"co\"># but not *that* dead</span></span>\n<span id=\"/etc/tor/torrc-10\"><a href=\"https://tylercipriani.com/blog/#/etc/tor/torrc-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ExitPolicy</span> reject <span class=\"pp\">*</span>:<span class=\"pp\">*</span> <span class=\"co\"># no other exits allowed</span></span></code></pre></div>\n<p>My Tor exit node is sometimes abused. There are fewer abuse-reports\nthan I would have expected—I probably get 1 report every 3 or 4 months.\nI just handled an abuse report today from Linode (heavily edited):</p>\n<blockquote>\n<p>We have received a report of malicious activity originating from your\nLinode. It appears that your Linode is being used to scan hosts. We ask\nthat you investigate this matter as soon as you are able.</p>\n</blockquote>\n<p>There was a follow-up message on the ticket with the specific IPs\nthat were being scanned. I blocked any exit to those targeted IPs in my\n<code class=\"verbatim\">/etc/tor/torrc</code> and replied to the ticket\n(most of this language comes from the <a\nhref=\"https://gitweb.torproject.org/tor.git/tree/contrib/operator-tools/tor-exit-notice.html\">operator-tools\nexit notice html</a>):</p>\n<blockquote>\n<p>This router is part of the Tor Anonymity Network, which is dedicated\nto providing people with anonymity who need it most: average computer\nusers. This router IP should be generating no other traffic.</p>\n<p>While Tor is not designed for malicious computer users, it is\ninevitable that some may use the network for malicious ends. In the mind\nof this operator, the social need for easily accessible\ncensorship-resistant anonymous communication trumps the risk. Tor sees\nuse by many important segments of the population, including whistle\nblowers, journalists, Chinese dissidents skirting the Great Firewall and\noppressive censorship, abuse victims, stalker targets, the US military,\nand law enforcement, just to name a few.</p>\n<p>I\'ve updated my /etc/tor/torrc to include all ports on the\ndestination IP:</p>\n<p>ExitPolicy reject [targeted-ip]:*</p>\n<p>I\'ve also restarted the tor service. The destination IP should no\nlonger receive any traffic from this machine.</p>\n</blockquote>\n<p>Not 5 minutes later this reply came:</p>\n<blockquote>\n<p>Hi,</p>\n<p>Thank you for your response. At this time, it looks like we can\nconsider this case resolved. We will continue to monitor for additional\ncomplaints and let you know should we receive more.</p>\n<p>I’ve set this ticket to close automatically in 48 hours, so there’s\nno need to respond since this case is now resolved.</p>\n<p>Let us know if there\'s anything else we can do for you, and we\'ll be\nhappy to help.</p>\n</blockquote>\n<p>&lt;3 Linode.</p>\n<p>Without Linode I would be unable to host a stable and fast node.\nLinode supports online freedom, so I support Linode.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/15/what-is-code-review/",

    "title": "What is Code Review?",
    "url": "https://tylercipriani.com/blog/2016/09/15/what-is-code-review/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "rambling",

     "software"

    ],

    "date_published": "2016-09-15T23:37:22Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>A jargon-less definition of code review is a difficult thing to pin-\ndown. Code review is what happens when someone submits some code to a\nsoftware project and a different person, who has knowledge about that\nproject, checks to see if there are any problems in the submitted code\nbefore making the submitted code a part of the project.</p>\n<p>Code review is based around the simple idea that with enough eyes all\nbugs are shallow.</p>\n<blockquote>\n<p>Given a large enough beta-tester and co-developer base, almost every\nproblem will be characterized quickly and the fix obvious to\nsomeone.</p>\n<p>– Linus’s Law, ESR, <a\nhref=\"http://www.catb.org/~esr/writings/cathedral-bazaar/cathedral-bazaar/ar01s04.html\">The\nCathedral and the Bazaar</a></p>\n</blockquote>\n<p>This is all part of a <strong>collaborative model</strong> of\nsoftware development. A model in which anyone can submit code or\nfeedback to an open project. This model is the engine that drives the\ndevelopment of some of the world’s largest and most successful software\nprojects. It’s an accepted Good Thing™. It is tested. It works. As a\nresult, almost every software project uses code review for almost every\ncode change—big or small.</p>\n<p>Code review is meant to ensure that only high-quality code can be\nmerged into a project. Code review may be used for many other purposes,\nsome good and some bad.</p>\n<section id=\"review-as-a-pedagogical-tool\" class=\"level2\">\n<h2>Review as a pedagogical tool</h2>\n<p>Code review at its best is a Socratic teaching style.</p>\n<p>Many software projects are large, tangled, and, sometimes, confusing.\nA sweeping change can create regressions, or be disruptive rather than\nhelpful. Software functions as an interconnected system, and to learn to\nwork within that system you must learn how that system came into\nbeing.</p>\n<blockquote>\n<p>A complex system that works is invariably found to have evolved from\na simple system that worked. A complex system designed from scratch\nnever works and cannot be patched up to make it work. You have to start\nover with a working simple system.</p>\n<p>– Gall’s Law, John Gall, Systemantics: How Systems Really Work and\nHow They Fail</p>\n</blockquote>\n<p>Through code review a newcomer learns about the design of the\nproject—to work with the project’s design rather than against it. And by\nworking with the design of a system, to work more effectively within\nit.</p>\n<p>When review is done well, the person who’s code is being reviewed may\nlearn about software design, general debugging, the management of open\nprojects, the underlying language, or the underlying language’s\nimplementation.</p>\n</section>\n<section id=\"review-as-culture\" class=\"level2\">\n<h2>Review as culture</h2>\n<p>For better or worse, every project has a culture.</p>\n<p>The culture that is conveyed through review may be completely\ninnocuous. The propensity of a particular project to favor third-party\nlibraries versus maintaining their own implementations in the project.\nHow much trust a particular project puts in third-party entities (Jira,\nGithub, Gitlab, etc.). The tools and best-practices for a project also\noften become obvious during code review. For instance, whether a project\naccepts pull requests via Github <a\nhref=\"https://github.com/torvalds/linux/pull/17\">or not</a>.</p>\n<p>Meaningful cultural norms are also conveyed via code review. A\nproject may have a culture that is generous and helpful, or it may be\nopenly hostile to outside contribution. Ultimately, the person reviewing\ncode has power over the person submitting code. This power dynamic can\nbecome even larger when the person submitting code is a member of a\nmarginalized group in the society of the person reviewing the code.</p>\n<p>The person who is reviewing (hopefully) has some sense of the power\nimbalance that is inherent in the code review process. It is often\ndishearteningly uncomfortable to give code review—particularly when you\ndisagree with some of the code’s implementation. Code reviewers should\n(and often do) work hard to offer constructive feedback and to avoid\nhostile interactions.</p>\n<p>Code review, from the perspective of the person who submits code, is\na situation where you’re interacting with a person who has no real\nincentive to be nice. Code review is a situation that can tell you a lot\nabout a person.</p>\n</section>\n<section id=\"mindful-review\" class=\"level2\">\n<h2>Mindful review</h2>\n<p>I’m far from a master when it comes to code review.</p>\n<p>I’ve done my share of review, and I’ve had my share of reviews—both\ngood and bad. These are the things I try to remain mindful of during the\nreview process—both as patch-submitter and as a reviewer.</p>\n<ul>\n<li><p>It takes time</p>\n<p>It takes a LOT of time. I spend so much time on each review because I\nwant to offer helpful and meaningful feedback. I could easily spend my\nentire working day reviewing code (and sometimes, I do).</p>\n<p>I’ve seen rules and guidelines for how much time you should take for\neach SLOC in a review, but I think that’s meaningless. If I haven’t\nreasonably considered the consequences of a change—I’m not done\nreviewing the code.</p>\n<p>When you submit a patch, you should be mindful that review takes\ntime. If this is a one-line change that you want rubber-stamped, then\nyou should be explicit about that. Honestly, I’m pretty OK\nrubber-stamping the work of peers that I trust; however, asking for code\nreview on that one line means that I will spend at least 15 minutes\nmentally shifting gears, examining, running, and otherwise poking-at the\ncode.</p>\n<p>There is no better way to exhaust the patience and goodwill of a\nsoftware project than to continually submit obviously untested changes.\nHave you run the code? If not, the code is not ready for\nreview.</p></li>\n<li><p>If everything is OK, then everything is OK</p>\n<p>Sometimes, I can’t find anything wrong with a large patch that was\njust submitted. If that’s the case, I try to not to penalize that\npatch—I don’t go back through the patch and <strong>really</strong>\nscrutinize the method names, I don’t suggest libraries that do the same\nthing but in a way I slightly prefer, I don’t enumerate the approaches\nthat could have been taken. I just post, “+1 lgtm” and that’s all I have\nto show for the hour of work I just put in reviewing, but I think that’s\nOK.</p>\n<p>I feel like this is part of project culture. If a person you don’t\nknow submits a good patch, that should be OK.</p></li>\n<li><p>Say something nice</p>\n<p>This is probably my own weird insecurity. For each review, I go\nthrough and make sure to leave comments about some of the things I like\nin the patch. I know that whomever I am reviewing is my intellectual\nequal (or often intellectual better), and that they’ve just put a lot of\ntime into this patch. I also know that when I’ve put a lot of time into\nsomething, and all of its redeeming qualities are ignored it stinks, and\nsometimes it fucks up my day.</p>\n<p>I try not to fuck up anyone’s day.</p></li>\n<li><p>Nitpicks and show-stoppers</p>\n<p>When I review things, I try to be explicit if I can—“Fix this\nproblem, and I’ll merge the patch.” There are times I may feel strongly\nthat a piece of code can be improved, but not strongly enough to reject\nthe patch—“Nitpick: could use a comment here”. I’ll reply overall with,\n“Some nitpicks inline, but overall lgtm” and then ask in IRC if they’re\nfine with the patch merging as-is.</p>\n<p>The difference between a nitpick and a show-stopper is important when\nthere are both types of problems in one patch. How do I know what\n<strong>really</strong> needs fixing versus (what really amounts to) the\nway the reviewer would have written the same patch?</p></li>\n</ul>\n</section>\n<section id=\"a-blatant-disregard-for-best-practice-a.k.a.-jfdi.\"\nclass=\"level2\">\n<h2>A blatant disregard for best practice, A.K.A. JFDI.</h2>\n<p>Code review is slow (by design) and hard to get right. Also (CAUTION:\ncontroversy ahead), some changes don’t <strong>need</strong> review.\nThat is, they’re not important to the overall code function, and can be\ncorrected easily. Adding a section to a README, or adding to the docs:\nJFDI. If there’s a spelling error, well, someone will fix it.</p>\n<p>When you have to deploy a hot-fix to production because production is\n<strong>completely broken</strong>: JFDI.</p>\n<p>I don’t like being a roadblock for things like this. There are many\ncode-review systems that force you to gate changes like this.\nUltimately, I think this creates something akin to alarm-fatigue but for\ncode review. It hurts everyone involved, it hurts the process, and could\ncause some resentment.</p>\n</section>\n<section id=\"conclusions\" class=\"level2\">\n<h2>Conclusions</h2>\n<p>I suppose the <strong>tl;dr</strong> here is: Code review is good\nwhen its done well, and bad when it’s done poorly. Earth shaking stuff,\nbelieve me—I know.</p>\n<p>My big, bold, and important message about code review is—as with all\nprocesses that involve people—staying mindful that everyone involved is,\nin fact, a person is paramount to the process’s success.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/13/imagemagick-to-extract-a-pdf-page/",

    "title": "ImageMagick to Extract a PDF Page",
    "url": "https://tylercipriani.com/blog/2016/09/13/imagemagick-to-extract-a-pdf-page/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "TIL"

    ],

    "date_published": "2016-09-13T16:35:22Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Today I was working with a PDF that was 27,000 pages long (god help\nme).</p>\n<p>I never tried to open that PDF. This is just the page count I got\nfrom a python script I wrote to parse that PDF to a CSV file.</p>\n<p>When the time came to spot-check the results of that python script I\nneeded to compare some pages deep within the PDF with the output on the\nCSV file.</p>\n<p>I use the <a href=\"https://pwmt.org/projects/zathura/\">Zathura</a>\ndocument viewer to view PDFs, but I was reasonably certain that it would\nchoke on such a large document. Instead I extracted one page at a time\nusing <a\nhref=\"https://www.imagemagick.org/script/index.php\">ImageMagick</a>.</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">convert</span> <span class=\"st\">&#39;big.pdf[2000]&#39;</span> big-pg2000.pdf</span></code></pre></div>\n<p>Then I opened the generated PDF using Zathura.</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">zathura</span> big-pg2000.pdf</span></code></pre></div>\n<p>I was able to compare that side-by-side with the generated CSV.</p>\n<p>Easy peasy.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/09/git-revision-colon-slash/",

    "title": "Git Revision Colon Slash",
    "url": "https://tylercipriani.com/blog/2016/09/09/git-revision-colon-slash/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "TIL"

    ],

    "date_published": "2016-09-09T13:47:22Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>From <code>gitrevisions(7)</code></p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">SPECIFYING</span> REVISIONS</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">:/</span><span class=\"op\">&lt;</span>text<span class=\"op\">&gt;</span>, e.g. :/fix nasty bug</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">A</span> colon, followed by a slash, followed by a text, names a commit whose</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">commit</span> message matches the specified regular expression. This name</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">returns</span> the youngest matching commit which is reachable from any ref.</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">The</span> regular expression can match any part of the commit message. To</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">match</span> messages starting with a string, one can use e.g.  :/^foo. The</span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">special</span> sequence :/! is reserved for modifiers to what is matched.</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">:/!-foo</span> performs a negative match, while :/!!foo matches a literal !</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">character,</span> followed by foo. Any other sequence beginning with :/! is</span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"ex\">reserved</span> for now.</span></code></pre></div>\n<p>This is the same revision that is returned by</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> log <span class=\"at\">--grep</span> <span class=\"st\">&#39;&lt;regex&gt;&#39;</span> <span class=\"at\">-1</span></span></code></pre></div>\n<p>Where it seems awesome is in combination with <code>git revert</code>\nor <code>git commit --fixup</code></p>\n<p>I could see running this in a panic:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> revert <span class=\"at\">--no-edit</span> <span class=\"st\">&#39;:/that thing that broke&#39;</span></span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> commit</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> push origin HEAD:refs/for/master</span></code></pre></div>\n<p>Found via a <a\nhref=\"https://news.ycombinator.com/item?id=12461992\">comment on\nhackernews</a></p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/07/delete-local-git-commits/",

    "title": "Delete Local Git Commits",
    "url": "https://tylercipriani.com/blog/2016/09/07/delete-local-git-commits/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "git",

     "vcs"

    ],

    "date_published": "2016-09-07T17:48:08Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>Usually when I need to delete a commit from a local git repo I\nuse:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> rebase <span class=\"at\">-i</span></span></code></pre></div>\n<p>This starts an interactive rebase session for all commits from\n<code>HEAD..@{u}</code>. Once I’m in the git rebase editor I put a\n<code>drop</code> on the line that has the commit I want to delete and\nsave the file. Magic. Commit gone.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">drop</span> c572357 [LOCAL] Change to be removed</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Rebase dbfcb3a..c572357 onto dbfcb3a (1 command(s))</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Commands:</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># p, pick = use commit</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># r, reword = use commit, but edit the commit message</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># e, edit = use commit, but stop for amending</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># s, squash = use commit, but meld into previous commit</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># f, fixup = like &quot;squash&quot;, but discard this commit&#39;s log message</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># x, exec = run command (the rest of the line) using shell</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># d, drop = remove commit</span></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#</span></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># These lines can be re-ordered; they are executed from top to bottom.</span></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#</span></span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># If you remove a line here THAT COMMIT WILL BE LOST.</span></span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#</span></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># However, if you remove everything, the rebase will be aborted.</span></span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#</span></span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Note that empty commits are commented out</span></span></code></pre></div>\n<p>This is fine if you’re there to drive an editor for an interactive\nrebase.</p>\n<section id=\"the-problem-with-interactivity\" class=\"level2\">\n<h2>The problem with interactivity</h2>\n<p>The problem with interactive rebase is you can’t easily script\nit.</p>\n<p>At work I help to maintain our “beta cluster” which is a bunch of\nvirtual machines that is supposed to mirror the setup of production. The\nextent to which production is actually mirrored is debatable; however,\nit is true that we use the same puppet repository as production.\nFurther, this puppet repository resides on a virtual machine within the\ncluster that acts as the beta cluster’s puppetmaster.</p>\n<p>Often, to test a patch for production puppet, folks will apply\npatches on top of beta’s local copy of the production puppet repo.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> cd /var/lib/git/operations/puppet</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git apply <span class=\"at\">--check</span> <span class=\"at\">--3way</span> /home/thcipriani/0001-some.patch</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git am <span class=\"at\">--3way</span> /home/thcipriani/0001-some.path</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git status</span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">On</span> branch production</span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Your</span> branch is ahead of <span class=\"st\">&#39;origin/production&#39;</span> by 6 commits.</span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"kw\">(</span><span class=\"ex\">use</span> <span class=\"st\">&quot;git push&quot;</span> to publish your local commits<span class=\"kw\">)</span></span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">nothing</span> to commit, working directory clean</span></code></pre></div>\n<p>The problem here is that a lot of these commits are old and\nbusted.</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git log <span class=\"at\">-6</span> <span class=\"at\">--format</span><span class=\"op\">=</span><span class=\"st\">&#39;%h %ai&#39;</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ad4f419</span> 2016-08-25 20:46:23 +0530</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">d3e9ab8</span> 2016-09-05 15:49:48 +0100</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">59b7377</span> 2016-08-30 16:21:39 <span class=\"at\">-0700</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">5d2609e</span> 2016-08-17 14:17:02 +0100</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">194ee1c</span> 2016-07-19 13:19:54 <span class=\"at\">-0600</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">057c9f7</span> 2016-01-07 17:11:12 <span class=\"at\">-0800</span></span></code></pre></div>\n<p>It’d be nice to have a script that periodically cleans up these\npatches based on some criteria. This script would have to potentially be\nable to remove, say, <code>59b7377</code> while leaving all the others\nin-tact, and it would have to do so without any access to\n<code>git rebase -i</code> or any user input.</p>\n</section>\n<section id=\"non-interactive-commit-deletion\" class=\"level2\">\n<h2>Non-interactive commit deletion</h2>\n<p>The way to do this is with <code>git rebase --onto</code>.</p>\n<p>Selective quoting of <code>man git-rebase</code></p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">SYNOPSIS</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">git</span> rebase [--onto <span class=\"op\">&lt;</span>newbase<span class=\"op\">&gt;</span>] [<span class=\"op\">&lt;</span>upstream<span class=\"op\">&gt;</span>]</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">DESCRIPTION</span></span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">All</span> changes made by commits in the current branch but that are not</span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"er\">in</span> <span class=\"op\">&lt;</span>upstream<span class=\"op\">&gt;</span> are <span class=\"ex\">saved</span> to a temporary area. This is the same set</span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">of</span> commits that would be shown by git log <span class=\"op\">&lt;</span>upstream<span class=\"op\">&gt;</span>..HEAD</span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">The</span> current branch is reset to <span class=\"op\">&lt;</span>newbase<span class=\"op\">&gt;</span> --onto option was supplied.</span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb5-11\"><a href=\"https://tylercipriani.com/blog/#cb5-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">The</span> commits that were previously saved into the temporary area are</span>\n<span id=\"cb5-12\"><a href=\"https://tylercipriani.com/blog/#cb5-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"cf\">then</span> <span class=\"ex\">reapplied</span> to the current branch, one by one, in order.</span></code></pre></div>\n<p>The commits we want are all the commits surrounding\n<code>59b7377</code> without <code>59b7377</code>.</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git log <span class=\"at\">--format</span><span class=\"op\">=</span><span class=\"st\">&#39;%h %ai&#39;</span> 59b7377..HEAD</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ad4f419</span> 2016-08-25 20:46:23 +0530</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">d3e9ab8</span> 2016-09-05 15:49:48 +0100</span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git log <span class=\"at\">--format</span><span class=\"op\">=</span><span class=\"st\">&#39;%h %ai&#39;</span> @{u}..59b7377^</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">5d2609e</span> 2016-08-17 14:17:02 +0100</span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">194ee1c</span> 2016-07-19 13:19:54 <span class=\"at\">-0600</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">057c9f7</span> 2016-01-07 17:11:12 <span class=\"at\">-0800</span></span></code></pre></div>\n<p>So we really want to take the commits <code>59b7377..HEAD</code> and\nrebase them onto the commit before <code>59b7377</code> (which is\n<code>59b7377^</code>)</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git rebase <span class=\"at\">--onto</span> 59b7377^ 59b7377</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">root@puppetmaster#</span> git log <span class=\"at\">-6</span> <span class=\"at\">--format</span><span class=\"op\">=</span><span class=\"st\">&#39;%h %ai&#39;</span></span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ad4f419</span> 2016-08-25 20:46:23 +0530</span>\n<span id=\"cb7-4\"><a href=\"https://tylercipriani.com/blog/#cb7-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">d3e9ab8</span> 2016-09-05 15:49:48 +0100</span>\n<span id=\"cb7-5\"><a href=\"https://tylercipriani.com/blog/#cb7-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">5d2609e</span> 2016-08-17 14:17:02 +0100</span>\n<span id=\"cb7-6\"><a href=\"https://tylercipriani.com/blog/#cb7-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">194ee1c</span> 2016-07-19 13:19:54 <span class=\"at\">-0600</span></span>\n<span id=\"cb7-7\"><a href=\"https://tylercipriani.com/blog/#cb7-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">057c9f7</span> 2016-01-07 17:11:12 <span class=\"at\">-0800</span></span>\n<span id=\"cb7-8\"><a href=\"https://tylercipriani.com/blog/#cb7-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">d5e1340</span> 2016-09-07 23:45:25 +0200</span></code></pre></div>\n<p>Tada! Commit gone.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/07/sensible-editor/",

    "title": "sensible-editor",
    "url": "https://tylercipriani.com/blog/2016/09/07/sensible-editor/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "TIL"

    ],

    "date_published": "2016-09-07T16:34:11Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p><code class=\"verbatim\">sensible-editor</code> is a shell script in\nDebian at <code class=\"verbatim\">/usr/bin/sensible-editor</code> that\nselects a <strong>sensible editor</strong>.</p>\n<p>See also: <code\nclass=\"verbatim\">sensible-{browser,editor,pager}</code></p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/02/gpg-subkeys/",

    "title": "GPG Security things",
    "url": "https://tylercipriani.com/blog/2016/09/02/gpg-subkeys/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "crypto",

     "notes",

     "pgp"

    ],

    "date_published": "2016-09-02T23:29:05Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"revocation-cert\" class=\"level1\">\n<h1>Revocation Cert</h1>\n<p>Needed to revoke your key should the master signing/certifying key\never be compromised</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--output</span> <span class=\"dt\">\\&lt;</span>tyler@tylercipriani.com<span class=\"dt\">\\&gt;</span>.gpg-revocation-certificate <span class=\"at\">--gen-revoke</span> tyler@tylercipriani.com</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">lpr</span> <span class=\"dt\">\\&lt;</span>tyler@tylercipriani.com<span class=\"dt\">\\&gt;</span>.gpg-revocation-certificate</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">shred</span> <span class=\"at\">--remove</span> <span class=\"dt\">\\&lt;</span>tyler@tylercipriani.com<span class=\"dt\">\\&gt;</span>.gpg-revocation-certificate</span></code></pre></div>\n<p>store printed revocation cert in file or safe-deposit box</p>\n</section>\n<section id=\"key-backup\" class=\"level1\">\n<h1>Key backup</h1>\n<p><a\nhref=\"http://www.jabberwocky.com/software/paperkey/\">Paperkey</a></p>\n<p>Download paperkey and its gpg signature</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">wget</span> <span class=\"at\">-c</span> http://www.jabberwocky.com/software/paperkey/paperkey-1.3.tar.gz</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">wget</span> <span class=\"at\">-c</span> http://www.jabberwocky.com/software/paperkey/paperkey-1.3.tar.gz.sig</span></code></pre></div>\n<p>Get David Shaw\'s public key (0x99242560) from your keyserver of\nchoice</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--search-keys</span> <span class=\"st\">&#39;dshaw@jabberwocky.com&#39;</span></span></code></pre></div>\n<p>Verify you have downloaded the right paper key and that the level of\ntrust is sufficient for your purposes</p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--verify</span> Downloads/paperkey-1.3.tar.gz.sig paperkey-1.3.tar.gz</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg:</span> Signature made Thu 03 Jan 2013 09:18:32 PM MST using RSA key ID FEA78A7AA1BC4FA4</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg:</span> Good signature from <span class=\"st\">&quot;David M. Shaw &lt;dshaw@jabberwocky.com&gt;&quot;</span> [unknown]</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg:</span> WARNING: This key is not certified with a trusted signature!</span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg:</span>          There is no indication that the signature belongs to the owner.</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Primary</span> key fingerprint: 7D92 FD31 3AB6 F373 4CC5  9CA1 DB69 8D71 9924 2560</span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Subkey</span> fingerprint: A154 3829 812C 9EA9 87F1  4526 FEA7 8A7A A1BC 4FA4</span></code></pre></div>\n<p>If you have a good signature from davidExtract and install</p>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">tar</span> xvzf paperkey-1.3.tar.gz</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">rm</span> paperkey-1.3.tar.gz</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> paperkey-1.3</span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">./configure</span></span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> make install</span></code></pre></div>\n<p>Print you secret key</p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--export-secret-key</span> tyler@tylercipriani.com <span class=\"kw\">|</span> <span class=\"ex\">paperkey</span> <span class=\"kw\">|</span> <span class=\"fu\">lpr</span></span></code></pre></div>\n<p>Store it in your file or safe-deposit-box</p>\n</section>\n<section id=\"subkeys\" class=\"level1\">\n<h1>Subkeys</h1>\n<p><a\nhref=\"https://alexcabal.com/creating-the-perfect-gpg-keypair/\">Good\nResource</a></p>\n<p>By default, GnuPG creates a key for signing and an encryption\nsubkey:</p>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--list-keys</span> tyler</span></code></pre></div>\n<table>\n<tbody>\n<tr class=\"odd\">\n<td>pub</td>\n<td>rsa4096</td>\n<td>2014-02-19</td>\n<td>[SC]</td>\n<td></td>\n</tr>\n<tr class=\"even\">\n<td>6237D8D3ECC1AE918729296FF6DAD285018FAC02</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr class=\"odd\">\n<td>uid</td>\n<td>[ultimate]</td>\n<td>Tyler</td>\n<td>Cipriani</td>\n<td>&lt;tyler@tylercipriani.com&gt;</td>\n</tr>\n<tr class=\"even\">\n<td>sub</td>\n<td>rsa4096</td>\n<td>2014-02-19</td>\n<td>[E]</td>\n<td></td>\n</tr>\n<tr class=\"odd\">\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>You can add a new subkey with the command</p>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--edit-key</span> tyler</span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span><span class=\"op\">&gt;</span> addkey</span></code></pre></div>\n<p>And then you should see</p>\n<div class=\"sourceCode\" id=\"cb9\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--list-keys</span> tyler</span></code></pre></div>\n<table>\n<tbody>\n<tr class=\"odd\">\n<td>pub</td>\n<td>rsa4096</td>\n<td>2014-02-19</td>\n<td>[SC]</td>\n<td></td>\n<td></td>\n</tr>\n<tr class=\"even\">\n<td>6237D8D3ECC1AE918729296FF6DAD285018FAC02</td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n<tr class=\"odd\">\n<td>uid</td>\n<td>[ultimate]</td>\n<td>Tyler</td>\n<td>Cipriani</td>\n<td>&lt;tyler@tylercipriani.com&gt;</td>\n<td></td>\n</tr>\n<tr class=\"even\">\n<td>sub</td>\n<td>rsa4096</td>\n<td>2014-02-19</td>\n<td>[E]</td>\n<td></td>\n<td></td>\n</tr>\n<tr class=\"odd\">\n<td>sub</td>\n<td>rsa4096</td>\n<td>2016-09-02</td>\n<td>[S]</td>\n<td>[expires:</td>\n<td>2018-09-02]</td>\n</tr>\n<tr class=\"even\">\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n<td></td>\n</tr>\n</tbody>\n</table>\n<p>You can then remove your certification master key (make sure you\'ve\ngone through the <a href=\"https://tylercipriani.com/blog/#key-backup\">key backup</a> process before you\ndo this!)</p>\n<ol>\n<li>Export all your secret subkeys</li>\n<li>Remove all your secret keys from your keyring</li>\n<li>Reimport only your subkeys</li>\n</ol>\n<div class=\"sourceCode\" id=\"cb10\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--export-secret-subkeys</span> tyler <span class=\"op\">&gt;</span> subkeys</span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--delete-secret-key</span> tyler</span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--import</span> subkeys</span>\n<span id=\"cb10-4\"><a href=\"https://tylercipriani.com/blog/#cb10-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">shred</span> <span class=\"at\">--remove</span> subkeys</span></code></pre></div>\n<p>Now <code class=\"verbatim\">gpg --list-keys</code> shows a <code\nclass=\"verbatim\">#</code> next to <code class=\"verbatim\">sec#</code>\nnext to my <code class=\"verbatim\">[SC]</code> key. This indicates that\nthe key is no longer accessible.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/09/02/lowering-the-barrier-to-blogging/",

    "title": "Lowering the Barrier to Blogging",
    "url": "https://tylercipriani.com/blog/2016/09/02/lowering-the-barrier-to-blogging/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "administravia",

     "computing"

    ],

    "date_published": "2016-09-02T16:00:28Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I really want to blog more. The problem is that most of the posts to\nthis blog are fairly long-form. This will probably change as I do blog\nmore.</p>\n<p>I\'ve also moved to Pandoc for rendering posts via <a\nhref=\"https://github.com/sciunto-org/ikiwiki-pandoc\">ikiwiki-pandoc</a>.</p>\n<p>In that process, I\'ve also come to realize that pandoc handles <a\nhref=\"https://orgmode.org\">org-mode</a> files almost completely\nunambiguously—which is not actually something you get in most markup\nlanguages/markup language interpreters. BONUS: I enjoy writing in\norg-mode.</p>\n<p>As is my wont, I\'ve also created some (not-so) fancy scripts to help\nme:</p>\n<div class=\"sourceCode\" id=\"~/bin/blog\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"~/bin/blog-1\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"~/bin/blog-2\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-3\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">set</span> <span class=\"at\">-eu</span></span>\n<span id=\"~/bin/blog-4\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-5\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">POST</span><span class=\"op\">=</span><span class=\"va\">$*</span></span>\n<span id=\"~/bin/blog-6\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">BLOG_DIR</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">grep</span> <span class=\"st\">&#39;^srcdir&#39;</span> ~/ikiwiki.setup <span class=\"kw\">|</span> <span class=\"fu\">cut</span> <span class=\"at\">-d</span><span class=\"st\">&#39;:&#39;</span> <span class=\"at\">-f2</span> <span class=\"kw\">|</span> <span class=\"fu\">xargs</span><span class=\"va\">)</span></span>\n<span id=\"~/bin/blog-7\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">DATE</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> <span class=\"at\">-Ins</span><span class=\"va\">)</span></span>\n<span id=\"~/bin/blog-8\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">BLOG_PATH</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> +<span class=\"st\">&#39;blog/%Y/%m/%d&#39;</span><span class=\"va\">)</span></span>\n<span id=\"~/bin/blog-9\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">EXT</span><span class=\"op\">=</span><span class=\"st\">&#39;.org&#39;</span></span>\n<span id=\"~/bin/blog-10\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-11\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">SAFE_POST</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"bu\">echo</span> <span class=\"st\">&quot;</span><span class=\"va\">$POST</span><span class=\"st\">&quot;</span> <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"~/bin/blog-12\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">tr</span> <span class=\"st\">&#39;[:upper:]&#39;</span> <span class=\"st\">&#39;[:lower:]&#39;</span> <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"~/bin/blog-13\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">sed</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;s/\\W/-/g&#39;</span><span class=\"va\">)</span></span>\n<span id=\"~/bin/blog-14\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-14\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-15\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">OUT</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">${BLOG_DIR}</span><span class=\"st\">/</span><span class=\"va\">${BLOG_PATH}</span><span class=\"st\">/</span><span class=\"va\">${SAFE_POST}${EXT}</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-16\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-16\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-17\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> <span class=\"at\">-p</span> <span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"fu\">dirname</span> <span class=\"st\">&quot;</span><span class=\"va\">$OUT</span><span class=\"st\">&quot;</span><span class=\"va\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-18\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-18\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-19\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">{</span></span>\n<span id=\"~/bin/blog-20\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">printf</span> <span class=\"st\">&#39;#+TITLE: %b\\n&#39;</span> <span class=\"st\">&quot;</span><span class=\"va\">$POST</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-21\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">printf</span> <span class=\"st\">&#39;\\n&#39;</span> <span class=\"st\">&quot;</span><span class=\"va\">$POST</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-22\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">printf</span> <span class=\"st\">&#39;[[!meta &lt;span class=&quot;error&quot;&gt;Error: cannot parse date/time: &amp;#37;b&lt;/span&gt;]]\\n\\n&#39;</span> <span class=\"st\">&quot;</span><span class=\"va\">$DATE</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-23\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">}</span> <span class=\"op\">&gt;&gt;</span> <span class=\"st\">&quot;</span><span class=\"va\">$OUT</span><span class=\"st\">&quot;</span></span>\n<span id=\"~/bin/blog-24\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-24\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/blog-25\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-25\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># http://www.emacswiki.org/emacs/EmacsClient</span></span>\n<span id=\"~/bin/blog-26\"><a href=\"https://tylercipriani.com/blog/#~/bin/blog-26\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">exec</span> emacsclient <span class=\"at\">--no-wait</span> <span class=\"at\">--alternate-editor</span><span class=\"op\">=</span><span class=\"st\">&quot;&quot;</span> <span class=\"at\">--create-frame</span> <span class=\"st\">&quot;</span><span class=\"va\">$OUT</span><span class=\"st\">&quot;</span></span></code></pre></div>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/30/bash-completion/",

    "title": "Bash Completion",
    "url": "https://tylercipriani.com/blog/2016/08/30/bash-completion/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "bash",

     "computing",

     "notes",

     "shell"

    ],

    "date_published": "2016-08-30T05:01:47Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<section id=\"links\" class=\"level2\">\n<h2>Links</h2>\n<p><a\nhref=\"https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1\">Intro\nto bash completion</a></p>\n</section>\n<section id=\"basics\" class=\"level2\">\n<h2>Basics</h2>\n<p>Most Debian installed bash completions live under\n<code>/usr/share/bash_completion/completions</code></p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a><span class=\"co\"># the first argument ($1) is the name of the command whose  arguments are being completed</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a><span class=\"co\"># the second argument ($2) is the word being completed,</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a><span class=\"co\"># and the third argument ($3) is the word preceding the word  being  completed  on the current command line</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a><span class=\"co\"># In the context of this function the following variables are defined:</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\"></a><span class=\"co\"># COMP_LINE, COMP_POINT, COMP_KEY, and COMP_TYPE</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\"></a><span class=\"co\"># as well as COMP_WORDS and COMP_CWORD</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\"></a><span class=\"co\">#  It must put the possible completions in the COMPREPLY array</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\"></a><span class=\"co\"># See bash(1) &#39;^  Programmable Completion&#39; for more information</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\"></a><span class=\"fu\">_some_function()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\"></a>  <span class=\"bu\">local</span> <span class=\"va\">cur</span> <span class=\"va\">cmd</span></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\"></a>  <span class=\"va\">cur</span><span class=\"op\">=</span><span class=\"va\">${COMP_WORDS</span><span class=\"op\">[</span><span class=\"va\">$COMP_CWORD</span><span class=\"op\">]</span><span class=\"va\">}</span></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\"></a>  <span class=\"va\">cmd</span><span class=\"op\">=</span><span class=\"va\">(</span> <span class=\"st\">&quot;</span><span class=\"va\">${COMP_WORDS</span><span class=\"op\">[@]</span><span class=\"va\">}</span><span class=\"st\">&quot;</span> <span class=\"va\">)</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\"></a><span class=\"bu\">complete</span> <span class=\"at\">-F</span> _some_function command</span></code></pre></div>\n</section>\n<section id=\"complete-options\" class=\"level2\">\n<h2><code>complete</code> options</h2>\n<p>Some complete options you want:</p>\n<ul>\n<li><code>-o bashdefault</code> - if no completions are found do the\nbash default thing</li>\n<li><code>-o default</code> - readline completions if both the complete\nfunction and bash expansions fail</li>\n<li><code>-o nospace</code> - don’t append a space at the end of matches\n(useful if you’re doing directory stuffs)</li>\n<li><code>-S or -P</code> - a prefix or suffix that is added at the end\nof a completion generated by the function passed to\n<code>complete -F</code></li>\n</ul>\n</section>\n<section id=\"example\" class=\"level2\">\n<h2>Example</h2>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"co\"># Many of the ideas presented in this script were stolen</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a><span class=\"co\"># in-part or wholesale from</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a><span class=\"co\"># &lt;https://github.com/git/git/blob/master/contrib/completion/git-completion.bash&gt;</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a><span class=\"va\">__scap_subcommands</span><span class=\"op\">=</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a><span class=\"fu\">__scap_get_subcommands()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a>    <span class=\"cf\">if</span> <span class=\"bu\">[</span> <span class=\"ot\">-n</span> <span class=\"st\">&quot;</span><span class=\"va\">$__scap_subcommands</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span><span class=\"kw\">;</span> <span class=\"cf\">then</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a>        <span class=\"cf\">return</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\"></a>    <span class=\"cf\">fi</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\"></a></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\"></a>    <span class=\"va\">__scap_subcommands</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"ex\">scap</span> <span class=\"at\">--_autocomplete</span><span class=\"va\">)</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\"></a></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\"></a><span class=\"fu\">_scap()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\"></a>    <span class=\"bu\">local</span> <span class=\"va\">cur</span> <span class=\"va\">cmd</span><span class=\"op\">=</span><span class=\"va\">()</span> <span class=\"va\">sub</span> <span class=\"va\">rep</span></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\"></a></span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\"></a>    <span class=\"va\">cur</span><span class=\"op\">=</span><span class=\"va\">${COMP_WORDS</span><span class=\"op\">[</span><span class=\"va\">$COMP_CWORD</span><span class=\"op\">]</span><span class=\"va\">}</span></span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\"></a>    <span class=\"va\">cmd</span><span class=\"op\">=</span><span class=\"va\">(</span> <span class=\"st\">&quot;</span><span class=\"va\">${COMP_WORDS</span><span class=\"op\">[@]</span><span class=\"va\">}</span><span class=\"st\">&quot;</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\"></a></span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\"></a>    <span class=\"cf\">if</span> <span class=\"kw\">((</span> <span class=\"va\">COMP_CWORD</span> <span class=\"op\">==</span> <span class=\"dv\">1</span> <span class=\"kw\">));</span> <span class=\"cf\">then</span></span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\"></a>        <span class=\"ex\">__scap_get_subcommands</span></span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\"></a>        <span class=\"va\">rep</span><span class=\"op\">=</span><span class=\"va\">$(</span> <span class=\"bu\">compgen</span> <span class=\"at\">-W</span> <span class=\"st\">&quot;</span><span class=\"va\">$__scap_subcommands</span><span class=\"st\">&quot;</span> <span class=\"at\">--</span> <span class=\"st\">&quot;</span><span class=\"va\">$cur</span><span class=\"st\">&quot;</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\"></a>        <span class=\"va\">COMPREPLY</span><span class=\"op\">=</span><span class=\"va\">(</span> <span class=\"va\">$rep</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\"></a>        <span class=\"cf\">return</span></span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\"></a>    <span class=\"cf\">fi</span></span>\n<span id=\"cb2-25\"><a href=\"https://tylercipriani.com/blog/#cb2-25\"></a></span>\n<span id=\"cb2-26\"><a href=\"https://tylercipriani.com/blog/#cb2-26\"></a>    <span class=\"co\"># limit the command to autocomplete to the first 3 words</span></span>\n<span id=\"cb2-27\"><a href=\"https://tylercipriani.com/blog/#cb2-27\"></a>    <span class=\"cf\">if</span> <span class=\"kw\">((</span> <span class=\"va\">COMP_CWORD</span> <span class=\"op\">&gt;=</span> <span class=\"dv\">2</span> <span class=\"kw\">));</span> <span class=\"cf\">then</span></span>\n<span id=\"cb2-28\"><a href=\"https://tylercipriani.com/blog/#cb2-28\"></a>        <span class=\"co\"># don&#39;t complete any sub-subcommands, only options</span></span>\n<span id=\"cb2-29\"><a href=\"https://tylercipriani.com/blog/#cb2-29\"></a>        <span class=\"cf\">if</span> <span class=\"kw\">[[</span> <span class=\"ot\">-n</span> <span class=\"st\">&quot;</span><span class=\"va\">$cur</span><span class=\"st\">&quot;</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"st\">&quot;</span><span class=\"va\">${cur</span><span class=\"op\">:</span><span class=\"dv\">0</span><span class=\"op\">:</span><span class=\"dv\">1</span><span class=\"va\">}</span><span class=\"st\">&quot;</span> <span class=\"ot\">!=</span> <span class=\"st\">&#39;-&#39;</span> <span class=\"kw\">]];</span> <span class=\"cf\">then</span></span>\n<span id=\"cb2-30\"><a href=\"https://tylercipriani.com/blog/#cb2-30\"></a>            <span class=\"va\">COMPREPLY</span><span class=\"op\">=</span><span class=\"va\">()</span></span>\n<span id=\"cb2-31\"><a href=\"https://tylercipriani.com/blog/#cb2-31\"></a>            <span class=\"cf\">return</span></span>\n<span id=\"cb2-32\"><a href=\"https://tylercipriani.com/blog/#cb2-32\"></a>        <span class=\"cf\">fi</span></span>\n<span id=\"cb2-33\"><a href=\"https://tylercipriani.com/blog/#cb2-33\"></a>        <span class=\"va\">cmd</span><span class=\"op\">=</span><span class=\"va\">(</span> <span class=\"st\">&quot;</span><span class=\"va\">${COMP_WORDS</span><span class=\"op\">[@]:</span><span class=\"dv\">0</span><span class=\"op\">:</span><span class=\"dv\">3</span><span class=\"va\">}</span><span class=\"st\">&quot;</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-34\"><a href=\"https://tylercipriani.com/blog/#cb2-34\"></a>    <span class=\"cf\">fi</span></span>\n<span id=\"cb2-35\"><a href=\"https://tylercipriani.com/blog/#cb2-35\"></a></span>\n<span id=\"cb2-36\"><a href=\"https://tylercipriani.com/blog/#cb2-36\"></a>    <span class=\"co\"># replace the last word in the command with &#39;--_autocomplete&#39;</span></span>\n<span id=\"cb2-37\"><a href=\"https://tylercipriani.com/blog/#cb2-37\"></a>    <span class=\"va\">cmd</span><span class=\"op\">[</span> <span class=\"va\">$((</span> <span class=\"va\">${</span><span class=\"op\">#</span><span class=\"va\">cmd</span><span class=\"op\">[@]</span><span class=\"va\">}</span> <span class=\"op\">-</span> <span class=\"dv\">1</span> <span class=\"va\">))</span> <span class=\"op\">]=</span><span class=\"st\">&#39;--_autocomplete&#39;</span></span>\n<span id=\"cb2-38\"><a href=\"https://tylercipriani.com/blog/#cb2-38\"></a></span>\n<span id=\"cb2-39\"><a href=\"https://tylercipriani.com/blog/#cb2-39\"></a>    <span class=\"va\">rep</span><span class=\"op\">=</span><span class=\"va\">$(</span> <span class=\"bu\">compgen</span> <span class=\"at\">-W</span> <span class=\"st\">&quot;</span><span class=\"va\">$(</span> <span class=\"va\">${cmd</span><span class=\"op\">[@]</span><span class=\"va\">}</span> <span class=\"va\">)</span><span class=\"st\">&quot;</span> <span class=\"at\">--</span> <span class=\"st\">&quot;</span><span class=\"va\">$cur</span><span class=\"st\">&quot;</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-40\"><a href=\"https://tylercipriani.com/blog/#cb2-40\"></a></span>\n<span id=\"cb2-41\"><a href=\"https://tylercipriani.com/blog/#cb2-41\"></a>    <span class=\"va\">COMPREPLY</span><span class=\"op\">=</span><span class=\"va\">(</span> <span class=\"va\">$rep</span> <span class=\"va\">)</span></span>\n<span id=\"cb2-42\"><a href=\"https://tylercipriani.com/blog/#cb2-42\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb2-43\"><a href=\"https://tylercipriani.com/blog/#cb2-43\"></a></span>\n<span id=\"cb2-44\"><a href=\"https://tylercipriani.com/blog/#cb2-44\"></a><span class=\"co\"># By default append nospace except when completion comes from _scap</span></span>\n<span id=\"cb2-45\"><a href=\"https://tylercipriani.com/blog/#cb2-45\"></a><span class=\"bu\">complete</span> <span class=\"at\">-S</span><span class=\"st\">&#39; &#39;</span> <span class=\"at\">-o</span> bashdefault <span class=\"at\">-o</span> default <span class=\"at\">-o</span> nospace <span class=\"at\">-F</span> _scap scap</span></code></pre></div>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/26/abusing-git-notes/",

    "title": "(ab)Using Git Notes",
    "url": "https://tylercipriani.com/blog/2016/08/26/abusing-git-notes/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "git",

     "git-abuse",

     "vcs"

    ],

    "date_published": "2016-08-26T22:35:15Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<section id=\"flickr\" class=\"level2\">\n<h2>Flickr</h2>\n<p>I like to post my <a href=\"http://photos.tylercipriani.com/\">photos\non the internet</a>. I used to post all of my photos on <a\nhref=\"https://www.flickr.com/photos/tylercipriani/\">Flickr</a>, but that\nsite has been getting <a\nhref=\"https://github.com/thcipriani/dotfiles/commit/c2ff9eeedb1c6634982efc940e43335264018269\">worse</a>\nand <a\nhref=\"https://techcrunch.com/2013/05/20/flickr-gets-a-huge-revamp-with-hi-res-image-filled-ui-new-android-app-and-1tb-of-free-storage/\">worse</a>\nand <a\nhref=\"https://www.theguardian.com/technology/2016/jul/25/yahoo-moves-next-for-flickr\">worse</a>.\nMore recently, I’ve been using a static photo gallery generator I\n<strike>wrote</strike> hacked together that I (perhaps unfortunately)\nnamed <a\nhref=\"https://github.com/thcipriani/dotfiles/tree/master/bin/hiraeth\">hiraeth</a>.</p>\n<p>Hiraeth is, to put it mildly, missing some features. There are a few\nreasons that I opted to create hiraeth rather than use something that\nwas already built:</p>\n<ol type=\"1\">\n<li>I <em>need</em> to host my own photos now, evidently. The internet\nhas seemingly decided to sell its user-base to the highest bidder, so\nhosted services are out.</li>\n<li>I think it makes sense to host my photos statically, since they’re\nstatic (mostly).</li>\n<li>I really <em>like</em> the way my <code>~/Pictures</code> directory\nis organized—I can find stuff—and I don’t want to mess all that up to\ngenerate a crappy website out of my photos.</li>\n<li>I use git-annex to manage my <code>~/Pictures</code>, which\ncreates…unique challenges :)</li>\n</ol>\n<p>Hiraeth is invoked like:\n<code>publish [edited-photo-dir] [output-dir]</code>. Hiraeth looks for\na file named <code>_metadata.yaml</code> inside the directory of edited\nphotos and uses that to map photo files to photo descriptions and add\ntitles and whatnot to the page. It makes a few different sized\nthumbnails of each photo, grabs the exif info, and generates some\nhtml.</p>\n<p>Hiraeth was designed to look and behave like a static version of\nFlickr circa 2007. There are still features to add, but there is a base\nthat works in place at least.</p>\n</section>\n<section id=\"home-pictures\" class=\"level2\">\n<h2>Home Pictures</h2>\n<p>I mange my <code>~/Pictures</code> directory using <a\nhref=\"https://git-annex.branchable.com/\">git-annex</a> (which I’ve\nwanted to write something about for a long time). This is mostly amazing\nand great. Git-annex has a lot of cool features. For instance, in\ngit-annex once you’ve copied files to a remote, it will allow you to\n“<code>drop</code>” a file locally to save space. You can still get the\nfile back from the remote any time you rootin’ tootin’ feel like, so\nnbd. Occasionally, when I’m running out of space on one machine or\nanother, I’ll <code>drop</code> a bunch of photos.</p>\n<p>The ability to drop a bunch of photos means that hiraeth needs to be\nable to get photo metadata from a picture without having the file\n<em>actually</em> be on disk.</p>\n</section>\n<section id=\"gerrit\" class=\"level2\">\n<h2>Gerrit</h2>\n<p>We use gerrit at work and I genuinely like it.</p>\n<p><code>&lt;rant&gt;</code> The web-UI is one of the worst interfaces\nI’ve ever used. The web interface is an unfortunate mix of late-90s,\ndesigned-by-engineers, impossibly-option-filled interface mashed\ntogether in an unholy union with a fancy-schmancy new-fangled\njavascripty single-page application. It’s basically a mix of two\ninterface paradigms I hate, yet rarely see in concert: back-button\nbreakage + no design aesthetic whatsoever.\n<code>&lt;/rant&gt;</code></p>\n<p><strong>HOWEVER</strong>, The workflow gerrit enforces, the git\nfeatures it uses, and the beautiful repository history that results\nmakes gerrit a really nice code review system.</p>\n<p>Gerrit is the first system I’ve seen use git-notes.</p>\n<p>Gerrit has a cool feature where it keeps all of the patch review in\ngit-notes:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:mediawiki-core$</span> git fetch origin refs/notes/<span class=\"pp\">*</span>:refs/notes/<span class=\"pp\">*</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">remote:</span> Counting objects: 176401, done</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">remote:</span> Finding sources: 100% <span class=\"er\">(</span><span class=\"ex\">147886/147886</span><span class=\"kw\">)</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">remote:</span> Getting sizes: 100% <span class=\"er\">(</span><span class=\"ex\">1723/1723</span><span class=\"kw\">)</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">remote:</span> Compressing objects: 100% <span class=\"er\">(</span><span class=\"ex\">116810/116810</span><span class=\"kw\">)</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">remote:</span> Total 147886 <span class=\"er\">(</span><span class=\"ex\">delta</span> 120436<span class=\"kw\">)</span><span class=\"ex\">,</span> reused 147854 <span class=\"er\">(</span><span class=\"ex\">delta</span> 120434<span class=\"kw\">)</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Receiving</span> objects: 100% <span class=\"er\">(</span><span class=\"ex\">147886/147886</span><span class=\"kw\">)</span><span class=\"ex\">,</span> 14.91 MiB <span class=\"kw\">|</span> <span class=\"ex\">3.01</span> MiB/s, done.</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Resolving</span> deltas: 100% <span class=\"er\">(</span><span class=\"ex\">120449/120449</span><span class=\"kw\">)</span><span class=\"ex\">,</span> done.</span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">From</span> ssh://gerrit.wikimedia.org:29418/mediawiki/core</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">*</span> [new ref]         refs/notes/commits <span class=\"at\">-</span><span class=\"op\">&gt;</span> refs/notes/commits</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">*</span> [new ref]         refs/notes/review <span class=\"at\">-</span><span class=\"op\">&gt;</span> refs/notes/review</span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:mediawiki-core$</span> ls <span class=\"at\">-l</span> .git/refs/notes</span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">total</span> 8</span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">-rw-r--r--</span> 1 tyler tyler 41 Aug 28 16:44 commits</span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">-rw-r--r--</span> 1 tyler tyler 41 Aug 28 16:44 review</span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:mediawiki-core$</span> git log <span class=\"at\">--show-notes</span><span class=\"op\">=</span>review <span class=\"at\">--author</span><span class=\"op\">=</span><span class=\"st\">&#39;Tyler Cipriani&#39;</span></span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">commit</span> ab131d4be475bf87b0f0a86fa356a2b1a188a673</span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Author:</span> Tyler Cipriani <span class=\"op\">&lt;</span>tcipriani@wikimedia.org<span class=\"op\">&gt;</span></span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Date:</span>   Tue Mar 22 09:08:52 2016 <span class=\"at\">-0700</span></span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\" aria-hidden=\"true\" tabindex=\"-1\"></a> </span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Revert</span> <span class=\"st\">&quot;Add link to anon&#39;s user page; remove &quot;</span>Not logged in<span class=\"st\">&quot;&quot;</span></span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\" aria-hidden=\"true\" tabindex=\"-1\"></a> </span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">This</span> reverts change I049d0671a7050.</span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\" aria-hidden=\"true\" tabindex=\"-1\"></a> </span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">This</span> change was reverted in the wmf/1.27.0-wmf.17. Since there is no</span>\n<span id=\"cb1-26\"><a href=\"https://tylercipriani.com/blog/#cb1-26\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"fu\">clear</span> consensus, revert in master before branching wmf/1.27.0-wmf.18.</span>\n<span id=\"cb1-27\"><a href=\"https://tylercipriani.com/blog/#cb1-27\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Bug:</span> T121793</span>\n<span id=\"cb1-28\"><a href=\"https://tylercipriani.com/blog/#cb1-28\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Change-Id:</span> I2dc0f2562c908d4e419d34e80a64065843778f3d</span>\n<span id=\"cb1-29\"><a href=\"https://tylercipriani.com/blog/#cb1-29\" aria-hidden=\"true\" tabindex=\"-1\"></a> </span>\n<span id=\"cb1-30\"><a href=\"https://tylercipriani.com/blog/#cb1-30\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Notes</span> <span class=\"er\">(</span><span class=\"ex\">review</span><span class=\"kw\">)</span><span class=\"bu\">:</span></span>\n<span id=\"cb1-31\"><a href=\"https://tylercipriani.com/blog/#cb1-31\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Verified+2:</span> jenkins-bot</span>\n<span id=\"cb1-32\"><a href=\"https://tylercipriani.com/blog/#cb1-32\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Code-Review+2:</span> Legoktm <span class=\"op\">&lt;</span>legoktm.wikipedia@gmail.com<span class=\"op\">&gt;</span></span>\n<span id=\"cb1-33\"><a href=\"https://tylercipriani.com/blog/#cb1-33\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Submitted-by:</span> jenkins-bot</span>\n<span id=\"cb1-34\"><a href=\"https://tylercipriani.com/blog/#cb1-34\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Submitted-at:</span> Tue, 22 Mar 2016 18:08:27 +0000</span>\n<span id=\"cb1-35\"><a href=\"https://tylercipriani.com/blog/#cb1-35\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Reviewed-on:</span> https://gerrit.wikimedia.org/r/278923</span>\n<span id=\"cb1-36\"><a href=\"https://tylercipriani.com/blog/#cb1-36\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Project:</span> mediawiki/core</span>\n<span id=\"cb1-37\"><a href=\"https://tylercipriani.com/blog/#cb1-37\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">Branch:</span> refs/heads/master</span></code></pre></div>\n<p>This is super cool. You can have, effectively, an offline backup of\nlots of information you’d usually have to brave the gerrit web-ui to\nfind. Plus, you don’t <em>have to</em> have this information in your\nlocal repo taking up space, it’s only there if you fetch it down.</p>\n<p>There is another project from Google that uses git-notes for review\ncalled <a\nhref=\"https://github.com/google/git-appraise\">git-appraise</a>.</p>\n<p>This is the stated use of git-notes in the docs: store extra\ninformation about a commit, without changing the SHA1 of the commit by\nmodifying its contents.</p>\n<p>It is, however, noteworthy that you can store a note that points to\nany object in your repository and not just commit objects.</p>\n</section>\n<section id=\"exif-data-without-pictures\" class=\"level2\">\n<h2>EXIF data without pictures</h2>\n<p>After some minor testing it seems that I can store all the EXIF info\nI need about my images in git-notes without <em>actually</em> having\nthose images on disk; i.e., I can have git-annex drop the actual files\nand just have broken symlinks that point to where the files live in\nannex.</p>\n<p>I wrote a <a\nhref=\"https://gist.github.com/thcipriani/e56cdef56a98eb0cf7e93dadf94fbdd8\">small\nbash script</a> to play with some of these ideas.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:Pictures$</span> git photo show fish.jpg</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">+</span> git notes <span class=\"at\">--ref</span><span class=\"op\">=</span>pictures show d4a9c57715ce63a228577900d1abc027</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">error:</span> No note found for object d4a9c57715ce63a228577900d1abc0273396e8ef.</span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:Pictures$</span> git photo add fish.jpg</span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">+</span> git notes <span class=\"at\">--ref</span><span class=\"op\">=</span>pictures add <span class=\"at\">-m</span> <span class=\"st\">&#39;FileName: fish.jpg</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">FileTypeExtension: jpg</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">Make: NIKON CORPORATION</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">Model: NIKON D610</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">LensID: AF-S Zoom-Nikkor 24-70mm f/2.8G ED</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">FocalLength: 62.0 mm</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">FNumber: 2.8</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">ISO: 3200&#39;</span> d4a9c57715ce63a228577900d1abc027</span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">+</span> set +x</span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tyler@taskmaster:Pictures$</span> git photo show fish.jpg</span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">+</span> git notes <span class=\"at\">--ref</span><span class=\"op\">=</span>pictures show d4a9c57715ce63a228577900d1abc027</span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FileName:</span> fish.jpg</span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FileTypeExtension:</span> jpg</span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Make:</span> NIKON CORPORATION</span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Model:</span> NIKON D610</span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">LensID:</span> AF-S Zoom-Nikkor 24-70mm f/2.8G ED</span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FocalLength:</span> 62.0 mm</span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">FNumber:</span> 2.8</span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ISO:</span> 3200</span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">+</span> set +x</span></code></pre></div>\n<p>Now it seems like it <em>should be</em> possible to\n<code>git push origin refs/notes/pictures</code>, fetch them on the\nother side, and modify hiraeth to read EXIF from notes when the symlink\ntarget doesn’t exist.</p>\n<p>We’ll see how any of that goes in practice :<br />\n</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/23/updates-around-here/",

    "title": "Updates around here",
    "url": "https://tylercipriani.com/blog/2016/08/23/updates-around-here/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "administravia",

     "computing"

    ],

    "date_published": "2016-08-23T23:28:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>I’ve (mostly) finished moving my blog off of Jekyll and over to <a\nhref=\"https://ikiwiki.info/\">IkiWiki</a>.</p>\n<p>The source for my posts is still on github. My Jekyll stuff is still\nin <a\nhref=\"https://github.com/thcipriani/blog_src\">thcipriani/blog_src</a>.\nMy IkiWiki stuff can be found in <a\nhref=\"https://tylercipriani.com/blog/thcipriani/wikihttps://github.com/thcipriani/wiki\">thcipriani/wiki</a>.\nI’ve also made a couple of plugins for IkiWiki—one to use <a\nhref=\"http://pygments.org/\">Pygments</a> for syntax highlighting,\nanother to use <a href=\"http://s3tools.org/s3cmd\">s3cmd</a> to do my\npublishing. I’ll get around to publishing those plugins Soon™. For\nwhatever reason the <a\nhref=\"https://ikiwiki.info/plugins/amazon_s3/\">amazon_s3</a> plugin for\nIkiWiki failed in strange ways for me.</p>\n<section id=\"content-ownership\" class=\"level2\">\n<h2>Content Ownership</h2>\n<p>This move was prompted mostly by content ownership and licensing\nissues.</p>\n<p>On the previous iteration of this site, I used the <a\nhref=\"https://disqus.com/\">Disqus</a> service (which is really good) for\ncomments—but I really wanted to own the comments on my blog! I wanted to\nbe certain that the comments made here were owned by the folks that made\nthem and licensed in a Free way. To that end, I exported all comments\nfrom Disqus (which is an awesome feature) and imported them into a\nservice that I hosted on a tiny platform called <a\nhref=\"https://posativ.org/isso/\">Isso</a>. Isso seems like good\nsoftware, and everything worked out of the box.</p>\n</section>\n<section id=\"copyleft\" class=\"level2\">\n<h2>Copyleft</h2>\n<p>So after a lot of yak shaving, I was running on Jekyll and Isso which\nare both <a href=\"https://en.wikipedia.org/wiki/MIT_License\">MIT\nLicensed</a> projects. For my personal blog, I really wanted to use\nsomething with a Copyleft license. The criteria of a\nstatically-generated blog and comment system with a Copyleft license was\nsurprisingly limiting.</p>\n<p>I looked at using <a href=\"http://blog.getpelican.com/\">Pelican</a>\nand IkiWiki. Ultimately, IkiWiki just seemed more flexible and\nextensible to me. Plus, I’m writing this via the CGI and it will be\nbuilt statically and uploaded to s3 which is kind of neat.</p>\n</section>\n<section id=\"administravia\" class=\"level2\">\n<h2>Administravia</h2>\n<p>I’ve made some effort to ensure that RSS feeds don’t break. This\neffort consists of a single 301 redirect.</p>\n<p>I’ve also written a new <a href=\"https://tylercipriani.com/comment-policy/\">comment policy</a>\nfor this site.</p>\n<p>Sorry if I’ve broken things. Let me know if I’ve broken things\nbadly.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/20/2016/",

    "title": "Books Read (so far) in 2016",
    "url": "https://tylercipriani.com/blog/2016/08/20/2016/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2016-08-20T00:00:00Z",
    "date_modified": "2018-01-13T19:49:37Z",


    "content_html": "<p>The goal here is to hit 2 books a month, so 24 for the year. I’m on\ntrack as of now. Perilous.</p>\n<ol type=\"1\">\n<li><a\nhref=\"https://openlibrary.org/books/OL7500496M/Stranger_in_a_Strange_Land\">Stranger\nin a Strange Land</a> by Robert A. Heinlein</li>\n<li><a href=\"https://openlibrary.org/works/OL573448W/Black_hole\">Black\nHole</a> by Charles Burns</li>\n<li><a href=\"https://openlibrary.org/works/OL17314347W/Fun_Home\">Fun\nHome</a> by Alison Bechdel</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL17112428W/The_Girl_on_the_Train\">The\nGirl on the Train</a> by Paula Hawkins</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL59740W/Starship_Troopers\">Starship\nTroopers</a> by Robert A. Heinlein</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL15936512W/Ready_Player_One\">Ready\nPlayer One</a> by Ernest Cline</li>\n<li><a href=\"https://openlibrary.org/works/OL16808654W/The_Circle\">The\nCircle</a> by Dave Eggers</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL17318135W/Notorious_RBG\">Notorious\nRBG</a> by Irin Carmon and Shana Knizhnik</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL17335914W/The_Three_Body_Problem\">The\nThree-Body Problem</a> by Cixin Liu</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL59852W/A_wizard_of_Earthsea\">A\nWizard of Earthsea</a> by Ursula K. Le Guin</li>\n<li><a href=\"https://openlibrary.org/works/OL271675W/Stoner\">Stoner</a>\nby John Williams</li>\n<li><a href=\"https://openlibrary.org/works/OL2670584W/Prost\">Prost! The\nStory of German Beer</a> by Horst D. Dornbusch</li>\n<li><a href=\"https://openlibrary.org/works/OL3673999W/Bock\">Bock</a> by\nDarryl Richman</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL2172532W/Do_Androids_Dream_of_Electric_Sheep\">Do\nAndroids Dream of Electric Sheep</a> by Philip K. Dick</li>\n<li><a href=\"https://openlibrary.org/works/OL15536410W/Room\">Room</a> by\nEmma Donoghue</li>\n<li><a\nhref=\"https://openlibrary.org/works/OL3348011W/Kitchen_Confidential\">Kitchen\nConfidential: adventures in the culinary underbelly</a> by Anthony\nBourdain</li>\n<li><a href=\"https://openlibrary.org/works/OL17110026W/H_Is_for_Hawk\">H\nis for Hawk</a> by Helen Macdonald</li>\n</ol>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/05/25/gnu-autotools/",

    "title": "GNU Autotools",
    "url": "https://tylercipriani.com/blog/2016/05/25/gnu-autotools/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "gnu",

     "notes"

    ],

    "date_published": "2016-05-25T14:22:03Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"links\" class=\"level1\">\n<h1>Links</h1>\n<ul>\n<li><a\nhref=\"https://robots.thoughtbot.com/the-magic-behind-configure-make-make-install\">https://robots.thoughtbot.com/the-magic-behind-configure-make-make-install</a></li>\n</ul>\n</section>\n<section id=\"configure.ac\" class=\"level1\">\n<h1><code class=\"verbatim\">configure.ac</code></h1>\n<ul>\n<li>Written in m4sh (m4 + shell)</li>\n<li>Program initialization: <code>AC_INIT</code> macro—needs name,\nversion, maintainer</li>\n<li>Initialize automake: <code>AM_INIT_AUTOMAKE</code></li>\n<li>Make sure that C-compiler exists: <code>AC_PROG_CC</code></li>\n<li>Build <code>Makefile</code> from <code>Makefile.in</code>, replaces\n<code>@PACKAGE_VERSION@</code>-type variables:\n<code>AC_CONFIG_FILES([Makefile])</code></li>\n<li>Output the script: <code>AC_OUTPUT</code></li>\n</ul>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode makefile\"><code class=\"sourceCode makefile\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>AC_INIT([hello-world], [0.1], [tyler@tylercipriani.com])</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Initialize automake</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>AM_INIT_AUTOMAKE</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Ensure C-compiler exists</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>AC_PROG_CC</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Specify what files are to be created</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>AC_CONFIG_FILES([Makefile])</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>AC_OUTPUT</span></code></pre></div>\n</section>\n<section id=\"makefile.am\" class=\"level1\">\n<h1><code class=\"verbatim\">Makefile.am</code></h1>\n<ul>\n<li>The <code>./configure</code> script (created by\n<code>configure.ac</code>), expects to find\n<code>Makefile.in</code></li>\n<li><code>Makefile.in</code> is long and dumb (just like\n<code>./configure</code>), so we make a <code>Makefile.am</code></li>\n<li><code>automake</code> generates <code>Makefile.in</code></li>\n<li><code>foreign</code> AUTOMAKE<sub>OPTIONS</sub> tells that the\nlayout is \"non standard\"</li>\n</ul>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode makefile\"><code class=\"sourceCode makefile\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">AUTOMAKE_OPTIONS </span><span class=\"ch\">=</span><span class=\"st\"> foreign</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">bin_PROGRAMS </span><span class=\"ch\">=</span><span class=\"st\"> hello-world</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">hello-world_SOURCES </span><span class=\"ch\">=</span><span class=\"st\"> hello-world.c</span></span></code></pre></div>\n</section>\n<section id=\"put-it-all-together\" class=\"level1\">\n<h1>Put it all together:</h1>\n<ul>\n<li>create m4 environment: <code>aclocal</code></li>\n<li><code>autoconf</code> does: <code>configure.ac</code> →\n<code>configure</code></li>\n<li><code>automake --add-missing</code> does: <code>Makefile.am</code> →\n<code>Makefile.in</code></li>\n<li><code>autoreconf --install</code>: autoreconf runs autoconf,\nautoheader, aclocal, automake, libtoolize, and autopoint</li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/05/25/ikiwiki/",

    "title": "Ikiwiki things",
    "url": "https://tylercipriani.com/blog/2016/05/25/ikiwiki/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "ikiwiki",

     "notes"

    ],

    "date_published": "2016-05-25T14:22:03Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"install\" class=\"level1\">\n<h1>Install</h1>\n<p>Mostly it was pretty easy</p>\n<ul>\n<li>Grabbed the <a\nhref=\"https://packages.debian.org/unstable/source/ikiwiki\">tar from\ndebian</a></li>\n<li>Followed install instructions from <a\nhref=\"https://ikiwiki.info/install/\">Ikiwiki\'s install page</a></li>\n</ul>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">tar</span> xvzf ikiwiki_3.20160121.tar.gz</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ikiwiki_3.20160121</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> PERL5LIB=<span class=\"kw\">`</span><span class=\"bu\">pwd</span><span class=\"kw\">`</span> PERL_MM_USE_DEFAULT=1 perl <span class=\"at\">-MCPAN</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;CPAN::Shell-&gt;install(&quot;Bundle::IkiWiki&quot;)&#39;</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> PERL5LIB=<span class=\"kw\">`</span><span class=\"bu\">pwd</span><span class=\"kw\">`</span> PERL_MM_USE_DEFAULT=1 perl <span class=\"at\">-MCPAN</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;CPAN::Shell-&gt;install(&quot;Bundle::IkiWiki::Extras&quot;)&#39;</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> make install</span></code></pre></div>\n</section>\n<section id=\"openid-setup\" class=\"level1\">\n<h1>OpenID Setup</h1>\n<p><del>Ikiwiki requires an OpenID setup</del>.</p>\n<p>You can login to Ikiwiki with OpenID, and I think that\'s neat!</p>\n<p>Since OpenID is somewhat dead, I decided to setup a personal\nSimpleID.</p>\n<p>I put this all on the analytics server.</p>\n<p>First I had to create a DNS record for\n<code>openid.tylercipriani.com</code> so letsencrypt would work.</p>\n<p>Then I made a new letsencrypt cert:</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">/usr/local/src/letsencrypt/letsencrypt-auto</span> certonly <span class=\"at\">--standalone</span> <span class=\"at\">-d</span> openid.tylercipriani.com</span></code></pre></div>\n<p>Then I grabbed and installed openid</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> /usr/local/src</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">curl</span> <span class=\"at\">-sLO</span> http://downloads.sourceforge.net/simpleid/simpleid-1.0.1.tar.gz</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">tar</span> xvzf simpleid-1.0.1.tar.gz</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> /srv/www/openid.tylercipriani.com</span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mv</span> simpleid/<span class=\"dt\">{cache</span><span class=\"op\">,</span><span class=\"dt\">identities</span><span class=\"op\">,</span><span class=\"dt\">store</span><span class=\"op\">,</span><span class=\"dt\">www}</span> /srv/www/openid.tylercipriani.com</span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mv</span> /srv/www/openid.tylercipriani.com/<span class=\"dt\">{config.php.dist</span><span class=\"op\">,</span><span class=\"dt\">config.php}</span></span></code></pre></div>\n<p>Edited the <code>config.php</code> file, changed root webserver and\nthe pretty url thing</p>\n<p>I also made a virtualserver: openid.tylercipriani.com</p>\n<p>Identity file: <code>thcipriani.identity</code></p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode ini\"><code class=\"sourceCode ini\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">identity</span><span class=\"ot\">=</span><span class=\"st\">&quot;https://tylercipriani.com/&quot;</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">password</span><span class=\"ot\">=</span><span class=\"st\">&quot;blah:sha1:salt&quot;</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">administrator</span><span class=\"ot\">=</span><span class=\"dv\">1</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[user_info]</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">...</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">[sreg]</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">...</span></span></code></pre></div>\n</section>\n<section id=\"blog-setup\" class=\"level1\">\n<h1>Blog setup</h1>\n<p>The things that I didn\'t understand about Ikiwiki:</p>\n<ol>\n<li>htmlscrubber removes all your scripts</li>\n<li>Some changes to the setup file (like <code\nclass=\"verbatim\">git_wrapper</code> updates) require you to run <code\nclass=\"verbatim\">ikiwiki --changesetup [setupfile]</code></li>\n<li>I am running a staging wiki on my laptop, a wiki on my webserver,\nand then pushing the compiled files to s3: WAT‽</li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/05/25/mutt/",

    "title": "Mutt",
    "url": "https://tylercipriani.com/blog/2016/05/25/mutt/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "mutt",

     "notes"

    ],

    "date_published": "2016-05-25T14:22:03Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"contacts\" class=\"level1\">\n<h1>Contacts</h1>\n<p>Install goobook:</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> pip2 install <span class=\"at\">-U</span> goobook</span></code></pre></div>\n<p>I ran into some problems in arch, had to upgrade/reinstall a few\ndeps:</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">ﾉ^ヮ^</span><span class=\"kw\">)</span><span class=\"ex\">ﾉ*:・ﾟ✧</span> sudo pip2 install <span class=\"at\">-U</span> pyasn1</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">ﾉ^ヮ^</span><span class=\"kw\">)</span><span class=\"ex\">ﾉ*:・ﾟ✧</span> sudo pip2 install <span class=\"at\">-U</span> cryptography</span></code></pre></div>\n<p>goobook then needs to authenticate with gmail:</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">goobook</span> authenticate</span></code></pre></div>\n<p>Once you go through the oauth song and dance you should be able to\nrun a <code>query</code></p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">(</span><span class=\"ex\">ﾉ^ヮ^</span><span class=\"kw\">)</span><span class=\"ex\">ﾉ*:・ﾟ✧</span> goobook query tyler</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">thcipriani@gmail.com</span>    Tyler Cipriani  other groups: <span class=\"st\">&quot;System Group: Friends&quot;</span></span></code></pre></div>\n<p>From there, just need to add a bit of magic to the\n<code>~/.muttrc</code> file</p>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">set</span> query_command=<span class=\"st\">&quot;goobook query %s&quot;</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">macro</span> index,pager a <span class=\"dt\">\\</span></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"st\">&quot;&lt;pipe-message&gt;goobook add&lt;return&gt;&quot;</span> <span class=\"st\">&quot;add sender to google contacts&quot;</span></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">bind</span> editor <span class=\"op\">&lt;</span>Tab<span class=\"op\">&gt;</span> complete-query</span></code></pre></div>\n</section>\n<section id=\"viewing-urls\" class=\"level1\">\n<h1>Viewing URLs</h1>\n<p>Install urlview: ncurses program parses urls out of text.</p>\n<p>Create a <code>$HOME/urlview</code> file:</p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">COMMAND</span> xdg-open %s <span class=\"kw\">&amp;</span></span></code></pre></div>\n<p>Bind <code class=\"verbatim\">\\,u</code> in the editor:</p>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">macro</span> pager ,u <span class=\"st\">&quot;|urlview&lt;enter&gt;&quot;</span> <span class=\"st\">&quot;call urlview to open links&quot;</span></span></code></pre></div>\n</section>\n<section id=\"searching-mail\" class=\"level1\">\n<h1>Searching Mail</h1>\n<p>Searching works really well via <code>notmuch</code></p>\n<p>Afer install, setup via</p>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">notmuch</span> setup</span></code></pre></div>\n<p>After setup, it\'s just a matter of calling</p>\n<div class=\"sourceCode\" id=\"cb9\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">notmuch</span> new</span></code></pre></div>\n<p>to index the things</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/04/26/bitlbee/",

    "title": "Bitlebee/IRC info",
    "url": "https://tylercipriani.com/blog/2016/04/26/bitlbee/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "bitlebee",

     "computing",

     "irc",

     "notes"

    ],

    "date_published": "2016-04-26T14:50:54Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"helpful-posts\" class=\"level1\">\n<h1>Helpful Posts</h1>\n<p><a href=\"https://pthree.org/2011/03/08/bitlbee-and-otr/\">- pthree.org\npost</a></p>\n<ul>\n<li>Datko\'s book has this same kinda stuff.</li>\n</ul>\n</section>\n<section id=\"restart-bitlbee-without-restarting-weechat\" class=\"level1\">\n<h1>Restart bitlbee without restarting Weechat</h1>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> service bitlbee stop</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">/disconnect</span> localhost</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> service bitlbee start</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">/connect</span> localhost/6667</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">/msg</span> <span class=\"kw\">&amp;</span><span class=\"ex\">bitlbee</span> identify [password]</span></code></pre></div>\n</section>\n<section id=\"setup-otr\" class=\"level1\">\n<h1>Setup OTR</h1>\n<p>First had to install the <code>bitlbee-plugin-otr</code> plugin:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get install bitlbee-plugin-otr</span></code></pre></div>\n<p>In the <code>&amp;bitlebee</code> window</p>\n<pre><code>account list\n&gt; @root 0 (gtalk): jabber, thcipriani@gmail.com (connected)\n&gt; @root 1 (twitter): twitter, thcipriani (connected)\n</code></pre>\n<p>Will return a list of accounts that are currently setup in\nbitlbee.</p>\n<p>To generate a key for the 0th account—gmail in my case:</p>\n<pre><code>otr keygen 0\n</code></pre>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/04/26/vcr-recording-linux/",

    "title": "VHS to MP4 on Linux",
    "url": "https://tylercipriani.com/blog/2016/04/26/vcr-recording-linux/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "notes",

     "video"

    ],

    "date_published": "2016-04-26T14:50:54Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I recently ordered a set of videos that I remember from a few years\nago that did not make the jump to DVD, unfortunately.</p>\n<p>I <em>do</em> have a VCR; however, I never have it hooked up\nbecause…why would I?</p>\n<p>The solution here: convert my VHS tapes into H.264/MP3 mp4-contained\nfiles.</p>\n<p>Now the question is: how?</p>\n<section id=\"hardware\" class=\"level1\">\n<h1>Hardware</h1>\n<p>I managed to grab an <a\nhref=\"http://www.amazon.com/WZYuan-Easycap-Adapter-Capture-Support/dp/B01D65M1CK?ie=UTF8&amp;psc=1&amp;redirect=true&amp;ref_=oh_aui_detailpage_o00_s00\">EasyCap\nD60</a> Recording device from Amazon.</p>\n<p>This device is supported inside the linux kernel (from version 3.18\nforward…maybe?)</p>\n<p>Once I plugged in this device, it was working:</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"\ndata-export=\"both\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">lsusb</span></span></code></pre></div>\n<p>This bad boy:</p>\n<table>\n<tbody>\n<tr class=\"odd\">\n<td>Bus</td>\n<td>1</td>\n<td>Device</td>\n<td>016:</td>\n<td>ID</td>\n<td>1b71:3002</td>\n<td>Fushicai</td>\n<td>USBTV007</td>\n<td>Video</td>\n<td>Grabber</td>\n<td>[EasyCAP]</td>\n</tr>\n</tbody>\n</table>\n<p>I checked out:</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"\ndata-export=\"both\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ls</span> /dev <span class=\"kw\">|</span> <span class=\"fu\">grep</span> <span class=\"at\">-i</span> video</span></code></pre></div>\n<p>And I noticed a <strong>new</strong> video device <code\nclass=\"verbatim\">video1</code>. Easy.</p>\n</section>\n<section id=\"capture-software\" class=\"level1\">\n<h1>Capture Software</h1>\n<p>I used VLC to caputre raw input.</p>\n<ol>\n<li><code class=\"verbatim\">Media</code> → <code\nclass=\"verbatim\">Open Caputre Device</code></li>\n<li><code class=\"verbatim\">Video Device Name</code> → <code\nclass=\"verbatim\">/dev/video1</code></li>\n<li><code class=\"verbatim\">Audio Device Name</code> → <code\nclass=\"verbatim\">hw:2,0</code></li>\n<li><code class=\"verbatim\">Play</code> pulldown menu → <code\nclass=\"verbatim\">Convert</code></li>\n<li><code class=\"verbatim\">Dump Raw Input</code></li>\n<li><code class=\"verbatim\">Destination File</code> → <code\nclass=\"verbatim\">/home/tyler/Videos</code></li>\n<li><code class=\"verbatim\">Start</code></li>\n<li>Hit play on the VCR</li>\n<li>Hit the Rec. button in VLC</li>\n</ol>\n<p>The auto-named avi file in <code class=\"verbatim\">~/Videos</code> was\n<strong>FUCKING HUGE</strong>.</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"\ndata-export=\"both\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ls</span> <span class=\"at\">-lh</span> ~/Videos <span class=\"kw\">|</span> <span class=\"fu\">grep</span> <span class=\"at\">-i</span> avi</span></code></pre></div>\n</section>\n<section id=\"conversion\" class=\"level1\">\n<h1>Conversion</h1>\n<p>I found a <a\nhref=\"https://www.guyrutenberg.com/2010/09/10/capturing-video-and-converting-to-h-264-using-ffmpeg/\">blog</a>\nwhere a person does this. I have a vauge memory about doing this at\nUpSync, so I\'ll give it a shot: 2-pass mp4 conversion.</p>\n<p>Let\'s see what happens!</p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ffmpeg</span> <span class=\"at\">-i</span> ~/Videos/vlc-record-2016-04-22-14h47m57s-Streaming-.avi <span class=\"at\">-c:v</span> libx264 <span class=\"at\">-pix_fmt</span> yuv420p <span class=\"at\">-preset</span> slow <span class=\"at\">-threads</span> 0 <span class=\"at\">-b:v</span> 825k <span class=\"at\">-strict</span> <span class=\"at\">-2</span> <span class=\"at\">-c:a</span> aac <span class=\"at\">-b:a</span> 96k <span class=\"at\">-pass</span> 1 <span class=\"at\">-f</span> mp4 <span class=\"at\">-y</span> /dev/null</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ffmpeg</span> <span class=\"at\">-i</span> ~/Videos/vlc-record-2016-04-22-14h47m57s-Streaming-.avi <span class=\"at\">-c:v</span> libx264 <span class=\"at\">-pix_fmt</span> yuv420p <span class=\"dt\">\\</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-preset</span> slow <span class=\"at\">-threads</span> 0 <span class=\"at\">-b:v</span> 825k <span class=\"at\">-strict</span> <span class=\"at\">-2</span> <span class=\"at\">-c:a</span> aac <span class=\"at\">-b:a</span> 96k <span class=\"at\">-pass</span> 2 ~/Videos/out.mp4</span></code></pre></div>\n<p>The settings above created an mp4 that could be played via x264 on a\nRaspberryPi 3.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/04/01/beaglebone/",

    "title": "Beaglebone Black Setup on Debian 8",
    "url": "https://tylercipriani.com/blog/2016/04/01/beaglebone/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "notes",

     "soc"

    ],

    "date_published": "2016-04-01T21:01:25Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"flash-emmc-with-latest-debian-image\" class=\"level1\">\n<h1>Flash eMMC with latest Debian image</h1>\n<ol>\n<li><p>Download Debian image [whatever].img.xz</p>\n<ul>\n<li><p><a\nhref=\"http://beagleboard.org/latest-images\">http://beagleboard.org/latest-images</a></p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">unxz</span> bone-debian-7.8-lxde-4gb-armhf-2015-03-01-4gb.img.xz</span></code></pre></div></li>\n</ul></li>\n<li><p>Insert microSD card and make sure that it is unmounted</p>\n<ul>\n<li><code class=\"verbatim\">lsblk</code></li>\n<li><code class=\"verbatim\">fdisk -l</code></li>\n</ul></li>\n<li><p>Copy the img to the microSD card</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> dd bs=4 if=bone-debian-7.8-lxde-4gb-armhf-2015-03-01-4gb.img of=/dev/mmcblk0 conv=fsync</span></code></pre></div>\n<p>This step will take a lot of time.</p></li>\n<li><p>Mount the microSD card and make sure it flashes to the\nbeaglebone:</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> mount /dev/mmcblk0p1 /mnt/sd-card</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">vim</span> /mnt/sd-card/boot/uEnv.txt</span></code></pre></div>\n<p>Uncomment the line:</p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">cmdline</span><span class=\"op\">=</span>init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh</span></code></pre></div></li>\n<li><p>Hookup the <a\nhref=\"https://www.adafruit.com/products/954\">USB-to-serial cable</a></p>\n<ul>\n<li>Connect <strong>Black Wire</strong> to <strong>Pin 1</strong>\n(closest to 5v barrel)</li>\n<li>Connect <strong>Green Wire</strong> to <strong>Pin 4</strong> (2\npins from pin 1)</li>\n<li>Connect <strong>White Wire</strong> to <strong>Pin 5</strong></li>\n</ul></li>\n<li><p>Connect to USB, check output of <code>dmesg</code> for which\n<code>/dev/</code> the serial connection is on</p></li>\n<li><p>Connect to serial connection via screen</p>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">screen</span> /dev/ttyUSB0 115200</span></code></pre></div></li>\n<li><p>put sdcard in BBB and power up, hold the S2 button, power\nup</p></li>\n<li><p>Wait, the status lights will flash in a cylon pattern, you can\nwatch the eMMC flash progress via <code>screen</code></p></li>\n<li><p>All User LEDs should be solid on completion</p></li>\n</ol>\n<p>More info is available on the <a\nhref=\"http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#FAQ\">BeagleBoneBlack\nWiki</a></p>\n</section>\n<section id=\"initial-setup\" class=\"level1\">\n<h1>Initial setup</h1>\n<section id=\"connect-over-ssh\" class=\"level2\">\n<h2>Connect over SSH</h2>\n<p>To connect via ssh: plugin beaglebone to computer via SSH</p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ssh</span> <span class=\"at\">-l</span> root 192.168.7.2</span></code></pre></div>\n</section>\n<section id=\"wifi-setup\" class=\"level2\">\n<h2>Wifi Setup</h2>\n<ol>\n<li><p>Plugin the <a href=\"https://www.adafruit.com/products/814\">wifi\nadapter</a></p></li>\n<li><p>Reboot (unplug it and plug it back in)</p></li>\n<li><p>Generate your pre-shared key using <code>wpa_passphrase</code>\n(see <a\nhref=\"https://wiki.debian.org/WiFi/HowToUse#WPA-PSK_and_WPA2-PSK\">Debian\nWiki</a>)</p></li>\n<li><p>vim <code>/etc/network/interfaces</code></p>\n<div class=\"sourceCode\" id=\"/etc/network/interfaces\"\ndata-org-language=\"sh\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"/etc/network/interfaces-1\"><a href=\"https://tylercipriani.com/blog/#/etc/network/interfaces-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">auto</span> wlan0</span>\n<span id=\"/etc/network/interfaces-2\"><a href=\"https://tylercipriani.com/blog/#/etc/network/interfaces-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">iface</span> wlan0 inet dhcp</span>\n<span id=\"/etc/network/interfaces-3\"><a href=\"https://tylercipriani.com/blog/#/etc/network/interfaces-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">wpa-ssid</span> <span class=\"st\">&quot;network-name&quot;</span></span>\n<span id=\"/etc/network/interfaces-4\"><a href=\"https://tylercipriani.com/blog/#/etc/network/interfaces-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">wpa-psk</span> <span class=\"st\">&quot;network-password&quot;</span></span></code></pre></div></li>\n<li><p><code>ifdown wlan0; ifup wlan0</code></p></li>\n<li><p>use <code>ip -o addr show</code> to confirm that you have an ip\naddress</p></li>\n</ol>\n</section>\n<section id=\"update-debian\" class=\"level2\">\n<h2>Update debian</h2>\n<p>Use the <a\nhref=\"https://debian-handbook.info/browse/stable/sect.automatic-upgrades.html\">Debian\nUpgrade Script</a> to update debian:</p>\n<div class=\"sourceCode\" id=\"~/bin/upgrade-debian\"\ndata-org-language=\"sh\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"~/bin/upgrade-debian-1\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"~/bin/upgrade-debian-2\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Debian auto-upgrade script</span></span>\n<span id=\"~/bin/upgrade-debian-3\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># https://debian-handbook.info/browse/stable/sect.automatic-upgrades.html</span></span>\n<span id=\"~/bin/upgrade-debian-4\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/upgrade-debian-5\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># kill all cached creds</span></span>\n<span id=\"~/bin/upgrade-debian-6\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> <span class=\"at\">-k</span></span>\n<span id=\"~/bin/upgrade-debian-7\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/upgrade-debian-8\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># ask for new creds</span></span>\n<span id=\"~/bin/upgrade-debian-9\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> <span class=\"at\">-v</span></span>\n<span id=\"~/bin/upgrade-debian-10\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-10\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"~/bin/upgrade-debian-11\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">export</span> <span class=\"va\">DEBIAN_FRONTEND</span><span class=\"op\">=</span>noninteractive</span>\n<span id=\"~/bin/upgrade-debian-12\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get update</span>\n<span id=\"~/bin/upgrade-debian-13\"><a href=\"https://tylercipriani.com/blog/#~/bin/upgrade-debian-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">yes</span> <span class=\"st\">&#39;&#39;</span> <span class=\"kw\">|</span> <span class=\"fu\">sudo</span> apt-get <span class=\"at\">-y</span> <span class=\"at\">-o</span> Dpkg::Options::=<span class=\"st\">&quot;--force-confdef&quot;</span> <span class=\"at\">-o</span> Dpkg::Options::=<span class=\"st\">&quot;--force-confold&quot;</span> dist-upgrade</span></code></pre></div>\n</section>\n</section>\n<section id=\"basic-security\" class=\"level1\">\n<h1>Basic security</h1>\n<section id=\"make-a-root-password\" class=\"level2\">\n<h2>Make a root password</h2>\n<ul>\n<li>Install <code>pwgen</code>:\n<code>sudo apt-get install pwgen</code></li>\n<li>Generate a root password: <code>pwgen -Bsy 16 1</code></li>\n<li>Store that password in your password store—you\'ll never remember\nit</li>\n<li>Login to beaglebone via ssh, run <code>passwd</code></li>\n</ul>\n</section>\n<section id=\"add-a-privileged-non-root-user\" class=\"level2\">\n<h2>Add a privileged non-root user</h2>\n<ul>\n<li><p>Generate a non-privileged user password:\n<code>pwgen -Bsy 16 1</code></p></li>\n<li><p>Save password in password store</p></li>\n<li><p>Add the user</p>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> groupadd sudo-user</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> groupadd ssh-user</span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">useradd</span> tyler</span>\n<span id=\"cb7-4\"><a href=\"https://tylercipriani.com/blog/#cb7-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> /home/tyler</span>\n<span id=\"cb7-5\"><a href=\"https://tylercipriani.com/blog/#cb7-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> /home/tyler/.ssh</span>\n<span id=\"cb7-6\"><a href=\"https://tylercipriani.com/blog/#cb7-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">touch</span> /home/tyler/.ssh/authorized_keys</span>\n<span id=\"cb7-7\"><a href=\"https://tylercipriani.com/blog/#cb7-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">chown</span> <span class=\"at\">-R</span> tyler:tyler /home/tyler</span>\n<span id=\"cb7-8\"><a href=\"https://tylercipriani.com/blog/#cb7-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">chmod</span> 700 /home/tyler/.ssh</span>\n<span id=\"cb7-9\"><a href=\"https://tylercipriani.com/blog/#cb7-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">chmod</span> 600 /home/tyler/.ssh/authorized_keys</span>\n<span id=\"cb7-10\"><a href=\"https://tylercipriani.com/blog/#cb7-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">usermod</span> <span class=\"at\">-a</span> <span class=\"at\">-G</span> sudo-user tyler</span>\n<span id=\"cb7-11\"><a href=\"https://tylercipriani.com/blog/#cb7-11\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">usermod</span> <span class=\"at\">-a</span> <span class=\"at\">-G</span> ssh-user tyler</span>\n<span id=\"cb7-12\"><a href=\"https://tylercipriani.com/blog/#cb7-12\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">usermod</span> <span class=\"at\">--shell</span> /bin/bash tyler</span>\n<span id=\"cb7-13\"><a href=\"https://tylercipriani.com/blog/#cb7-13\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">passwd</span> tyler</span></code></pre></div></li>\n<li><p>give that user sudo privileges</p>\n<ul>\n<li><code>EDITOR=vim visudo -f /etc/sudoers.d/sudo-user</code></li>\n<li>Add the line: <code>%sudo-user ALL=(ALL) NOPASSWD:ALL</code></li>\n</ul></li>\n<li><p>Add your laptop\'s key to user\'s <code>authorized_keys</code></p>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># This should happen from your local machine: laptop/desktop/whatever</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">cat</span> ~/.ssh/id_rsa.pub <span class=\"kw\">|</span> <span class=\"fu\">ssh</span> <span class=\"at\">-l</span> tyler 192.168.7.2 <span class=\"st\">&#39;mkdir -p .ssh &amp;&amp; cat &gt;&gt; ~/.ssh/authorized_keys&#39;</span></span></code></pre></div></li>\n</ul>\n</section>\n<section id=\"remove-demo-user\" class=\"level2\">\n<h2>Remove demo user</h2>\n<ul>\n<li><code>userdel -fr debian</code></li>\n</ul>\n</section>\n<section id=\"lockdown-ssh\" class=\"level2\">\n<h2>Lockdown ssh</h2>\n<ul>\n<li><p>Generate better hostkeys</p>\n<div class=\"sourceCode\" id=\"cb9\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> /etc/ssh</span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">rm</span> ssh_host_<span class=\"pp\">*</span>key<span class=\"pp\">*</span></span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ssh-keygen</span> <span class=\"at\">-t</span> rsa <span class=\"at\">-b</span> 4096 <span class=\"at\">-f</span> ssh_host_rsa_key <span class=\"op\">&lt;</span> /dev/null</span></code></pre></div></li>\n<li><p>Modfiy <code>/etc/ssh/sshd_config</code> to make it like\nbelow:</p>\n<div class=\"sourceCode\" id=\"/etc/ssh/sshd_config\"\ndata-org-language=\"sh\"><pre class=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"/etc/ssh/sshd_config-1\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Ciphers</span> aes256-ctr,aes192-ctr,aes128-ctr</span>\n<span id=\"/etc/ssh/sshd_config-2\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">KexAlgorithms</span> diffie-hellman-group-exchange-sha256</span>\n<span id=\"/etc/ssh/sshd_config-3\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">MACs</span> hmac-sha2-512,hmac-sha2-256,hmac-ripemd160</span>\n<span id=\"/etc/ssh/sshd_config-4\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Protocol</span> 2</span>\n<span id=\"/etc/ssh/sshd_config-5\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">HostKey</span> /etc/ssh/ssh_host_rsa_key</span>\n<span id=\"/etc/ssh/sshd_config-6\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">PubkeyAuthentication</span> yes</span>\n<span id=\"/etc/ssh/sshd_config-7\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">PermitRootLogin</span> no</span>\n<span id=\"/etc/ssh/sshd_config-8\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">PasswordAuthentication</span> no</span>\n<span id=\"/etc/ssh/sshd_config-9\"><a href=\"https://tylercipriani.com/blog/#/etc/ssh/sshd_config-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">AllowGroups</span> ssh-user</span></code></pre></div></li>\n<li><p>Restart SSH <code>service ssh restart</code></p></li>\n<li><p>Open a new terminal window and make sure you can still login (you\nmay need to delete and reaccept hostkeys)</p></li>\n</ul>\n</section>\n</section>\n<section id=\"fun-stuff\" class=\"level1\">\n<h1>Fun Stuff</h1>\n<ul>\n<li><p>Change ssh banner:</p>\n<div class=\"sourceCode\" id=\"cb10\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get install figlet</span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">awk</span> <span class=\"st\">&#39;$1 !~ /default/&#39;</span> /etc/issue.net <span class=\"op\">&gt;</span> ~/issue.net <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">sudo</span> mv ~/issue.net /etc/issue.net</span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> sh <span class=\"at\">-c</span> <span class=\"st\">&#39;figlet BeagleBone &gt;&gt; /etc/issue.net&#39;</span></span></code></pre></div></li>\n<li><p>BeagleBone pin-out</p>\n<ul>\n<li><a\nhref=\"http://stuffwemade.net/post/beaglebone-pinout\">http://stuffwemade.net/post/beaglebone-pinout</a></li>\n</ul></li>\n</ul>\n</section>\n<section id=\"things-to-remember\" class=\"level1\">\n<h1>Things to remember</h1>\n<p>thank god for 1wire temp sensor blog posts:</p>\n<ul>\n<li><p><a\nhref=\"http://interactingobjects.com/ds18b20-temperature-sensor-on-a-beaglebone-black-running-ubuntu/\">http://interactingobjects.com/ds18b20-temperature-sensor-on-a-beaglebone-black-running-ubuntu/</a></p></li>\n<li><p><a\nhref=\"http://klaus.ede.hih.au.dk/index.php/BBB_and_OneWire\">http://klaus.ede.hih.au.dk/index.php/BBB_and_OneWire</a></p>\n<p>iwconfig when can\'t find wlan0 interface (could be wlan1)</p></li>\n</ul>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/04/01/neovim/",

    "title": "neovim on debian",
    "url": "https://tylercipriani.com/blog/2016/04/01/neovim/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "notes",

     "vim"

    ],

    "date_published": "2016-04-01T21:01:25Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"installing-neovim\" class=\"level1\">\n<h1><a\nhref=\"https://github.com/neovim/neovim/wiki/Building-Neovim\">Installing\nNeovim</a></h1>\n<ol>\n<li><p><a\nhref=\"https://github.com/neovim/neovim/wiki/Building-Neovim#ubuntu--debian\">Install\nPrerequisites</a></p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get <span class=\"at\">-f</span> install libtool libtool-bin autoconf automake cmake g++ pkg-config unzip libmsgpack-dev libuv-dev libluajit-5.1-dev</span></code></pre></div></li>\n<li><p>Clone repo</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> clone https://github.com/neovim/neovim.git</span></code></pre></div></li>\n<li><p><a\nhref=\"https://github.com/neovim/neovim/wiki/Installing-Neovim#install-from-source\">Make\ninstall</a></p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> neovim</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> make install</span></code></pre></div></li>\n</ol>\n</section>\n<section id=\"setup-neovim\" class=\"level1\">\n<h1><a href=\"https://neovim.io/doc/user/nvim_from_vim.html\">Setup\nNeovim</a></h1>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ln</span> <span class=\"at\">-s</span> ~/.vim <span class=\"va\">$XDG_CONFIG_HOME</span>/nvim</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">ln</span> <span class=\"at\">-s</span> ~/.vimrc <span class=\"va\">$XDG_CONFIG_HOME</span>/nvim/init.vim</span></code></pre></div>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/03/21/Visualizing-Git-Merkle-DAG-with-D3.js/",

    "title": "Visualizing Git&#x2019;s Merkle DAG with D3.js",
    "url": "https://tylercipriani.com/blog/2016/03/21/Visualizing-Git-Merkle-DAG-with-D3.js/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "javascript",

     "vcs"

    ],

    "date_published": "2016-03-21T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>The <a\nhref=\"https://en.wikipedia.org/wiki/Directed_acyclic_graph\">Directed\nAcyclic Graph</a> (DAG) is a concept I run into over-and-over again;\nwhich is, perhaps, somewhat ironic.</p>\n<p>A DAG is a representation of vertices (nodes) that are connected by\ndirectional edges (arcs—i.e., lines) in such a way that there are no\ncycles (e.g., starting at <code>Node A</code>, you shouldn’t be able to\nreturn to <code>Node A</code>).</p>\n<p>DAGs have lots of uses in computer science problems and in discrete\nmathematics. You’ll find DAGs in build-systems, network problems, and,\nimportantly (for this blog post, if not generally) in Git.</p>\n<p>One way to think of a DAG is as a set of dependencies—each node may\nhave a dependency on one or more other nodes. That is, in order to get\nto <code>Node B</code> you must route through <code>Node A</code>, so\n<code>Node B</code> depends on <code>Node A</code>:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a><span class=\"co\">// Node → [dependent nodes]</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a><span class=\"kw\">var</span> dag <span class=\"op\">=</span> {</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a>    <span class=\"st\">&#39;Node A&#39;</span><span class=\"op\">:</span> [<span class=\"st\">&#39;Node B&#39;</span>]<span class=\"op\">,</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a>    <span class=\"st\">&#39;Node B&#39;</span><span class=\"op\">:</span> []</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\"></a>}<span class=\"op\">;</span></span></code></pre></div>\n<p>The visualization of dependencies in a JSON object is (SURPRISE!)\ndifferent from the input format needed to visualize a DAG using the <a\nhref=\"https://github.com/mbostock/d3/wiki/Force-Layout\">D3.js Force\nlayout</a>. To change the above object into Force’s expected input, I\ncreated a little helper function:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"kw\">var</span> forceFormat <span class=\"op\">=</span> <span class=\"kw\">function</span>(dag) {</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a>    <span class=\"kw\">var</span> orderedNodes <span class=\"op\">=</span> []<span class=\"op\">,</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a>        nodes <span class=\"op\">=</span> []<span class=\"op\">,</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a>        links <span class=\"op\">=</span> []<span class=\"op\">,</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a>        usesPack <span class=\"op\">=</span> <span class=\"kw\">false</span><span class=\"op\">;</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a>    <span class=\"co\">// Basically a dumb Object.keys</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\"></a>    <span class=\"cf\">for</span> (node <span class=\"kw\">in</span> dag) {</span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\"></a>        <span class=\"cf\">if</span> ( <span class=\"op\">!</span>dag<span class=\"op\">.</span><span class=\"fu\">hasOwnProperty</span>( node ) ) <span class=\"cf\">continue</span><span class=\"op\">;</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\"></a>        orderedNodes<span class=\"op\">.</span><span class=\"fu\">push</span>(node)<span class=\"op\">;</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\"></a>    }</span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\"></a></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\"></a>    orderedNodes<span class=\"op\">.</span><span class=\"fu\">forEach</span>(<span class=\"kw\">function</span>(node) {</span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\"></a>        <span class=\"kw\">var</span> sources <span class=\"op\">=</span> dag[node]<span class=\"op\">;</span></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\"></a></span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\"></a>        <span class=\"cf\">if</span> (<span class=\"op\">!</span>sources) <span class=\"cf\">return</span><span class=\"op\">;</span></span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\"></a></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\"></a>        sources<span class=\"op\">.</span><span class=\"fu\">forEach</span>(<span class=\"kw\">function</span>(source) {</span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\"></a>            <span class=\"kw\">var</span> source <span class=\"op\">=</span> orderedNodes<span class=\"op\">.</span><span class=\"fu\">indexOf</span>(source)<span class=\"op\">;</span></span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\"></a></span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\"></a>            <span class=\"co\">// If the source isn&#39;t in the Git DAG, it&#39;s in a packfile</span></span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\"></a>            <span class=\"cf\">if</span> (source <span class=\"op\">&lt;</span> <span class=\"dv\">0</span>) {</span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\"></a>                <span class=\"cf\">if</span> (usesPack) <span class=\"cf\">return</span><span class=\"op\">;</span></span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\"></a>                source <span class=\"op\">=</span> orderedNodes<span class=\"op\">.</span><span class=\"at\">length</span><span class=\"op\">;</span></span>\n<span id=\"cb2-25\"><a href=\"https://tylercipriani.com/blog/#cb2-25\"></a>                usesPack <span class=\"op\">=</span> <span class=\"kw\">true</span><span class=\"op\">;</span></span>\n<span id=\"cb2-26\"><a href=\"https://tylercipriani.com/blog/#cb2-26\"></a>            }</span>\n<span id=\"cb2-27\"><a href=\"https://tylercipriani.com/blog/#cb2-27\"></a></span>\n<span id=\"cb2-28\"><a href=\"https://tylercipriani.com/blog/#cb2-28\"></a>            links<span class=\"op\">.</span><span class=\"fu\">push</span>({</span>\n<span id=\"cb2-29\"><a href=\"https://tylercipriani.com/blog/#cb2-29\"></a>                <span class=\"st\">&#39;source&#39;</span><span class=\"op\">:</span> source<span class=\"op\">,</span></span>\n<span id=\"cb2-30\"><a href=\"https://tylercipriani.com/blog/#cb2-30\"></a>                <span class=\"st\">&#39;target&#39;</span><span class=\"op\">:</span> orderedNodes<span class=\"op\">.</span><span class=\"fu\">indexOf</span>(node)</span>\n<span id=\"cb2-31\"><a href=\"https://tylercipriani.com/blog/#cb2-31\"></a>            })<span class=\"op\">;</span></span>\n<span id=\"cb2-32\"><a href=\"https://tylercipriani.com/blog/#cb2-32\"></a>        })<span class=\"op\">;</span></span>\n<span id=\"cb2-33\"><a href=\"https://tylercipriani.com/blog/#cb2-33\"></a>        nodes<span class=\"op\">.</span><span class=\"fu\">push</span>({<span class=\"st\">&#39;name&#39;</span><span class=\"op\">:</span> node})<span class=\"op\">;</span></span>\n<span id=\"cb2-34\"><a href=\"https://tylercipriani.com/blog/#cb2-34\"></a>    })<span class=\"op\">;</span></span>\n<span id=\"cb2-35\"><a href=\"https://tylercipriani.com/blog/#cb2-35\"></a></span>\n<span id=\"cb2-36\"><a href=\"https://tylercipriani.com/blog/#cb2-36\"></a>    <span class=\"co\">// Add pack file to end of list</span></span>\n<span id=\"cb2-37\"><a href=\"https://tylercipriani.com/blog/#cb2-37\"></a>    <span class=\"cf\">if</span> (usesPack) nodes<span class=\"op\">.</span><span class=\"fu\">push</span>({<span class=\"st\">&#39;name&#39;</span><span class=\"op\">:</span> <span class=\"st\">&#39;PACK&#39;</span>})<span class=\"op\">;</span></span>\n<span id=\"cb2-38\"><a href=\"https://tylercipriani.com/blog/#cb2-38\"></a></span>\n<span id=\"cb2-39\"><a href=\"https://tylercipriani.com/blog/#cb2-39\"></a>    <span class=\"cf\">return</span> { <span class=\"st\">&#39;nodes&#39;</span><span class=\"op\">:</span> nodes<span class=\"op\">,</span> <span class=\"st\">&#39;links&#39;</span><span class=\"op\">:</span> links }<span class=\"op\">;</span></span>\n<span id=\"cb2-40\"><a href=\"https://tylercipriani.com/blog/#cb2-40\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb2-41\"><a href=\"https://tylercipriani.com/blog/#cb2-41\"></a></span>\n<span id=\"cb2-42\"><a href=\"https://tylercipriani.com/blog/#cb2-42\"></a><span class=\"kw\">var</span> forceInput <span class=\"op\">=</span> <span class=\"fu\">forceFormat</span>(dag)<span class=\"op\">;</span></span></code></pre></div>\n<p><code>forceFormat</code> outputs a JSON object that can be used as\ninput for the Force layout.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\"></a>{</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\"></a>    <span class=\"st\">&quot;links&quot;</span><span class=\"op\">:</span> [</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\"></a>        {</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\"></a>            <span class=\"st\">&quot;source&quot;</span><span class=\"op\">:</span> <span class=\"st\">&quot;Node A&quot;</span><span class=\"op\">,</span></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\"></a>            <span class=\"st\">&quot;target&quot;</span><span class=\"op\">:</span> <span class=\"st\">&quot;Node B&quot;</span></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\"></a>        }</span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\"></a>    ]<span class=\"op\">,</span></span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\"></a>    <span class=\"st\">&quot;nodes&quot;</span><span class=\"op\">:</span> [</span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\"></a>        { <span class=\"st\">&quot;name&quot;</span><span class=\"op\">:</span> <span class=\"st\">&quot;Node A&quot;</span> }<span class=\"op\">,</span></span>\n<span id=\"cb3-10\"><a href=\"https://tylercipriani.com/blog/#cb3-10\"></a>        { <span class=\"st\">&quot;name&quot;</span><span class=\"op\">:</span> <span class=\"st\">&quot;Node B&quot;</span> }</span>\n<span id=\"cb3-11\"><a href=\"https://tylercipriani.com/blog/#cb3-11\"></a>    ]</span>\n<span id=\"cb3-12\"><a href=\"https://tylercipriani.com/blog/#cb3-12\"></a>}</span></code></pre></div>\n<p>I can pass this resulting JSON object off to a function that I\ncreated after a long time staring at one of <a\nhref=\"https://github.com/mbostock/d3/wiki/Gallery\">mbostock</a>’s many\namazing <a href=\"http://bl.ocks.org/mbostock/1138500\">examples</a> to\ncreate a D3 Force graph of verticies and edges:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a><span class=\"co\">// http://bl.ocks.org/mbostock/1138500</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\"></a><span class=\"kw\">var</span> makeGraph  <span class=\"op\">=</span> <span class=\"kw\">function</span>(target<span class=\"op\">,</span> graphData) {</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\"></a>    <span class=\"kw\">var</span> target <span class=\"op\">=</span> d3<span class=\"op\">.</span><span class=\"fu\">select</span>(target)<span class=\"op\">,</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\"></a>        bounds <span class=\"op\">=</span> target<span class=\"op\">.</span><span class=\"fu\">node</span>()<span class=\"op\">.</span><span class=\"fu\">getBoundingClientRect</span>()<span class=\"op\">,</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\"></a>        fill   <span class=\"op\">=</span> d3<span class=\"op\">.</span><span class=\"at\">scale</span><span class=\"op\">.</span><span class=\"fu\">category20</span>()<span class=\"op\">,</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\"></a>        radius <span class=\"op\">=</span> <span class=\"dv\">25</span><span class=\"op\">;</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\"></a></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\"></a>    <span class=\"kw\">var</span> svg <span class=\"op\">=</span> target<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;svg&#39;</span>)</span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;width&#39;</span><span class=\"op\">,</span> bounds<span class=\"op\">.</span><span class=\"at\">width</span>)</span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;height&#39;</span><span class=\"op\">,</span> bounds<span class=\"op\">.</span><span class=\"at\">height</span>)<span class=\"op\">;</span></span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\"></a></span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\"></a>    <span class=\"co\">// Arrow marker for end-of-line arrow</span></span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\"></a>    svg<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;defs&#39;</span>)<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;marker&#39;</span>)</span>\n<span id=\"cb4-14\"><a href=\"https://tylercipriani.com/blog/#cb4-14\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;id&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;arrowhead&#39;</span>)</span>\n<span id=\"cb4-15\"><a href=\"https://tylercipriani.com/blog/#cb4-15\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;refX&#39;</span><span class=\"op\">,</span> <span class=\"fl\">17.5</span>)</span>\n<span id=\"cb4-16\"><a href=\"https://tylercipriani.com/blog/#cb4-16\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;refY&#39;</span><span class=\"op\">,</span> <span class=\"dv\">2</span>)</span>\n<span id=\"cb4-17\"><a href=\"https://tylercipriani.com/blog/#cb4-17\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;markerWidth&#39;</span><span class=\"op\">,</span> <span class=\"dv\">8</span>)</span>\n<span id=\"cb4-18\"><a href=\"https://tylercipriani.com/blog/#cb4-18\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;markerHeight&#39;</span><span class=\"op\">,</span> <span class=\"dv\">4</span>)</span>\n<span id=\"cb4-19\"><a href=\"https://tylercipriani.com/blog/#cb4-19\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;orient&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;auto&#39;</span>)</span>\n<span id=\"cb4-20\"><a href=\"https://tylercipriani.com/blog/#cb4-20\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;fill&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;#ccc&#39;</span>)</span>\n<span id=\"cb4-21\"><a href=\"https://tylercipriani.com/blog/#cb4-21\"></a>        <span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;path&#39;</span>)</span>\n<span id=\"cb4-22\"><a href=\"https://tylercipriani.com/blog/#cb4-22\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;d&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;M 0,0 V 4 L6,2 Z&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb4-23\"><a href=\"https://tylercipriani.com/blog/#cb4-23\"></a></span>\n<span id=\"cb4-24\"><a href=\"https://tylercipriani.com/blog/#cb4-24\"></a>    <span class=\"kw\">var</span> link <span class=\"op\">=</span> svg<span class=\"op\">.</span><span class=\"fu\">selectAll</span>(<span class=\"st\">&#39;line&#39;</span>)</span>\n<span id=\"cb4-25\"><a href=\"https://tylercipriani.com/blog/#cb4-25\"></a>        <span class=\"op\">.</span><span class=\"fu\">data</span>(graphData<span class=\"op\">.</span><span class=\"at\">links</span>)</span>\n<span id=\"cb4-26\"><a href=\"https://tylercipriani.com/blog/#cb4-26\"></a>        <span class=\"op\">.</span><span class=\"fu\">enter</span>()</span>\n<span id=\"cb4-27\"><a href=\"https://tylercipriani.com/blog/#cb4-27\"></a>            <span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;line&#39;</span>)</span>\n<span id=\"cb4-28\"><a href=\"https://tylercipriani.com/blog/#cb4-28\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;class&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;link&#39;</span>)</span>\n<span id=\"cb4-29\"><a href=\"https://tylercipriani.com/blog/#cb4-29\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;marker-end&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;url(#arrowhead)&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb4-30\"><a href=\"https://tylercipriani.com/blog/#cb4-30\"></a></span>\n<span id=\"cb4-31\"><a href=\"https://tylercipriani.com/blog/#cb4-31\"></a>    <span class=\"co\">// Create a group for each node</span></span>\n<span id=\"cb4-32\"><a href=\"https://tylercipriani.com/blog/#cb4-32\"></a>    <span class=\"kw\">var</span> node <span class=\"op\">=</span> svg<span class=\"op\">.</span><span class=\"fu\">selectAll</span>(<span class=\"st\">&#39;g&#39;</span>)</span>\n<span id=\"cb4-33\"><a href=\"https://tylercipriani.com/blog/#cb4-33\"></a>        <span class=\"op\">.</span><span class=\"fu\">data</span>(graphData<span class=\"op\">.</span><span class=\"at\">nodes</span>)</span>\n<span id=\"cb4-34\"><a href=\"https://tylercipriani.com/blog/#cb4-34\"></a>        <span class=\"op\">.</span><span class=\"fu\">enter</span>()</span>\n<span id=\"cb4-35\"><a href=\"https://tylercipriani.com/blog/#cb4-35\"></a>            <span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;g&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb4-36\"><a href=\"https://tylercipriani.com/blog/#cb4-36\"></a></span>\n<span id=\"cb4-37\"><a href=\"https://tylercipriani.com/blog/#cb4-37\"></a>    <span class=\"co\">// Color the node based on node&#39;s git-type (otherwise, hot pink!)</span></span>\n<span id=\"cb4-38\"><a href=\"https://tylercipriani.com/blog/#cb4-38\"></a>    node<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;circle&#39;</span>)</span>\n<span id=\"cb4-39\"><a href=\"https://tylercipriani.com/blog/#cb4-39\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;r&#39;</span><span class=\"op\">,</span> radius)</span>\n<span id=\"cb4-40\"><a href=\"https://tylercipriani.com/blog/#cb4-40\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;class&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;node&#39;</span>)</span>\n<span id=\"cb4-41\"><a href=\"https://tylercipriani.com/blog/#cb4-41\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;fill&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) {</span>\n<span id=\"cb4-42\"><a href=\"https://tylercipriani.com/blog/#cb4-42\"></a>            <span class=\"kw\">var</span> blue  <span class=\"op\">=</span> <span class=\"st\">&#39;#1BA1E2&#39;</span><span class=\"op\">,</span></span>\n<span id=\"cb4-43\"><a href=\"https://tylercipriani.com/blog/#cb4-43\"></a>                red   <span class=\"op\">=</span> <span class=\"st\">&#39;tomato&#39;</span><span class=\"op\">,</span></span>\n<span id=\"cb4-44\"><a href=\"https://tylercipriani.com/blog/#cb4-44\"></a>                green <span class=\"op\">=</span> <span class=\"st\">&#39;#5BB75B&#39;</span><span class=\"op\">,</span></span>\n<span id=\"cb4-45\"><a href=\"https://tylercipriani.com/blog/#cb4-45\"></a>                pink  <span class=\"op\">=</span> <span class=\"st\">&#39;#FE57A1&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb4-46\"><a href=\"https://tylercipriani.com/blog/#cb4-46\"></a></span>\n<span id=\"cb4-47\"><a href=\"https://tylercipriani.com/blog/#cb4-47\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.b&#39;</span>)) { <span class=\"cf\">return</span> red<span class=\"op\">;</span> }</span>\n<span id=\"cb4-48\"><a href=\"https://tylercipriani.com/blog/#cb4-48\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.t&#39;</span>)) { <span class=\"cf\">return</span> blue<span class=\"op\">;</span> }</span>\n<span id=\"cb4-49\"><a href=\"https://tylercipriani.com/blog/#cb4-49\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.c&#39;</span>)) { <span class=\"cf\">return</span> green<span class=\"op\">;</span> }</span>\n<span id=\"cb4-50\"><a href=\"https://tylercipriani.com/blog/#cb4-50\"></a>            <span class=\"cf\">return</span> pink<span class=\"op\">;</span></span>\n<span id=\"cb4-51\"><a href=\"https://tylercipriani.com/blog/#cb4-51\"></a>        })<span class=\"op\">;</span></span>\n<span id=\"cb4-52\"><a href=\"https://tylercipriani.com/blog/#cb4-52\"></a></span>\n<span id=\"cb4-53\"><a href=\"https://tylercipriani.com/blog/#cb4-53\"></a>    node<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;text&#39;</span>)</span>\n<span id=\"cb4-54\"><a href=\"https://tylercipriani.com/blog/#cb4-54\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;y&#39;</span><span class=\"op\">,</span> radius <span class=\"op\">*</span> <span class=\"fl\">1.5</span>)</span>\n<span id=\"cb4-55\"><a href=\"https://tylercipriani.com/blog/#cb4-55\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;text-anchor&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;middle&#39;</span>)</span>\n<span id=\"cb4-56\"><a href=\"https://tylercipriani.com/blog/#cb4-56\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;fill&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;#555&#39;</span>)</span>\n<span id=\"cb4-57\"><a href=\"https://tylercipriani.com/blog/#cb4-57\"></a>        <span class=\"op\">.</span><span class=\"fu\">text</span>(<span class=\"kw\">function</span>(d) {</span>\n<span id=\"cb4-58\"><a href=\"https://tylercipriani.com/blog/#cb4-58\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"at\">length</span> <span class=\"op\">&gt;</span> <span class=\"dv\">10</span>) {</span>\n<span id=\"cb4-59\"><a href=\"https://tylercipriani.com/blog/#cb4-59\"></a>                <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">substring</span>(<span class=\"dv\">0</span><span class=\"op\">,</span> <span class=\"dv\">8</span>) <span class=\"op\">+</span> <span class=\"st\">&#39;...&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb4-60\"><a href=\"https://tylercipriani.com/blog/#cb4-60\"></a>            }</span>\n<span id=\"cb4-61\"><a href=\"https://tylercipriani.com/blog/#cb4-61\"></a></span>\n<span id=\"cb4-62\"><a href=\"https://tylercipriani.com/blog/#cb4-62\"></a>            <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">;</span></span>\n<span id=\"cb4-63\"><a href=\"https://tylercipriani.com/blog/#cb4-63\"></a>         })<span class=\"op\">;</span></span>\n<span id=\"cb4-64\"><a href=\"https://tylercipriani.com/blog/#cb4-64\"></a></span>\n<span id=\"cb4-65\"><a href=\"https://tylercipriani.com/blog/#cb4-65\"></a>    <span class=\"co\">// If the node has a type: tag it</span></span>\n<span id=\"cb4-66\"><a href=\"https://tylercipriani.com/blog/#cb4-66\"></a>    node<span class=\"op\">.</span><span class=\"fu\">append</span>(<span class=\"st\">&#39;text&#39;</span>)</span>\n<span id=\"cb4-67\"><a href=\"https://tylercipriani.com/blog/#cb4-67\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;text-anchor&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;middle&#39;</span>)</span>\n<span id=\"cb4-68\"><a href=\"https://tylercipriani.com/blog/#cb4-68\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;y&#39;</span><span class=\"op\">,</span> <span class=\"dv\">4</span>)</span>\n<span id=\"cb4-69\"><a href=\"https://tylercipriani.com/blog/#cb4-69\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;fill&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;white&#39;</span>)</span>\n<span id=\"cb4-70\"><a href=\"https://tylercipriani.com/blog/#cb4-70\"></a>        <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;class&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;bold-text&#39;</span>)</span>\n<span id=\"cb4-71\"><a href=\"https://tylercipriani.com/blog/#cb4-71\"></a>        <span class=\"op\">.</span><span class=\"fu\">text</span>(<span class=\"kw\">function</span>(d) {</span>\n<span id=\"cb4-72\"><a href=\"https://tylercipriani.com/blog/#cb4-72\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.b&#39;</span>)) { <span class=\"cf\">return</span> <span class=\"st\">&#39;BLOB&#39;</span><span class=\"op\">;</span> }</span>\n<span id=\"cb4-73\"><a href=\"https://tylercipriani.com/blog/#cb4-73\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.t&#39;</span>)) { <span class=\"cf\">return</span> <span class=\"st\">&#39;TREE&#39;</span><span class=\"op\">;</span> }</span>\n<span id=\"cb4-74\"><a href=\"https://tylercipriani.com/blog/#cb4-74\"></a>            <span class=\"cf\">if</span> (d<span class=\"op\">.</span><span class=\"at\">name</span><span class=\"op\">.</span><span class=\"fu\">endsWith</span>(<span class=\"st\">&#39;.c&#39;</span>)) { <span class=\"cf\">return</span> <span class=\"st\">&#39;COMMIT&#39;</span><span class=\"op\">;</span> }</span>\n<span id=\"cb4-75\"><a href=\"https://tylercipriani.com/blog/#cb4-75\"></a>            <span class=\"cf\">return</span> <span class=\"st\">&#39;&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb4-76\"><a href=\"https://tylercipriani.com/blog/#cb4-76\"></a>         })<span class=\"op\">;</span></span>\n<span id=\"cb4-77\"><a href=\"https://tylercipriani.com/blog/#cb4-77\"></a></span>\n<span id=\"cb4-78\"><a href=\"https://tylercipriani.com/blog/#cb4-78\"></a>    <span class=\"kw\">var</span> charge <span class=\"op\">=</span> <span class=\"dv\">700</span> <span class=\"op\">*</span> graphData<span class=\"op\">.</span><span class=\"at\">nodes</span><span class=\"op\">.</span><span class=\"at\">length</span><span class=\"op\">;</span></span>\n<span id=\"cb4-79\"><a href=\"https://tylercipriani.com/blog/#cb4-79\"></a></span>\n<span id=\"cb4-80\"><a href=\"https://tylercipriani.com/blog/#cb4-80\"></a>    <span class=\"kw\">var</span> force <span class=\"op\">=</span> d3<span class=\"op\">.</span><span class=\"at\">layout</span><span class=\"op\">.</span><span class=\"fu\">force</span>()</span>\n<span id=\"cb4-81\"><a href=\"https://tylercipriani.com/blog/#cb4-81\"></a>        <span class=\"op\">.</span><span class=\"fu\">size</span>([bounds<span class=\"op\">.</span><span class=\"at\">width</span><span class=\"op\">,</span> bounds<span class=\"op\">.</span><span class=\"at\">height</span>])</span>\n<span id=\"cb4-82\"><a href=\"https://tylercipriani.com/blog/#cb4-82\"></a>        <span class=\"op\">.</span><span class=\"fu\">nodes</span>(graphData<span class=\"op\">.</span><span class=\"at\">nodes</span>)</span>\n<span id=\"cb4-83\"><a href=\"https://tylercipriani.com/blog/#cb4-83\"></a>        <span class=\"op\">.</span><span class=\"fu\">links</span>(graphData<span class=\"op\">.</span><span class=\"at\">links</span>)</span>\n<span id=\"cb4-84\"><a href=\"https://tylercipriani.com/blog/#cb4-84\"></a>        <span class=\"op\">.</span><span class=\"fu\">linkDistance</span>(<span class=\"dv\">150</span>)</span>\n<span id=\"cb4-85\"><a href=\"https://tylercipriani.com/blog/#cb4-85\"></a>        <span class=\"op\">.</span><span class=\"fu\">charge</span>(<span class=\"op\">-</span>(charge))</span>\n<span id=\"cb4-86\"><a href=\"https://tylercipriani.com/blog/#cb4-86\"></a>        <span class=\"op\">.</span><span class=\"fu\">gravity</span>(<span class=\"dv\">1</span>)</span>\n<span id=\"cb4-87\"><a href=\"https://tylercipriani.com/blog/#cb4-87\"></a>        <span class=\"op\">.</span><span class=\"fu\">on</span>(<span class=\"st\">&#39;tick&#39;</span><span class=\"op\">,</span> tick)<span class=\"op\">;</span></span>\n<span id=\"cb4-88\"><a href=\"https://tylercipriani.com/blog/#cb4-88\"></a></span>\n<span id=\"cb4-89\"><a href=\"https://tylercipriani.com/blog/#cb4-89\"></a>    <span class=\"co\">// No fancy animation, tick amount varies based on number of nodes</span></span>\n<span id=\"cb4-90\"><a href=\"https://tylercipriani.com/blog/#cb4-90\"></a>    force<span class=\"op\">.</span><span class=\"fu\">start</span>()<span class=\"op\">;</span></span>\n<span id=\"cb4-91\"><a href=\"https://tylercipriani.com/blog/#cb4-91\"></a>    <span class=\"cf\">for</span> (<span class=\"kw\">var</span> i <span class=\"op\">=</span> <span class=\"dv\">0</span><span class=\"op\">;</span> i <span class=\"op\">&lt;</span> graphData<span class=\"op\">.</span><span class=\"at\">nodes</span><span class=\"op\">.</span><span class=\"at\">length</span> <span class=\"op\">*</span> <span class=\"dv\">100</span><span class=\"op\">;</span> <span class=\"op\">++</span>i) force<span class=\"op\">.</span><span class=\"fu\">tick</span>()<span class=\"op\">;</span></span>\n<span id=\"cb4-92\"><a href=\"https://tylercipriani.com/blog/#cb4-92\"></a>    force<span class=\"op\">.</span><span class=\"fu\">stop</span>()<span class=\"op\">;</span></span>\n<span id=\"cb4-93\"><a href=\"https://tylercipriani.com/blog/#cb4-93\"></a></span>\n<span id=\"cb4-94\"><a href=\"https://tylercipriani.com/blog/#cb4-94\"></a>    <span class=\"kw\">function</span> <span class=\"fu\">tick</span>(e) {</span>\n<span id=\"cb4-95\"><a href=\"https://tylercipriani.com/blog/#cb4-95\"></a>        <span class=\"co\">// Push sources up and targets down to form a weak tree.</span></span>\n<span id=\"cb4-96\"><a href=\"https://tylercipriani.com/blog/#cb4-96\"></a>        <span class=\"kw\">var</span> k <span class=\"op\">=</span> <span class=\"op\">-</span><span class=\"dv\">12</span> <span class=\"op\">*</span> e<span class=\"op\">.</span><span class=\"at\">alpha</span><span class=\"op\">;</span></span>\n<span id=\"cb4-97\"><a href=\"https://tylercipriani.com/blog/#cb4-97\"></a></span>\n<span id=\"cb4-98\"><a href=\"https://tylercipriani.com/blog/#cb4-98\"></a>        link</span>\n<span id=\"cb4-99\"><a href=\"https://tylercipriani.com/blog/#cb4-99\"></a>            <span class=\"op\">.</span><span class=\"fu\">each</span>(<span class=\"kw\">function</span>(d) { d<span class=\"op\">.</span><span class=\"at\">source</span><span class=\"op\">.</span><span class=\"at\">y</span> <span class=\"op\">-=</span> k<span class=\"op\">,</span> d<span class=\"op\">.</span><span class=\"at\">target</span><span class=\"op\">.</span><span class=\"at\">y</span> <span class=\"op\">+=</span> k<span class=\"op\">;</span> })</span>\n<span id=\"cb4-100\"><a href=\"https://tylercipriani.com/blog/#cb4-100\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;x2&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) { <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">source</span><span class=\"op\">.</span><span class=\"at\">x</span><span class=\"op\">;</span> })</span>\n<span id=\"cb4-101\"><a href=\"https://tylercipriani.com/blog/#cb4-101\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;y2&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) { <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">source</span><span class=\"op\">.</span><span class=\"at\">y</span><span class=\"op\">;</span> })</span>\n<span id=\"cb4-102\"><a href=\"https://tylercipriani.com/blog/#cb4-102\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;x1&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) { <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">target</span><span class=\"op\">.</span><span class=\"at\">x</span><span class=\"op\">;</span> })</span>\n<span id=\"cb4-103\"><a href=\"https://tylercipriani.com/blog/#cb4-103\"></a>                <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;y1&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) { <span class=\"cf\">return</span> d<span class=\"op\">.</span><span class=\"at\">target</span><span class=\"op\">.</span><span class=\"at\">y</span><span class=\"op\">;</span> })<span class=\"op\">;</span></span>\n<span id=\"cb4-104\"><a href=\"https://tylercipriani.com/blog/#cb4-104\"></a></span>\n<span id=\"cb4-105\"><a href=\"https://tylercipriani.com/blog/#cb4-105\"></a>        node</span>\n<span id=\"cb4-106\"><a href=\"https://tylercipriani.com/blog/#cb4-106\"></a>            <span class=\"op\">.</span><span class=\"fu\">attr</span>(<span class=\"st\">&#39;transform&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(d) {</span>\n<span id=\"cb4-107\"><a href=\"https://tylercipriani.com/blog/#cb4-107\"></a>                <span class=\"cf\">return</span> <span class=\"st\">&#39;translate(&#39;</span> <span class=\"op\">+</span> d<span class=\"op\">.</span><span class=\"at\">x</span> <span class=\"op\">+</span> <span class=\"st\">&#39;,&#39;</span> <span class=\"op\">+</span> d<span class=\"op\">.</span><span class=\"at\">y</span> <span class=\"op\">+</span> <span class=\"st\">&#39;)&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb4-108\"><a href=\"https://tylercipriani.com/blog/#cb4-108\"></a>            })<span class=\"op\">;</span></span>\n<span id=\"cb4-109\"><a href=\"https://tylercipriani.com/blog/#cb4-109\"></a>    }</span>\n<span id=\"cb4-110\"><a href=\"https://tylercipriani.com/blog/#cb4-110\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb4-111\"><a href=\"https://tylercipriani.com/blog/#cb4-111\"></a><span class=\"fu\">makeGraph</span>(<span class=\"st\">&#39;.merkle-1&#39;</span><span class=\"op\">,</span> forceInput)<span class=\"op\">;</span></span></code></pre></div>\n<div class=\"merkle-1\">\n\n</div>\n<p>You’d be forgiven for thinking that is a line.</p>\n<p>This directional line <em>is</em> a DAG—albeit a simple one.\n<code>Node B</code> depends on <code>Node A</code> and that is the whole\ngraph. If you want to get to <code>Node B</code> then you have to start\nat <code>Node A</code>. Depending on your problem-space,\n<code>Node B</code> could be many things: A place in <a\nhref=\"https://en.wikipedia.org/wiki/Seven_Bridges_of_K%C3%B6nigsberg\">Königsberg</a>,\na target in a Makefile (or a <a\nhref=\"http://martinfowler.com/articles/rake.html\">Rakefile</a>), or\n(brace yourself) a <em>Git object</em>.</p>\n<section id=\"git-object-anatomy\" class=\"level2\">\n<h2>Git Object Anatomy</h2>\n<p>In order to understand how Git is a DAG, you need to understand Git\n“objects”:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> mkdir merkle</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd merkle</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;This is the beginning&#39;</span> <span class=\"op\">&gt;</span> README</span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git init</span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git add .</span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git <span class=\"at\">-m</span> <span class=\"st\">&#39;Initial Commit&#39;</span></span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> find .git/objects/ <span class=\"at\">-type</span> f</span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1b/9f426a8407ffee551ad2993c5d7d3780296353</span></span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/09/8e6de29daf4e55f83406b49f5768df9bc7d624</span></span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span></code></pre></div>\n<p>What are Git objects? Because they look like nonsense:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cat .git/objects/1b/9f426a8407ffee551ad2993c5d7d3780296353</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">xKOR02,V¢T¤̼¼̼t.</span></span></code></pre></div>\n<p>After a little digging through the <a\nhref=\"https://git-scm.com/book/en/v2/Git-Internals-Git-Objects\">Pro\nGit</a> book, Git objects are a little less non-sensicle. Git objects\nare simply <code>zlib</code> compressed, formatted messages:</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> python2 <span class=\"at\">-c</span> <span class=\"st\">&#39;import sys,zlib; \\</span></span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">  print zlib.decompress(sys.stdin.read());&#39;</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">&lt;</span> .git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span>\n<span id=\"cb7-4\"><a href=\"https://tylercipriani.com/blog/#cb7-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">commit</span> 195tree 098e6de29daf4e55f83406b49f5768df9bc7d624</span>\n<span id=\"cb7-5\"><a href=\"https://tylercipriani.com/blog/#cb7-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">author</span> Tyler Cipriani <span class=\"op\">&lt;</span>tcipriani@wikimedia.org<span class=\"op\">&gt;</span> 1458604120 <span class=\"at\">-0700</span></span>\n<span id=\"cb7-6\"><a href=\"https://tylercipriani.com/blog/#cb7-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">committer</span> Tyler Cipriani <span class=\"op\">&lt;</span>tcipriani@wikimedia.org<span class=\"op\">&gt;</span> 1458604120 <span class=\"at\">-0700</span></span>\n<span id=\"cb7-7\"><a href=\"https://tylercipriani.com/blog/#cb7-7\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb7-8\"><a href=\"https://tylercipriani.com/blog/#cb7-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Initial</span> Commit</span></code></pre></div>\n<p>Parts of that message are obvious: <code>author</code> and\n<code>committer</code> obviously come from my <code>.gitconfig</code>.\nThere is a Unix epoch timestamp with a timezone offset.\n<code>commit</code> is the type of object. <code>195</code> is the\nbyte-length of the remainder of the message.</p>\n<p>There are a few parts of that message that aren’t immediately\nobvious. What is\n<code>tree 098e6de29daf4e55f83406b49f5768df9bc7d624</code>? And why\nwould we store this message in\n<code>.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</code> and\nnot <code>.git/objects/commit-message</code>? Is a <em>merkle</em> what\nI think it is? The answer to all of these questions and many more is the\nsame: <a\nhref=\"https://en.wikipedia.org/wiki/Cryptographic_hash_function\">Cryptographic\nHash Functions</a>.</p>\n</section>\n<section id=\"hash-functions\" class=\"level2\">\n<h2>Hash Functions</h2>\n<p>A cryptographic hash function is a function that when given an input\nof any length it creates a fixed-length output. Furthermore (and more\nimportantly), the fixed-length output should be unique to a given input;\nany change in input will likely cause a big change in the output. Git\nuses a cryptographic hash function called <em>Secure Hash Algorithm\n1</em> (<a href=\"https://en.wikipedia.org/wiki/SHA-1\">SHA-1</a>).</p>\n<p>You can play with the SHA-1 function on the command line:</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;message&#39;</span> <span class=\"kw\">|</span> <span class=\"fu\">sha1sum</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1133e3acf0a4cbb9d8b3bfd3f227731b8cd2650b</span>  <span class=\"at\">-</span></span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;message&#39;</span> <span class=\"kw\">|</span> <span class=\"fu\">sha1sum</span></span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1133e3acf0a4cbb9d8b3bfd3f227731b8cd2650b</span>  <span class=\"at\">-</span></span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;message1&#39;</span> <span class=\"kw\">|</span> <span class=\"fu\">sha1sum</span></span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">c133514a60a4641b83b365d3dc7b715dc954e010</span>  <span class=\"at\">-</span></span></code></pre></div>\n<p>Note the big change in the output of <code>sha1sum</code> from a tiny\nchange in input. This is what cryptographic hash functions do.</p>\n</section>\n<section id=\"hash-that-dag\" class=\"level2\">\n<h2>Hash that DAG!</h2>\n<p>Now that we have some idea of what is inside a commit object, let’s\nreverse-engineer the commit object from the <code>HEAD</code> of our\n<code>merkle</code> repo:</p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span>  python2 <span class=\"at\">-c</span> <span class=\"st\">&#39;import sys,zlib; \\</span></span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">print zlib.decompress(sys.stdin.read());&#39;</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"op\">&lt;</span> .git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">od</span> <span class=\"at\">-c</span></span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000000</span>   c   o   m   m   i   t       1   9   5  <span class=\"dt\">\\0</span>   t   r   e   e    </span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000020</span>   0   9   8   e   6   d   e   2   9   d   a   f   4   e   5   5</span>\n<span id=\"cb9-7\"><a href=\"https://tylercipriani.com/blog/#cb9-7\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000040</span>   f   8   3   4   0   6   b   4   9   f   5   7   6   8   d   f</span>\n<span id=\"cb9-8\"><a href=\"https://tylercipriani.com/blog/#cb9-8\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000060</span>   9   b   c   7   d   6   2   4  <span class=\"dt\">\\n</span>   a   u   t   h   o   r    </span>\n<span id=\"cb9-9\"><a href=\"https://tylercipriani.com/blog/#cb9-9\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000100</span>   T   y   l   e   r       C   i   p   r   i   a   n   i       <span class=\"op\">&lt;</span></span>\n<span id=\"cb9-10\"><a href=\"https://tylercipriani.com/blog/#cb9-10\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000120</span>   t   c   i   p   r   i   a   n   i   @   w   i   k   i   m   e</span>\n<span id=\"cb9-11\"><a href=\"https://tylercipriani.com/blog/#cb9-11\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000140</span>   d   i   a   .   o   r   g   <span class=\"op\">&gt;</span>       1   4   5   8   6   0   4</span>\n<span id=\"cb9-12\"><a href=\"https://tylercipriani.com/blog/#cb9-12\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000160</span>   1   2   0       <span class=\"at\">-</span>   0   7   0   0  <span class=\"dt\">\\n</span>   c   o   m   m   i   t</span>\n<span id=\"cb9-13\"><a href=\"https://tylercipriani.com/blog/#cb9-13\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000200</span>   t   e   r       T   y   l   e   r       C   i   p   r   i   a</span>\n<span id=\"cb9-14\"><a href=\"https://tylercipriani.com/blog/#cb9-14\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000220</span>   n   i       <span class=\"op\">&lt;</span>   t   c   i   p   r   i   a   n   i   @   w   i</span>\n<span id=\"cb9-15\"><a href=\"https://tylercipriani.com/blog/#cb9-15\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000240</span>   k   i   m   e   d   i   a   .   o   r   g   <span class=\"op\">&gt;</span>       1   4   5</span>\n<span id=\"cb9-16\"><a href=\"https://tylercipriani.com/blog/#cb9-16\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000260</span>   8   6   0   4   1   2   0       <span class=\"at\">-</span>   0   7   0   0  <span class=\"dt\">\\n</span>  <span class=\"dt\">\\n</span>   I</span>\n<span id=\"cb9-17\"><a href=\"https://tylercipriani.com/blog/#cb9-17\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000300</span>   n   i   t   i   a   l       C   o   m   m   i   t  <span class=\"dt\">\\n</span>  <span class=\"dt\">\\n</span></span>\n<span id=\"cb9-18\"><a href=\"https://tylercipriani.com/blog/#cb9-18\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">0000317</span></span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb10\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> printf <span class=\"st\">&#39;tree 098e6de29daf4e55f83406b49f5768df9bc7d62k4\\n&#39;</span> <span class=\"op\">&gt;&gt;</span> commit-msg</span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> printf <span class=\"st\">&#39;author Tyler Cipriani &lt;tcipriani@wikimedia.org&gt; 1458604120 -0700\\n&#39;</span> <span class=\"op\">&gt;&gt;</span> commit-msg</span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> printf <span class=\"st\">&#39;committer Tyler Cipriani &lt;tcipriani@wikimedia.org&gt; 1458604120 -0700\\n&#39;</span> <span class=\"op\">&gt;&gt;</span> commit-msg</span>\n<span id=\"cb10-4\"><a href=\"https://tylercipriani.com/blog/#cb10-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> printf <span class=\"st\">&#39;\\nInitial Commit\\n&#39;</span> <span class=\"op\">&gt;&gt;</span> commit-msg</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb11\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sha1sum <span class=\"op\">&lt;(</span><span class=\"fu\">cat</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb11-2\"><a href=\"https://tylercipriani.com/blog/#cb11-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">&lt;(</span><span class=\"bu\">printf</span> <span class=\"st\">&quot;commit &quot;</span><span class=\"op\">)</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb11-3\"><a href=\"https://tylercipriani.com/blog/#cb11-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">&lt;(</span><span class=\"fu\">wc</span> <span class=\"at\">-c</span> <span class=\"op\">&lt;</span> commit-msg <span class=\"kw\">|</span> <span class=\"fu\">tr</span> <span class=\"at\">-d</span> <span class=\"st\">&#39;\\n&#39;</span><span class=\"op\">)</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb11-4\"><a href=\"https://tylercipriani.com/blog/#cb11-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"op\">&lt;(</span><span class=\"bu\">printf</span> <span class=\"st\">&#39;%b&#39;</span> <span class=\"st\">&#39;\\0&#39;</span><span class=\"op\">)</span> commit-msg<span class=\"op\">)</span></span>\n<span id=\"cb11-5\"><a href=\"https://tylercipriani.com/blog/#cb11-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1a06ce381ac14f7a5baa1670691c2ff8a73aa6da</span>  /dev/fd/63</span></code></pre></div>\n<p>Hmm… that seems familiar</p>\n<div class=\"sourceCode\" id=\"cb12\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> export COMMIT_HASH=<span class=\"va\">$(</span><span class=\"fu\">sha1sum</span> <span class=\"op\">&lt;(</span><span class=\"fu\">cat</span> <span class=\"op\">&lt;(</span><span class=\"bu\">printf</span> <span class=\"st\">&quot;commit &quot;</span><span class=\"op\">)</span> <span class=\"op\">&lt;(</span><span class=\"fu\">wc</span> <span class=\"at\">-c</span> <span class=\"op\">&lt;</span> commit-msg <span class=\"kw\">|</span> <span class=\"fu\">tr</span> <span class=\"at\">-d</span> <span class=\"st\">&#39;\\n&#39;</span><span class=\"op\">)</span> <span class=\"op\">&lt;(</span><span class=\"bu\">printf</span> <span class=\"st\">&#39;%b&#39;</span> <span class=\"st\">&#39;\\0&#39;</span><span class=\"op\">)</span> commit-msg<span class=\"op\">)</span> <span class=\"kw\">|</span> <span class=\"fu\">cut</span> <span class=\"at\">-d</span><span class=\"st\">&#39; &#39;</span> <span class=\"at\">-f1</span><span class=\"va\">)</span></span>\n<span id=\"cb12-2\"><a href=\"https://tylercipriani.com/blog/#cb12-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> find <span class=\"st\">&quot;.git/objects/</span><span class=\"va\">${COMMIT_HASH</span><span class=\"op\">:</span><span class=\"dv\">0</span><span class=\"op\">:</span><span class=\"dv\">2</span><span class=\"va\">}</span><span class=\"st\">&quot;</span> <span class=\"at\">-type</span> f <span class=\"at\">-name</span> <span class=\"st\">&quot;</span><span class=\"va\">${COMMIT_HASH</span><span class=\"op\">:</span>(-<span class=\"dv\">38</span>)<span class=\"va\">}</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb12-3\"><a href=\"https://tylercipriani.com/blog/#cb12-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span></code></pre></div>\n<p>The commit object is a zlib-compressed, formatted message that is\nstored in a file named after the SHA-1 hash of the file’s\nun-<code>zlib</code> compressed contents.</p>\n<p>(/me wipes brow)</p>\n<p>Let’s use <code>git-cat-file</code> to see if we can explore the\n<code>tree 098e6de29daf4e55f83406b49f5768df9bc7d62k4</code>-part of the\ncommit message object:</p>\n<div class=\"sourceCode\" id=\"cb13\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb13-1\"><a href=\"https://tylercipriani.com/blog/#cb13-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cat .git/HEAD</span>\n<span id=\"cb13-2\"><a href=\"https://tylercipriani.com/blog/#cb13-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ref:</span> refs/heads/master</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb14\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cat .git/refs/heads/master</span>\n<span id=\"cb14-2\"><a href=\"https://tylercipriani.com/blog/#cb14-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">1a06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb15\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb15-1\"><a href=\"https://tylercipriani.com/blog/#cb15-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git cat-file <span class=\"at\">-p</span> 1a06ce381ac14f7a5baa1670691c2ff8a73aa6da</span>\n<span id=\"cb15-2\"><a href=\"https://tylercipriani.com/blog/#cb15-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">tree</span> 098e6de29daf4e55f83406b49f5768df9bc7d624</span>\n<span id=\"cb15-3\"><a href=\"https://tylercipriani.com/blog/#cb15-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">author</span> Tyler Cipriani <span class=\"op\">&lt;</span>tcipriani@wikimedia.org<span class=\"op\">&gt;</span> 1458604120 <span class=\"at\">-0700</span></span>\n<span id=\"cb15-4\"><a href=\"https://tylercipriani.com/blog/#cb15-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">committer</span> Tyler Cipriani <span class=\"op\">&lt;</span>tcipriani@wikimedia.org<span class=\"op\">&gt;</span> 1458604120 <span class=\"at\">-0700</span></span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb16\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb16-1\"><a href=\"https://tylercipriani.com/blog/#cb16-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git cat-file <span class=\"at\">-p</span> 098e6de29daf4e55f83406b49f5768df9bc7d624</span>\n<span id=\"cb16-2\"><a href=\"https://tylercipriani.com/blog/#cb16-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">100644</span> blob 1b9f426a8407ffee551ad2993c5d7d3780296353    README</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb17\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb17-1\"><a href=\"https://tylercipriani.com/blog/#cb17-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git cat-file <span class=\"at\">-p</span> 1b9f426a8407ffee551ad2993c5d7d3780296353</span>\n<span id=\"cb17-2\"><a href=\"https://tylercipriani.com/blog/#cb17-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">This</span> is the beginning</span></code></pre></div>\n<p>Hey that’s the text I put into <code>README</code>!</p>\n<p>So <code>.git/HEAD</code> refers to\n<code>.git/refs/heads/master</code>, calling <code>git-cat-file</code>\non the object found inside that file shows that it’s the commit object\nwe recreated. The commit object points to\n<code>098e6de29daf4e55f83406b49f5768df9bc7d624</code>, which is a tree\nobject with the contents:\n<code>100644 blob 1b9f426a8407ffee551ad2993c5d7d3780296353    README</code>\nThe <code>blob</code> object\n<code>1b9f426a8407ffee551ad2993c5d7d3780296353</code> is the contents of\n<code>README</code>! So it seems each <code>commit</code> object points\nto a <code>tree</code> object that points to other objects.</p>\n</section>\n<section id=\"what-was-i-talking-about-merkle-dags-d3.js\" class=\"level2\">\n<h2>What was I talking about? Merkle DAGs? D3.js?</h2>\n<p>Let’s see if we can paste together what Git is doing at a low-level\nwhen we make a new commit:</p>\n<ol type=\"1\">\n<li>Take the contents of <code>README</code>, hash the contents using\nSHA-1, and store as a <code>blob</code> object in\n<code>.git/objects</code>.</li>\n<li>Create a directory listing of the git working directory, listing\neach file, with its directory permissions and its hash value. Hash this\ndirectory listing and store as a <code>tree</code> in\n<code>.git/objects</code>.</li>\n<li>Take the commit message, along with info from\n<code>.gitconfig</code> and the hash of the top-level tree. Hash this\ninformation and store it as a <code>commit</code> object in\n<code>.git/objects</code>.</li>\n</ol>\n<p>It seems that there may be a chain of dependencies:</p>\n<div class=\"sourceCode\" id=\"cb18\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb18-1\"><a href=\"https://tylercipriani.com/blog/#cb18-1\"></a><span class=\"kw\">var</span> gitDag <span class=\"op\">=</span> {</span>\n<span id=\"cb18-2\"><a href=\"https://tylercipriani.com/blog/#cb18-2\"></a>    <span class=\"co\">// blob (add .b for blob)</span></span>\n<span id=\"cb18-3\"><a href=\"https://tylercipriani.com/blog/#cb18-3\"></a>    <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span><span class=\"op\">:</span> []<span class=\"op\">,</span></span>\n<span id=\"cb18-4\"><a href=\"https://tylercipriani.com/blog/#cb18-4\"></a>    <span class=\"co\">// tree (.t == tree) is a hash that includes the hash from blob</span></span>\n<span id=\"cb18-5\"><a href=\"https://tylercipriani.com/blog/#cb18-5\"></a>    <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span><span class=\"op\">:</span> [<span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span>]<span class=\"op\">,</span></span>\n<span id=\"cb18-6\"><a href=\"https://tylercipriani.com/blog/#cb18-6\"></a>    <span class=\"co\">// commit (.c == commit) is a hash that includes the hash from tree</span></span>\n<span id=\"cb18-7\"><a href=\"https://tylercipriani.com/blog/#cb18-7\"></a>    <span class=\"st\">&#39;1a06ce381ac14f7a5baa1670691c2ff8a73aa6da.c&#39;</span><span class=\"op\">:</span> [<span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span>]<span class=\"op\">,</span></span>\n<span id=\"cb18-8\"><a href=\"https://tylercipriani.com/blog/#cb18-8\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb18-9\"><a href=\"https://tylercipriani.com/blog/#cb18-9\"></a></span>\n<span id=\"cb18-10\"><a href=\"https://tylercipriani.com/blog/#cb18-10\"></a><span class=\"fu\">makeGraph</span>(<span class=\"st\">&#39;.merkle-2&#39;</span><span class=\"op\">,</span> <span class=\"fu\">forceFormat</span>(gitDag))<span class=\"op\">;</span></span></code></pre></div>\n<div class=\"merkle-2\">\n\n</div>\n<p>You’d be forgiven for thinking that is a line.</p>\n<p>What’s really happening is that there is a <code>commit</code> object\n(<code>1a06ce38</code>) that depends on a <code>tree</code> object\n(<code>098e6de2</code>) that depends on a <code>blob</code>\n(<code>1b9f426a</code>).</p>\n<p>Since it’s running each of these objects through a hash function and\neach of them contains a reference up the chain of dependencies, a minor\nchange to either the <code>blob</code> or the <code>tree</code> will\ncreate a drastically different <code>commit</code> object.</p>\n<p>Applying a cryptographic hash function on top of a graph was <a\nhref=\"https://en.wikipedia.org/wiki/Ralph_Merkle\">Ralph Merkle</a>’s big\nidea. This scheme makes magic possible. Transferring verifiable and\ntrusted information through an untrusted medium is toatz for realz\npossible with Ralph’s little scheme.</p>\n<p>The idea is that if you have the <em>root-node hash</em>, that is,\nthe cryptographic hash of the node that depends on all other nodes (the\n<code>commit</code> object in Git), and you obtained that root-node hash\nfrom a trusted source, you can trust all sub-nodes that stem from that\nroot node <em>if</em> the hash of all those sub-root-nodes matches the\nroot-node hash!</p>\n<p>This is the mechanism by which things like Git, <a\nhref=\"https://github.com/ipfs/specs/blob/master/protocol/README.md#1-ipfs-and-the-merkle-dag\">IPFS</a>,\n<a\nhref=\"http://chimera.labs.oreilly.com/books/1234000001802/ch07.html#merkle_trees\">Bitcoin</a>,\nand <a href=\"http://bittorrent.org/beps/bep_0030.html\">BitTorrent</a>\nare made possible: changing any one node in the graph changes all nodes\nthat depend on that node all the way to the root-node (the\n<code>commit</code> in Git).</p>\n</section>\n<section id=\"tales-from-the-merkle-graph\" class=\"level2\">\n<h2>Tales from the Merkle Graph</h2>\n<p>I wrote a simple NodeJS script that creates a graph that is suitable\nfor input into the JavaScript that I’ve already written that will create\na D3.js force graph with whatever it finds in\n<code>.git/objects</code>.</p>\n<div class=\"sourceCode\" id=\"cb19\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb19-1\"><a href=\"https://tylercipriani.com/blog/#cb19-1\"></a><span class=\"co\">#!/usr/bin/env nodejs</span></span>\n<span id=\"cb19-2\"><a href=\"https://tylercipriani.com/blog/#cb19-2\"></a><span class=\"co\">/* makeDag - creates a JSON dependency graph from .git/objects */</span></span>\n<span id=\"cb19-3\"><a href=\"https://tylercipriani.com/blog/#cb19-3\"></a></span>\n<span id=\"cb19-4\"><a href=\"https://tylercipriani.com/blog/#cb19-4\"></a><span class=\"kw\">var</span> glob <span class=\"op\">=</span> <span class=\"pp\">require</span>(<span class=\"st\">&#39;glob&#39;</span>)<span class=\"op\">,</span></span>\n<span id=\"cb19-5\"><a href=\"https://tylercipriani.com/blog/#cb19-5\"></a>    fs <span class=\"op\">=</span> <span class=\"pp\">require</span>(<span class=\"st\">&#39;fs&#39;</span>)<span class=\"op\">,</span></span>\n<span id=\"cb19-6\"><a href=\"https://tylercipriani.com/blog/#cb19-6\"></a>    zlib <span class=\"op\">=</span> <span class=\"pp\">require</span>(<span class=\"st\">&#39;zlib&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb19-7\"><a href=\"https://tylercipriani.com/blog/#cb19-7\"></a></span>\n<span id=\"cb19-8\"><a href=\"https://tylercipriani.com/blog/#cb19-8\"></a><span class=\"kw\">var</span> types <span class=\"op\">=</span> [<span class=\"st\">&#39;tree&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;commit&#39;</span><span class=\"op\">,</span> <span class=\"st\">&#39;blob&#39;</span>]<span class=\"op\">,</span></span>\n<span id=\"cb19-9\"><a href=\"https://tylercipriani.com/blog/#cb19-9\"></a>    treeRegex <span class=\"op\">=</span> {</span>\n<span id=\"cb19-10\"><a href=\"https://tylercipriani.com/blog/#cb19-10\"></a>        <span class=\"co\">// 100644 README\\0[20 byte sha1]</span></span>\n<span id=\"cb19-11\"><a href=\"https://tylercipriani.com/blog/#cb19-11\"></a>        <span class=\"dt\">regex</span><span class=\"op\">:</span> <span class=\"ss\">/</span><span class=\"sc\">[0-9]+\\s[^\\0]+\\0((</span><span class=\"ss\">.</span><span class=\"sc\">|\\n){20})</span><span class=\"ss\">/gm</span><span class=\"op\">,</span></span>\n<span id=\"cb19-12\"><a href=\"https://tylercipriani.com/blog/#cb19-12\"></a>        <span class=\"dt\">fn</span><span class=\"op\">:</span> <span class=\"kw\">function</span>(sha) {</span>\n<span id=\"cb19-13\"><a href=\"https://tylercipriani.com/blog/#cb19-13\"></a>            <span class=\"kw\">var</span> buf <span class=\"op\">=</span> <span class=\"kw\">new</span> <span class=\"bu\">Buffer</span>(sha[<span class=\"dv\">1</span>]<span class=\"op\">,</span> <span class=\"st\">&#39;binary&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb19-14\"><a href=\"https://tylercipriani.com/blog/#cb19-14\"></a>            <span class=\"cf\">return</span> buf<span class=\"op\">.</span><span class=\"fu\">toString</span>(<span class=\"st\">&#39;hex&#39;</span>) <span class=\"op\">+</span> <span class=\"st\">&#39;.b&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb19-15\"><a href=\"https://tylercipriani.com/blog/#cb19-15\"></a>        }</span>\n<span id=\"cb19-16\"><a href=\"https://tylercipriani.com/blog/#cb19-16\"></a>    }<span class=\"op\">,</span></span>\n<span id=\"cb19-17\"><a href=\"https://tylercipriani.com/blog/#cb19-17\"></a>    commitRegex <span class=\"op\">=</span> {</span>\n<span id=\"cb19-18\"><a href=\"https://tylercipriani.com/blog/#cb19-18\"></a>        <span class=\"co\">// tree 098e6de29daf4e55f83406b49f5768df9bc7d624</span></span>\n<span id=\"cb19-19\"><a href=\"https://tylercipriani.com/blog/#cb19-19\"></a>        <span class=\"dt\">regex</span><span class=\"op\">:</span> <span class=\"ss\">/</span><span class=\"sc\">(</span><span class=\"ss\">tree</span><span class=\"sc\">|</span><span class=\"ss\">parent</span><span class=\"sc\">)\\s([a-f0-9]{40})</span><span class=\"ss\">/gm</span><span class=\"op\">,</span></span>\n<span id=\"cb19-20\"><a href=\"https://tylercipriani.com/blog/#cb19-20\"></a>        <span class=\"dt\">fn</span><span class=\"op\">:</span> <span class=\"kw\">function</span>(sha) {</span>\n<span id=\"cb19-21\"><a href=\"https://tylercipriani.com/blog/#cb19-21\"></a>            <span class=\"cf\">if</span> (sha[<span class=\"dv\">1</span>] <span class=\"op\">===</span> <span class=\"st\">&#39;tree&#39;</span>) {</span>\n<span id=\"cb19-22\"><a href=\"https://tylercipriani.com/blog/#cb19-22\"></a>                <span class=\"cf\">return</span> sha[<span class=\"dv\">2</span>] <span class=\"op\">+</span> <span class=\"st\">&#39;.t&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb19-23\"><a href=\"https://tylercipriani.com/blog/#cb19-23\"></a>            }</span>\n<span id=\"cb19-24\"><a href=\"https://tylercipriani.com/blog/#cb19-24\"></a>            <span class=\"cf\">return</span> sha[<span class=\"dv\">2</span>] <span class=\"op\">+</span> <span class=\"st\">&#39;.c&#39;</span><span class=\"op\">;</span></span>\n<span id=\"cb19-25\"><a href=\"https://tylercipriani.com/blog/#cb19-25\"></a>        }</span>\n<span id=\"cb19-26\"><a href=\"https://tylercipriani.com/blog/#cb19-26\"></a>    }<span class=\"op\">,</span></span>\n<span id=\"cb19-27\"><a href=\"https://tylercipriani.com/blog/#cb19-27\"></a>    total <span class=\"op\">=</span> <span class=\"dv\">0</span><span class=\"op\">,</span></span>\n<span id=\"cb19-28\"><a href=\"https://tylercipriani.com/blog/#cb19-28\"></a>    final <span class=\"op\">=</span> {}<span class=\"op\">;</span></span>\n<span id=\"cb19-29\"><a href=\"https://tylercipriani.com/blog/#cb19-29\"></a></span>\n<span id=\"cb19-30\"><a href=\"https://tylercipriani.com/blog/#cb19-30\"></a><span class=\"co\">// determine file type, parse out SHA1s</span></span>\n<span id=\"cb19-31\"><a href=\"https://tylercipriani.com/blog/#cb19-31\"></a><span class=\"kw\">var</span> handleObjects <span class=\"op\">=</span> <span class=\"kw\">function</span>(objData<span class=\"op\">,</span> name) {</span>\n<span id=\"cb19-32\"><a href=\"https://tylercipriani.com/blog/#cb19-32\"></a>    types<span class=\"op\">.</span><span class=\"fu\">forEach</span>(<span class=\"kw\">function</span>(type) {</span>\n<span id=\"cb19-33\"><a href=\"https://tylercipriani.com/blog/#cb19-33\"></a>        <span class=\"kw\">var</span> re<span class=\"op\">,</span> regex<span class=\"op\">,</span> match<span class=\"op\">,</span> key<span class=\"op\">;</span></span>\n<span id=\"cb19-34\"><a href=\"https://tylercipriani.com/blog/#cb19-34\"></a></span>\n<span id=\"cb19-35\"><a href=\"https://tylercipriani.com/blog/#cb19-35\"></a>        <span class=\"cf\">if</span> (<span class=\"op\">!</span>objData<span class=\"op\">.</span><span class=\"fu\">startsWith</span>(type)) { <span class=\"cf\">return</span><span class=\"op\">;</span> }</span>\n<span id=\"cb19-36\"><a href=\"https://tylercipriani.com/blog/#cb19-36\"></a></span>\n<span id=\"cb19-37\"><a href=\"https://tylercipriani.com/blog/#cb19-37\"></a>        key <span class=\"op\">=</span> name <span class=\"op\">+</span> <span class=\"st\">&#39;.&#39;</span> <span class=\"op\">+</span> type[<span class=\"dv\">0</span>]<span class=\"op\">;</span></span>\n<span id=\"cb19-38\"><a href=\"https://tylercipriani.com/blog/#cb19-38\"></a>        final[key] <span class=\"op\">=</span> []<span class=\"op\">;</span></span>\n<span id=\"cb19-39\"><a href=\"https://tylercipriani.com/blog/#cb19-39\"></a>        <span class=\"cf\">if</span> (type <span class=\"op\">===</span> <span class=\"st\">&#39;tree&#39;</span>) { objType <span class=\"op\">=</span> treeRegex<span class=\"op\">;</span> }</span>\n<span id=\"cb19-40\"><a href=\"https://tylercipriani.com/blog/#cb19-40\"></a>        <span class=\"cf\">if</span> (type <span class=\"op\">===</span> <span class=\"st\">&#39;commit&#39;</span>) { objType <span class=\"op\">=</span> commitRegex<span class=\"op\">;</span> }</span>\n<span id=\"cb19-41\"><a href=\"https://tylercipriani.com/blog/#cb19-41\"></a>        <span class=\"cf\">if</span> (type <span class=\"op\">===</span> <span class=\"st\">&#39;blob&#39;</span>) { <span class=\"cf\">return</span><span class=\"op\">;</span> }</span>\n<span id=\"cb19-42\"><a href=\"https://tylercipriani.com/blog/#cb19-42\"></a></span>\n<span id=\"cb19-43\"><a href=\"https://tylercipriani.com/blog/#cb19-43\"></a>        <span class=\"co\">// Remove the object-type and size from file</span></span>\n<span id=\"cb19-44\"><a href=\"https://tylercipriani.com/blog/#cb19-44\"></a>        objData <span class=\"op\">=</span> objData<span class=\"op\">.</span><span class=\"fu\">split</span>(<span class=\"st\">&#39;</span><span class=\"sc\">\\0</span><span class=\"st\">&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb19-45\"><a href=\"https://tylercipriani.com/blog/#cb19-45\"></a>        objData<span class=\"op\">.</span><span class=\"fu\">shift</span>()<span class=\"op\">;</span></span>\n<span id=\"cb19-46\"><a href=\"https://tylercipriani.com/blog/#cb19-46\"></a>        objData <span class=\"op\">=</span> objData<span class=\"op\">.</span><span class=\"fu\">join</span>(<span class=\"st\">&#39;</span><span class=\"sc\">\\0</span><span class=\"st\">&#39;</span>)<span class=\"op\">;</span></span>\n<span id=\"cb19-47\"><a href=\"https://tylercipriani.com/blog/#cb19-47\"></a></span>\n<span id=\"cb19-48\"><a href=\"https://tylercipriani.com/blog/#cb19-48\"></a>        <span class=\"co\">// Recursive regex match remainder</span></span>\n<span id=\"cb19-49\"><a href=\"https://tylercipriani.com/blog/#cb19-49\"></a>        <span class=\"cf\">while</span> ((match <span class=\"op\">=</span> objType<span class=\"op\">.</span><span class=\"at\">regex</span><span class=\"op\">.</span><span class=\"fu\">exec</span>(objData)) <span class=\"op\">!==</span> <span class=\"kw\">null</span>) {</span>\n<span id=\"cb19-50\"><a href=\"https://tylercipriani.com/blog/#cb19-50\"></a>            final[key]<span class=\"op\">.</span><span class=\"fu\">push</span>(objType<span class=\"op\">.</span><span class=\"fu\">fn</span>(match))<span class=\"op\">;</span></span>\n<span id=\"cb19-51\"><a href=\"https://tylercipriani.com/blog/#cb19-51\"></a>        }</span>\n<span id=\"cb19-52\"><a href=\"https://tylercipriani.com/blog/#cb19-52\"></a>    })<span class=\"op\">;</span></span>\n<span id=\"cb19-53\"><a href=\"https://tylercipriani.com/blog/#cb19-53\"></a></span>\n<span id=\"cb19-54\"><a href=\"https://tylercipriani.com/blog/#cb19-54\"></a>    <span class=\"co\">// Don&#39;t output until you&#39;ve got it all</span></span>\n<span id=\"cb19-55\"><a href=\"https://tylercipriani.com/blog/#cb19-55\"></a>    <span class=\"cf\">if</span> (<span class=\"bu\">Object</span><span class=\"op\">.</span><span class=\"fu\">keys</span>(final)<span class=\"op\">.</span><span class=\"at\">length</span> <span class=\"op\">!==</span> total) {</span>\n<span id=\"cb19-56\"><a href=\"https://tylercipriani.com/blog/#cb19-56\"></a>        <span class=\"cf\">return</span><span class=\"op\">;</span></span>\n<span id=\"cb19-57\"><a href=\"https://tylercipriani.com/blog/#cb19-57\"></a>    }</span>\n<span id=\"cb19-58\"><a href=\"https://tylercipriani.com/blog/#cb19-58\"></a></span>\n<span id=\"cb19-59\"><a href=\"https://tylercipriani.com/blog/#cb19-59\"></a>    <span class=\"co\">// Output what ya got.</span></span>\n<span id=\"cb19-60\"><a href=\"https://tylercipriani.com/blog/#cb19-60\"></a>    <span class=\"bu\">console</span><span class=\"op\">.</span><span class=\"fu\">log</span>(final)<span class=\"op\">;</span></span>\n<span id=\"cb19-61\"><a href=\"https://tylercipriani.com/blog/#cb19-61\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb19-62\"><a href=\"https://tylercipriani.com/blog/#cb19-62\"></a></span>\n<span id=\"cb19-63\"><a href=\"https://tylercipriani.com/blog/#cb19-63\"></a><span class=\"co\">// Readable object names not file names</span></span>\n<span id=\"cb19-64\"><a href=\"https://tylercipriani.com/blog/#cb19-64\"></a><span class=\"kw\">var</span> getName <span class=\"op\">=</span> <span class=\"kw\">function</span>(file) {</span>\n<span id=\"cb19-65\"><a href=\"https://tylercipriani.com/blog/#cb19-65\"></a>    <span class=\"kw\">var</span> fileParts <span class=\"op\">=</span> file<span class=\"op\">.</span><span class=\"fu\">split</span>(<span class=\"st\">&#39;/&#39;</span>)<span class=\"op\">,</span></span>\n<span id=\"cb19-66\"><a href=\"https://tylercipriani.com/blog/#cb19-66\"></a>        len <span class=\"op\">=</span> fileParts<span class=\"op\">.</span><span class=\"at\">length</span><span class=\"op\">;</span></span>\n<span id=\"cb19-67\"><a href=\"https://tylercipriani.com/blog/#cb19-67\"></a>    <span class=\"cf\">return</span> fileParts[len <span class=\"op\">-</span> <span class=\"dv\">2</span>] <span class=\"op\">+</span> fileParts[len <span class=\"op\">-</span> <span class=\"dv\">1</span>]<span class=\"op\">;</span></span>\n<span id=\"cb19-68\"><a href=\"https://tylercipriani.com/blog/#cb19-68\"></a>}</span>\n<span id=\"cb19-69\"><a href=\"https://tylercipriani.com/blog/#cb19-69\"></a></span>\n<span id=\"cb19-70\"><a href=\"https://tylercipriani.com/blog/#cb19-70\"></a><span class=\"co\">// Inflate the deflated git object file</span></span>\n<span id=\"cb19-71\"><a href=\"https://tylercipriani.com/blog/#cb19-71\"></a><span class=\"kw\">var</span> handleFile <span class=\"op\">=</span> <span class=\"kw\">function</span>(file<span class=\"op\">,</span> out) {</span>\n<span id=\"cb19-72\"><a href=\"https://tylercipriani.com/blog/#cb19-72\"></a>    <span class=\"kw\">var</span> name <span class=\"op\">=</span> <span class=\"fu\">getName</span>(file)<span class=\"op\">;</span></span>\n<span id=\"cb19-73\"><a href=\"https://tylercipriani.com/blog/#cb19-73\"></a></span>\n<span id=\"cb19-74\"><a href=\"https://tylercipriani.com/blog/#cb19-74\"></a>    fs<span class=\"op\">.</span><span class=\"fu\">readFile</span>(file<span class=\"op\">,</span> <span class=\"kw\">function</span>(e<span class=\"op\">,</span> data) {</span>\n<span id=\"cb19-75\"><a href=\"https://tylercipriani.com/blog/#cb19-75\"></a>        zlib<span class=\"op\">.</span><span class=\"fu\">inflate</span>(data<span class=\"op\">,</span> <span class=\"kw\">function</span>(e<span class=\"op\">,</span> data) {</span>\n<span id=\"cb19-76\"><a href=\"https://tylercipriani.com/blog/#cb19-76\"></a>            <span class=\"cf\">if</span> (e) { <span class=\"bu\">console</span><span class=\"op\">.</span><span class=\"fu\">log</span>(file<span class=\"op\">,</span> e)<span class=\"op\">;</span> <span class=\"cf\">return</span><span class=\"op\">;</span> }</span>\n<span id=\"cb19-77\"><a href=\"https://tylercipriani.com/blog/#cb19-77\"></a>            <span class=\"fu\">handleObjects</span>(data<span class=\"op\">.</span><span class=\"fu\">toString</span>(<span class=\"st\">&#39;binary&#39;</span>)<span class=\"op\">,</span> name)<span class=\"op\">;</span></span>\n<span id=\"cb19-78\"><a href=\"https://tylercipriani.com/blog/#cb19-78\"></a>        })<span class=\"op\">;</span></span>\n<span id=\"cb19-79\"><a href=\"https://tylercipriani.com/blog/#cb19-79\"></a>    })<span class=\"op\">;</span></span>\n<span id=\"cb19-80\"><a href=\"https://tylercipriani.com/blog/#cb19-80\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb19-81\"><a href=\"https://tylercipriani.com/blog/#cb19-81\"></a></span>\n<span id=\"cb19-82\"><a href=\"https://tylercipriani.com/blog/#cb19-82\"></a><span class=\"co\">// Sort through the gitobjects directory</span></span>\n<span id=\"cb19-83\"><a href=\"https://tylercipriani.com/blog/#cb19-83\"></a><span class=\"kw\">var</span> handleFiles <span class=\"op\">=</span> <span class=\"kw\">function</span>(files) {</span>\n<span id=\"cb19-84\"><a href=\"https://tylercipriani.com/blog/#cb19-84\"></a>    files<span class=\"op\">.</span><span class=\"fu\">forEach</span>(<span class=\"kw\">function</span>(file) {</span>\n<span id=\"cb19-85\"><a href=\"https://tylercipriani.com/blog/#cb19-85\"></a>        fs<span class=\"op\">.</span><span class=\"fu\">stat</span>(file<span class=\"op\">,</span> <span class=\"kw\">function</span>(e<span class=\"op\">,</span> f) {</span>\n<span id=\"cb19-86\"><a href=\"https://tylercipriani.com/blog/#cb19-86\"></a>            <span class=\"cf\">if</span> (e) { <span class=\"cf\">return</span><span class=\"op\">;</span> }</span>\n<span id=\"cb19-87\"><a href=\"https://tylercipriani.com/blog/#cb19-87\"></a>            <span class=\"cf\">if</span> (f<span class=\"op\">.</span><span class=\"fu\">isFile</span>()) {</span>\n<span id=\"cb19-88\"><a href=\"https://tylercipriani.com/blog/#cb19-88\"></a>                <span class=\"co\">// Don&#39;t worry about pack files for now</span></span>\n<span id=\"cb19-89\"><a href=\"https://tylercipriani.com/blog/#cb19-89\"></a>                <span class=\"cf\">if</span> (file<span class=\"op\">.</span><span class=\"fu\">indexOf</span>(<span class=\"st\">&#39;pack&#39;</span>) <span class=\"op\">&gt;</span> <span class=\"op\">-</span><span class=\"dv\">1</span>) { <span class=\"cf\">return</span><span class=\"op\">;</span> }</span>\n<span id=\"cb19-90\"><a href=\"https://tylercipriani.com/blog/#cb19-90\"></a>                total<span class=\"op\">++;</span></span>\n<span id=\"cb19-91\"><a href=\"https://tylercipriani.com/blog/#cb19-91\"></a>                <span class=\"fu\">handleFile</span>(file)<span class=\"op\">;</span></span>\n<span id=\"cb19-92\"><a href=\"https://tylercipriani.com/blog/#cb19-92\"></a>            }</span>\n<span id=\"cb19-93\"><a href=\"https://tylercipriani.com/blog/#cb19-93\"></a>        })<span class=\"op\">;</span></span>\n<span id=\"cb19-94\"><a href=\"https://tylercipriani.com/blog/#cb19-94\"></a></span>\n<span id=\"cb19-95\"><a href=\"https://tylercipriani.com/blog/#cb19-95\"></a>    })<span class=\"op\">;</span></span>\n<span id=\"cb19-96\"><a href=\"https://tylercipriani.com/blog/#cb19-96\"></a>}<span class=\"op\">;</span></span>\n<span id=\"cb19-97\"><a href=\"https://tylercipriani.com/blog/#cb19-97\"></a></span>\n<span id=\"cb19-98\"><a href=\"https://tylercipriani.com/blog/#cb19-98\"></a>(<span class=\"kw\">function</span>() {</span>\n<span id=\"cb19-99\"><a href=\"https://tylercipriani.com/blog/#cb19-99\"></a>    <span class=\"fu\">glob</span>(<span class=\"st\">&#39;.git/objects/**/*&#39;</span><span class=\"op\">,</span> <span class=\"kw\">function</span>(e<span class=\"op\">,</span> f) {</span>\n<span id=\"cb19-100\"><a href=\"https://tylercipriani.com/blog/#cb19-100\"></a>        <span class=\"cf\">if</span> (e) { <span class=\"cf\">throw</span> e<span class=\"op\">;</span> }</span>\n<span id=\"cb19-101\"><a href=\"https://tylercipriani.com/blog/#cb19-101\"></a>        <span class=\"fu\">handleFiles</span>(f)<span class=\"op\">;</span></span>\n<span id=\"cb19-102\"><a href=\"https://tylercipriani.com/blog/#cb19-102\"></a>    })<span class=\"op\">;</span></span>\n<span id=\"cb19-103\"><a href=\"https://tylercipriani.com/blog/#cb19-103\"></a>})()<span class=\"op\">;</span></span></code></pre></div>\n<p>Merkle graph transformations are often difficult to describe, but\neasy to see. Using this last piece of code to create and view graphs for\nseveral repositories has been illuminating. The graph visualization both\nilluminates and challenges my understanding of Git in ways I didn’t\nanticipate.</p>\n<section id=\"the-tale-of-commit-message-bike-shedding\" class=\"level3\">\n<h3>The Tale of Commit Message Bike-shedding</h3>\n<p>When you change your commit message, what happens to the graph? What\ndepends on a commit? Where is the context for a commit?</p>\n<div class=\"sourceCode\" id=\"cb20\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb20-1\"><a href=\"https://tylercipriani.com/blog/#cb20-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git commit <span class=\"at\">--amend</span> <span class=\"at\">-m</span> <span class=\"st\">&#39;This is the commit message now&#39;</span></span>\n<span id=\"cb20-2\"><a href=\"https://tylercipriani.com/blog/#cb20-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">[master</span> 585448a] This is the commit message now</span>\n<span id=\"cb20-3\"><a href=\"https://tylercipriani.com/blog/#cb20-3\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">Date:</span> Mon Mar 21 16:48:40 2016 <span class=\"at\">-0700</span></span>\n<span id=\"cb20-4\"><a href=\"https://tylercipriani.com/blog/#cb20-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">1</span> file changed, 1 insertion<span class=\"er\">(</span><span class=\"ex\">+</span><span class=\"kw\">)</span></span>\n<span id=\"cb20-5\"><a href=\"https://tylercipriani.com/blog/#cb20-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"ex\">create</span> mode 100644 README</span>\n<span id=\"cb20-6\"><a href=\"https://tylercipriani.com/blog/#cb20-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> find .git/objects <span class=\"at\">-type</span> f</span>\n<span id=\"cb20-7\"><a href=\"https://tylercipriani.com/blog/#cb20-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1b/9f426a8407ffee551ad2993c5d7d3780296353</span></span>\n<span id=\"cb20-8\"><a href=\"https://tylercipriani.com/blog/#cb20-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/09/8e6de29daf4e55f83406b49f5768df9bc7d624</span></span>\n<span id=\"cb20-9\"><a href=\"https://tylercipriani.com/blog/#cb20-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span>\n<span id=\"cb20-10\"><a href=\"https://tylercipriani.com/blog/#cb20-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/da/94af3a21ac7e0c875bbbe6162aa1d26d699c73</span></span></code></pre></div>\n<p>Now the DAG is a bit different:</p>\n<div class=\"sourceCode\" id=\"cb21\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb21-1\"><a href=\"https://tylercipriani.com/blog/#cb21-1\"></a><span class=\"kw\">var</span> gitDag <span class=\"op\">=</span> { <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span><span class=\"op\">:</span> [ <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span> ]<span class=\"op\">,</span></span>\n<span id=\"cb21-2\"><a href=\"https://tylercipriani.com/blog/#cb21-2\"></a>  <span class=\"st\">&#39;1a06ce381ac14f7a5baa1670691c2ff8a73aa6da.c&#39;</span><span class=\"op\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ]<span class=\"op\">,</span></span>\n<span id=\"cb21-3\"><a href=\"https://tylercipriani.com/blog/#cb21-3\"></a>  <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span><span class=\"op\">:</span> []<span class=\"op\">,</span></span>\n<span id=\"cb21-4\"><a href=\"https://tylercipriani.com/blog/#cb21-4\"></a>  <span class=\"st\">&#39;da94af3a21ac7e0c875bbbe6162aa1d26d699c73.c&#39;</span><span class=\"op\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ] }</span>\n<span id=\"cb21-5\"><a href=\"https://tylercipriani.com/blog/#cb21-5\"></a></span>\n<span id=\"cb21-6\"><a href=\"https://tylercipriani.com/blog/#cb21-6\"></a><span class=\"fu\">makeGraph</span>(<span class=\"st\">&#39;.merkle-3&#39;</span><span class=\"op\">,</span> <span class=\"fu\">forceFormat</span>(gitDag))<span class=\"op\">;</span></span></code></pre></div>\n<div class=\"merkle-3\">\n\n</div>\n<p>Here we see that there are now two <code>commit</code> objects\n(<code>1a06ce38</code> and <code>da94af3a</code>) that both depend on a\nsingle <code>tree</code> object (<code>098e6de2</code>) that depends on\na single <code>blob</code> (<code>1b9f426a</code>).</p>\n<p>One of these commit objects will never be seen with\n<code>git log</code>.</p>\n</section>\n<section id=\"the-orphan-blob-that-dared-to-dream\" class=\"level3\">\n<h3>The Orphan Blob That Dared to Dream</h3>\n<p>TIL: Git creates <code>blob</code> objects as soon as a file is added\nto the staging area.</p>\n<div class=\"sourceCode\" id=\"cb22\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb22-1\"><a href=\"https://tylercipriani.com/blog/#cb22-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;staged&#39;</span> <span class=\"op\">&gt;</span> staged</span>\n<span id=\"cb22-2\"><a href=\"https://tylercipriani.com/blog/#cb22-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> find .git/objects <span class=\"at\">-type</span> f</span>\n<span id=\"cb22-3\"><a href=\"https://tylercipriani.com/blog/#cb22-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1b/9f426a8407ffee551ad2993c5d7d3780296353</span></span>\n<span id=\"cb22-4\"><a href=\"https://tylercipriani.com/blog/#cb22-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/09/8e6de29daf4e55f83406b49f5768df9bc7d624</span></span>\n<span id=\"cb22-5\"><a href=\"https://tylercipriani.com/blog/#cb22-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span>\n<span id=\"cb22-6\"><a href=\"https://tylercipriani.com/blog/#cb22-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/da/94af3a21ac7e0c875bbbe6162aa1d26d699c73</span></span></code></pre></div>\n<p>Notice that nothing depends on this object just yet. It’s a lonely\norphan <code>blob</code>.</p>\n<div class=\"sourceCode\" id=\"cb23\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb23-1\"><a href=\"https://tylercipriani.com/blog/#cb23-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git add staged</span>\n<span id=\"cb23-2\"><a href=\"https://tylercipriani.com/blog/#cb23-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> find .git/objects <span class=\"at\">-type</span> f</span>\n<span id=\"cb23-3\"><a href=\"https://tylercipriani.com/blog/#cb23-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1b/9f426a8407ffee551ad2993c5d7d3780296353</span></span>\n<span id=\"cb23-4\"><a href=\"https://tylercipriani.com/blog/#cb23-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/09/8e6de29daf4e55f83406b49f5768df9bc7d624</span></span>\n<span id=\"cb23-5\"><a href=\"https://tylercipriani.com/blog/#cb23-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/1a/06ce381ac14f7a5baa1670691c2ff8a73aa6da</span></span>\n<span id=\"cb23-6\"><a href=\"https://tylercipriani.com/blog/#cb23-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/da/94af3a21ac7e0c875bbbe6162aa1d26d699c73</span></span>\n<span id=\"cb23-7\"><a href=\"https://tylercipriani.com/blog/#cb23-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">.git/objects/19/d9cc8584ac2c7dcf57d2680375e80f099dc481</span></span>\n<span id=\"cb23-8\"><a href=\"https://tylercipriani.com/blog/#cb23-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> makeDag</span>\n<span id=\"cb23-9\"><a href=\"https://tylercipriani.com/blog/#cb23-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">{</span> <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span> ],</span>\n<span id=\"cb23-10\"><a href=\"https://tylercipriani.com/blog/#cb23-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;19d9cc8584ac2c7dcf57d2680375e80f099dc481.b&#39;</span><span class=\"ex\">:</span> [],</span>\n<span id=\"cb23-11\"><a href=\"https://tylercipriani.com/blog/#cb23-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;1a06ce381ac14f7a5baa1670691c2ff8a73aa6da.c&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ],</span>\n<span id=\"cb23-12\"><a href=\"https://tylercipriani.com/blog/#cb23-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;da94af3a21ac7e0c875bbbe6162aa1d26d699c73.c&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ],</span>\n<span id=\"cb23-13\"><a href=\"https://tylercipriani.com/blog/#cb23-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span><span class=\"ex\">:</span> [] }</span></code></pre></div>\n<div class=\"merkle-4\">\n\n</div>\n<p>Even unstaging and deleting the file doesn’t remove the object.\nOrphan objects in git are only garbage collected as part of\n<code>git gc --prune</code>.</p>\n<p>When this object is committed to the repo, it creates a whole new\nlayer of the graph:</p>\n<div class=\"sourceCode\" id=\"cb24\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb24-1\"><a href=\"https://tylercipriani.com/blog/#cb24-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git commit <span class=\"at\">-m</span> <span class=\"st\">&#39;Add staged file&#39;</span></span>\n<span id=\"cb24-2\"><a href=\"https://tylercipriani.com/blog/#cb24-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">[master</span> 4f407b3] Add staged file</span>\n<span id=\"cb24-3\"><a href=\"https://tylercipriani.com/blog/#cb24-3\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">1</span> file changed, 1 insertion<span class=\"er\">(</span><span class=\"ex\">+</span><span class=\"kw\">)</span></span>\n<span id=\"cb24-4\"><a href=\"https://tylercipriani.com/blog/#cb24-4\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"ex\">create</span> mode 100644 staged</span>\n<span id=\"cb24-5\"><a href=\"https://tylercipriani.com/blog/#cb24-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> makeDag</span>\n<span id=\"cb24-6\"><a href=\"https://tylercipriani.com/blog/#cb24-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">{</span> <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span> ],</span>\n<span id=\"cb24-7\"><a href=\"https://tylercipriani.com/blog/#cb24-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;19d9cc8584ac2c7dcf57d2680375e80f099dc481.b&#39;</span><span class=\"ex\">:</span> [],</span>\n<span id=\"cb24-8\"><a href=\"https://tylercipriani.com/blog/#cb24-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;1a06ce381ac14f7a5baa1670691c2ff8a73aa6da.c&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ],</span>\n<span id=\"cb24-9\"><a href=\"https://tylercipriani.com/blog/#cb24-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span><span class=\"ex\">:</span> [],</span>\n<span id=\"cb24-10\"><a href=\"https://tylercipriani.com/blog/#cb24-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;4f407b396e6ecbb65de6cf192259c18ecd4d1e9b.c&#39;</span><span class=\"ex\">:</span> </span>\n<span id=\"cb24-11\"><a href=\"https://tylercipriani.com/blog/#cb24-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"bu\">[</span> <span class=\"st\">&#39;7ce38101e91de29ee0fee3aa9940cc81159e0f8d.t&#39;</span>,</span>\n<span id=\"cb24-12\"><a href=\"https://tylercipriani.com/blog/#cb24-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"st\">&#39;da94af3a21ac7e0c875bbbe6162aa1d26d699c73.c&#39;</span> ],</span>\n<span id=\"cb24-13\"><a href=\"https://tylercipriani.com/blog/#cb24-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"er\">&#39;7ce38101e91de29ee0fee3aa9940cc81159e0f8d.t&#39;:</span> </span>\n<span id=\"cb24-14\"><a href=\"https://tylercipriani.com/blog/#cb24-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>   <span class=\"er\">[</span> <span class=\"st\">&#39;1b9f426a8407ffee551ad2993c5d7d3780296353.b&#39;</span><span class=\"ex\">,</span></span>\n<span id=\"cb24-15\"><a href=\"https://tylercipriani.com/blog/#cb24-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"st\">&#39;19d9cc8584ac2c7dcf57d2680375e80f099dc481.b&#39;</span> ],</span>\n<span id=\"cb24-16\"><a href=\"https://tylercipriani.com/blog/#cb24-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"st\">&#39;da94af3a21ac7e0c875bbbe6162aa1d26d699c73.c&#39;</span><span class=\"ex\">:</span> [ <span class=\"st\">&#39;098e6de29daf4e55f83406b49f5768df9bc7d624.t&#39;</span> ] }</span></code></pre></div>\n<div class=\"merkle-5\">\n\n</div>\n<p>So we’ve created a new commit (<code>4f407b39</code>) that is the\nparent of a different commit (<code>da94af3a</code>) and a new tree\n(<code>7ce38101</code>) that contains our old <code>README</code> blob\n(<code>1b9f426a</code>) and our new, previously orphaned, blob\n(<code>19d9cc85</code>).</p>\n</section>\n<section id=\"the-tale-of-powerful-software\" class=\"level3\">\n<h3>The Tale of Powerful Software</h3>\n<p>I’ve always enjoyed the idea that software (and computer science more\ngenerally) is nothing but an abstraction to manage complexity. Good\nsoftware— powerful software—like Git—is a software that manages an\nincredible amount of complexity and hides it completely from the\nuser.</p>\n<p>In recognition of this idea, I’ll leave you with the graph of my\nlocal copy of <a\nhref=\"https://github.com/thcipriani/clippy\">clippy</a>—a small command\nline tool I created that is like <code>man(1)</code> except it shows <a\nhref=\"https://en.wikipedia.org/wiki/Office_Assistant\">Clippy</a> at the\nend of the <code>man</code> output (yes, it’s dumb).</p>\n<p>This should give you an idea of the complexity that is abstracted by\nthe Git merkle graph: this repo contains 5 commits!</p>\n<div class=\"merkle-container\">\n<div class=\"merkle-6\">\n\n</div>\n</div>\n</section>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/",

    "title": "Command-Timing-Bash-Prompt",
    "url": "https://tylercipriani.com/blog/2016/01/19/Command-Timing-Bash-Prompt/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "shell"

    ],

    "date_published": "2016-01-19T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>A few years ago I was using ZSH with Sindre Sorhus’s <a\nhref=\"https://github.com/sindresorhus/pure\">Pure prompt</a> and\ngenerally enjoying the experience. The big, dumb, obvious caveat of\nusing ZSH is that it’s not Bash. As a result, when you SSH into\nproduction machines that only have bash installed, you feel a little\noff-balance. <em>Off-balance</em> is not a feeling you want during an\nemergency on a live application server. As a result, I switched back to\nusing bash everywhere.</p>\n<section id=\"how-i-learned-to-stop-worrying-and-love-bash.\"\nclass=\"level2\">\n<h2>How I learned to stop worrying and love bash.</h2>\n<p>I never really missed fancy syntax highlighting, or the nice globbing\nfeatures, or most of ZSH really. The one thing I missed immensely was\nnot so much a feature of ZSH as it was a feature of the Pure prompt I\nhad been using: execution time for long-running commands shown in the\nprompt.</p>\n<p>The <code>time(1)</code> command is a command that I never think to\nrun until it’s too late. <a\nhref=\"https://github.com/sindresorhus/pure/blob/master/pure.zsh#L46-L53\">The\nPure prompt is fancy</a>. By default, if a particular command takes\nlonger than 5 seconds to run, Pure calculates the running time of that\ncommand, and renders a human-readable version just above your current\nprompt.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> sleep 5</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span> 5s</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> sleep 10</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span> 10s</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span></span></code></pre></div>\n</section>\n<section id=\"bash-it-until-it-works\" class=\"level2\">\n<h2>Bash it until it works</h2>\n<p>Command execution time in Pure uses the <code>preexec</code> and\n<code>precmd</code> feature of ZSH, which doesn’t exist in Bash. Instead\nBash has the less intuitive <code>trap</code> command and the\n<code>PROMPT_COMMAND</code> shell variable.</p>\n<p><code>PROMPT_COMMAND</code> is a variable that can be set in your\nbash config file that, “is executed as a command prior to issuing each\nprimary prompt.” [bash(1)]</p>\n<p><code>trap [-lp] [arg] [sigspec]</code> can be used to listen for the\n<code>DEBUG</code> signal. “If a sigspec is DEBUG, the command arg is\nexecuted before every simple command”</p>\n<p>Using these two tools in conjunction, you can approximate\n<code>preexec</code> and <code>precmd</code>:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"fu\">debug()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a>    <span class=\"co\"># do nothing if completing</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a>    <span class=\"bu\">[</span> <span class=\"ot\">-n</span> <span class=\"st\">&quot;</span><span class=\"va\">$COMP_LINE</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a>    <span class=\"co\"># don&#39;t cause a preexec for $PROMPT_COMMAND</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a>    <span class=\"bu\">[</span> <span class=\"st\">&quot;</span><span class=\"va\">$BASH_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"ot\">=</span> <span class=\"st\">&quot;</span><span class=\"va\">$PROMPT_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&#39;debug&#39;</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\"></a></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\"></a><span class=\"fu\">prompt()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&#39;prompt&#39;</span></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\"></a></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\"></a><span class=\"bu\">trap</span> <span class=\"st\">&#39;debug&#39;</span> DEBUG</span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\"></a><span class=\"va\">PROMPT_COMMAND</span><span class=\"op\">=</span>prompt</span></code></pre></div>\n<p>So now debug is executed before each “simple command” and\n<code>prompt</code> is executed before each issuing the primary\nprompt.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> echo <span class=\"st\">&#39;hi&#39;</span></span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">debug</span></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">hi</span></span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">prompt</span></span></code></pre></div>\n<p>Timing each command is then pretty trivial:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a><span class=\"fu\">debug()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\"></a>    <span class=\"co\"># do nothing if completing</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\"></a>    <span class=\"bu\">[</span> <span class=\"ot\">-n</span> <span class=\"st\">&quot;</span><span class=\"va\">$COMP_LINE</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\"></a></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\"></a>    <span class=\"co\"># don&#39;t cause a preexec for $PROMPT_COMMAND</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\"></a>    <span class=\"bu\">[</span> <span class=\"st\">&quot;</span><span class=\"va\">$BASH_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"ot\">=</span> <span class=\"st\">&quot;</span><span class=\"va\">$PROMPT_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\"></a></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\"></a>    <span class=\"va\">start_time</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> +<span class=\"st\">&#39;%s&#39;</span><span class=\"va\">)</span></span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\"></a></span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\"></a><span class=\"fu\">prompt()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\"></a>    <span class=\"va\">end_time</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> +<span class=\"st\">&#39;%s&#39;</span><span class=\"va\">)</span></span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\"></a></span>\n<span id=\"cb4-14\"><a href=\"https://tylercipriani.com/blog/#cb4-14\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&quot;</span><span class=\"va\">$((</span> <span class=\"va\">end_time</span> <span class=\"op\">-</span> <span class=\"va\">start_time</span> <span class=\"va\">))</span><span class=\"st\"> seconds&quot;</span></span>\n<span id=\"cb4-15\"><a href=\"https://tylercipriani.com/blog/#cb4-15\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb4-16\"><a href=\"https://tylercipriani.com/blog/#cb4-16\"></a></span>\n<span id=\"cb4-17\"><a href=\"https://tylercipriani.com/blog/#cb4-17\"></a><span class=\"bu\">trap</span> <span class=\"st\">&#39;debug&#39;</span> DEBUG</span>\n<span id=\"cb4-18\"><a href=\"https://tylercipriani.com/blog/#cb4-18\"></a><span class=\"va\">PROMPT_COMMAND</span><span class=\"op\">=</span>prompt</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sleep 2</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">2</span> seconds</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span></span></code></pre></div>\n<p>Integrating that into the prompt and making it look pretty is just a\nlittle-bit of code away:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\"></a><span class=\"co\"># Human readable time output</span></span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\"></a><span class=\"co\"># e.g., 5d 6h 3m 2s</span></span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\"></a><span class=\"fu\">format_time()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\"></a>  <span class=\"bu\">local</span> <span class=\"va\">_time</span><span class=\"op\">=</span><span class=\"va\">$1</span></span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\"></a></span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\"></a>  <span class=\"co\"># Don&#39;t show anything if time is less than 5 seconds</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\"></a>  <span class=\"kw\">((</span> <span class=\"va\">$_time</span> <span class=\"op\">&lt;</span> <span class=\"dv\">5</span> <span class=\"kw\">))</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb6-8\"><a href=\"https://tylercipriani.com/blog/#cb6-8\"></a></span>\n<span id=\"cb6-9\"><a href=\"https://tylercipriani.com/blog/#cb6-9\"></a>  <span class=\"bu\">local</span> <span class=\"va\">_out</span></span>\n<span id=\"cb6-10\"><a href=\"https://tylercipriani.com/blog/#cb6-10\"></a>  <span class=\"bu\">local</span> <span class=\"va\">days</span><span class=\"op\">=</span><span class=\"va\">$((</span> <span class=\"va\">$_time</span> <span class=\"op\">/</span> <span class=\"dv\">60</span> <span class=\"op\">/</span> <span class=\"dv\">60</span> <span class=\"op\">/</span> <span class=\"dv\">24</span> <span class=\"va\">))</span></span>\n<span id=\"cb6-11\"><a href=\"https://tylercipriani.com/blog/#cb6-11\"></a>  <span class=\"bu\">local</span> <span class=\"va\">hours</span><span class=\"op\">=</span><span class=\"va\">$((</span> <span class=\"va\">$_time</span> <span class=\"op\">/</span> <span class=\"dv\">60</span> <span class=\"op\">/</span> <span class=\"dv\">60</span> <span class=\"op\">%</span> <span class=\"dv\">24</span> <span class=\"va\">))</span></span>\n<span id=\"cb6-12\"><a href=\"https://tylercipriani.com/blog/#cb6-12\"></a>  <span class=\"bu\">local</span> <span class=\"va\">minutes</span><span class=\"op\">=</span><span class=\"va\">$((</span> <span class=\"va\">$_time</span> <span class=\"op\">/</span> <span class=\"dv\">60</span> <span class=\"op\">%</span> <span class=\"dv\">60</span> <span class=\"va\">))</span></span>\n<span id=\"cb6-13\"><a href=\"https://tylercipriani.com/blog/#cb6-13\"></a>  <span class=\"bu\">local</span> <span class=\"va\">seconds</span><span class=\"op\">=</span><span class=\"va\">$((</span> <span class=\"va\">$_time</span> <span class=\"op\">%</span> <span class=\"dv\">60</span> <span class=\"va\">))</span></span>\n<span id=\"cb6-14\"><a href=\"https://tylercipriani.com/blog/#cb6-14\"></a>  <span class=\"kw\">((</span> <span class=\"va\">$days</span> <span class=\"op\">&gt;</span> <span class=\"dv\">0</span> <span class=\"kw\">))</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"va\">_out</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">${days}</span><span class=\"st\">d&quot;</span></span>\n<span id=\"cb6-15\"><a href=\"https://tylercipriani.com/blog/#cb6-15\"></a>  <span class=\"kw\">((</span> <span class=\"va\">$hours</span> <span class=\"op\">&gt;</span> <span class=\"dv\">0</span> <span class=\"kw\">))</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"va\">_out</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$_out</span><span class=\"st\"> </span><span class=\"va\">${hours}</span><span class=\"st\">h&quot;</span></span>\n<span id=\"cb6-16\"><a href=\"https://tylercipriani.com/blog/#cb6-16\"></a>  <span class=\"kw\">((</span> <span class=\"va\">$minutes</span> <span class=\"op\">&gt;</span> <span class=\"dv\">0</span> <span class=\"kw\">))</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"va\">_out</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$_out</span><span class=\"st\"> </span><span class=\"va\">${minutes}</span><span class=\"st\">m&quot;</span></span>\n<span id=\"cb6-17\"><a href=\"https://tylercipriani.com/blog/#cb6-17\"></a>  <span class=\"va\">_out</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$_out</span><span class=\"st\"> </span><span class=\"va\">${seconds}</span><span class=\"st\">s&quot;</span></span>\n<span id=\"cb6-18\"><a href=\"https://tylercipriani.com/blog/#cb6-18\"></a>  <span class=\"bu\">printf</span> <span class=\"st\">&quot;</span><span class=\"va\">$_out</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb6-19\"><a href=\"https://tylercipriani.com/blog/#cb6-19\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb6-20\"><a href=\"https://tylercipriani.com/blog/#cb6-20\"></a></span>\n<span id=\"cb6-21\"><a href=\"https://tylercipriani.com/blog/#cb6-21\"></a><span class=\"fu\">debug()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb6-22\"><a href=\"https://tylercipriani.com/blog/#cb6-22\"></a>    <span class=\"co\"># do nothing if completing</span></span>\n<span id=\"cb6-23\"><a href=\"https://tylercipriani.com/blog/#cb6-23\"></a>    <span class=\"bu\">[</span> <span class=\"ot\">-n</span> <span class=\"st\">&quot;</span><span class=\"va\">$COMP_LINE</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb6-24\"><a href=\"https://tylercipriani.com/blog/#cb6-24\"></a></span>\n<span id=\"cb6-25\"><a href=\"https://tylercipriani.com/blog/#cb6-25\"></a>    <span class=\"co\"># don&#39;t cause a preexec for $PROMPT_COMMAND</span></span>\n<span id=\"cb6-26\"><a href=\"https://tylercipriani.com/blog/#cb6-26\"></a>    <span class=\"bu\">[</span> <span class=\"st\">&quot;</span><span class=\"va\">$BASH_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"ot\">=</span> <span class=\"st\">&quot;</span><span class=\"va\">$PROMPT_COMMAND</span><span class=\"st\">&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"cf\">return</span></span>\n<span id=\"cb6-27\"><a href=\"https://tylercipriani.com/blog/#cb6-27\"></a></span>\n<span id=\"cb6-28\"><a href=\"https://tylercipriani.com/blog/#cb6-28\"></a>    <span class=\"va\">start_time</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> +<span class=\"st\">&#39;%s&#39;</span><span class=\"va\">)</span></span>\n<span id=\"cb6-29\"><a href=\"https://tylercipriani.com/blog/#cb6-29\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb6-30\"><a href=\"https://tylercipriani.com/blog/#cb6-30\"></a></span>\n<span id=\"cb6-31\"><a href=\"https://tylercipriani.com/blog/#cb6-31\"></a><span class=\"fu\">prompt()</span> <span class=\"kw\">{</span></span>\n<span id=\"cb6-32\"><a href=\"https://tylercipriani.com/blog/#cb6-32\"></a>    <span class=\"va\">end_time</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"fu\">date</span> +<span class=\"st\">&#39;%s&#39;</span><span class=\"va\">)</span></span>\n<span id=\"cb6-33\"><a href=\"https://tylercipriani.com/blog/#cb6-33\"></a>    <span class=\"va\">time_f</span><span class=\"op\">=</span><span class=\"va\">$(</span><span class=\"ex\">format_time</span> <span class=\"va\">$((</span> <span class=\"va\">end_time</span> <span class=\"op\">-</span> <span class=\"va\">start_time</span> <span class=\"va\">)))</span></span>\n<span id=\"cb6-34\"><a href=\"https://tylercipriani.com/blog/#cb6-34\"></a></span>\n<span id=\"cb6-35\"><a href=\"https://tylercipriani.com/blog/#cb6-35\"></a>    <span class=\"va\">PS1</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">${time_f}</span><span class=\"st\"> (•◡•)❥&quot;</span></span>\n<span id=\"cb6-36\"><a href=\"https://tylercipriani.com/blog/#cb6-36\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb6-37\"><a href=\"https://tylercipriani.com/blog/#cb6-37\"></a></span>\n<span id=\"cb6-38\"><a href=\"https://tylercipriani.com/blog/#cb6-38\"></a><span class=\"bu\">trap</span> <span class=\"st\">&#39;debug&#39;</span> DEBUG</span>\n<span id=\"cb6-39\"><a href=\"https://tylercipriani.com/blog/#cb6-39\"></a><span class=\"va\">PROMPT_COMMAND</span><span class=\"op\">=</span>prompt</span></code></pre></div>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"kw\">(</span><span class=\"ex\">•◡•</span><span class=\"kw\">)</span><span class=\"ex\">❥</span> sleep 5</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">5s</span> <span class=\"er\">(</span><span class=\"ex\">•◡•</span><span class=\"kw\">)</span><span class=\"ex\">❥</span></span></code></pre></div>\n<p>Motherfucking magic.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/12/02/gpg/",

    "title": "GPG Things",
    "url": "https://tylercipriani.com/blog/2015/12/02/gpg/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "crypto",

     "notes",

     "pgp"

    ],

    "date_published": "2015-12-03T00:27:40Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"get-your-fingerprint\" class=\"level1\">\n<h1>Get your fingerprint:</h1>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--list-secret-keys</span> <span class=\"at\">--fingerprint</span></span></code></pre></div>\n</section>\n<section id=\"get-someone-elses-key\" class=\"level1\">\n<h1>Get someone elses key</h1>\n<section id=\"using-email\" class=\"level2\">\n<h2>Using email</h2>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--search-keys</span> EMAIL</span></code></pre></div>\n</section>\n<section id=\"using-keyid\" class=\"level2\">\n<h2>Using keyid</h2>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--recv-key</span> KEYID</span></code></pre></div>\n</section>\n</section>\n<section id=\"sign-keys\" class=\"level1\">\n<h1>Sign keys</h1>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--recv-key</span> KEYID</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--sign-key</span> KEYID</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--send-key</span> KEYID</span></code></pre></div>\n</section>\n<section id=\"photos\" class=\"level1\">\n<h1>Photos</h1>\n<section id=\"view-someones-photo\" class=\"level2\">\n<h2>View someone\'s photo</h2>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--edit-key</span> KEYID showphoto</span></code></pre></div>\n</section>\n<section id=\"add-a-photo\" class=\"level2\">\n<h2>Add a photo</h2>\n<p>Suggested image sizes are 240x288 pixels (GnuPG) or 120x144 pixels\n(PGP) to make a JPEG of 4K-6K in size. A 1.2 h:w ratio\n<code>w = h / (144 / 120)</code></p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg</span> <span class=\"at\">--edit-key</span> KEYID addphoto</span></code></pre></div>\n</section>\n</section>\n<section id=\"keysigning-party-etherpad\" class=\"level1\">\n<h1>Keysigning party etherpad</h1>\n<section id=\"to-sign-keys\" class=\"level2\">\n<h2>To Sign keys</h2>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--recv-key</span> KEYID</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--sign-key</span> KEYID</span>\n<span id=\"cb7-3\"><a href=\"https://tylercipriani.com/blog/#cb7-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg2</span> <span class=\"at\">--send-key</span> KEYID</span></code></pre></div>\n</section>\n<section id=\"script-to-quickly-sign-all-keys\" class=\"level2\">\n<h2>Script to quickly sign all keys</h2>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a> <span class=\"cf\">for</span> k <span class=\"kw\">in</span> <span class=\"va\">$(</span><span class=\"fu\">grep</span> pub ksp-wmf-20160108.txt <span class=\"kw\">|</span> <span class=\"fu\">awk</span> <span class=\"st\">&#39;{print $2}&#39;</span> <span class=\"kw\">|</span> <span class=\"fu\">awk</span> <span class=\"at\">-F</span> <span class=\"st\">&#39;/&#39;</span> <span class=\"st\">&#39;{print $2}&#39;</span><span class=\"va\">)</span><span class=\"kw\">;</span> <span class=\"cf\">do</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&quot;Receiving </span><span class=\"va\">$k</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">gpg2</span> <span class=\"at\">--recv-key</span> <span class=\"va\">$k</span></span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&quot;Signing key </span><span class=\"va\">$k</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">gpg2</span> <span class=\"at\">--sign-key</span> <span class=\"va\">$k</span></span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"bu\">echo</span> <span class=\"st\">&quot;Sending key </span><span class=\"va\">$k</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">gpg2</span> <span class=\"at\">--send-key</span> <span class=\"va\">$k</span></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"cf\">done</span></span></code></pre></div>\n</section>\n<section id=\"if-you-need-a-key-get-help\" class=\"level2\">\n<h2>IF YOU NEED A KEY, GET HELP!!</h2>\n</section>\n<section id=\"resources\" class=\"level2\">\n<h2>Resources</h2>\n<p>PGP/GPG Intro</p>\n<ul>\n<li><a\nhref=\"https://ssd.eff.org/en/module/introduction-public-key-cryptography-and-pgp\">https://ssd.eff.org/en/module/introduction-public-key-cryptography-and-pgp</a></li>\n<li><a\nhref=\"https://ssd.eff.org/en/module/how-use-pgp-mac-os-x\">https://ssd.eff.org/en/module/how-use-pgp-mac-os-x</a></li>\n</ul>\n<p>OpenPGP Best practices</p>\n<ul>\n<li><a\nhref=\"https://help.riseup.net/en/gpg-best-practices\">https://help.riseup.net/en/gpg-best-practices</a></li>\n<li><a\nhref=\"https://help.riseup.net/en/security/message-security/openpgp/gpg-keys\">https://help.riseup.net/en/security/message-security/openpgp/gpg-keys</a></li>\n</ul>\n<ul>\n<li><a\nhref=\"http://web.monkeysphere.info/monkeysign/\">http://web.monkeysphere.info/monkeysign/</a></li>\n</ul>\n</section>\n<section id=\"wmf-keysigning\" class=\"level2\">\n<h2>WMF Keysigning</h2>\n<p><a\nhref=\"https://people.wikimedia.org/~faidon/ksp-wmf-20160108.txt\">https://people.wikimedia.org/~faidon/ksp-wmf-20160108.txt</a></p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode txt\"><code class=\"sourceCode default\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a>SHA256 Checksum: 52F2 CF39   6A54 6D56   7F55 7138   7264 11BA</span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    AEE3 F34E   8880 681C   9A67 75D1   3BBC 74DC              [ ]</span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    52F2CF39 6A546D56 7F557138 726411BA AEE3F34E 8880681C 9A6775D1 3BBC74DC</span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    RIPEMD160 Checksum: BB44 91B6 0A4D 5865 2105    2A4C 19FB 11AD 8BCC C3C3    [ ]</span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>                    BB44 91B6 0A4D 5865 2105  2A4C 19FB 11AD 8BCC C3C3</span></code></pre></div>\n</section>\n</section>\n<section id=\"mutt-problems\" class=\"level1\">\n<h1>Mutt problems</h1>\n<section id=\"cant-query-passphrase-in-batch-mode\" class=\"level2\">\n<h2>\"can\'t query passphrase in batch mode\"</h2>\n<p>Uncomment, <code class=\"verbatim\">use agent</code> in <code\nclass=\"verbatim\">~/.gnupg/gpg.conf</code></p>\n</section>\n</section>\n<section id=\"pass-problems\" class=\"level1\">\n<h1>Pass problems</h1>\n<section id=\"no-secret-key\" class=\"level2\">\n<h2>No Secret Key</h2>\n<section id=\"problem\" class=\"level3\">\n<h3>Problem</h3>\n<div class=\"sourceCode\" id=\"cb10\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">gpg:</span> decryption failed: No secret key</span></code></pre></div>\n</section>\n<section id=\"solution\" class=\"level3\">\n<h3>Solution</h3>\n<ol>\n<li>install <code class=\"verbatim\">pinentry-curses</code></li>\n<li><code class=\"verbatim\">~/.gnupg/gpg-agent.conf</code></li>\n</ol>\n<pre><code>pinentry-program /usr/bin/pinentry\n</code></pre>\n<ol>\n<li><code\nclass=\"verbatim\">gpg-connect-agent reloadagent /bye</code></li>\n</ol>\n</section>\n</section>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/11/24/aws-certificate/",

    "title": "AWS Cloudfront SSL Cert",
    "url": "https://tylercipriani.com/blog/2015/11/24/aws-certificate/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "crypto",

     "notes"

    ],

    "date_published": "2015-11-24T15:40:55Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Setup an Comodo positive SSL cert on AWS Cloudfront</p>\n<ol type=\"1\">\n<li><p>Buy Comodo positive SSL cert via namecheap</p></li>\n<li><p>Inspect last years cert:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">openssl</span> req <span class=\"at\">-noout</span> <span class=\"at\">-text</span> <span class=\"at\">-in</span> tylercipriani_com.csr</span></code></pre></div></li>\n<li><p>Generate private key and signing request</p></li>\n</ol>\n<ul>\n<li><p>You can generate a new key as a separate step, or as part of the\n<code>req</code> command</p></li>\n<li><p>To generate a new key manually use:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">openssl</span> genrsa <span class=\"at\">-out</span> /path/to/output.key 2048</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">mkdir</span> <span class=\"at\">-p</span> ~/Projects/Certs/com.tylercipriani/2015-11-24</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> ~/Projects/Certs/com.tylercipriani/2015-11-24</span></code></pre></div></li>\n<li><p>To generate a new key as part of a signing reuest use:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">openssl</span> req <span class=\"at\">-sha256</span> <span class=\"at\">-new</span> <span class=\"at\">-newkey</span> rsa:2048 <span class=\"at\">-nodes</span> <span class=\"at\">-keyout</span> /path/to/output.key <span class=\"at\">-out</span> /path/to/output.csr</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>     <span class=\"ex\">ensures</span> output key is not encrypted ────┘</span></code></pre></div></li>\n<li><p>Answer lots of questions</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Country</span> Name <span class=\"er\">(</span><span class=\"ex\">2</span> letter code<span class=\"kw\">)</span> <span class=\"ex\">[XX]:US</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">State</span> or Province Name <span class=\"er\">(</span><span class=\"ex\">full</span> name<span class=\"kw\">)</span> <span class=\"ex\">[]:Colorado</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Locality</span> Name <span class=\"er\">(</span><span class=\"ex\">eg,</span> city<span class=\"kw\">)</span> <span class=\"ex\">[Default</span> City]:Longmont</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Organization</span> Name <span class=\"er\">(</span><span class=\"ex\">eg,</span> company<span class=\"kw\">)</span> <span class=\"ex\">[Default</span> Company Ltd]:Tyler Cipriani</span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Organizational</span> Unit Name <span class=\"er\">(</span><span class=\"ex\">eg,</span> section<span class=\"kw\">)</span> <span class=\"ex\">[]:.</span></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">Common</span> Name <span class=\"er\">(</span><span class=\"ex\">eg,</span> your name or your server<span class=\"st\">&#39;s hostname) []:tylercipriani.com</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">Email Address []:spam@tylercipriani.com</span></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"st\">A challenge password []:</span></span></code></pre></div>\n<ul>\n<li>What is a challenge password:\nhttps://tools.ietf.org/html/rfc2985#page-16</li>\n</ul></li>\n</ul>\n<ol start=\"3\" type=\"1\">\n<li><p>Should now have a <code>tylercipriani_com.csr</code> and an\n<code>tylercipriani_com.key</code></p></li>\n<li><p>Do the namecheap needful:</p>\n<ul>\n<li>Login to namecheap and activate your certificate</li>\n<li><code>xsel -p &lt; tylercipriani_com.csr</code> then paste in the\n“Enter CSR” field</li>\n<li>Choose, “Apache, Nginx, or Other” as the server type</li>\n<li>Verify the domain, click “Next”</li>\n<li>Verify CSR info, click “Next”</li>\n<li>Select “Email-based” Domain Control Validation (DCV) method</li>\n<li>Company contacts page, “NA” as company name, my address in address,\ntyler@tylercipriani.com in admin email</li>\n</ul></li>\n<li><p>You’ll get an email that asks you to enter a validation into a\nComodo site, do that</p></li>\n<li><p>You’ll get an email with\n<code>tylercipriani_com.zip</code></p></li>\n<li><p><code>aws configure</code> to ensure that your awscli is\nsetup</p></li>\n<li><p>Use awscli to upload</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">awscli</span> iam upload-server-certificate <span class=\"dt\">\\</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">--server-certificate-name</span> tylercipriani_com_2015-11-24 <span class=\"dt\">\\</span></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">--certificate-body</span> file://tylercipriani_com.crt <span class=\"dt\">\\</span></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">--private-key</span> file://tylercipriani_com.key <span class=\"dt\">\\</span></span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">--certificate-chain</span> file://tylercipriani_com.ca-bundle <span class=\"dt\">\\</span></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">--path</span> /cloudfront/</span></code></pre></div></li>\n<li><p>Login to your aws dashboard, click cloudfront, go do Distribution\nSettings, click edit, find the new ssl key name in the dropdown and\nclick, “Yes, edit”</p></li>\n<li><p>Should work…</p></li>\n</ol>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/06/08/asus-deiban-jessie-install/",

    "title": "Asus debian jessie install",
    "url": "https://tylercipriani.com/blog/2015/06/08/asus-deiban-jessie-install/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "debian",

     "notes"

    ],

    "date_published": "2015-06-08T16:48:42Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<ol start=\"0\" type=\"1\">\n<li><p>Reboot, hitting F2 over-and-over</p></li>\n<li><p>Turn off Fastboot and Secureboot in UEFI</p></li>\n<li><p>Download Non-free firmware</p>\n<ul>\n<li><a\nhref=\"http://www.linuxquestions.org/questions/debian-26/how-to-provide-non-free-firmware-files-to-the-debian-jessie-installer-4175542680/\">Linux\nQuestions Answer</a></li>\n<li><a\nhref=\"https://packages.debian.org/jessie/all/firmware-iwlwifi/download\">firmware-iwlwifi\ndownload</a></li>\n</ul></li>\n<li><p>Extract firmware from deb</p>\n<p>ar xv firmware-iwlwifi.deb tar xvf data.tar.xz</p></li>\n<li><p>Copy to ext4 formatted sd-card</p>\n<p>mkfs.ext4 /dev/[sd-card] mount -t ext4 /dev/[sd-card] /mnt/sd-card cp\n-r lib/firmware/* /mnt/sd-card</p></li>\n<li><p>Insert Install Media</p></li>\n<li><p>Setup installer to recognize dmraid</p>\n<ul>\n<li><a href=\"https://wiki.debian.org/DebianInstaller/SataRaid\">SataRaid\nDebianInstaller</a></li>\n<li>Hit ‘E’ with ‘Install’ selected</li>\n<li>append ‘dmraid=true’ to eol</li>\n<li>F10 to save-and-exit</li>\n</ul></li>\n<li><p>Detect network hardware</p>\n<ul>\n<li>Ctrl-Alt F2</li>\n<li>mkdir /lib/firmware</li>\n<li>blkid (to list mounts)</li>\n<li>mount -t ext4 /dev/sdd1 /lib/firmware</li>\n<li>modprobe ahci</li>\n<li>Ctrl-Alt F1 <yes></li>\n</ul></li>\n<li><p>Manual partition</p>\n<p>https://wiki.debian.org/DebianInstaller/SoftwareRaidRoot</p></li>\n<li><p>Run live disk, chroot, fuck around</p>\n<p>http://forums.debian.net/viewtopic.php?f=17&amp;t=116036</p></li>\n</ol>\n<p>Troubleshooting:</p>\n<p>https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=711147</p>\n<ul>\n<li><p>Show root partition:</p>\n<pre><code>cat /proc/cmdline</code></pre></li>\n<li><p>initramfs modules</p>\n<p>/etc/initramfs-tools/modules update-initramfs –k all –u</p></li>\n<li><p>Large xterm:</p>\n<p>xterm -fn 10x20</p></li>\n<li><p>chroot</p>\n<p>boot ubuntu live sudo -i cryptsetup luksOpen\n/dev/mapper/isw_cejababahfd_ASUS_03 cryptroot lvm vgscan lvm vgchange\n-ay mount /dev/mapper/taskmaster–vg-root /mnt mount\n/dev/mapper/isw_cejababahfd_ASUS_02 /mnt/boot mount -o bind /sys\n/mnt/sys mount -t proc /proc /mnt/proc mount -o bind /dev /mnt/dev\nchroot /mnt</p></li>\n<li><p>chroot &amp; install dmraid</p>\n<p>chroot apt-get install dmraid initramfs modules</p></li>\n<li><p>break raid:</p></li>\n</ul>\n<p>http://ubuntuforums.org/showthread.php?t=2193133&amp;page=2&amp;p=12913689#post12913689</p>\n<section id=\"for-realz-steps\" class=\"level1\">\n<h1>For realz Steps!</h1>\n<ol type=\"1\">\n<li><p>Download Ubuntu 14.04 Live OS and Debian 8.1.0 netinst</p></li>\n<li><p>Copy to a Ubuntu USB Drive:</p>\n<ul>\n<li>use lsblk/blkid to find USB drive name without number, e.g. /dev/sdb\nNOT /dev/sdb1</li>\n<li><code>dd bs=4M ~/Downloads/ubuntu-14.04.2-desktop-amd64.iso of=/dev/[usbdrive-without-number]</code></li>\n</ul></li>\n<li><p>Download Non-free firmware</p>\n<ul>\n<li><a\nhref=\"http://www.linuxquestions.org/questions/debian-26/how-to-provide-non-free-firmware-files-to-the-debian-jessie-installer-4175542680/\">Linux\nQuestions Answer</a></li>\n<li><a\nhref=\"https://packages.debian.org/jessie/all/firmware-iwlwifi/download\">firmware-iwlwifi\ndownload</a></li>\n</ul></li>\n<li><p>Extract firmware from deb</p>\n<ul>\n<li><code>ar xv firmware-iwlwifi.deb</code></li>\n<li><code>tar xvf data.tar.xz</code></li>\n</ul></li>\n<li><p>Copy to ext4 formatted sd-card</p>\n<ul>\n<li><code>mkfs.ext4 /dev/[sd-card]</code></li>\n<li><code>mount -t ext4 /dev/[sd-card] /mnt/sd-card</code></li>\n<li><code>cp -r lib/firmware/* /mnt/sd-card</code></li>\n</ul></li>\n<li><p>Boot Ubuntu from usb/change UEFI opts</p>\n<ul>\n<li>Insert Ubuntu USB drive in Asus, Boot while holding F2</li>\n<li>Boot → Fastboot [Disabled]</li>\n<li>Security → Secure Boot Menu → Secure Boot Control [Disabled]</li>\n<li>Advanced → SATA Configuration → SATA Mode Selection [AHCI]</li>\n<li>Boot → Boot Option Priorites (hit + until USB drive is at the\ntop)</li>\n<li>F10 (save and exit)</li>\n</ul></li>\n<li><p>Try Ubuntu without installing</p></li>\n<li><p>Enable network, start terminal (Start → uxterm → xterm -fn\n10x20)</p></li>\n<li><p>sudo gparted, delete all partitions on /dev/sda /dev/sdb</p></li>\n<li><p>Create partition table on /dev/sdb:</p>\n<ul>\n<li>Select /dev/sdb</li>\n<li>Device → Create Partition Table…</li>\n</ul></li>\n<li><p>Shutdown, remove usb</p></li>\n<li><p>Copy Debian netinst to USB Drive:</p>\n<ul>\n<li>use lsblk/blkid to find USB drive name without number, e.g. /dev/sdb\nNOT /dev/sdb1</li>\n<li><code>sudo dd bs=4M if=Downloads/debian-8.0.0-amd64-netinst.iso of=[usbdrive-without-number]</code></li>\n</ul></li>\n<li><p>Detect network hardware</p>\n<ul>\n<li>Ctrl-Alt F2</li>\n<li>mkdir /lib/firmware</li>\n<li>blkid (to list mounts)</li>\n<li>mount -t ext4 /dev/sdd1 /lib/firmware</li>\n<li>modprobe ahci</li>\n<li>Ctrl-Alt F1 <yes></li>\n</ul></li>\n<li><p>Partition Disks</p>\n<ul>\n<li>Manual\n<ol type=\"1\">\n<li>sda &amp; sbd delete existing partitions</li>\n<li>sda1 256MB EFI System partition</li>\n<li>sda2 512MB mountat /boot ext4</li>\n<li>sda3 REMAINDER physical volume for raid</li>\n<li>sdb1 ALL physical volument for raid</li>\n<li>configure software raid, raid0 [x]sda3 [x]sdb1</li>\n<li>raid0 disk1 use as physical volume for encryption</li>\n<li>configure encrypted volumes [x]/dev/md0</li>\n<li>encrypted-disk 1: use as physical volume for lvm</li>\n<li>configure lvm volume group</li>\n<li>20 GB / ; 4 GB swap ; remainder /home</li>\n</ol></li>\n</ul></li>\n<li><p>Post xmonad-install disable GDM login:</p>\n<ul>\n<li><a\nhref=\"https://github.com/thcipriani/TheSetup/blob/master/puppet/modules/haskell/manifests/debian.pp#L38-L50\">XMonad\nInstall</a></li>\n<li><a\nhref=\"https://github.com/thcipriani/TheSetup/blob/master/puppet/modules/haskell/manifests/debian.pp#L38-L50\">Disable\nGDM systemd</a></li>\n</ul></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/05/27/ruby-test-notes/",

    "title": "Cucumber tests getting started",
    "url": "https://tylercipriani.com/blog/2015/05/27/ruby-test-notes/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "notes",

     "ruby"

    ],

    "date_published": "2015-05-27T15:09:45Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p><a\nhref=\"https://gorails.com/setup/ubuntu/14.04\">https://gorails.com/setup/ubuntu/14.04</a></p>\n<section id=\"check-setup\" class=\"level1\">\n<h1>Check setup</h1>\n<ul>\n<li>ruby -v</li>\n<li>gem list selenium</li>\n<li>gem install selenium-webdriver</li>\n<li>Firefox</li>\n<li>IRB</li>\n</ul>\n</section>\n<section id=\"ruby-install\" class=\"level1\">\n<h1>Ruby install</h1>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> curl <span class=\"at\">-fsSL</span> https://gist.github.com/mislav/055441129184a1512bb5.txt <span class=\"kw\">|</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">rbenv</span> install <span class=\"at\">--patch</span> 2.2.3</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span> 6m 50s</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> rbenv global 2.2.2</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> ruby <span class=\"at\">-v</span></span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">ruby</span> 2.2.2p95 <span class=\"er\">(</span><span class=\"ex\">2015-04-13</span> revision 50295<span class=\"kw\">)</span> <span class=\"ex\">[x86_64-linux]</span></span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">❯</span> echo <span class=\"st\">&quot;gem: --no-ri --no-rdoc&quot;</span> <span class=\"op\">&gt;</span> ~/.gemrc</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">~</span></span></code></pre></div>\n</section>\n<section id=\"selenium-webdriver\" class=\"level1\">\n<h1>Selenium webdriver</h1>\n<p>require \"selenium-webdriver\" <a\nhref=\"https://code.google.com/p/selenium/wiki/RubyBindings\">https://code.google.com/p/selenium/wiki/RubyBindings</a></p>\n<p>driver.class <a\nhref=\"http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Driver\">http://www.rubydoc.info/gems/selenium-webdriver/Selenium/WebDriver/Driver</a></p>\n</section>\n<section id=\"core-tests\" class=\"level1\">\n<h1>Core tests</h1>\n<p><code\nclass=\"verbatim\">[mw-core]/tests/browser/features/create_account.feature</code></p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode ruby\"><code class=\"sourceCode ruby\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">Schenario</span> <span class=\"dt\">Outline</span> can be passed variable</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">Scenario</span>: <span class=\"kw\">[</span><span class=\"dt\">English</span> text<span class=\"kw\">]</span> <span class=\"co\"># Just a comment, nothing is parsed</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">Given</span> <span class=\"kw\">[</span>this thing<span class=\"kw\">]</span> <span class=\"co\"># Sets up the test</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">When</span> <span class=\"kw\">[</span>other thing<span class=\"kw\">]</span> <span class=\"co\"># Action that is part of the test</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">And</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dt\">But</span></span></code></pre></div>\n</section>\n<section id=\"bundler\" class=\"level1\">\n<h1>Bundler</h1>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> [mwcore]/tests/browser</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">bundle</span> install</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">bundle</span> exec cucumber features/create_account.feature:14</span></code></pre></div>\n</section>\n<section id=\"important\" class=\"level1\">\n<h1>Important</h1>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">export</span> <span class=\"va\">BROWSER</span><span class=\"op\">=</span>firefox</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">export</span> <span class=\"va\">MEDIAWIKI_ENVIRONMENT</span><span class=\"op\">=</span>mw-vagrant-host</span></code></pre></div>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/05/23/Puppet-Apt-get-update-Source-lists-and-Dumbness/",

    "title": "Puppet, apt-get-update, source-lists, and Dumbness",
    "url": "https://tylercipriani.com/blog/2015/05/23/Puppet-Apt-get-update-Source-lists-and-Dumbness/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "configuration-management"

    ],

    "date_published": "2015-05-23T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Configuration management software is nice because it lets you be a\nlittle dumb. Puppet, Chef, Ansible, and Salt have all managed to smooth\ndown many of the rough edges that were ubiquitous in the terrible bash\nand perl scripts used for old-time, ad-hoc configuration management.</p>\n<p>My main problem with configuration management software is that\n<em>I’m still dumb</em>. I’m still dumb and there are now new,\nnon-obvious, ways to be dumb.</p>\n<p>One non-obvious example is below:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource ruby numberLines\"><code class=\"sourceCode ruby\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a>package <span class=\"kw\">{</span> <span class=\"vs\">&#39;apache&#39;</span>:</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a>    <span class=\"cf\">ensure</span>  <span class=\"kw\">=&gt;</span> installed,</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a>    <span class=\"fu\">require</span> <span class=\"kw\">=&gt;</span> <span class=\"dt\">File</span><span class=\"kw\">[</span><span class=\"vs\">&#39;/etc/apt/sources.list.d/some_source.list&#39;</span><span class=\"kw\">]</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\"></a></span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\"></a>file <span class=\"kw\">{</span> <span class=\"vs\">&#39;/etc/apt/sources.list.d/some_source.list&#39;</span>:</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\"></a>    notify <span class=\"kw\">=&gt;</span> <span class=\"dt\">Exec</span><span class=\"kw\">[</span><span class=\"vs\">&#39;apt-get update&#39;</span><span class=\"kw\">]</span>,</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\"></a>    source <span class=\"kw\">=&gt;</span> <span class=\"kw\">...</span></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\"></a></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\"></a><span class=\"fu\">exec</span> <span class=\"kw\">{</span> <span class=\"vs\">&#39;apt-get update&#39;</span>: <span class=\"kw\">}</span></span></code></pre></div>\n<p>On the surface, this little contrived example seems fine: Apache\nrequires a special source, adding that source triggers an\n<code>apt-get update</code>. Therefore, before Apache is installed, our\nsources list should be up-to-date, right? Wrong.</p>\n<p>The problem here is subtle: the\n<code>notify =&gt; Exec[\'apt-get update\']</code> in the file resource\nmeans that the file <code>\"/etc/apt/sources.d/${name}.list\"</code> has\nto exist before <code>apt-get update</code> is run. Adding\n<code>require =&gt; File[\'/etc/apt/sources.list.d/some_source.list\']</code>\nto the Apache package means that it will be installed only after\n<code>\"/etc/apt/sources.d/${name}.list\"</code> gets added.</p>\n<p><strong>HOWEVER</strong>, the Apache package, currently, has no\nrelationship with <code>apt-get update</code>. This means Puppet may try\nto install the Apache package <em>after</em> adding\n<code>/etc/apt/sources.d/some_source.list</code>, but <em>before</em>\nrunning <code>apt-get update</code>.</p>\n<p>While the short example above is not a problem in isolation, it\n<em>can be</em> a problem in a larger manifest. Puppet will succeed with\nsome packages, fail in others, then create <a\nhref=\"http://en.wikipedia.org/wiki/Dependency_hell\">unresolvable\ndependency conflicts</a> on the next run (after\n<code>apt-get update</code> has run).</p>\n<blockquote>\n<p><strong>Edit</strong>—2016-03-20</p>\n<p>This relationship is easier to see when you take advantage of\npuppet’s <code>--graph</code> ability:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">puppet</span> apply <span class=\"at\">--graph</span> test.pp dot <span class=\"at\">-Tpng</span> /var/lib/puppet/state/graphs/relationships.dot <span class=\"at\">-o</span> Pictures/relationships.png</span></code></pre></div>\n<p><img src=\"https://tylercipriani.com/static/images/2016/2016-03-20_puppet-dot.png\"\nalt=\"Puppet relationship graph\" /><br />\n</p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/05/13/git-annex/",

    "title": "Git annex notes",
    "url": "https://tylercipriani.com/blog/2015/05/13/git-annex/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "git",

     "notes"

    ],

    "date_published": "2015-05-13T22:29:34Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<section id=\"setup-new-repo\" class=\"level1\">\n<h1>Setup New repo</h1>\n<ol>\n<li><p>init git:</p>\n<div class=\"sourceCode\" id=\"cb1\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> init</span></code></pre></div></li>\n<li><p>init git annex:</p>\n<div class=\"sourceCode\" id=\"cb2\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex init local</span></code></pre></div></li>\n<li><p>Add S3 Remote named public-s3</p>\n<div class=\"sourceCode\" id=\"cb3\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex initremote public-s3 type=S3 encryption=none bucket=tyler.zone chunk=0</span></code></pre></div></li>\n<li><p>Add file to git annex</p>\n<div class=\"sourceCode\" id=\"cb4\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex add [big-file]</span></code></pre></div></li>\n<li><p>copy current directory to public-s3 remote</p>\n<div class=\"sourceCode\" id=\"cb5\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex copy <span class=\"at\">--to</span> public-s3</span></code></pre></div></li>\n<li><p>remove local copy—will only remove if already in remote—nothing\nlost</p>\n<div class=\"sourceCode\" id=\"cb6\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex drop [file]</span></code></pre></div></li>\n<li><p>Commit</p>\n<div class=\"sourceCode\" id=\"cb7\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> <span class=\"at\">-a</span> <span class=\"at\">-m</span> <span class=\"st\">&#39;initial commit&#39;</span></span></code></pre></div></li>\n</ol>\n</section>\n<section id=\"setup-nfs-as-remote-using-rsync-over-ssh\" class=\"level1\">\n<h1>Setup NFS as remote using Rsync over ssh</h1>\n<ol>\n<li><p><a\nhref=\"https://git-annex.branchable.com/special_remotes/rsync/\">Add Rsync\nas unencrypted remote</a></p>\n<div class=\"sourceCode\" id=\"cb8\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex initremote nas type=rsync rsyncurl=nfs.blazeyandltyler.com:/volume1/homes/tyler/PicturesAnnex encryption=none</span></code></pre></div></li>\n<li><p>Add file to nas</p>\n<div class=\"sourceCode\" id=\"cb9\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex copy <span class=\"at\">--to</span><span class=\"op\">=</span>nas</span></code></pre></div></li>\n</ol>\n</section>\n<section id=\"pull-down-photos\" class=\"level1\">\n<h1>Pull down photos</h1>\n<div class=\"sourceCode\" id=\"cb10\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">eval</span> <span class=\"er\">(</span><span class=\"ex\">~/.amazonrc</span><span class=\"kw\">)</span></span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex enableremote public-s3</span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex get [whatever]</span></code></pre></div>\n</section>\n<section id=\"make-available-to-the-public-after-public-s3-setup\"\nclass=\"level1\">\n<h1>Make available to the public (after public s3 setup):</h1>\n<div class=\"sourceCode\" id=\"cb11\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex addurl <span class=\"at\">--file</span> [filename] <span class=\"st\">&quot;http://tyler.zone/</span><span class=\"va\">$(</span><span class=\"fu\">git</span> annex lookupkey [filename]<span class=\"va\">)</span><span class=\"st\">&quot;</span></span></code></pre></div>\n</section>\n<section id=\"list-remotes-and-remote-info\" class=\"level1\">\n<h1>List remotes and remote info</h1>\n<section id=\"show-remotes\" class=\"level2\">\n<h2>Show remotes</h2>\n<div class=\"sourceCode\" id=\"cb12\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex enableremote</span></code></pre></div>\n</section>\n<section id=\"show-remote-info\" class=\"level2\">\n<h2>Show remote info</h2>\n<div class=\"sourceCode\" id=\"cb13\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb13-1\"><a href=\"https://tylercipriani.com/blog/#cb13-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex info [remote-name]</span>\n<span id=\"cb13-2\"><a href=\"https://tylercipriani.com/blog/#cb13-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex info tylercipriani-raw</span></code></pre></div>\n</section>\n</section>\n<section id=\"finding-info-about-files\" class=\"level1\">\n<h1>Finding info about files</h1>\n<p>Find a file:</p>\n<div class=\"sourceCode\" id=\"cb14\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex whereis [filename]</span></code></pre></div>\n<p>Adding a file to <a\nhref=\"http://tyler.zone\">http://tyler.zone</a></p>\n<div class=\"sourceCode\" id=\"cb15\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb15-1\"><a href=\"https://tylercipriani.com/blog/#cb15-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">eval</span> <span class=\"va\">$(</span><span class=\"ex\">~/.amazonrc</span><span class=\"va\">)</span></span>\n<span id=\"cb15-2\"><a href=\"https://tylercipriani.com/blog/#cb15-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex copy <span class=\"at\">--to</span><span class=\"op\">=</span>photo-site [file]</span>\n<span id=\"cb15-3\"><a href=\"https://tylercipriani.com/blog/#cb15-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> annex addurl <span class=\"at\">--file</span> [file] <span class=\"st\">&quot;http://tyler.zone/</span><span class=\"va\">$(</span><span class=\"fu\">git</span> annex lookupkey [filename]<span class=\"va\">)</span><span class=\"st\">&quot;</span></span></code></pre></div>\n</section>\n<section id=\"sharing-via-amazon-s3\" class=\"level1\">\n<h1>Sharing via Amazon s3</h1>\n<section id=\"links\" class=\"level2\">\n<h2>Links</h2>\n<ul>\n<li><a\nhref=\"http://git-annex.branchable.com/tips/publishing_your_files_to_the_public/\">http://git-annex.branchable.com/tips/publishing_your_files_to_the_public/</a></li>\n<li><a\nhref=\"http://git-annex.branchable.com/tips/using_Amazon_S3/\">http://git-annex.branchable.com/tips/using_Amazon_S3/</a></li>\n</ul>\n</section>\n<section id=\"setup\" class=\"level2\">\n<h2>Setup</h2>\n<p>Make amazon bucket with policy:</p>\n<div class=\"sourceCode\" id=\"cb16\"><pre\nclass=\"sourceCode json\"><code class=\"sourceCode json\"><span id=\"cb16-1\"><a href=\"https://tylercipriani.com/blog/#cb16-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">{</span></span>\n<span id=\"cb16-2\"><a href=\"https://tylercipriani.com/blog/#cb16-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"dt\">&quot;Version&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;2008-10-17&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb16-3\"><a href=\"https://tylercipriani.com/blog/#cb16-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"dt\">&quot;Statement&quot;</span><span class=\"fu\">:</span> <span class=\"ot\">[</span></span>\n<span id=\"cb16-4\"><a href=\"https://tylercipriani.com/blog/#cb16-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">{</span></span>\n<span id=\"cb16-5\"><a href=\"https://tylercipriani.com/blog/#cb16-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"dt\">&quot;Sid&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;AllowPublicRead&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb16-6\"><a href=\"https://tylercipriani.com/blog/#cb16-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"dt\">&quot;Effect&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;Allow&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb16-7\"><a href=\"https://tylercipriani.com/blog/#cb16-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"dt\">&quot;Principal&quot;</span><span class=\"fu\">:</span> <span class=\"fu\">{</span></span>\n<span id=\"cb16-8\"><a href=\"https://tylercipriani.com/blog/#cb16-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>        <span class=\"dt\">&quot;AWS&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;*&quot;</span></span>\n<span id=\"cb16-9\"><a href=\"https://tylercipriani.com/blog/#cb16-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"fu\">},</span></span>\n<span id=\"cb16-10\"><a href=\"https://tylercipriani.com/blog/#cb16-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"dt\">&quot;Action&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;s3:GetObject&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb16-11\"><a href=\"https://tylercipriani.com/blog/#cb16-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>      <span class=\"dt\">&quot;Resource&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;arn:aws:s3:::[bucket-name]/*&quot;</span></span>\n<span id=\"cb16-12\"><a href=\"https://tylercipriani.com/blog/#cb16-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"fu\">}</span></span>\n<span id=\"cb16-13\"><a href=\"https://tylercipriani.com/blog/#cb16-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ot\">]</span></span>\n<span id=\"cb16-14\"><a href=\"https://tylercipriani.com/blog/#cb16-14\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">}</span></span></code></pre></div>\n<p>Put creds out into the environment</p>\n<div class=\"sourceCode\" id=\"cb17\" data-org-language=\"sh\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb17-1\"><a href=\"https://tylercipriani.com/blog/#cb17-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">eval</span> <span class=\"er\">(</span><span class=\"ex\">~/.amazonrc</span><span class=\"kw\">)</span></span>\n<span id=\"cb17-2\"><a href=\"https://tylercipriani.com/blog/#cb17-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> into repo:</span>\n<span id=\"cb17-3\"><a href=\"https://tylercipriani.com/blog/#cb17-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> /home/tyler/Projects/Timelapse</span></code></pre></div>\n</section>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2015/01/23/toward-a-useful-keyboard-in-x/",

    "title": "Toward a More Useful X Keyboard",
    "url": "https://tylercipriani.com/blog/2015/01/23/toward-a-useful-keyboard-in-x/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "keyboard",

     "unicode"

    ],

    "date_published": "2015-01-23T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>I’m not sure when, exactly, it became clear that I was going to spend\nas much time as necessary perfecting my keyboard configuration. It’s one\nof those things that you <em>know</em> you can make absolutely\nperfect—given enough time and energy. On Linux, when you spend enough\ntime bashing your brain into a topic, you often find your effort\nrewarded manyfold. This is the hallmark of a professional tool: a tool\nwith which your efficiency increases with your proficiency.</p>\n<p>The way many people first experience a computer is through a\npoint-and-click-style mouse interface. While there are professional\ntools that prefer a <a href=\"http://research.swtch.com/acme\">mouse\ninterface</a>, and there is <a\nhref=\"http://www.loper-os.org/?p=861\">healthy</a> <a\nhref=\"http://99percentinvisible.org/episode/of-mice-and-men/\">debate</a>\nabout the most appropriate tool for computer interaction, the fact\nremains: most professional computing and programming is done with a\nQWERTY keyboard.</p>\n<p>My endless <code>X</code> keyboard tinkerings have given me the most\nefficient keyboard configuration I have ever used. This configuration is\nprobably achievable on other platforms; however, on a modern Linux\nsystem my configuration only requires one tool that isn’t included with\nthe kernel: <a href=\"https://github.com/alols/xcape\">XCape</a>, which is\n500 lines of GPL-licensed C-code—not too shabby overall.</p>\n<ul>\n<li><a href=\"https://tylercipriani.com/blog/#keymaps\">Keymaps</a></li>\n<li><a href=\"https://tylercipriani.com/blog/#autorepeat\">Key Autorepeat</a></li>\n<li><a href=\"https://tylercipriani.com/blog/#persist\">Persistence</a></li>\n</ul>\n<div id=\"keymaps\">\n\n</div>\n<section id=\"keymaps\" class=\"level2\">\n<h2>Keymaps</h2>\n<p>To start working with keyboard layout the lowest-risk command is\n<code>setxkbmap(1)</code>. <code>setxkbmap</code> temporarily maps the\nkeyboard to use options specified on the command line. Changes will not\npersist when you restart <code>X</code> (i.e., log out and log back in).\nThis is a good place to start experimenting with configuration and\nlayouts.</p>\n<p>The options that can be applied with <code>setxkbmap</code> are found\nin <code>xkeyboard-config(7)</code>. For whatever reason, neither my\nDebian nor Arch box has this man file. I found <a\nhref=\"https://web.archive.org/web/20150125024107/http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=xkeyboard-config&amp;ampsect=7\">one\ncopy</a> online and made sure to snapshot it in the <a\nhref=\"https://web.archive.org\">internet archive</a>—which is a project\nto which I plan to donate more heavily in the upcoming year.</p>\n<p>To view currently applied options use: <code>setxkbmap -query</code>\nwhich should output something like:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a>rules:      evdev</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a>model:      pc105</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a>layout:     us</span></code></pre></div>\n<p>To achieve this with <code>setxkbmap</code> you would type in your\nxterm: <code>setxkbmap -model pc105 -layout us</code></p>\n<p>This is a pretty vanilla setup—when you setup your computer and\naccept the defaults, this is what you get.</p>\n<div id=\"altgr-intl\">\n\n</div>\n<section id=\"altgr-intl\" class=\"level3\">\n<h3>AltGr-Intl</h3>\n<p>One of the features I find myself using frequently is the <a\nhref=\"https://en.wikipedia.org/wiki/AltGr_key\">AltGr</a> (or\n<em>Alternate Graphic</em>) key. I like to be able to type international\ncharacters that are often used in English (like “é”) without resorting\nto using deadkeys or esoteric key-compostability sequences.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a>&quot;é&quot; == [Right Alt] + [e]</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a>&quot;ñ&quot; == [Right Alt] + [n]</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a>&quot;ö&quot; == [Right Alt] + [p]</span></code></pre></div>\n<p>To enable this simply use the <code>setxkbmap</code> command:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">setxkbmap</span> <span class=\"at\">-model</span> pc105 <span class=\"at\">-layout</span> us <span class=\"at\">-variant</span> altgr-intl</span></code></pre></div>\n<p>More information about the <em>AltGr-Intl</em> layout can be found in\nthe <a\nhref=\"http://lists.x.org/archives/xorg/2007-July/026534.html\">Xorg\nMailing List</a> (found via <a\nhref=\"https://zuttobenkyou.wordpress.com/2011/08/24/xorg-using-the-us-international-altgr-intl-variant-keyboard-layout/\">Shinobu’s\nSecrets</a>)</p>\n</section>\n<section id=\"xcompose\" class=\"level3\">\n<h3><code>~/.XCompose</code></h3>\n<p>Text expansion is awesome. Being able to type a sequence of three\ncharacters to dump your public key into IRC is awesome. Or how about\n<code>ಠ_ಠ</code>? Being able to express disapproval quickly is what\nseparates our emails from those of animals: it’s why we have\ncivilization.</p>\n<p>The <a href=\"https://en.wikipedia.org/wiki/Compose_key\">compose</a>\n(or <em>MultiKey</em>) key, can be mapped to any number of keys or key\ncombinations (again, see: <a\nhref=\"https://web.archive.org/web/20150125024107/http://www.dsm.fordham.edu/cgi-bin/man-cgi.pl?topic=xkeyboard-config&amp;ampsect=7\">xkeyboard-config(7)</a>)\nI prefer to map my MultiKey to the right Ctrl key:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">setxkbmap</span> <span class=\"at\">-model</span> pc105 <span class=\"at\">-layout</span> us <span class=\"at\">-variant</span> altgr-intl <span class=\"at\">-option</span> compose:rctrl</span></code></pre></div>\n<p>To type special symbols or expansions using the compose key, simply\nhit the compose key (in my case right Ctrl) and then type the additional\ncharacter for the combination in sequence.</p>\n<p>For instance, to make a degree mark (“°”) I type:\n<code>[Ctrl]-o-o</code>; just like I’m typing “oo”, but I hit the right\nCtrl key first.</p>\n<p>The real magic of the compose key can be unleashed with the\n<code>~/.XCompose</code> file. This is the file into which you can drop\nyour custom key combination mappings that will generate any text\noutput.</p>\n<p>Example expansions for <a\nhref=\"https://github.com/thcipriani/dotfiles/blob/master/XCompose\"><code>~/.XCompose</code></a>:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\"></a># Quick ssh key output</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\"></a>&lt;Multi_key&gt; &lt;k&gt; &lt;e&gt; &lt;y&gt; : &quot;https://gist.github.com/thcipriani/5e95399457da6544a4cb&quot;</span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\"></a></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\"></a>&lt;Multi_key&gt; &lt;S&gt; &lt;N&gt; &lt;O&gt; &lt;W&gt;     : &quot;❄&quot;   U2603</span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\"></a>&lt;Multi_key&gt; &lt;p&gt; &lt;l&gt; &lt;a&gt; &lt;n&gt; &lt;e&gt; : &quot;✈&quot;   U2708</span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\"></a>&lt;Multi_key&gt; &lt;z&gt; &lt;a&gt; &lt;p&gt;         : &quot;⚡&quot;   U26A1</span>\n<span id=\"cb5-7\"><a href=\"https://tylercipriani.com/blog/#cb5-7\"></a></span>\n<span id=\"cb5-8\"><a href=\"https://tylercipriani.com/blog/#cb5-8\"></a># prefix &#39;m&#39; = mathematical symbols</span>\n<span id=\"cb5-9\"><a href=\"https://tylercipriani.com/blog/#cb5-9\"></a>&lt;Multi_key&gt; &lt;m&gt; &lt;d&gt; : &quot;Δ&quot;</span>\n<span id=\"cb5-10\"><a href=\"https://tylercipriani.com/blog/#cb5-10\"></a>&lt;Multi_key&gt; &lt;m&gt; &lt;e&gt; : &quot;ϵ&quot;</span>\n<span id=\"cb5-11\"><a href=\"https://tylercipriani.com/blog/#cb5-11\"></a>&lt;Multi_key&gt; &lt;m&gt; &lt;l&gt; : &quot;λ&quot;</span>\n<span id=\"cb5-12\"><a href=\"https://tylercipriani.com/blog/#cb5-12\"></a></span>\n<span id=\"cb5-13\"><a href=\"https://tylercipriani.com/blog/#cb5-13\"></a># misc</span>\n<span id=\"cb5-14\"><a href=\"https://tylercipriani.com/blog/#cb5-14\"></a>&lt;Multi_key&gt; &lt;colon&gt; &lt;bar&gt; &lt;bar&gt; : &quot;ಠ_ಠ&quot;</span>\n<span id=\"cb5-15\"><a href=\"https://tylercipriani.com/blog/#cb5-15\"></a>&lt;Multi_key&gt; &lt;less&gt; &lt;3&gt; : &quot;❤&quot;</span></code></pre></div>\n</section>\n<section id=\"youre-out-of-your-element-capslock\" class=\"level3\">\n<h3>You’re out of your element, CapsLock</h3>\n<p>CapsLock sucks and everyone hates it.</p>\n<p>People <em>think</em> they use CapsLock, but, <em>I</em> think, if\npeople were honest with themselves they would admit that CapsLock is the\nworse than useless: it’s usually counter-productive. Also, if you find\nyourself frequently needing to type in ALL CAPS, maybe you should look\nat life: <em>what have you become</em>?</p>\n<p>I like to remap my CapsLock key to a modifier key I use more\nfrequently: Ctrl.</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\"></a>setxkbmap \\</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\"></a>  -model pc105 \\</span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\"></a>  -layout us \\</span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\"></a>  -variant altgr-intl \\</span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\"></a>  -option compose:rctrl \\</span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\"></a>  -option ctrl:nocaps</span></code></pre></div>\n</section>\n<section id=\"xcape\" class=\"level3\">\n<h3>XCape</h3>\n<p>The other function of my CapsLock key only happens when it is pressed\nwithout any additonal keys. Basically, if I hit\n<code>CapsLock+[t]</code>, I want a new tab, but if I just hit\n<code>CapsLock</code>, it doesn’t do anything—which <em>was</em> a\nwaste.</p>\n<p>The program <a href=\"https://github.com/alols/xcape\">XCape</a> allows\nyou to configure modifier keys (Alt, Ctrl, Shift, Meta) to act as other\nkeys when pressed on their own. And, since the CapsLock key is so\ncentral on my keyboard, I also use it as an escape key. Compiling\n<code>xcape</code> is pretty straight forward (provided you have the\nrequisite build tools):</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">git</span> clone https://github.com/alols/xcape.git .</span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">cd</span> xcape <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">make</span></span></code></pre></div>\n<p>The command that allows for that functionality is also pretty\nstraight-forward:</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">xcape</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;Control_L=Escape&#39;</span></span></code></pre></div>\n<p>Finally, I also use the option that allows\n<code>[Ctrl]+[Alt]+[Backspace]</code> to end an <code>X</code> session.\nSo my final <code>setxkbmap</code> looks like:</p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">setxkbmap</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-model</span> pc105 <span class=\"dt\">\\</span></span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-layout</span> us <span class=\"dt\">\\</span></span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-variant</span> altgr-intl <span class=\"dt\">\\</span></span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-option</span> compose:rctrl <span class=\"dt\">\\</span></span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-option</span> ctrl:nocaps <span class=\"dt\">\\</span></span>\n<span id=\"cb9-7\"><a href=\"https://tylercipriani.com/blog/#cb9-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"at\">-option</span> terminate:ctrl_alt_bksp</span></code></pre></div>\n</section>\n</section>\n<section id=\"key-autorepeat\" class=\"level2\">\n<h2>Key Autorepeat</h2>\n<p>There are some keyboard options that cannot be set via\n<code>setxkbmap</code>. The <code>AutoRepeat</code> option was removed\nfrom the <code>X</code> keyboard driver (<code>kbd(4)</code>) as of <a\nhref=\"https://bugzilla.redhat.com/show_bug.cgi?id=601853\">version\n1.4.0</a>.</p>\n<p>The only recourse is using <code>xset(1)</code>, the <code>X</code>\nuser-preference utility. An infinitely customizable keyrate is one of\nthe many luxuries of using a Linux keyboard.</p>\n<p>There are two main options that matter for me in <code>xset</code>\nthat affect the autorepeat rate: AutoRepeatDelay and AutoRepeatRate</p>\n<p>The syntax for <code>xset</code> autorepeat is:</p>\n<div class=\"sourceCode\" id=\"cb10\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">xset</span> [-r keycode] rate [AutoRepeatRate] [AutoRepeatDelay]</span></code></pre></div>\n<p>By omitting the <code>-r keycode</code> you apply the\n<code>rate</code> to all keys (e.g., <code>xset -r 10</code> will apply\nthe <code>rate</code> settings only to the “1” key). The default\nAutoRepeatDelay is 660ms and the default AutoRepeatRate is 25Hz, which\nis fine, but after tweaking this rate and living with it for a few days\nit will seem <em>unbearably slow</em>. My settings are:</p>\n<div class=\"sourceCode\" id=\"cb11\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">xset</span> r rate 330 75</span></code></pre></div>\n<p>These settings half the time I spend waiting for a key to\nauto-repeat, and triple the rate at which that auto-repeat fires.</p>\n<p>While mentioning <code>xset</code> it’s also worth mentioning that I\nhate HATE the system beep. It’s that beep that happens when you\ndouble-tab Tab in Bash, or try to backspace beyond the beginning of a\nline (which happens a lot with a fast AutoRepeatRate). You can probably\ndisable it many ways in <code>X</code>, but I use:</p>\n<div class=\"sourceCode\" id=\"cb12\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">xset</span> <span class=\"at\">-b</span></span></code></pre></div>\n</section>\n<section id=\"persistence\" class=\"level2\">\n<h2>Persistence</h2>\n<p>By placing the <code>setxkbmap</code> command, the <code>xcape</code>\ncommand, and the two <code>xset</code> commands shown above into\n<code>~/.xinitrc</code>, that configuration will load whenever\n<code>X</code> is started.</p>\n<div class=\"sourceCode\" id=\"cb13\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb13-1\"><a href=\"https://tylercipriani.com/blog/#cb13-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb13-2\"><a href=\"https://tylercipriani.com/blog/#cb13-2\"></a><span class=\"co\">#</span></span>\n<span id=\"cb13-3\"><a href=\"https://tylercipriani.com/blog/#cb13-3\"></a><span class=\"co\"># ~/.xinitrc</span></span>\n<span id=\"cb13-4\"><a href=\"https://tylercipriani.com/blog/#cb13-4\"></a><span class=\"co\">#</span></span>\n<span id=\"cb13-5\"><a href=\"https://tylercipriani.com/blog/#cb13-5\"></a><span class=\"ex\">has?</span><span class=\"er\">(</span><span class=\"kw\">)</span> <span class=\"kw\">{</span></span>\n<span id=\"cb13-6\"><a href=\"https://tylercipriani.com/blog/#cb13-6\"></a>    <span class=\"bu\">command</span> <span class=\"at\">-v</span> <span class=\"st\">&quot;</span><span class=\"va\">$1</span><span class=\"st\">&quot;</span> <span class=\"op\">&gt;</span> /dev/null <span class=\"dv\">2</span><span class=\"op\">&gt;&amp;</span><span class=\"dv\">1</span></span>\n<span id=\"cb13-7\"><a href=\"https://tylercipriani.com/blog/#cb13-7\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb13-8\"><a href=\"https://tylercipriani.com/blog/#cb13-8\"></a></span>\n<span id=\"cb13-9\"><a href=\"https://tylercipriani.com/blog/#cb13-9\"></a><span class=\"co\"># Keyboard stuffs</span></span>\n<span id=\"cb13-10\"><a href=\"https://tylercipriani.com/blog/#cb13-10\"></a><span class=\"co\"># ---</span></span>\n<span id=\"cb13-11\"><a href=\"https://tylercipriani.com/blog/#cb13-11\"></a><span class=\"co\"># * use right-alt as Alt-Gr key ($ → £)</span></span>\n<span id=\"cb13-12\"><a href=\"https://tylercipriani.com/blog/#cb13-12\"></a><span class=\"co\"># * use right ctrl key as compose (ctrl 1 2 → ½)</span></span>\n<span id=\"cb13-13\"><a href=\"https://tylercipriani.com/blog/#cb13-13\"></a><span class=\"co\"># * use ctrl+alt+bksp to restart `X`</span></span>\n<span id=\"cb13-14\"><a href=\"https://tylercipriani.com/blog/#cb13-14\"></a><span class=\"co\"># * Capslock → Ctrl</span></span>\n<span id=\"cb13-15\"><a href=\"https://tylercipriani.com/blog/#cb13-15\"></a><span class=\"co\"># * Alt-Gr + Space = nbsp/Alt-Gr + Shift + Space = shy nbsp</span></span>\n<span id=\"cb13-16\"><a href=\"https://tylercipriani.com/blog/#cb13-16\"></a><span class=\"ex\">setxkbmap</span> <span class=\"dt\">\\</span></span>\n<span id=\"cb13-17\"><a href=\"https://tylercipriani.com/blog/#cb13-17\"></a>  <span class=\"at\">-layout</span> us <span class=\"dt\">\\</span></span>\n<span id=\"cb13-18\"><a href=\"https://tylercipriani.com/blog/#cb13-18\"></a>  <span class=\"at\">-variant</span> altgr-intl <span class=\"dt\">\\</span></span>\n<span id=\"cb13-19\"><a href=\"https://tylercipriani.com/blog/#cb13-19\"></a>  <span class=\"at\">-option</span> compose:rctrl <span class=\"dt\">\\</span></span>\n<span id=\"cb13-20\"><a href=\"https://tylercipriani.com/blog/#cb13-20\"></a>  <span class=\"at\">-option</span> terminate:ctrl_alt_bksp <span class=\"dt\">\\</span></span>\n<span id=\"cb13-21\"><a href=\"https://tylercipriani.com/blog/#cb13-21\"></a>  <span class=\"at\">-option</span> ctrl:nocaps</span>\n<span id=\"cb13-22\"><a href=\"https://tylercipriani.com/blog/#cb13-22\"></a></span>\n<span id=\"cb13-23\"><a href=\"https://tylercipriani.com/blog/#cb13-23\"></a><span class=\"fu\">xset</span> <span class=\"at\">-b</span>            <span class=\"co\"># Stop beeping at me (A.K.A turn off PC speaker)</span></span>\n<span id=\"cb13-24\"><a href=\"https://tylercipriani.com/blog/#cb13-24\"></a><span class=\"fu\">xset</span> r rate 330 60 <span class=\"co\"># Set keyboard repeat rate</span></span>\n<span id=\"cb13-25\"><a href=\"https://tylercipriani.com/blog/#cb13-25\"></a></span>\n<span id=\"cb13-26\"><a href=\"https://tylercipriani.com/blog/#cb13-26\"></a><span class=\"ex\">has?</span> xcape <span class=\"kw\">&amp;&amp;</span> <span class=\"ex\">xcape</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;Control_L=Escape&#39;</span> <span class=\"co\"># https://github.com/alols/xcape</span></span></code></pre></div>\n<p><code>~/.xinitrc</code> will NOT, however, keep those configurations\nwhen an external USB keyboard is added to the mix.</p>\n<p>The configuration loaded by <code>setxkbmap</code> can easily become\npersistent since it is part of the <code>X</code> keyboard driver. I\nhave the following in a file at\n<code>/etc/X11/xorg.conf.d/10-keyboard.conf</code>:</p>\n<div class=\"sourceCode\" id=\"cb14\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\"></a>Section &quot;InputDevice&quot;</span>\n<span id=\"cb14-2\"><a href=\"https://tylercipriani.com/blog/#cb14-2\"></a>  Identifier &quot;Muh Keyboard&quot;</span>\n<span id=\"cb14-3\"><a href=\"https://tylercipriani.com/blog/#cb14-3\"></a>  MatchIsKeyboard &quot;true&quot;</span>\n<span id=\"cb14-4\"><a href=\"https://tylercipriani.com/blog/#cb14-4\"></a>  Option &quot;xkblayout&quot; &quot;us&quot;</span>\n<span id=\"cb14-5\"><a href=\"https://tylercipriani.com/blog/#cb14-5\"></a>  Option &quot;xkbvariant&quot; &quot;altgr-intl&quot;</span>\n<span id=\"cb14-6\"><a href=\"https://tylercipriani.com/blog/#cb14-6\"></a>  Option &quot;Xkboptions&quot; &quot;compose:rctrl&quot;</span>\n<span id=\"cb14-7\"><a href=\"https://tylercipriani.com/blog/#cb14-7\"></a>  Option &quot;Xkboptions&quot; &quot;terminate:ctrl_alt_bksp&quot;</span>\n<span id=\"cb14-8\"><a href=\"https://tylercipriani.com/blog/#cb14-8\"></a>  Option &quot;Xkboptions&quot; &quot;ctrl:nocaps&quot;</span>\n<span id=\"cb14-9\"><a href=\"https://tylercipriani.com/blog/#cb14-9\"></a>EndSection</span></code></pre></div>\n<p>The <code>xset</code> commands and <code>xcape</code> daemon are a\nbit more difficult to persist when attaching external keyboards.</p>\n<p>In the lazy past, I created a file in my <code>~/bin/</code>\ndirectory (which, in my case, is on my <code>$PATH</code>) that I ran\nmanually whenever a new keyboard was attached.</p>\n<div class=\"sourceCode\" id=\"cb15\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb15-1\"><a href=\"https://tylercipriani.com/blog/#cb15-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb15-2\"><a href=\"https://tylercipriani.com/blog/#cb15-2\"></a><span class=\"co\">#</span></span>\n<span id=\"cb15-3\"><a href=\"https://tylercipriani.com/blog/#cb15-3\"></a><span class=\"co\"># ~/bin/keyboard—In case of new keyboard, break gla...er...I mean...run this.</span></span>\n<span id=\"cb15-4\"><a href=\"https://tylercipriani.com/blog/#cb15-4\"></a><span class=\"co\">#</span></span>\n<span id=\"cb15-5\"><a href=\"https://tylercipriani.com/blog/#cb15-5\"></a></span>\n<span id=\"cb15-6\"><a href=\"https://tylercipriani.com/blog/#cb15-6\"></a><span class=\"kw\">(</span></span>\n<span id=\"cb15-7\"><a href=\"https://tylercipriani.com/blog/#cb15-7\"></a>  <span class=\"fu\">sleep</span> 1</span>\n<span id=\"cb15-8\"><a href=\"https://tylercipriani.com/blog/#cb15-8\"></a></span>\n<span id=\"cb15-9\"><a href=\"https://tylercipriani.com/blog/#cb15-9\"></a>  <span class=\"va\">DISPLAY</span><span class=\"op\">=</span>:0.0 <span class=\"fu\">xset</span> <span class=\"at\">-b</span></span>\n<span id=\"cb15-10\"><a href=\"https://tylercipriani.com/blog/#cb15-10\"></a>  <span class=\"va\">DISPLAY</span><span class=\"op\">=</span>:0.0 <span class=\"fu\">xset</span> r rate 330 60</span>\n<span id=\"cb15-11\"><a href=\"https://tylercipriani.com/blog/#cb15-11\"></a>  <span class=\"ex\">xcape</span> <span class=\"at\">-e</span> <span class=\"st\">&#39;Control_L=Escape&#39;</span></span>\n<span id=\"cb15-12\"><a href=\"https://tylercipriani.com/blog/#cb15-12\"></a>  <span class=\"va\">DISPLAY</span><span class=\"op\">=</span>:0.0 <span class=\"ex\">notify-send</span> <span class=\"st\">&quot;External USB Connected&quot;</span></span>\n<span id=\"cb15-13\"><a href=\"https://tylercipriani.com/blog/#cb15-13\"></a><span class=\"kw\">)</span> <span class=\"kw\">&amp;</span></span></code></pre></div>\n<p>Getting over to my terminal and typing: <code>keyboard</code>\neverytime I attached a new keyboard is pretty far from\n<em>perfect</em>.</p>\n<p>So what are my other options? Initially, I thought about doing\nsomething with <code>acpid(8)</code> (<a\nhref=\"https://github.com/thcipriani/acpi\">since I use that a ton</a>),\nwhich would have been easy enough. <code>acpid</code> notifies\nuser-space utilities about system events, which includes when devices\nare attached.</p>\n<p>After reading a great post from <a\nhref=\"http://pbrisbin.com/posts/disable_all_the_caps/\">Pat Brisbin</a>\nabout udev events, I thought (and think) that’s the answer. You can\nprobably tell that my <code>~/bin/keyboard</code> script has evolved to\naccommodate what he outlined in his article. In any event (pun\nintended), I created a file at\n<code>/etc/udev/rules.d/99-usb-keyboards.rules</code> with the following\ncontents:</p>\n<div class=\"sourceCode\" id=\"cb16\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb16-1\"><a href=\"https://tylercipriani.com/blog/#cb16-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">SUBSYSTEM</span><span class=\"op\">=</span>=<span class=\"st\">&quot;input&quot;</span>, <span class=\"va\">ACTION</span><span class=\"op\">=</span>=<span class=\"st\">&quot;add&quot;</span>, <span class=\"va\">RUN</span><span class=\"op\">+=</span><span class=\"st\">&quot;/bin/su tyler --shell=/bin/bash -c /home/tyler/bin/keyboard&quot;</span></span></code></pre></div>\n<p>Which seems to do the trick!</p>\n<p>The configuration you see above is the result of <em>way too\nmuch</em> thinking about how I use my keyboard. Now, I just need to get\nthis configuration to work <em>without</em> <code>X</code> Server…<em>le\nsigh</em></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2014/11/30/conways-game-of-life-favicon/",

    "title": "Conway&#x2019;s Favicon",
    "url": "https://tylercipriani.com/blog/2014/11/30/conways-game-of-life-favicon/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "javascript"

    ],

    "date_published": "2014-11-30T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>I find favicons pretty useful overall. That weird little <a\nhref=\"https://bugs.r-project.org/bugzilla3/images/favicon.ico\">Earthworm-Jim-esque\nbug-head</a> in my bookmarks bar immediately queues me in on where to\nclick to get to bugzilla. My site hasn’t had a favicon. The only\nexplanation I can offer is laziness mixed with a lack of inspiration. A\nfavicon isn’t typically a glamorous undertaking—it’s just one of those\nthings that ought to be done.</p>\n<p>My first idea for a favicon was Eric S. Raymond’s <a\nhref=\"http://www.catb.org/hacker-emblem/\">Hacker Emblem</a>. The Hacker\nEmblem is certainly a meaningful symbol, but it’s also kind of a\ncop-out.</p>\n<p>I tried something with <a href=\"https://tylercipriani.com/images/nyan-conway.png\">nyan cat and\nthe hacker emblem</a>, which was a solid idea, but sort of lost\nsomething at 16px×16px. Then I started to think, <em>why not just have\nConway’s Game of Life running in the favicon</em>?</p>\n<section id=\"game-of-life-in-javascript\" class=\"level2\">\n<h2>Game of Life in JavaScript</h2>\n<p><a\nhref=\"https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life\">Conway’s\nGame of Life</a> is a zero player game with 4 simple rules (this is\nverbatim from the Wikipedia article):</p>\n<blockquote>\n<ol type=\"1\">\n<li>Any live cell with less than two live neighbours dies, as if caused\nby under-population.</li>\n<li>Any live cell with two or three live neighbours lives on to the next\ngeneration.</li>\n<li>Any live cell with more than three live neighbours dies, as if by\novercrowding.</li>\n<li>Any dead cell with exactly three live neighbours becomes a live\ncell, as if by reproduction.</li>\n</ol>\n</blockquote>\n<p><a\nhref=\"https://github.com/thcipriani/conways-favicon/blob/master/conways-favicon.js\">My\ngame of life</a> is heavily derived from an IBM DeveloperWorks post, <a\nhref=\"http://www.ibm.com/developerworks/library/wa-coffeescriptcanvas/\"><em>Conway’s\nGame of Life in CoffeeScript and canvas</em></a>, except that I just\nused plain ol’ JavaScript, a much smaller grid, and I included some\nfunctionality to reset the game seed if the last two evolutions of life\ndon’t change the grid layout.</p>\n</section>\n<section id=\"dynamic-favicons\" class=\"level2\">\n<h2>Dynamic Favicons</h2>\n<p>After creating the game loop in JavaScript, I had to create some code\nto dynamically update the favicon.</p>\n<p>First, I created the <a href=\"https://tylercipriani.com/favicon.ico\">default favicon</a> for\nthis site by rendering out a glider via JavaScript and rendering the\ncanvas as a png on the page.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a>GameOfLife<span class=\"op\">.</span><span class=\"at\">prototype</span><span class=\"op\">.</span><span class=\"at\">glider</span> <span class=\"op\">=</span> [</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a>  {<span class=\"dt\">x</span><span class=\"op\">:</span> <span class=\"dv\">0</span><span class=\"op\">,</span> <span class=\"dt\">y</span><span class=\"op\">:</span> <span class=\"dv\">1</span>}</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a> <span class=\"op\">,</span>{<span class=\"dt\">x</span><span class=\"op\">:</span> <span class=\"dv\">1</span><span class=\"op\">,</span> <span class=\"dt\">y</span><span class=\"op\">:</span> <span class=\"dv\">2</span>}</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a> <span class=\"op\">,</span>{<span class=\"dt\">x</span><span class=\"op\">:</span> <span class=\"dv\">2</span><span class=\"op\">,</span> <span class=\"dt\">y</span><span class=\"op\">:</span> <span class=\"dv\">0</span>}</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\"></a> <span class=\"op\">,</span>{<span class=\"dt\">x</span><span class=\"op\">:</span> <span class=\"dv\">2</span><span class=\"op\">,</span> <span class=\"dt\">y</span><span class=\"op\">:</span> <span class=\"dv\">1</span>}</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\"></a> <span class=\"op\">,</span>{<span class=\"dt\">x</span><span class=\"op\">:</span> <span class=\"dv\">2</span><span class=\"op\">,</span> <span class=\"dt\">y</span><span class=\"op\">:</span> <span class=\"dv\">2</span>}</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\"></a>]</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\"></a></span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\"></a><span class=\"co\">/* ... */</span></span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\"></a></span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\"></a><span class=\"co\">/**</span></span>\n<span id=\"cb1-12\"><a href=\"https://tylercipriani.com/blog/#cb1-12\"></a><span class=\"co\"> * Seed with default of glider</span></span>\n<span id=\"cb1-13\"><a href=\"https://tylercipriani.com/blog/#cb1-13\"></a><span class=\"co\"> */</span></span>\n<span id=\"cb1-14\"><a href=\"https://tylercipriani.com/blog/#cb1-14\"></a>GameOfLife<span class=\"op\">.</span><span class=\"at\">prototype</span><span class=\"op\">.</span><span class=\"at\">seed</span> <span class=\"op\">=</span> <span class=\"kw\">function</span>() {</span>\n<span id=\"cb1-15\"><a href=\"https://tylercipriani.com/blog/#cb1-15\"></a>  <span class=\"kw\">var</span> i<span class=\"op\">,</span> j<span class=\"op\">,</span> rowLen<span class=\"op\">,</span> colLen<span class=\"op\">,</span> row<span class=\"op\">,</span> col<span class=\"op\">,</span> gliderLen</span>\n<span id=\"cb1-16\"><a href=\"https://tylercipriani.com/blog/#cb1-16\"></a></span>\n<span id=\"cb1-17\"><a href=\"https://tylercipriani.com/blog/#cb1-17\"></a>  <span class=\"co\">// Start with all empty</span></span>\n<span id=\"cb1-18\"><a href=\"https://tylercipriani.com/blog/#cb1-18\"></a>  <span class=\"cf\">for</span>(i <span class=\"op\">=</span> row <span class=\"op\">=</span> <span class=\"dv\">0</span><span class=\"op\">,</span> rowLen <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">numberOfRows</span><span class=\"op\">;</span> i <span class=\"op\">&lt;</span> rowLen<span class=\"op\">;</span> row <span class=\"op\">=</span> <span class=\"op\">++</span>i) {</span>\n<span id=\"cb1-19\"><a href=\"https://tylercipriani.com/blog/#cb1-19\"></a>    <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">curCellGen</span>[row] <span class=\"op\">=</span> []</span>\n<span id=\"cb1-20\"><a href=\"https://tylercipriani.com/blog/#cb1-20\"></a>    <span class=\"cf\">for</span>(j <span class=\"op\">=</span> col <span class=\"op\">=</span> <span class=\"dv\">0</span><span class=\"op\">,</span> colLen <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">numberOfCols</span><span class=\"op\">;</span> j <span class=\"op\">&lt;</span> colLen<span class=\"op\">;</span> col <span class=\"op\">=</span> <span class=\"op\">++</span>j) {</span>\n<span id=\"cb1-21\"><a href=\"https://tylercipriani.com/blog/#cb1-21\"></a>      <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">curCellGen</span>[row][col] <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"fu\">createCell</span>(<span class=\"kw\">false</span><span class=\"op\">,</span> row<span class=\"op\">,</span> col)</span>\n<span id=\"cb1-22\"><a href=\"https://tylercipriani.com/blog/#cb1-22\"></a>    }</span>\n<span id=\"cb1-23\"><a href=\"https://tylercipriani.com/blog/#cb1-23\"></a>  }</span>\n<span id=\"cb1-24\"><a href=\"https://tylercipriani.com/blog/#cb1-24\"></a></span>\n<span id=\"cb1-25\"><a href=\"https://tylercipriani.com/blog/#cb1-25\"></a>  <span class=\"co\">// Create glider</span></span>\n<span id=\"cb1-26\"><a href=\"https://tylercipriani.com/blog/#cb1-26\"></a>  <span class=\"cf\">for</span>(i <span class=\"op\">=</span> <span class=\"dv\">0</span><span class=\"op\">,</span> gliderLen <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">glider</span><span class=\"op\">.</span><span class=\"at\">length</span><span class=\"op\">;</span> i <span class=\"op\">&lt;</span> gliderLen<span class=\"op\">;</span> i<span class=\"op\">++</span>) {</span>\n<span id=\"cb1-27\"><a href=\"https://tylercipriani.com/blog/#cb1-27\"></a>    <span class=\"kw\">var</span> x<span class=\"op\">,</span> y</span>\n<span id=\"cb1-28\"><a href=\"https://tylercipriani.com/blog/#cb1-28\"></a></span>\n<span id=\"cb1-29\"><a href=\"https://tylercipriani.com/blog/#cb1-29\"></a>    x <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">glider</span>[i]<span class=\"op\">.</span><span class=\"at\">x</span></span>\n<span id=\"cb1-30\"><a href=\"https://tylercipriani.com/blog/#cb1-30\"></a>    y <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">glider</span>[i]<span class=\"op\">.</span><span class=\"at\">y</span></span>\n<span id=\"cb1-31\"><a href=\"https://tylercipriani.com/blog/#cb1-31\"></a></span>\n<span id=\"cb1-32\"><a href=\"https://tylercipriani.com/blog/#cb1-32\"></a>    <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">curCellGen</span>[x][y] <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"fu\">createCell</span>(<span class=\"kw\">true</span><span class=\"op\">,</span> x<span class=\"op\">,</span> y)</span>\n<span id=\"cb1-33\"><a href=\"https://tylercipriani.com/blog/#cb1-33\"></a>  }</span>\n<span id=\"cb1-34\"><a href=\"https://tylercipriani.com/blog/#cb1-34\"></a>}</span>\n<span id=\"cb1-35\"><a href=\"https://tylercipriani.com/blog/#cb1-35\"></a></span>\n<span id=\"cb1-36\"><a href=\"https://tylercipriani.com/blog/#cb1-36\"></a>GameOfLife<span class=\"op\">.</span><span class=\"at\">prototype</span><span class=\"op\">.</span><span class=\"at\">drawGrid</span> <span class=\"op\">=</span> <span class=\"kw\">function</span>() {</span>\n<span id=\"cb1-37\"><a href=\"https://tylercipriani.com/blog/#cb1-37\"></a>  <span class=\"kw\">var</span> img <span class=\"op\">=</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"fu\">createElement</span>(<span class=\"st\">&#39;img&#39;</span>)</span>\n<span id=\"cb1-38\"><a href=\"https://tylercipriani.com/blog/#cb1-38\"></a>  img<span class=\"op\">.</span><span class=\"at\">src</span> <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">canvas</span><span class=\"op\">.</span><span class=\"fu\">toDataURL</span>(<span class=\"st\">&#39;img/png&#39;</span>)</span>\n<span id=\"cb1-39\"><a href=\"https://tylercipriani.com/blog/#cb1-39\"></a>}</span></code></pre></div>\n<p>After rendering as a png in the browser, I saved the\n<code>.png</code> to my computer. Then I uploaded the png to <a\nhref=\"http://favicon-generator.org/\">favicon-generator.org</a> saving\nthe resulting <code>.ico</code> to my site’s directory root as\n<code>favicon.ico</code>. <code>favicon.ico</code> is what gets rendered\nin IE, since IE has found brand new ways to be non-compliant with\nemerging standards (le sigh).</p>\n<p>The finishing touch is to make the\n<code>GameOfLife.prototype.drawGrid</code> function update my favicon’s\n<code>href</code> attribute on every <code>tick</code> function\ncall:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a>GameOfLife<span class=\"op\">.</span><span class=\"at\">prototype</span><span class=\"op\">.</span><span class=\"at\">createCanvas</span> <span class=\"op\">=</span> <span class=\"kw\">function</span>() {</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a>  <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">canvas</span> <span class=\"op\">=</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"fu\">createElement</span>(<span class=\"st\">&#39;canvas&#39;</span>)</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a>  <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">favicon</span> <span class=\"op\">=</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"fu\">createElement</span>(<span class=\"st\">&#39;link&#39;</span>)</span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a>  <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">favicon</span><span class=\"op\">.</span><span class=\"at\">rel</span> <span class=\"op\">=</span> <span class=\"st\">&#39;icon&#39;</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a>  <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"fu\">getElementsByTagName</span>(<span class=\"st\">&#39;head&#39;</span>)[<span class=\"dv\">0</span>]<span class=\"op\">.</span><span class=\"fu\">appendChild</span>(link)</span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a>}</span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\"></a></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\"></a>GameOfLife<span class=\"op\">.</span><span class=\"at\">prototype</span><span class=\"op\">.</span><span class=\"at\">drawGrid</span> <span class=\"op\">=</span> <span class=\"kw\">function</span>() {</span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\"></a>  <span class=\"co\">/* ... */</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\"></a>  <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">favicon</span><span class=\"op\">.</span><span class=\"at\">href</span> <span class=\"op\">=</span> <span class=\"kw\">this</span><span class=\"op\">.</span><span class=\"at\">canvas</span><span class=\"op\">.</span><span class=\"fu\">toDataURL</span>(<span class=\"st\">&#39;img/png&#39;</span>)</span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\"></a>}</span></code></pre></div>\n<p>The entirety of this javascript is available under the <a\nhref=\"https://tldrlegal.com/license/gnu-general-public-license-v3-%28gpl-3%29\">GPLv3\nLicense</a> on <a\nhref=\"https://github.com/thcipriani/conways-favicon\">my github</a>.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2014/07/12/crossbrowser-javascript-scrollbar-detection/",

    "title": "Cross-Browser JavaScript Scrollbar Detection",
    "url": "https://tylercipriani.com/blog/2014/07/12/crossbrowser-javascript-scrollbar-detection/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "design",

     "javascript"

    ],

    "date_published": "2014-07-12T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I recently contributed a fix to the <a\nhref=\"https://github.com/twbs/bootstrap/issues/9855\">bootstrap\nframework</a> that detects on-screen scrollbars to determine whether or\nnot the body should be padded when a modal window is opened to prevent\nshifting of background contents. Detecting on-screen scrollbars turned\nout to be a bit more involved than I initially anticipated.</p>\n<p>The tl;dr, semi-näive version:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a><span class=\"kw\">var</span> hasScrollbar <span class=\"op\">=</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"at\">innerWidth</span> <span class=\"op\">&gt;</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">clientWidth</span></span></code></pre></div>\n<p>This works for most browsers. Basically it checks to see if the width\nof the <code>window</code> element (read: including scrollbars) is\ngreater than the width of the root element of the page (read: without\nscrollbars). If the width of the page with scrollbars is greater than\nthe width of a page without scrollbars it would stand to reason that the\nextra width <em>is</em> a scrollbar.</p>\n<p>This solution behaves correctly when IE10+ has\n<code>@-ms-viewport { width: device-width; }</code> set (as it is in the\nbootstrap framework), which seems to result in scrollbars being\nauto-hidden. This solution also works for Chrome on the Mac where the\nscrollbars are automagically hidden.</p>\n<p>This certainly seems to function as expected for IE9+; however, <a\nhref=\"http://www.paulirish.com/2011/browser-market-pollution-iex-is-the-new-ie6/\">IE8\nis our newest anchor browser</a> so IE8 should be addressed in any\nostensibly “cross-browser” approaches.</p>\n<p><code>window.innerWidth</code> doesn’t exist on IE8. Any workarounds\nyou see utilizing <code>document.documentElement</code> will not include\nscrollbars in the reported width, so\n<code>document.docutmentElement</code> will not be an adequate\nsubstitute in &lt; IE9.</p>\n<p>One thing to check is the <code>scrollHeight</code>. If the\n<code>scrollHeight</code> of the root element is greater than the\n<code>clientHeight</code> of the root element, then that root element is\ngoing to need to scroll to show the overflowing content:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"kw\">var</span> hasScrollbar</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a><span class=\"cf\">if</span> (<span class=\"kw\">typeof</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"at\">innerWidth</span> <span class=\"op\">===</span> <span class=\"st\">&#39;number&#39;</span>)</span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a>  hasScrollbar <span class=\"op\">=</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"at\">innerWidth</span> <span class=\"op\">&gt;</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">clientWidth</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a>hasScrollbar <span class=\"op\">=</span> hasScrollbar <span class=\"op\">||</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a>  <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">scrollHeight</span> <span class=\"op\">&gt;</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">clientHeight</span></span></code></pre></div>\n<p>Again, this is an oversimplification. The <code>overflow</code>\nproperty of the root element can modify the appearance of scrollbars (to\ncreate on-screen <em>faux</em> llbars). Of course, once again, IE and\nmodern browsers differ about how they’ve implemented the javascript api\nfor accessing element styles. We can account for this difference and\ngrab the overflow property like this:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\"></a><span class=\"kw\">var</span> overflowStyle</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\"></a></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\"></a><span class=\"cf\">if</span> (<span class=\"kw\">typeof</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">currentStyle</span> <span class=\"op\">!==</span> <span class=\"st\">&#39;undefined&#39;</span>)</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\"></a>  overflowStyle <span class=\"op\">=</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">currentStyle</span><span class=\"op\">.</span><span class=\"at\">overflow</span></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\"></a></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\"></a>overflowStyle <span class=\"op\">=</span> overflowStyle <span class=\"op\">||</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"fu\">getComputedStyle</span>(<span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">,</span> <span class=\"st\">&#39;&#39;</span>)<span class=\"op\">.</span><span class=\"at\">overflow</span></span></code></pre></div>\n<p>The two values of the <code>overflow</code> or\n<code>overflow-y</code> properties that will create scrollbars are\n<code>visible</code> and <code>auto</code> provided that the\n<code>scrollHeight</code> is greater than the <code>clientHeight</code>.\nA value of <code>scroll</code> for the <code>overflow</code> or\n<code>overflow-y</code> properties will always cause a scrollbar.</p>\n<p>This is, once again, a bit of a simplification.</p>\n<p>In quirksmode in IE8\n<code>document.documentElement.clientHeight</code> is 0. The root\nelement is <code>document.body</code>. This won’t affect most people\nreading this, but just to be on the safe side let’s add it into our\nsolution.</p>\n<p>The final solution looks like this:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource javascript numberLines\"><code class=\"sourceCode javascript\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a><span class=\"kw\">var</span> hasScrollbar <span class=\"op\">=</span> <span class=\"kw\">function</span>() {</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\"></a>  <span class=\"co\">// The Modern solution</span></span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\"></a>  <span class=\"cf\">if</span> (<span class=\"kw\">typeof</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"at\">innerWidth</span> <span class=\"op\">===</span> <span class=\"st\">&#39;number&#39;</span>)</span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\"></a>    <span class=\"cf\">return</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"at\">innerWidth</span> <span class=\"op\">&gt;</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span><span class=\"op\">.</span><span class=\"at\">clientWidth</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\"></a></span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\"></a>  <span class=\"co\">// rootElem for quirksmode</span></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\"></a>  <span class=\"kw\">var</span> rootElem <span class=\"op\">=</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">documentElement</span> <span class=\"op\">||</span> <span class=\"bu\">document</span><span class=\"op\">.</span><span class=\"at\">body</span></span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\"></a></span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\"></a>  <span class=\"co\">// Check overflow style property on body for fauxscrollbars</span></span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\"></a>  <span class=\"kw\">var</span> overflowStyle</span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\"></a></span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\"></a>  <span class=\"cf\">if</span> (<span class=\"kw\">typeof</span> rootElem<span class=\"op\">.</span><span class=\"at\">currentStyle</span> <span class=\"op\">!==</span> <span class=\"st\">&#39;undefined&#39;</span>)</span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\"></a>    overflowStyle <span class=\"op\">=</span> rootElem<span class=\"op\">.</span><span class=\"at\">currentStyle</span><span class=\"op\">.</span><span class=\"at\">overflow</span></span>\n<span id=\"cb4-14\"><a href=\"https://tylercipriani.com/blog/#cb4-14\"></a></span>\n<span id=\"cb4-15\"><a href=\"https://tylercipriani.com/blog/#cb4-15\"></a>  overflowStyle <span class=\"op\">=</span> overflowStyle <span class=\"op\">||</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"fu\">getComputedStyle</span>(rootElem<span class=\"op\">,</span> <span class=\"st\">&#39;&#39;</span>)<span class=\"op\">.</span><span class=\"at\">overflow</span></span>\n<span id=\"cb4-16\"><a href=\"https://tylercipriani.com/blog/#cb4-16\"></a></span>\n<span id=\"cb4-17\"><a href=\"https://tylercipriani.com/blog/#cb4-17\"></a>    <span class=\"co\">// Also need to check the Y axis overflow</span></span>\n<span id=\"cb4-18\"><a href=\"https://tylercipriani.com/blog/#cb4-18\"></a>  <span class=\"kw\">var</span> overflowYStyle</span>\n<span id=\"cb4-19\"><a href=\"https://tylercipriani.com/blog/#cb4-19\"></a></span>\n<span id=\"cb4-20\"><a href=\"https://tylercipriani.com/blog/#cb4-20\"></a>  <span class=\"cf\">if</span> (<span class=\"kw\">typeof</span> rootElem<span class=\"op\">.</span><span class=\"at\">currentStyle</span> <span class=\"op\">!==</span> <span class=\"st\">&#39;undefined&#39;</span>)</span>\n<span id=\"cb4-21\"><a href=\"https://tylercipriani.com/blog/#cb4-21\"></a>    overflowYStyle <span class=\"op\">=</span> rootElem<span class=\"op\">.</span><span class=\"at\">currentStyle</span><span class=\"op\">.</span><span class=\"at\">overflowY</span></span>\n<span id=\"cb4-22\"><a href=\"https://tylercipriani.com/blog/#cb4-22\"></a></span>\n<span id=\"cb4-23\"><a href=\"https://tylercipriani.com/blog/#cb4-23\"></a>  overflowYStyle <span class=\"op\">=</span> overflowYStyle <span class=\"op\">||</span> <span class=\"bu\">window</span><span class=\"op\">.</span><span class=\"fu\">getComputedStyle</span>(rootElem<span class=\"op\">,</span> <span class=\"st\">&#39;&#39;</span>)<span class=\"op\">.</span><span class=\"at\">overflowY</span></span>\n<span id=\"cb4-24\"><a href=\"https://tylercipriani.com/blog/#cb4-24\"></a></span>\n<span id=\"cb4-25\"><a href=\"https://tylercipriani.com/blog/#cb4-25\"></a>  <span class=\"kw\">var</span> contentOverflows <span class=\"op\">=</span> rootElem<span class=\"op\">.</span><span class=\"at\">scrollHeight</span> <span class=\"op\">&gt;</span> rootElem<span class=\"op\">.</span><span class=\"at\">clientHeight</span></span>\n<span id=\"cb4-26\"><a href=\"https://tylercipriani.com/blog/#cb4-26\"></a>  <span class=\"kw\">var</span> overflowShown    <span class=\"op\">=</span> <span class=\"ss\">/</span><span class=\"sc\">^(</span><span class=\"ss\">visible</span><span class=\"sc\">|</span><span class=\"ss\">auto</span><span class=\"sc\">)$</span><span class=\"ss\">/</span><span class=\"op\">.</span><span class=\"fu\">test</span>(overflowStyle) <span class=\"op\">||</span> <span class=\"ss\">/</span><span class=\"sc\">^(</span><span class=\"ss\">visible</span><span class=\"sc\">|</span><span class=\"ss\">auto</span><span class=\"sc\">)$</span><span class=\"ss\">/</span><span class=\"op\">.</span><span class=\"fu\">test</span>(overflowYStyle)</span>\n<span id=\"cb4-27\"><a href=\"https://tylercipriani.com/blog/#cb4-27\"></a>  <span class=\"kw\">var</span> alwaysShowScroll <span class=\"op\">=</span> overflowStyle <span class=\"op\">===</span> <span class=\"st\">&#39;scroll&#39;</span> <span class=\"op\">||</span> overflowYStyle <span class=\"op\">===</span> <span class=\"st\">&#39;scroll&#39;</span></span>\n<span id=\"cb4-28\"><a href=\"https://tylercipriani.com/blog/#cb4-28\"></a></span>\n<span id=\"cb4-29\"><a href=\"https://tylercipriani.com/blog/#cb4-29\"></a>  <span class=\"cf\">return</span> (contentOverflows <span class=\"op\">&amp;&amp;</span> overflowShown) <span class=\"op\">||</span> (alwaysShowScroll)</span>\n<span id=\"cb4-30\"><a href=\"https://tylercipriani.com/blog/#cb4-30\"></a>}</span></code></pre></div>\n<p>If I missed something, or if <em>this</em> solution is a bit of an\noversimplification (le sigh), please let me know in the comments.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/",

    "title": "Development Environments with Vagrant, Docker, and Supervisord",
    "url": "https://tylercipriani.com/blog/2014/05/25/lightweight-portable-vagrant-docker/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "docker",

     "shell",

     "vagrant"

    ],

    "date_published": "2014-05-25T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>I’ve used Vagrant a fair amount in my day, and it’s great. I enjoy\nbeing able to spin-up toy linux environments to test out ideas. I tend\nto use the <a\nhref=\"http://docs.vagrantup.com/v2/provisioning/chef_solo.html\">Chef\nprovisioner</a> with Vagrant to build-out a local environment that\nmatches my server fairly closely.</p>\n<section id=\"my-ever-evolving-rant-about-devops\" class=\"level2\">\n<h2>My Ever-Evolving Rant About DevOps</h2>\n<p>I’ve been thinking about Chef a lot lately. Often is the time, in\nmoments of profound frustration, that I’ve had the thought that Chef is\nnothing more than a useless, leaky abstraction that separates me from\nsomething I know fairly well—Linux.</p>\n<p>This thought is usually fleeting: Chef provides many needed\nabstractions that are, ultimately, much easier to grok than the\nunderlying Linux system. Further, Chef allows you to keep a(n\nostensibly) well-tested system under version control.</p>\n<p>I’ve come to the realization that my problem with Chef is not really\na problem with Chef, but a <a\nhref=\"https://www.domenkozar.com/2014/03/11/why-puppet-chef-ansible-arent-good-enough-and-we-can-do-better/\">problem\nwith Linux itself</a>.</p>\n<p>Linux system administration is difficult because Linux commands are\nnon-deterministic and rely heavily on system state (e.g., installed\nsoftware, permissions, network settings and availability). Maintaining a\nbare-metal, long-running server non-interactively using Chef sucks\nbecause <a\nhref=\"http://me.andering.com/2011/02/03/server-login-considered-harmful/\">any\nhand-tinkering via ssh</a> is going to fuck with the “state” of the\nsystem—creating different results for subsequent chef-client runs. This\nsystem state adjustment may or may not be reflected in the chef\nrepository (which double sucks).</p>\n</section>\n<section id=\"why-docker-curtails-my-rage\" class=\"level2\">\n<h2>Why Docker Curtails My Rage</h2>\n<p>I started to think about Docker. I feel Docker addresses the problem\nof program state better than other currently available solutions\n(although, <a href=\"https://nixos.org/nixos/\">Nix</a> is looking pretty\npromising as well). While Docker is still a Linux system—and, ipso\nfacto, state-dependant—it’s also ephemeral and therefore, by not\npersisting changes to state, Docker has created a previously unavailable\n(on bare metal hardware), lightweight workaround to the problem of\nsystem state.</p>\n<p>As is my wont, I decided today to play a bit with Docker on Vagrant\nand, lo-and-below, I found that the newest version of Vagrant (1.6.2, as\nof May 26th) can actually use <a\nhref=\"https://www.vagrantup.com/blog/feature-preview-vagrant-1-6-docker-dev-environments.html\">docker\nas a <em>provider</em></a>, that is, as an alternative to VirtualBox.\nUsing Docker as a provider means that you can run a fully-independent\ndevelopment enviroment, on your host machine without the overhead of\nVirtualBox. Neat.</p>\n<p>“Imma setup a local development environment for Ubuntu 14.04, nginx\nand php-fpm using Vagrant, Supervisord and Docker,” says I.</p>\n</section>\n<section id=\"project-layout\" class=\"level2\">\n<h2>Project Layout</h2>\n<p>To keep my project directory nice and tidy, I’ve separated-out most\nof the files needed by the Docker provider into a <code>Docker</code>\nfolder. This results in the directory structure below.</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> Docker</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> ├── Dockerfile</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> ├── nginx</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> │   └── default</span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> ├── php-fpm</span>\n<span id=\"cb1-6\"><a href=\"https://tylercipriani.com/blog/#cb1-6\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> │   └── php-fpm.conf</span>\n<span id=\"cb1-7\"><a href=\"https://tylercipriani.com/blog/#cb1-7\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span> └── supervisor</span>\n<span id=\"cb1-8\"><a href=\"https://tylercipriani.com/blog/#cb1-8\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">│  </span>     └── supervisord.conf</span>\n<span id=\"cb1-9\"><a href=\"https://tylercipriani.com/blog/#cb1-9\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">├──</span> Vagrantfile</span>\n<span id=\"cb1-10\"><a href=\"https://tylercipriani.com/blog/#cb1-10\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">└──</span> www</span>\n<span id=\"cb1-11\"><a href=\"https://tylercipriani.com/blog/#cb1-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>    <span class=\"ex\">└──</span> index.php</span></code></pre></div>\n<p>The <code>Dockerfile</code> is used to build the main docker machine\nand the subfolders in the <code>Docker</code> directory contain\nconfiguration used in the <code>Dockerfile</code>.</p>\n<p>The <code>www</code> folder is my fake php project folder.</p>\n</section>\n<section id=\"vagrantfile\" class=\"level2\">\n<h2>VagrantFile</h2>\n<p>Since docker handles so much of what was previously handled by\nVagrant provisioner, the <code>Vagrantfile</code> for a Docker-backed\nVagrant instance is pretty sparse.</p>\n<p>In mine, I’ve got:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource ruby numberLines\"><code class=\"sourceCode ruby\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"dt\">Vagrant</span><span class=\"at\">.configure</span>(<span class=\"dv\">2</span>) <span class=\"cf\">do</span> <span class=\"kw\">|</span>config<span class=\"kw\">|</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\"></a>  config<span class=\"at\">.vm.synced_folder</span> <span class=\"st\">&quot;./www&quot;</span>, <span class=\"st\">&quot;/var/www&quot;</span>   <span class=\"co\"># Sync&#39;d folder</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\"></a></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\"></a>  config<span class=\"at\">.vm.provider</span> <span class=\"st\">&quot;docker&quot;</span> <span class=\"cf\">do</span> <span class=\"kw\">|</span>d<span class=\"kw\">|</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\"></a>    d<span class=\"at\">.build_dir</span> <span class=\"kw\">=</span> <span class=\"st\">&quot;./Docker&quot;</span> <span class=\"co\"># specifies the path to the Dockerfile</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\"></a>    d<span class=\"at\">.ports</span> <span class=\"kw\">&lt;&lt;</span> <span class=\"vs\">&#39;8080:80&#39;</span>     <span class=\"co\"># Forwards port 8080 from the host to the Docker Container port 80</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\"></a>  <span class=\"cf\">end</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\"></a><span class=\"cf\">end</span></span></code></pre></div>\n</section>\n<section id=\"dockerfile\" class=\"level2\">\n<h2>Dockerfile</h2>\n<p>Most of the work of provisioning a container is handled by Docker and\nthe Dockerfile. In fact, if you were only ever going to run this\ncontainer on a Linux machine, I don’t think that Vagrant adds any needed\nfunctionality to the <code>docker.io</code> cli. In terms of\nportability, however, Vagrant is, at this time, a necessary evil to run\ndocker on OSX and Windows.</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\"></a><span class=\"ex\">FROM</span> ubuntu:latest</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\"></a></span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\"></a><span class=\"ex\">MAINTAINER</span> Tyler Cipriani, tyler@tylercipriani.com</span>\n<span id=\"cb3-4\"><a href=\"https://tylercipriani.com/blog/#cb3-4\"></a></span>\n<span id=\"cb3-5\"><a href=\"https://tylercipriani.com/blog/#cb3-5\"></a><span class=\"co\"># Download and install php, nginx, and supervisor, hey, just linux for a change!</span></span>\n<span id=\"cb3-6\"><a href=\"https://tylercipriani.com/blog/#cb3-6\"></a><span class=\"ex\">RUN</span> apt-get update</span>\n<span id=\"cb3-7\"><a href=\"https://tylercipriani.com/blog/#cb3-7\"></a><span class=\"ex\">RUN</span> apt-get install <span class=\"at\">-y</span> software-properties-common</span>\n<span id=\"cb3-8\"><a href=\"https://tylercipriani.com/blog/#cb3-8\"></a><span class=\"ex\">RUN</span> add-apt-repository ppa:nginx/stable</span>\n<span id=\"cb3-9\"><a href=\"https://tylercipriani.com/blog/#cb3-9\"></a><span class=\"ex\">RUN</span> apt-get update</span>\n<span id=\"cb3-10\"><a href=\"https://tylercipriani.com/blog/#cb3-10\"></a><span class=\"ex\">RUN</span> apt-get <span class=\"at\">-y</span> dist-upgrade</span>\n<span id=\"cb3-11\"><a href=\"https://tylercipriani.com/blog/#cb3-11\"></a><span class=\"ex\">RUN</span> apt-get install <span class=\"at\">-y</span> php5-fpm nginx supervisor</span>\n<span id=\"cb3-12\"><a href=\"https://tylercipriani.com/blog/#cb3-12\"></a></span>\n<span id=\"cb3-13\"><a href=\"https://tylercipriani.com/blog/#cb3-13\"></a><span class=\"co\"># Setup config files</span></span>\n<span id=\"cb3-14\"><a href=\"https://tylercipriani.com/blog/#cb3-14\"></a><span class=\"ex\">RUN</span> echo <span class=\"st\">&quot;daemon off;&quot;</span> <span class=\"op\">&gt;&gt;</span> /etc/nginx/nginx.conf</span>\n<span id=\"cb3-15\"><a href=\"https://tylercipriani.com/blog/#cb3-15\"></a><span class=\"ex\">ADD</span> ./nginx/default /etc/nginx/sites-enabled/default</span>\n<span id=\"cb3-16\"><a href=\"https://tylercipriani.com/blog/#cb3-16\"></a><span class=\"ex\">ADD</span> ./supervisor/supervisord.conf /etc/supervisor/supervisord.conf</span>\n<span id=\"cb3-17\"><a href=\"https://tylercipriani.com/blog/#cb3-17\"></a><span class=\"ex\">ADD</span> ./php-fpm/php-fpm.conf /etc/php5/fpm/php-fpm.conf</span>\n<span id=\"cb3-18\"><a href=\"https://tylercipriani.com/blog/#cb3-18\"></a></span>\n<span id=\"cb3-19\"><a href=\"https://tylercipriani.com/blog/#cb3-19\"></a><span class=\"co\"># Shared volume</span></span>\n<span id=\"cb3-20\"><a href=\"https://tylercipriani.com/blog/#cb3-20\"></a><span class=\"ex\">RUN</span> mkdir <span class=\"at\">-p</span> /var/www</span>\n<span id=\"cb3-21\"><a href=\"https://tylercipriani.com/blog/#cb3-21\"></a><span class=\"ex\">VOLUME</span> [<span class=\"st\">&quot;/var/www&quot;</span>]</span>\n<span id=\"cb3-22\"><a href=\"https://tylercipriani.com/blog/#cb3-22\"></a></span>\n<span id=\"cb3-23\"><a href=\"https://tylercipriani.com/blog/#cb3-23\"></a><span class=\"co\"># Default command for container, start supervisor</span></span>\n<span id=\"cb3-24\"><a href=\"https://tylercipriani.com/blog/#cb3-24\"></a><span class=\"ex\">CMD</span> [<span class=\"st\">&quot;supervisord&quot;</span>, <span class=\"st\">&quot;--nodaemon&quot;</span>]</span>\n<span id=\"cb3-25\"><a href=\"https://tylercipriani.com/blog/#cb3-25\"></a><span class=\"ex\">USER</span> root</span>\n<span id=\"cb3-26\"><a href=\"https://tylercipriani.com/blog/#cb3-26\"></a></span>\n<span id=\"cb3-27\"><a href=\"https://tylercipriani.com/blog/#cb3-27\"></a><span class=\"co\"># Expose port 80 of the container</span></span>\n<span id=\"cb3-28\"><a href=\"https://tylercipriani.com/blog/#cb3-28\"></a><span class=\"ex\">EXPOSE</span> 80</span></code></pre></div>\n<p>This <code>Dockerfile</code> takes care of building a docker\ncontainer from the latest Ubuntu image (14.04 as of May 26th, 2014).\nRunning this code installs:</p>\n<ul>\n<li>Nginx 1.6.0</li>\n<li>PHP 5.5.9</li>\n<li>Supervisor</li>\n</ul>\n<p>This config also starts supervisor with the <code>--nodaemon</code>\nflag by default. Docker can run a container running a non-daemonized\nprogram as a daemon (much like supervisor can run non-daemonized\nprograms as daemons). Supervisor is used as a way of running both nginx\nand php-fpm as non-daemonized programs. It is also noteworthy that the\ndockerfile creates and/or modifies configuration files for php-fpm and\nnginx to make sure they both run in non-daemon mode.</p>\n<p><code>nginx/default</code></p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource numberLines\"><code class=\"sourceCode\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a>server {</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\"></a>  listen 80 default_server;</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\"></a></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\"></a>  root  /var/www;</span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\"></a>  index index.php index.html;</span>\n<span id=\"cb4-6\"><a href=\"https://tylercipriani.com/blog/#cb4-6\"></a></span>\n<span id=\"cb4-7\"><a href=\"https://tylercipriani.com/blog/#cb4-7\"></a>  # pass the PHP scripts to FastCGI server</span>\n<span id=\"cb4-8\"><a href=\"https://tylercipriani.com/blog/#cb4-8\"></a>  location ~ \\.php$ {</span>\n<span id=\"cb4-9\"><a href=\"https://tylercipriani.com/blog/#cb4-9\"></a>    try_files $uri =404;</span>\n<span id=\"cb4-10\"><a href=\"https://tylercipriani.com/blog/#cb4-10\"></a>    fastcgi_split_path_info ^(.+\\.php)(/.+)$;</span>\n<span id=\"cb4-11\"><a href=\"https://tylercipriani.com/blog/#cb4-11\"></a>    fastcgi_pass unix:/var/run/php5-fpm.sock;</span>\n<span id=\"cb4-12\"><a href=\"https://tylercipriani.com/blog/#cb4-12\"></a>    fastcgi_index index.php;</span>\n<span id=\"cb4-13\"><a href=\"https://tylercipriani.com/blog/#cb4-13\"></a>    include fastcgi_params;</span>\n<span id=\"cb4-14\"><a href=\"https://tylercipriani.com/blog/#cb4-14\"></a>  }</span>\n<span id=\"cb4-15\"><a href=\"https://tylercipriani.com/blog/#cb4-15\"></a>}</span></code></pre></div>\n<p><code>php-fpm/php-fpm.conf</code></p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode numberSource ini numberLines\"><code class=\"sourceCode ini\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\"></a><span class=\"kw\">[global]</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\"></a><span class=\"dt\">pid </span><span class=\"ot\">=</span><span class=\"st\"> /var/run/php5-fpm.pid</span></span>\n<span id=\"cb5-3\"><a href=\"https://tylercipriani.com/blog/#cb5-3\"></a><span class=\"dt\">error_log </span><span class=\"ot\">=</span><span class=\"st\"> /var/log/php5-fpm.log</span></span>\n<span id=\"cb5-4\"><a href=\"https://tylercipriani.com/blog/#cb5-4\"></a><span class=\"dt\">daemonize </span><span class=\"ot\">=</span><span class=\"st\"> </span><span class=\"kw\">no</span></span>\n<span id=\"cb5-5\"><a href=\"https://tylercipriani.com/blog/#cb5-5\"></a></span>\n<span id=\"cb5-6\"><a href=\"https://tylercipriani.com/blog/#cb5-6\"></a><span class=\"dt\">include</span><span class=\"ot\">=</span><span class=\"st\">/etc/php5/fpm/pool.d/*.conf</span></span></code></pre></div>\n<p><code>supervisor/supervisord.conf</code></p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode numberSource ini numberLines\"><code class=\"sourceCode ini\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\"></a><span class=\"kw\">[unix_http_server]</span></span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\"></a><span class=\"dt\">file</span><span class=\"ot\">=</span><span class=\"st\">/var/run/supervisor.sock   ; (the path to the socket file)</span></span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\"></a><span class=\"dt\">chmod</span><span class=\"ot\">=</span><span class=\"st\">0700                       ; sockef file mode (default 0700)</span></span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\"></a></span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\"></a><span class=\"kw\">[supervisord]</span></span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\"></a><span class=\"dt\">logfile</span><span class=\"ot\">=</span><span class=\"st\">/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\"></a><span class=\"dt\">logfile_maxbytes</span><span class=\"ot\">=</span><span class=\"st\">50MB        ; (max main logfile bytes b4 rotation;default 50MB)</span></span>\n<span id=\"cb6-8\"><a href=\"https://tylercipriani.com/blog/#cb6-8\"></a><span class=\"dt\">logfile_backups</span><span class=\"ot\">=</span><span class=\"st\">10           ; (num of main logfile rotation backups;default 10)</span></span>\n<span id=\"cb6-9\"><a href=\"https://tylercipriani.com/blog/#cb6-9\"></a><span class=\"dt\">loglevel</span><span class=\"ot\">=</span><span class=\"st\">info                ; (log level;default info; others: debug,warn,trace)</span></span>\n<span id=\"cb6-10\"><a href=\"https://tylercipriani.com/blog/#cb6-10\"></a><span class=\"dt\">pidfile</span><span class=\"ot\">=</span><span class=\"st\">/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)</span></span>\n<span id=\"cb6-11\"><a href=\"https://tylercipriani.com/blog/#cb6-11\"></a><span class=\"dt\">nodaemon</span><span class=\"ot\">=</span><span class=\"st\">false               ; (start in foreground if true;default false)</span></span>\n<span id=\"cb6-12\"><a href=\"https://tylercipriani.com/blog/#cb6-12\"></a><span class=\"dt\">minfds</span><span class=\"ot\">=</span><span class=\"st\">1024                  ; (min. avail startup file descriptors;default 1024)</span></span>\n<span id=\"cb6-13\"><a href=\"https://tylercipriani.com/blog/#cb6-13\"></a><span class=\"dt\">minprocs</span><span class=\"ot\">=</span><span class=\"st\">200                 ; (min. avail process descriptors;default 200)</span></span>\n<span id=\"cb6-14\"><a href=\"https://tylercipriani.com/blog/#cb6-14\"></a></span>\n<span id=\"cb6-15\"><a href=\"https://tylercipriani.com/blog/#cb6-15\"></a><span class=\"co\">; the below section must remain in the config file for RPC</span></span>\n<span id=\"cb6-16\"><a href=\"https://tylercipriani.com/blog/#cb6-16\"></a><span class=\"co\">; (supervisorctl/web interface) to work, additional interfaces may be</span></span>\n<span id=\"cb6-17\"><a href=\"https://tylercipriani.com/blog/#cb6-17\"></a><span class=\"co\">; added by defining them in separate rpcinterface: sections</span></span>\n<span id=\"cb6-18\"><a href=\"https://tylercipriani.com/blog/#cb6-18\"></a><span class=\"kw\">[rpcinterface:supervisor]</span></span>\n<span id=\"cb6-19\"><a href=\"https://tylercipriani.com/blog/#cb6-19\"></a><span class=\"dt\">supervisor.rpcinterface_factory </span><span class=\"ot\">=</span><span class=\"st\"> supervisor.rpcinterface:make_main_rpcinterface</span></span>\n<span id=\"cb6-20\"><a href=\"https://tylercipriani.com/blog/#cb6-20\"></a></span>\n<span id=\"cb6-21\"><a href=\"https://tylercipriani.com/blog/#cb6-21\"></a><span class=\"kw\">[supervisorctl]</span></span>\n<span id=\"cb6-22\"><a href=\"https://tylercipriani.com/blog/#cb6-22\"></a><span class=\"dt\">serverurl</span><span class=\"ot\">=</span><span class=\"st\">unix:///var/run/supervisor.sock ; use a unix:// URL  for a unix socket</span></span>\n<span id=\"cb6-23\"><a href=\"https://tylercipriani.com/blog/#cb6-23\"></a></span>\n<span id=\"cb6-24\"><a href=\"https://tylercipriani.com/blog/#cb6-24\"></a><span class=\"kw\">[program:php5-fpm]</span></span>\n<span id=\"cb6-25\"><a href=\"https://tylercipriani.com/blog/#cb6-25\"></a><span class=\"dt\">command</span><span class=\"ot\">=</span><span class=\"st\">/usr/sbin/php5-fpm -c /etc/php5/fpm</span></span>\n<span id=\"cb6-26\"><a href=\"https://tylercipriani.com/blog/#cb6-26\"></a><span class=\"dt\">stdout_events_enabled</span><span class=\"ot\">=</span><span class=\"kw\">true</span></span>\n<span id=\"cb6-27\"><a href=\"https://tylercipriani.com/blog/#cb6-27\"></a><span class=\"dt\">stderr_events_enabled</span><span class=\"ot\">=</span><span class=\"kw\">true</span></span>\n<span id=\"cb6-28\"><a href=\"https://tylercipriani.com/blog/#cb6-28\"></a></span>\n<span id=\"cb6-29\"><a href=\"https://tylercipriani.com/blog/#cb6-29\"></a><span class=\"kw\">[program:nginx]</span></span>\n<span id=\"cb6-30\"><a href=\"https://tylercipriani.com/blog/#cb6-30\"></a><span class=\"dt\">command</span><span class=\"ot\">=</span><span class=\"st\">/usr/sbin/nginx</span></span>\n<span id=\"cb6-31\"><a href=\"https://tylercipriani.com/blog/#cb6-31\"></a><span class=\"dt\">stdout_events_enabled</span><span class=\"ot\">=</span><span class=\"kw\">true</span></span>\n<span id=\"cb6-32\"><a href=\"https://tylercipriani.com/blog/#cb6-32\"></a><span class=\"dt\">stderr_events_enabled</span><span class=\"ot\">=</span><span class=\"kw\">true</span></span></code></pre></div>\n</section>\n<section id=\"jam-time\" class=\"level2\">\n<h2>Jam Time</h2>\n<p>With all of our configuration in place there isn’t much left to do\naside from running the vagrant instance and allowing docker to create\nour container.</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo docker pull ubuntu <span class=\"co\"># to grab the latest Ubuntu image, Vagrant should probably do this but doesn&#39;t</span></span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo vagrant up <span class=\"at\">--provider</span><span class=\"op\">=</span>docker <span class=\"at\">--debug</span> <span class=\"co\"># use debug if you don&#39;t want to sit waiting with no info for a long time on the first run</span></span></code></pre></div>\n<p>With that, you now have a container running nginx and php-fpm that is\nsharing a folder with you at <code>/var/www</code>. Navigating to\n<code>http://localhost:8080/index.php</code> should show you the\ncontents of your <code>./www/index.php</code> file.</p>\n<p>This process is really simple AND super lightweight. I’ve been\nrunning my docker/vagrant instance for about 45 minutes alongside chrome\nand tmux/xterm without any noticeable jankyness on a notoriously janky\nlaptop.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/",

    "title": "Create a Baller/Useful MOTD with ANSI Art",
    "url": "https://tylercipriani.com/blog/2014/05/22/creating-baller-useful-motd-ascii-art/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "ansi",

     "computing",

     "shell"

    ],

    "date_published": "2014-05-22T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<blockquote>\n<p><strong>EDIT</strong>: 2017-01-08</p>\n<p><a href=\"https://www.rzegocki.pl/\">Igor Rzegocki</a> has a project\nthat uses the same technique outlined here to make some incredible\nready-made <a href=\"https://github.com/ajgon/street-fighter-motd\">Street\nFIghter MotDs</a> – it is really cool, and if you are interested in\nabusing ansi escape sequences to make MotDs you should check it out\n:)</p>\n</blockquote>\n<figure>\n<img src=\"https://tylercipriani-files.s3.amazonaws.com/zangief_motd.png\"\nalt=\"Zangief MOtD\" />\n<figcaption aria-hidden=\"true\">Zangief MOtD</figcaption>\n</figure>\n<p>Everyone universally agrees that most <a\nhref=\"http://linux.die.net/man/5/motd\">Message of the Days (MOTDs)</a>\nare stupid and suck. By the end of reading this post, your mind grapes\nshould be swollen with the knowledge of how to make an MOTD that isn’t\nstupid and, some would say, <em>doesn’t</em> suck.</p>\n<section id=\"prerequisites\" class=\"level2\">\n<h2>Prerequisites</h2>\n<ul>\n<li>Imagemagick</li>\n<li>OpenJDK</li>\n<li>coreutils</li>\n<li>perl</li>\n<li>git</li>\n</ul>\n<p>This should have you covered:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo apt-get install imagemagick openjdk-6-jdk coreutils perl git</span></code></pre></div>\n</section>\n<section id=\"creating-the-util-say-file\" class=\"level2\">\n<h2>Creating the Util-say file</h2>\n<p>I use <a href=\"https://github.com/maandree/util-say\">Util-Say</a> to\ncreate motd messages. I started out using <a\nhref=\"https://github.com/rossy2401/img2xterm\">img2xterm</a>, but I’ve\nfound I get better results with Util-Say.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git clone https://github.com/maandree/util-say</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd util-say</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ./img2ponysay <span class=\"at\">--</span> yourimg.png <span class=\"op\">&gt;</span> yourimg.txt</span></code></pre></div>\n<p>You can also try\n<code>./img2ponysay -2 -- youimg.png &gt; yourimg.txt</code> but I’ve\nnever had good results with that</p>\n</section>\n<section id=\"motd-ifying\" class=\"level2\">\n<h2>MOTD-ifying</h2>\n<figure>\n<img src=\"https://tylercipriani-files.s3.amazonaws.com/mammoth_motd.png\"\nalt=\"Mammoth Motd\" />\n<figcaption aria-hidden=\"true\">Mammoth Motd</figcaption>\n</figure>\n<p>On CentOS and Debian, I usually just throw the ponysay file directly\ninto <code>/etc/motd</code> and maybe add on some other useful info:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo cat yourimg.txt <span class=\"op\">&gt;</span> /etc/motd</span>\n<span id=\"cb3-2\"><a href=\"https://tylercipriani.com/blog/#cb3-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo figlet <span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"fu\">hostname</span><span class=\"va\">)</span><span class=\"st\">&quot;</span> <span class=\"op\">&gt;&gt;</span> /etc/motd</span>\n<span id=\"cb3-3\"><a href=\"https://tylercipriani.com/blog/#cb3-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo printf <span class=\"st\">&quot;Public IP: </span><span class=\"va\">$(</span><span class=\"ex\">dig</span> +short myip.opendns.com @resolver1.opendns.com<span class=\"va\">)</span><span class=\"st\">\\n&quot;</span> <span class=\"op\">&gt;&gt;</span> /etc/motd</span></code></pre></div>\n<p>On Ubuntu Boxes (since they use <a\nhref=\"https://wiki.ubuntu.com/UpdateMotd\">update-motd(1)</a>), I do\npretty much the same thing except I just make a bash script in\n<code>/etc/update-motd.d/25-baller-motd</code></p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a><span class=\"co\">#!/usr/bin/env bash</span></span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\"></a><span class=\"fu\">cat</span> yourimg.txt</span>\n<span id=\"cb4-3\"><a href=\"https://tylercipriani.com/blog/#cb4-3\"></a><span class=\"ex\">figlet</span> <span class=\"st\">&quot;</span><span class=\"va\">$(</span><span class=\"fu\">hostname</span><span class=\"va\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb4-4\"><a href=\"https://tylercipriani.com/blog/#cb4-4\"></a><span class=\"bu\">printf</span> <span class=\"st\">&quot;Public IP: </span><span class=\"va\">$(</span><span class=\"ex\">dig</span> +short myip.opendns.com @resolver1.opendns.com<span class=\"va\">)</span><span class=\"st\">\\n&quot;</span></span>\n<span id=\"cb4-5\"><a href=\"https://tylercipriani.com/blog/#cb4-5\"></a><span class=\"bu\">command</span> <span class=\"at\">-v</span> fortune <span class=\"op\">&amp;&gt;</span> /dev/null <span class=\"kw\">&amp;&amp;</span> <span class=\"ex\">fortune</span></span></code></pre></div>\n<p>There are likely better articles on creating a <em>useful</em> MOTD,\n(<a\nhref=\"http://www.mewbies.com/how_to_customize_your_console_login_message_tutorial.htm\">here</a>’s\none that looks kinda cool) but there are exactly none-better articles on\ncreating MOTDs that are so flossy!</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/",

    "title": " Replacing Jekyll with Pandoc and a Makefile",
    "url": "https://tylercipriani.com/blog/2014/05/13/replace-jekyll-with-pandoc-makefile/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "jekyll",

     "make",

     "shell"

    ],

    "date_published": "2014-05-13T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<blockquote>\n<p><strong>EDIT</strong>: 2016-08-19</p>\n<p>I got an email a very long time ago that I meant to post about on ye\nold weblog from a fellow named <a href=\"http://tomduck.ca/\">Tom Duck</a>\nwho built a CMS based around some of the ideas presented here.</p>\n<p>It’s called <a\nhref=\"https://github.com/tomduck/bassclef/#bassclef-cms\">Bassclef</a>\nand it looks pretty amazing and folks should check it out.</p>\n</blockquote>\n<p>I used to use del.icio.us to keep track of links, then it went away.\nAfter del.icio.us shutdown, I used a ton of uniquely awful services to\nkeep track of links. Eventually, I came around to the idea that all I\nneeded was a series of markdown files and github: <a\nhref=\"https://github.com/thcipriani/links/tree/8d2442d4ba8a9090f645dd2cfe73216a7350dea5\">BOOM!</a>\nPublic link repositiory—just like del.icio.us back in the day.</p>\n<p>After a while I started thinking, I could make these files a lot more\npresentable if I did some jekyll-ifying and served them out on\ngithub.</p>\n<section id=\"previously-jekyllfied\" class=\"level2\">\n<h2>Previously Jekyllfied</h2>\n<p>My <code>linuxtips</code> repo is just a dumb jekyll repo. Esentially\nall <code>linuxtips</code> is is just <a\nhref=\"https://github.com/thcipriani/linuxtips/blob/master/README\">a big\n<code>README</code> file</a>. So, for that repo, I created a\n<code>gh-pages</code> branch with a <code>_config.yml</code> and a\n<code>_layout</code> directory and popped in a <a\nhref=\"https://github.com/thcipriani/linuxtips/blob/gh-pages/Makefile\">Makefile</a>:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">INDEX</span> = <span class=\"va\">${CURDIR}</span>/index.md</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">$(</span><span class=\"ex\">INDEX</span><span class=\"va\">)</span><span class=\"ex\">:</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">@</span> git show origin/master:README.md <span class=\"op\">&gt;</span> <span class=\"va\">$@</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">@</span> perl <span class=\"at\">-i</span> <span class=\"at\">-pe</span> <span class=\"st\">&#39;print &quot;---\\nlayout: default\\ntitle: Linux Tips\\n---\\n\\n&quot; if $$. == 1;&#39;</span> <span class=\"va\">$@</span></span></code></pre></div>\n<p>and then I got <a\nhref=\"http://www.tylercipriani.com/linuxtips/\">tylercipriani.com/linuxtips</a>;\nneat.</p>\n<p>I ran into some problems with that approach along the way. Mostly\nproblems with git and the separate branches and the order in which I’d\ncommit and pull and whatever, it was/is a headache.</p>\n</section>\n<section id=\"pandoc\" class=\"level2\">\n<h2>Pandoc</h2>\n<p>I started thinking about <a\nhref=\"http://johnmacfarlane.net/pandoc/\">Pandoc</a>. Pandoc is this\nhaskell library that makes miracles of text happen.</p>\n<p>Got an org-mode file and need TeX? Done.</p>\n<p>Got a markdown slideshow that needs to become a beamer slide show?\nOK, sure.</p>\n<p>Fuck Beamer, how about markdown slides → Reveal.js slides? You bet\nyour sweet sensual bologna.</p>\n</section>\n<section id=\"imma-install-pandoc\" class=\"level2\">\n<h2>Imma install Pandoc…</h2>\n<section id=\"debian\" class=\"level3\">\n<h3>Debian?</h3>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">sudo</span> apt-get install haskell-platform</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">cabal</span> update</span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">cabal</span> install pandoc</span></code></pre></div>\n<p>then add it to your path in your <code>.${SHELL}rc</code> file:</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"bu\">[</span> <span class=\"ot\">-d</span> <span class=\"st\">&quot;</span><span class=\"va\">$HOME</span><span class=\"st\">/.cabal/bin&quot;</span> <span class=\"bu\">]</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"bu\">export</span> <span class=\"va\">PATH</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$HOME</span><span class=\"st\">/.cabal/bin:</span><span class=\"va\">$PATH</span><span class=\"st\">&quot;</span></span></code></pre></div>\n</section>\n<section id=\"osx\" class=\"level3\">\n<h3>OSX?</h3>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">brew</span> update</span>\n<span id=\"cb4-2\"><a href=\"https://tylercipriani.com/blog/#cb4-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">brew</span> install pandoc</span></code></pre></div>\n</section>\n</section>\n<section id=\"imma-use-pandoc\" class=\"level2\">\n<h2>Imma Use Pandoc…</h2>\n<p>Alright, so I’ve got tons of markdown files, fairly structured, with\nbunches of links and I need html5. I’ll create a <code>Makefile</code>\nproof-of-concept for this:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">index.html:</span> README.md</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">pandoc</span> <span class=\"at\">-s</span> <span class=\"at\">-f</span> markdown <span class=\"at\">-t</span> html5 <span class=\"at\">-o</span> <span class=\"st\">&quot;</span><span class=\"va\">$@</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;$&lt;&quot;</span></span></code></pre></div>\n<p>Running <code>make</code> takes my <code>README.md</code> and makes\nthis:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode numberSource html numberLines\"><code class=\"sourceCode html\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\"></a><span class=\"dt\">&lt;!DOCTYPE </span>html<span class=\"dt\">&gt;</span></span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\"></a><span class=\"kw\">&lt;html&gt;</span></span>\n<span id=\"cb6-3\"><a href=\"https://tylercipriani.com/blog/#cb6-3\"></a><span class=\"kw\">&lt;head&gt;</span></span>\n<span id=\"cb6-4\"><a href=\"https://tylercipriani.com/blog/#cb6-4\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">charset</span><span class=\"ot\">=</span><span class=\"st\">&quot;utf-8&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb6-5\"><a href=\"https://tylercipriani.com/blog/#cb6-5\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">name</span><span class=\"ot\">=</span><span class=\"st\">&quot;generator&quot;</span> <span class=\"er\">content</span><span class=\"ot\">=</span><span class=\"st\">&quot;pandoc&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb6-6\"><a href=\"https://tylercipriani.com/blog/#cb6-6\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">name</span><span class=\"ot\">=</span><span class=\"st\">&quot;viewport&quot;</span> <span class=\"er\">content</span><span class=\"ot\">=</span><span class=\"st\">&quot;width=device-width, initial-scale=1.0, user-scalable=yes&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb6-7\"><a href=\"https://tylercipriani.com/blog/#cb6-7\"></a>  <span class=\"kw\">&lt;title&gt;&lt;/title&gt;</span></span>\n<span id=\"cb6-8\"><a href=\"https://tylercipriani.com/blog/#cb6-8\"></a>  <span class=\"kw\">&lt;style</span> <span class=\"er\">type</span><span class=\"ot\">=</span><span class=\"st\">&quot;text/css&quot;</span><span class=\"kw\">&gt;</span>code{<span class=\"kw\">white-space</span>: <span class=\"dv\">pre</span><span class=\"op\">;</span>}<span class=\"kw\">&lt;/style&gt;</span></span>\n<span id=\"cb6-9\"><a href=\"https://tylercipriani.com/blog/#cb6-9\"></a>  <span class=\"co\">&lt;!--[if lt IE 9]&gt;</span></span>\n<span id=\"cb6-10\"><a href=\"https://tylercipriani.com/blog/#cb6-10\"></a><span class=\"co\">    &lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;</span></span>\n<span id=\"cb6-11\"><a href=\"https://tylercipriani.com/blog/#cb6-11\"></a><span class=\"co\">  &lt;![endif]--&gt;</span></span>\n<span id=\"cb6-12\"><a href=\"https://tylercipriani.com/blog/#cb6-12\"></a><span class=\"kw\">&lt;/head&gt;</span></span>\n<span id=\"cb6-13\"><a href=\"https://tylercipriani.com/blog/#cb6-13\"></a><span class=\"kw\">&lt;body&gt;</span></span>\n<span id=\"cb6-14\"><a href=\"https://tylercipriani.com/blog/#cb6-14\"></a><span class=\"kw\">&lt;h1</span> <span class=\"er\">id</span><span class=\"ot\">=</span><span class=\"st\">&quot;tyler-ciprianis-bookmarks&quot;</span><span class=\"kw\">&gt;</span>Tyler Cipriani&#39;s Bookmarks<span class=\"kw\">&lt;/h1&gt;</span></span>\n<span id=\"cb6-15\"><a href=\"https://tylercipriani.com/blog/#cb6-15\"></a><span class=\"kw\">&lt;p&gt;</span>In an effort to <span class=\"kw\">&lt;em&gt;</span>not<span class=\"kw\">&lt;/em&gt;</span> have 100+ tabs open…<span class=\"kw\">&lt;/p&gt;</span></span>\n<span id=\"cb6-16\"><a href=\"https://tylercipriani.com/blog/#cb6-16\"></a><span class=\"kw\">&lt;ul&gt;</span></span>\n<span id=\"cb6-17\"><a href=\"https://tylercipriani.com/blog/#cb6-17\"></a><span class=\"kw\">&lt;li&gt;&lt;a</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;http://www.flickr.com/photos/tylercipriani/&quot;</span><span class=\"kw\">&gt;</span>My Photography<span class=\"kw\">&lt;/a&gt;&lt;/li&gt;</span></span>\n<span id=\"cb6-18\"><a href=\"https://tylercipriani.com/blog/#cb6-18\"></a><span class=\"kw\">&lt;li&gt;&lt;a</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;Design.md&quot;</span><span class=\"kw\">&gt;</span>Design<span class=\"kw\">&lt;/a&gt;&lt;/li&gt;</span></span>\n<span id=\"cb6-19\"><a href=\"https://tylercipriani.com/blog/#cb6-19\"></a><span class=\"kw\">&lt;li&gt;&lt;a</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;Development.md&quot;</span><span class=\"kw\">&gt;</span>Development<span class=\"kw\">&lt;/a&gt;&lt;/li&gt;</span></span>\n<span id=\"cb6-20\"><a href=\"https://tylercipriani.com/blog/#cb6-20\"></a><span class=\"kw\">&lt;li&gt;&lt;a</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;Business.md&quot;</span><span class=\"kw\">&gt;</span>Business<span class=\"kw\">&lt;/a&gt;&lt;/li&gt;</span></span>\n<span id=\"cb6-21\"><a href=\"https://tylercipriani.com/blog/#cb6-21\"></a><span class=\"kw\">&lt;li&gt;&lt;a</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;Fun.md&quot;</span><span class=\"kw\">&gt;</span>Fun<span class=\"kw\">&lt;/a&gt;&lt;/li&gt;</span></span>\n<span id=\"cb6-22\"><a href=\"https://tylercipriani.com/blog/#cb6-22\"></a><span class=\"kw\">&lt;/ul&gt;</span></span>\n<span id=\"cb6-23\"><a href=\"https://tylercipriani.com/blog/#cb6-23\"></a><span class=\"kw\">&lt;/body&gt;</span></span>\n<span id=\"cb6-24\"><a href=\"https://tylercipriani.com/blog/#cb6-24\"></a><span class=\"kw\">&lt;/html&gt;</span></span></code></pre></div>\n</section>\n<section id=\"titlelayoutcss\" class=\"level2\">\n<h2>Title/Layout/CSS</h2>\n<p>So now that I’m outputting html, I still need to be able to:</p>\n<ol type=\"1\">\n<li>Configure a layout in which to render html</li>\n<li>Include a css file in said layout</li>\n<li>Add post metadata to my layout (e.g., title, headline, etc.)</li>\n</ol>\n<p>Pandoc is able to do all of these\nthings—easy-peasy-lemon-squeezy.</p>\n<p>First, to establish a layout, let’s copy the default html5 layout\nfile for Pandoc:</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">pandoc</span> <span class=\"at\">-D</span> html5 <span class=\"op\">&gt;</span> _layout.html5</span></code></pre></div>\n<p>I’ll make some small tweaks to that file, keep the variables I need,\nditch the variables I don’t need. Here is the html5 layout file I came\nup with:</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode numberSource html numberLines\"><code class=\"sourceCode html\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\"></a><span class=\"dt\">&lt;!doctype </span>html<span class=\"dt\">&gt;</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\"></a><span class=\"kw\">&lt;html</span> <span class=\"er\">lang</span><span class=\"ot\">=</span><span class=\"st\">&quot;en&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-3\"><a href=\"https://tylercipriani.com/blog/#cb8-3\"></a><span class=\"kw\">&lt;head&gt;</span></span>\n<span id=\"cb8-4\"><a href=\"https://tylercipriani.com/blog/#cb8-4\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">charset</span><span class=\"ot\">=</span><span class=\"st\">&quot;utf-8&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-5\"><a href=\"https://tylercipriani.com/blog/#cb8-5\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">http-equiv</span><span class=\"ot\">=</span><span class=\"st\">&quot;X-UA-Compatible&quot;</span> <span class=\"er\">content</span><span class=\"ot\">=</span><span class=\"st\">&quot;IE=edge&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-6\"><a href=\"https://tylercipriani.com/blog/#cb8-6\"></a>  <span class=\"kw\">&lt;title&gt;</span>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$<span class=\"kw\">&lt;/title&gt;</span></span>\n<span id=\"cb8-7\"><a href=\"https://tylercipriani.com/blog/#cb8-7\"></a>  <span class=\"kw\">&lt;meta</span> <span class=\"er\">name</span><span class=\"ot\">=</span><span class=\"st\">&quot;viewport&quot;</span> <span class=\"er\">content</span><span class=\"ot\">=</span><span class=\"st\">&quot;width=device-width, initial-scale=1&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-8\"><a href=\"https://tylercipriani.com/blog/#cb8-8\"></a>  <span class=\"kw\">&lt;link</span> <span class=\"er\">rel</span><span class=\"ot\">=</span><span class=\"st\">&quot;stylesheet&quot;</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;http://fonts.googleapis.com/css?family=Open+Sans:800&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-9\"><a href=\"https://tylercipriani.com/blog/#cb8-9\"></a>$for(css)$</span>\n<span id=\"cb8-10\"><a href=\"https://tylercipriani.com/blog/#cb8-10\"></a>  <span class=\"kw\">&lt;link</span> <span class=\"er\">rel</span><span class=\"ot\">=</span><span class=\"st\">&quot;stylesheet&quot;</span> <span class=\"er\">href</span><span class=\"ot\">=</span><span class=\"st\">&quot;$css$&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-11\"><a href=\"https://tylercipriani.com/blog/#cb8-11\"></a>$endfor$</span>\n<span id=\"cb8-12\"><a href=\"https://tylercipriani.com/blog/#cb8-12\"></a><span class=\"kw\">&lt;/head&gt;</span></span>\n<span id=\"cb8-13\"><a href=\"https://tylercipriani.com/blog/#cb8-13\"></a><span class=\"kw\">&lt;body&gt;</span></span>\n<span id=\"cb8-14\"><a href=\"https://tylercipriani.com/blog/#cb8-14\"></a>  <span class=\"co\">&lt;!--[if lt IE 9]&gt;</span></span>\n<span id=\"cb8-15\"><a href=\"https://tylercipriani.com/blog/#cb8-15\"></a><span class=\"co\">    &lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;</span></span>\n<span id=\"cb8-16\"><a href=\"https://tylercipriani.com/blog/#cb8-16\"></a><span class=\"co\">  &lt;![endif]--&gt;</span></span>\n<span id=\"cb8-17\"><a href=\"https://tylercipriani.com/blog/#cb8-17\"></a></span>\n<span id=\"cb8-18\"><a href=\"https://tylercipriani.com/blog/#cb8-18\"></a>  <span class=\"kw\">&lt;main</span> <span class=\"er\">class</span><span class=\"ot\">=</span><span class=\"st\">&quot;container&quot;</span><span class=\"kw\">&gt;</span></span>\n<span id=\"cb8-19\"><a href=\"https://tylercipriani.com/blog/#cb8-19\"></a>    $body$</span>\n<span id=\"cb8-20\"><a href=\"https://tylercipriani.com/blog/#cb8-20\"></a>  <span class=\"kw\">&lt;/main&gt;</span></span>\n<span id=\"cb8-21\"><a href=\"https://tylercipriani.com/blog/#cb8-21\"></a></span>\n<span id=\"cb8-22\"><a href=\"https://tylercipriani.com/blog/#cb8-22\"></a><span class=\"kw\">&lt;/body&gt;</span></span>\n<span id=\"cb8-23\"><a href=\"https://tylercipriani.com/blog/#cb8-23\"></a><span class=\"kw\">&lt;/html&gt;</span></span></code></pre></div>\n<p>Next, I need to figure out how to include a css stylesheet. A quick\nsearch for <code>css</code> in <code>pandoc(1)</code> turns up the\n<code>--css</code> flag which enables you to link to a css\nstylesheet.</p>\n<p>Updated <code>Makefile</code>:</p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">index.html:</span> README.md</span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"ex\">pandoc</span> <span class=\"at\">-s</span> <span class=\"at\">--template</span> <span class=\"st\">&quot;_layout&quot;</span> <span class=\"at\">--css</span> <span class=\"st\">&quot;css/main.css&quot;</span> <span class=\"at\">-f</span> markdown <span class=\"at\">-t</span> html5 <span class=\"at\">-o</span> <span class=\"st\">&quot;</span><span class=\"va\">$@</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;$&lt;&quot;</span></span></code></pre></div>\n<p>Finally, I need to be able to include a unique\n<code>&lt;title&gt;</code> tag string for each page. Again, a search\nthrough <code>pandoc(1)</code> for <code>variable</code> yields results;\nusing the <code>-V</code> flag enables you to set template variables\nusing <code>-V [KEY]=[val]</code>.</p>\n<p>A bit more digging in the online docs, however, nets better solution:\nYAML Metadata blocks—just like jekyll!</p>\n<p>So, for each markdown file in my repo, I’ll add a block to the top\nthat looks like this:</p>\n<div class=\"sourceCode\" id=\"cb10\"><pre\nclass=\"sourceCode numberSource yaml numberLines\"><code class=\"sourceCode yaml\"><span id=\"cb10-1\"><a href=\"https://tylercipriani.com/blog/#cb10-1\"></a><span class=\"pp\">---</span></span>\n<span id=\"cb10-2\"><a href=\"https://tylercipriani.com/blog/#cb10-2\"></a><span class=\"fu\">pagetitle</span><span class=\"kw\">:</span><span class=\"at\"> &lt;pagetitle&gt;</span></span>\n<span id=\"cb10-3\"><a href=\"https://tylercipriani.com/blog/#cb10-3\"></a><span class=\"pp\">---</span></span></code></pre></div>\n<p><code>$pagetitle$</code> is the variable I defined in my\n<code>_layout.html5</code> that I’m now passing as a template to\nPandoc.</p>\n</section>\n<section id=\"makefile-fanciness\" class=\"level2\">\n<h2>Makefile fanciness</h2>\n<p>Alright, so now that I have the basics of Pandoc down, I need to whip\nmy <code>Makefile</code> into shape.</p>\n<p>First thing is I want to convert ALL of my markdown files to html,\nnot just the <code>README.md</code>. So howzabout I add a wildcard\ntarget for all the <code>html</code> files? Also, the whole point of\nthis is to make a github pages site, so let’s add that to the\n<code>Makefile</code> too</p>\n<div class=\"sourceCode\" id=\"cb11\"><pre\nclass=\"sourceCode numberSource makefile numberLines\"><code class=\"sourceCode makefile\"><span id=\"cb11-1\"><a href=\"https://tylercipriani.com/blog/#cb11-1\"></a><span class=\"dt\">REPO </span><span class=\"ch\">:=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">shell</span><span class=\"st\"> git config --get remote.origin.url</span><span class=\"ch\">)</span></span>\n<span id=\"cb11-2\"><a href=\"https://tylercipriani.com/blog/#cb11-2\"></a><span class=\"dt\">GHPAGES </span><span class=\"ch\">=</span><span class=\"st\"> gh-pages</span></span>\n<span id=\"cb11-3\"><a href=\"https://tylercipriani.com/blog/#cb11-3\"></a></span>\n<span id=\"cb11-4\"><a href=\"https://tylercipriani.com/blog/#cb11-4\"></a><span class=\"dv\">all:</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"kw\">addprefix</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">/</span><span class=\"kw\">,</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">addsuffix</span><span class=\"st\"> .html</span><span class=\"kw\">,</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">basename</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">wildcard</span><span class=\"st\"> *.md</span><span class=\"ch\">))))</span></span>\n<span id=\"cb11-5\"><a href=\"https://tylercipriani.com/blog/#cb11-5\"></a></span>\n<span id=\"cb11-6\"><a href=\"https://tylercipriani.com/blog/#cb11-6\"></a><span class=\"dv\">$(GHPAGES):</span></span>\n<span id=\"cb11-7\"><a href=\"https://tylercipriani.com/blog/#cb11-7\"></a>  git clone <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">REPO</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb11-8\"><a href=\"https://tylercipriani.com/blog/#cb11-8\"></a>  (cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git checkout <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span>) || (cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git checkout --orphan <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git rm -rf .)</span>\n<span id=\"cb11-9\"><a href=\"https://tylercipriani.com/blog/#cb11-9\"></a></span>\n<span id=\"cb11-10\"><a href=\"https://tylercipriani.com/blog/#cb11-10\"></a><span class=\"dv\">$(GHPAGES)/%.html:</span><span class=\"dt\"> %.md</span></span>\n<span id=\"cb11-11\"><a href=\"https://tylercipriani.com/blog/#cb11-11\"></a>  pandoc -s --template <span class=\"st\">&quot;_layout&quot;</span> -c <span class=\"st\">&quot;css/main.css&quot;</span> -f markdown -t html5 -o <span class=\"st\">&quot;</span><span class=\"ch\">$@</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$&lt;</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>Running <code>make</code> at this point should checkout your current\ngit repository to a subdirectory called <code>gh-pages</code> (which\nshould be added to <code>.gitignore</code> on master).</p>\n<p>This <code>Makefile</code> first tries to checkout an existing\n<code>gh-pages</code> branch, otherwise it creates a new orphan branch\nfor <code>gh-pages</code>. After that, we glob the current directory for\nany file name <code>*.md</code> and run it through pandoc, placing the\nresult in <code>gh-pages/[whatever].html</code></p>\n</section>\n<section id=\"niceities\" class=\"level2\">\n<h2>Niceities</h2>\n<p>I’m a big fan of pre-processors, so the css/main.css file (which\ndoesn’t <em>actually exist</em> as of yet) should be converted from\n<code>less</code>. The easiest way to do that: add a\n<code>package.json</code> with <code>less</code> as a dependency.</p>\n<div class=\"sourceCode\" id=\"cb12\"><pre\nclass=\"sourceCode numberSource json numberLines\"><code class=\"sourceCode json\"><span id=\"cb12-1\"><a href=\"https://tylercipriani.com/blog/#cb12-1\"></a><span class=\"fu\">{</span></span>\n<span id=\"cb12-2\"><a href=\"https://tylercipriani.com/blog/#cb12-2\"></a>  <span class=\"dt\">&quot;name&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;linkblog&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb12-3\"><a href=\"https://tylercipriani.com/blog/#cb12-3\"></a>  <span class=\"dt\">&quot;version&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;0.0.1&quot;</span><span class=\"fu\">,</span></span>\n<span id=\"cb12-4\"><a href=\"https://tylercipriani.com/blog/#cb12-4\"></a>  <span class=\"dt\">&quot;dependencies&quot;</span><span class=\"fu\">:</span> <span class=\"fu\">{</span></span>\n<span id=\"cb12-5\"><a href=\"https://tylercipriani.com/blog/#cb12-5\"></a>    <span class=\"dt\">&quot;less&quot;</span><span class=\"fu\">:</span> <span class=\"st\">&quot;*&quot;</span></span>\n<span id=\"cb12-6\"><a href=\"https://tylercipriani.com/blog/#cb12-6\"></a>  <span class=\"fu\">}</span></span>\n<span id=\"cb12-7\"><a href=\"https://tylercipriani.com/blog/#cb12-7\"></a><span class=\"fu\">}</span></span></code></pre></div>\n<p>Now running <code>npm install</code> should create a new\n<code>node_modules</code> directory (which should be added to\n<code>.gitignore</code> on master). Now we need to add a\n<code>lessc</code> step to our <code>Makefile</code>.</p>\n<div class=\"sourceCode\" id=\"cb13\"><pre\nclass=\"sourceCode numberSource makefile numberLines\"><code class=\"sourceCode makefile\"><span id=\"cb13-1\"><a href=\"https://tylercipriani.com/blog/#cb13-1\"></a><span class=\"dt\">LESSC    </span><span class=\"ch\">=</span><span class=\"st\"> node_modules/less/bin/lessc</span></span>\n<span id=\"cb13-2\"><a href=\"https://tylercipriani.com/blog/#cb13-2\"></a><span class=\"dt\">LESSFILE </span><span class=\"ch\">=</span><span class=\"st\"> less/main.less</span></span>\n<span id=\"cb13-3\"><a href=\"https://tylercipriani.com/blog/#cb13-3\"></a></span>\n<span id=\"cb13-4\"><a href=\"https://tylercipriani.com/blog/#cb13-4\"></a><span class=\"dt\">CSSDIR  </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">/css</span></span>\n<span id=\"cb13-5\"><a href=\"https://tylercipriani.com/blog/#cb13-5\"></a><span class=\"dt\">CSSFILE </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"st\">/main.css</span></span>\n<span id=\"cb13-6\"><a href=\"https://tylercipriani.com/blog/#cb13-6\"></a></span>\n<span id=\"cb13-7\"><a href=\"https://tylercipriani.com/blog/#cb13-7\"></a><span class=\"dv\">$(CSSFILE):</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">LESSFILE</span><span class=\"ch\">)</span></span>\n<span id=\"cb13-8\"><a href=\"https://tylercipriani.com/blog/#cb13-8\"></a>    <span class=\"ch\">$(</span><span class=\"dt\">LESSC</span><span class=\"ch\">)</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">LESSFILE</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">CSSFILE</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb13-9\"><a href=\"https://tylercipriani.com/blog/#cb13-9\"></a></span>\n<span id=\"cb13-10\"><a href=\"https://tylercipriani.com/blog/#cb13-10\"></a><span class=\"dv\">$(CSSDIR):</span></span>\n<span id=\"cb13-11\"><a href=\"https://tylercipriani.com/blog/#cb13-11\"></a>    mkdir -p <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>Also, it’s always nice to have a <code>clean</code> target in any\n<code>Makefile</code></p>\n<div class=\"sourceCode\" id=\"cb14\"><pre\nclass=\"sourceCode makefile\"><code class=\"sourceCode makefile\"><span id=\"cb14-1\"><a href=\"https://tylercipriani.com/blog/#cb14-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">clean:</span></span>\n<span id=\"cb14-2\"><a href=\"https://tylercipriani.com/blog/#cb14-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    rm -rf <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span></code></pre></div>\n<p>I’d also like to be able to preview before commiting this file by\ntyping <code>make serve</code></p>\n<div class=\"sourceCode\" id=\"cb15\"><pre\nclass=\"sourceCode makefile\"><code class=\"sourceCode makefile\"><span id=\"cb15-1\"><a href=\"https://tylercipriani.com/blog/#cb15-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">serve:</span></span>\n<span id=\"cb15-2\"><a href=\"https://tylercipriani.com/blog/#cb15-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; python -m SimpleHTTPServer</span></code></pre></div>\n<p>Finally, speaking of commiting this file, let’s make\n<code>commit</code> a target, too.</p>\n<div class=\"sourceCode\" id=\"cb16\"><pre\nclass=\"sourceCode makefile\"><code class=\"sourceCode makefile\"><span id=\"cb16-1\"><a href=\"https://tylercipriani.com/blog/#cb16-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"dv\">commit:</span></span>\n<span id=\"cb16-2\"><a href=\"https://tylercipriani.com/blog/#cb16-2\" aria-hidden=\"true\" tabindex=\"-1\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb16-3\"><a href=\"https://tylercipriani.com/blog/#cb16-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>        git add . &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb16-4\"><a href=\"https://tylercipriani.com/blog/#cb16-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>        git commit --edit --message=<span class=\"st\">&quot;Publish @</span><span class=\"ch\">$$</span><span class=\"st\">(date)&quot;</span></span>\n<span id=\"cb16-5\"><a href=\"https://tylercipriani.com/blog/#cb16-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb16-6\"><a href=\"https://tylercipriani.com/blog/#cb16-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>        git push origin <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span></span></code></pre></div>\n<p>Now when I update my <code>links</code> repo’s markdown files I issue\na simple series of commands: <code>make</code> checks-out my\n<code>gh-pages</code> branch and builds the html and css files,\n<code>make serve</code> lets me look at the output html at\n<code>localhost:8000</code>, and, finally, <code>make commit</code>\npushes those changes live.</p>\n<p>So here’s the <a href=\"http://www.tylercipriani.com/links\">result</a>\nand the final <code>Makefile</code></p>\n<div class=\"sourceCode\" id=\"cb17\"><pre\nclass=\"sourceCode numberSource makefile numberLines\"><code class=\"sourceCode makefile\"><span id=\"cb17-1\"><a href=\"https://tylercipriani.com/blog/#cb17-1\"></a><span class=\"dt\">REPO </span><span class=\"ch\">:=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">shell</span><span class=\"st\"> git config --get remote.origin.url</span><span class=\"ch\">)</span></span>\n<span id=\"cb17-2\"><a href=\"https://tylercipriani.com/blog/#cb17-2\"></a><span class=\"dt\">GHPAGES </span><span class=\"ch\">=</span><span class=\"st\"> gh-pages</span></span>\n<span id=\"cb17-3\"><a href=\"https://tylercipriani.com/blog/#cb17-3\"></a></span>\n<span id=\"cb17-4\"><a href=\"https://tylercipriani.com/blog/#cb17-4\"></a><span class=\"dt\">LESSC    </span><span class=\"ch\">=</span><span class=\"st\"> node_modules/less/bin/lessc</span></span>\n<span id=\"cb17-5\"><a href=\"https://tylercipriani.com/blog/#cb17-5\"></a><span class=\"dt\">LESSFILE </span><span class=\"ch\">=</span><span class=\"st\"> less/main.less</span></span>\n<span id=\"cb17-6\"><a href=\"https://tylercipriani.com/blog/#cb17-6\"></a></span>\n<span id=\"cb17-7\"><a href=\"https://tylercipriani.com/blog/#cb17-7\"></a><span class=\"dt\">CSSDIR  </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">/css</span></span>\n<span id=\"cb17-8\"><a href=\"https://tylercipriani.com/blog/#cb17-8\"></a><span class=\"dt\">CSSFILE </span><span class=\"ch\">=</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"st\">/main.css</span></span>\n<span id=\"cb17-9\"><a href=\"https://tylercipriani.com/blog/#cb17-9\"></a></span>\n<span id=\"cb17-10\"><a href=\"https://tylercipriani.com/blog/#cb17-10\"></a><span class=\"dv\">all:</span><span class=\"dt\"> init clean </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">CSSFILE</span><span class=\"ch\">)</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"kw\">addprefix</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">/</span><span class=\"kw\">,</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">addsuffix</span><span class=\"st\"> .html</span><span class=\"kw\">,</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">basename</span><span class=\"st\"> </span><span class=\"ch\">$(</span><span class=\"kw\">wildcard</span><span class=\"st\"> *.md</span><span class=\"ch\">))))</span></span>\n<span id=\"cb17-11\"><a href=\"https://tylercipriani.com/blog/#cb17-11\"></a></span>\n<span id=\"cb17-12\"><a href=\"https://tylercipriani.com/blog/#cb17-12\"></a><span class=\"dv\">$(GHPAGES)/%.html:</span><span class=\"dt\"> %.md</span></span>\n<span id=\"cb17-13\"><a href=\"https://tylercipriani.com/blog/#cb17-13\"></a>    pandoc -s --template <span class=\"st\">&quot;_layout&quot;</span> -c <span class=\"st\">&quot;css/main.css&quot;</span> -f markdown -t html5 -o <span class=\"st\">&quot;</span><span class=\"ch\">$@</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$&lt;</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb17-14\"><a href=\"https://tylercipriani.com/blog/#cb17-14\"></a></span>\n<span id=\"cb17-15\"><a href=\"https://tylercipriani.com/blog/#cb17-15\"></a><span class=\"dv\">$(CSSFILE):</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"dt\"> </span><span class=\"ch\">$(</span><span class=\"dt\">LESSFILE</span><span class=\"ch\">)</span></span>\n<span id=\"cb17-16\"><a href=\"https://tylercipriani.com/blog/#cb17-16\"></a>    <span class=\"ch\">$(</span><span class=\"dt\">LESSC</span><span class=\"ch\">)</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">LESSFILE</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">CSSFILE</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb17-17\"><a href=\"https://tylercipriani.com/blog/#cb17-17\"></a></span>\n<span id=\"cb17-18\"><a href=\"https://tylercipriani.com/blog/#cb17-18\"></a><span class=\"dv\">$(CSSDIR):</span></span>\n<span id=\"cb17-19\"><a href=\"https://tylercipriani.com/blog/#cb17-19\"></a>    mkdir -p <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">CSSDIR</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb17-20\"><a href=\"https://tylercipriani.com/blog/#cb17-20\"></a></span>\n<span id=\"cb17-21\"><a href=\"https://tylercipriani.com/blog/#cb17-21\"></a><span class=\"dv\">$(GHPAGES):</span></span>\n<span id=\"cb17-22\"><a href=\"https://tylercipriani.com/blog/#cb17-22\"></a>    <span class=\"ch\">@</span><span class=\"fu\">echo </span><span class=\"ch\">$(</span><span class=\"dt\">REPO</span><span class=\"ch\">)</span></span>\n<span id=\"cb17-23\"><a href=\"https://tylercipriani.com/blog/#cb17-23\"></a>    git clone <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">REPO</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span> <span class=\"st\">&quot;</span><span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb17-24\"><a href=\"https://tylercipriani.com/blog/#cb17-24\"></a>    <span class=\"ch\">@</span><span class=\"fu\">echo </span><span class=\"st\">&quot;Donezo&quot;</span></span>\n<span id=\"cb17-25\"><a href=\"https://tylercipriani.com/blog/#cb17-25\"></a>    (cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git checkout <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span>) || (cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git checkout --orphan <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; git rm -rf .)</span>\n<span id=\"cb17-26\"><a href=\"https://tylercipriani.com/blog/#cb17-26\"></a></span>\n<span id=\"cb17-27\"><a href=\"https://tylercipriani.com/blog/#cb17-27\"></a><span class=\"dv\">init:</span></span>\n<span id=\"cb17-28\"><a href=\"https://tylercipriani.com/blog/#cb17-28\"></a>    <span class=\"ch\">@</span><span class=\"fu\">command -v pandoc &gt; /dev/null 2&gt;&amp;1 || (echo </span><span class=\"st\">&#39;pandoc not found http://johnmacfarlane.net/pandoc/installing.html&#39;</span><span class=\"fu\"> &amp;&amp; exit 1)</span></span>\n<span id=\"cb17-29\"><a href=\"https://tylercipriani.com/blog/#cb17-29\"></a>    <span class=\"ch\">@</span><span class=\"fu\">[ -x </span><span class=\"ch\">$(</span><span class=\"dt\">LESSC</span><span class=\"ch\">)</span><span class=\"fu\"> ] || npm install</span></span>\n<span id=\"cb17-30\"><a href=\"https://tylercipriani.com/blog/#cb17-30\"></a></span>\n<span id=\"cb17-31\"><a href=\"https://tylercipriani.com/blog/#cb17-31\"></a><span class=\"dv\">serve:</span></span>\n<span id=\"cb17-32\"><a href=\"https://tylercipriani.com/blog/#cb17-32\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; python -m SimpleHTTPServer</span>\n<span id=\"cb17-33\"><a href=\"https://tylercipriani.com/blog/#cb17-33\"></a></span>\n<span id=\"cb17-34\"><a href=\"https://tylercipriani.com/blog/#cb17-34\"></a><span class=\"dv\">clean:</span></span>\n<span id=\"cb17-35\"><a href=\"https://tylercipriani.com/blog/#cb17-35\"></a>    rm -rf <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span></span>\n<span id=\"cb17-36\"><a href=\"https://tylercipriani.com/blog/#cb17-36\"></a></span>\n<span id=\"cb17-37\"><a href=\"https://tylercipriani.com/blog/#cb17-37\"></a><span class=\"dv\">commit:</span></span>\n<span id=\"cb17-38\"><a href=\"https://tylercipriani.com/blog/#cb17-38\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb17-39\"><a href=\"https://tylercipriani.com/blog/#cb17-39\"></a>        git add . &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb17-40\"><a href=\"https://tylercipriani.com/blog/#cb17-40\"></a>        git commit --edit --message=<span class=\"st\">&quot;Publish @</span><span class=\"ch\">$$</span><span class=\"st\">(date)&quot;</span></span>\n<span id=\"cb17-41\"><a href=\"https://tylercipriani.com/blog/#cb17-41\"></a>    cd <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span> &amp;&amp; <span class=\"ch\">\\</span></span>\n<span id=\"cb17-42\"><a href=\"https://tylercipriani.com/blog/#cb17-42\"></a>        git push origin <span class=\"ch\">$(</span><span class=\"dt\">GHPAGES</span><span class=\"ch\">)</span></span>\n<span id=\"cb17-43\"><a href=\"https://tylercipriani.com/blog/#cb17-43\"></a></span>\n<span id=\"cb17-44\"><a href=\"https://tylercipriani.com/blog/#cb17-44\"></a><span class=\"ot\">.PHONY:</span><span class=\"dt\"> init clean commit serve</span></span></code></pre></div>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/",

    "title": "Knowledge Nuggets From My Tmux.conf",
    "url": "https://tylercipriani.com/blog/2013/09/12/important-lines-in-my-tmux/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "shell",

     "tmux"

    ],

    "date_published": "2013-09-12T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>When I switched from GNU Screen to Tmux, I was just jazzed that Tmux\n<em>had</em> a status bar. To achieve that same effect in Screen I had a\ncryptic 115-character <code>hardstatus</code> string that I copy–pasted\nfrom someplace lost to the annals of the Internet Archive.</p>\n<p>It wasn’t too long after I made the switch until I felt that old\nhacker itch and began scouring Github for Tmux tips.</p>\n<p>You can view my complete <code>tmux.conf</code> on <a\nhref=\"https://github.com/thcipriani/dotfiles/blob/master/tmux.conf\">my\ngithub</a></p>\n<section id=\"tmux-tips-for-the-uninitiated\" class=\"level2\">\n<h2>Tmux Tips for the Uninitiated</h2>\n<ol type=\"1\">\n<li><p><code>Ctrl</code>-<code>f</code> Meta is for super stars</p>\n<p>I used to always bind <code>Ctrl</code>-<code>a</code> to Meta to\nmake Tmux behave like Screen; however, when you use Screen inside Tmux\n(as I often do with our AWS servers), hitting\n<code>Ctrl</code>-<code>a</code> <code>a</code> can get pretty tiresome.\nPlus, you can’t use Readline very effectively without\n<code>Ctrl</code>-<code>a</code></p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\"></a><span class=\"ex\">unbind-key</span> C-b <span class=\"co\">#no more Ctrl-b</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\"></a><span class=\"co\"># Switch me to ^f, thanks</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\"></a><span class=\"ex\">set-option</span> <span class=\"at\">-g</span> prefix C-f</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\"></a><span class=\"ex\">bind-key</span> f send-prefix</span></code></pre></div></li>\n<li><p>Faster escape</p>\n<p>When I first started using Tmux I couldn’t stand the amount of time\nit took to enter copy-mode. Then I realized—I didn’t have to.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\"></a><span class=\"ex\">set-option</span> <span class=\"at\">-sg</span> escape-time 0</span></code></pre></div></li>\n<li><p>Maximize Panes</p>\n<p>One of the things I love about Vim splits is that you can hit\n<code>Ctrl-w</code> <code>|</code> to maximize the current pane and hit\n<code>Ctrl-w</code> <code>=</code> to bring it back to an even split.\nBringing that functionality to Tmux is very powerful and super easy.\nThis line will let you hit <code>Meta</code> <code>|</code> to maximize\na single pane and then hit <code>Meta</code> <code>|</code> again to\nbring it back to the original split.</p>\n<p>Warning: this is a tip that will only work with tmux 1.8+ (check your\nversion via <code>tmux -V</code>)</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\"></a><span class=\"ex\">bind-key</span> <span class=\"kw\">|</span> <span class=\"ex\">resize-pane</span> <span class=\"at\">-Z</span> <span class=\"dt\">\\;</span> display-message <span class=\"st\">&quot;Zoom zoom zoom&quot;</span></span></code></pre></div></li>\n<li><p>Vim-esque system clipboard copy–paste</p>\n<p>Sometimes system clipboard support from Vim isn’t enough. It’s\nconvenient to be able to pull whatever is in your Tmux buffer onto your\nsystem clipboard (preferably without having to memorize any new\nkeybindings and without overwriting any existing keybindings).</p>\n<p>First, I set the window mode-keys to use Vi bindings:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\"></a><span class=\"ex\">set-window-option</span> <span class=\"at\">-g</span> mode-keys vi</span></code></pre></div>\n<p>Next, I bind <code>Meta Esc</code> to enter Tmux copy-mode:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\"></a><span class=\"ex\">unbind-key</span> [</span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\"></a><span class=\"ex\">bind-key</span> Escape copy-mode</span></code></pre></div>\n<p>After that, I bind visual-selection and copy keys inside vi-copy mode\nto their Vim equivalents:</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\"></a><span class=\"ex\">bind-key</span> <span class=\"at\">-t</span> vi-copy <span class=\"st\">&#39;v&#39;</span> begin-selection</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\"></a><span class=\"ex\">bind-key</span> <span class=\"at\">-t</span> vi-copy <span class=\"st\">&#39;y&#39;</span> copy-selection</span></code></pre></div>\n<p>Finally, I bind <code>Meta y</code> to execute a shell command. This\nshould work on either Linux or OSX, although I’ve only tested this on\nOSX:</p>\n<div class=\"sourceCode\" id=\"cb7\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb7-1\"><a href=\"https://tylercipriani.com/blog/#cb7-1\"></a><span class=\"ex\">if-shell</span> <span class=\"st\">&#39;test &quot;$(uname -s)&quot; = &quot;Darwin&quot;&#39;</span> <span class=\"st\">&#39;bind-key y run-shell &quot;tmux show-buffer | pbcopy&quot; \\; display-message &quot;Copied tmux buffer to system clipboard&quot;&#39;</span></span>\n<span id=\"cb7-2\"><a href=\"https://tylercipriani.com/blog/#cb7-2\"></a><span class=\"ex\">if-shell</span> <span class=\"st\">&#39;test &quot;$(uname -s)&quot; = &quot;Linux&quot;&#39;</span> <span class=\"st\">&#39;bind-key y run-shell &quot;tmux show-buffer | xclip -sel clip -i&quot; \\; display-message &quot;Copied tmux buffer to system clipboard&quot;&#39;</span></span></code></pre></div></li>\n<li><p>OSX Specific Tmux file</p>\n<p>Even though Tmux and Vim are really popular on OSX—they are,\nessentially, broken. You have to do the whole\n<code>reattach-to-user-namespace</code> thing to get Vim’s clipboard to\nplay nicely inside Tmux. This mess makes your <code>tmux.conf</code>\nlook more cluttered and makes your dotfiles a little less portable. To\nfix this I keep an OSX Specific <code>tmux.conf</code>.</p>\n<div class=\"sourceCode\" id=\"cb8\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb8-1\"><a href=\"https://tylercipriani.com/blog/#cb8-1\"></a><span class=\"co\">#dumb osx</span></span>\n<span id=\"cb8-2\"><a href=\"https://tylercipriani.com/blog/#cb8-2\"></a><span class=\"ex\">if-shell</span> <span class=\"st\">&#39;test &quot;$(uname)&quot; = &quot;Darwin&quot;&#39;</span> <span class=\"st\">&#39;source ~/.tmux-osx.conf&#39;</span></span></code></pre></div></li>\n<li><p>Steve Losh’s Bad Wolf Status Bar</p>\n<p>News Flash: Steve Losh makes cool looking stuff. In Steve’s version\nof this he uses a small script to get his unread email count from his\nlocal offlineimap folder. In the version below I use a little bash\nscript I wrote to grab weather info (that I call weathermajig).</p>\n<div class=\"sourceCode\" id=\"cb9\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb9-1\"><a href=\"https://tylercipriani.com/blog/#cb9-1\"></a><span class=\"co\"># Bad Wolf by Steve Losh</span></span>\n<span id=\"cb9-2\"><a href=\"https://tylercipriani.com/blog/#cb9-2\"></a><span class=\"co\"># =====================</span></span>\n<span id=\"cb9-3\"><a href=\"https://tylercipriani.com/blog/#cb9-3\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-fg white</span>\n<span id=\"cb9-4\"><a href=\"https://tylercipriani.com/blog/#cb9-4\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-bg colour234</span>\n<span id=\"cb9-5\"><a href=\"https://tylercipriani.com/blog/#cb9-5\"></a><span class=\"co\"># set -g status-bg default #set for transparent background</span></span>\n<span id=\"cb9-6\"><a href=\"https://tylercipriani.com/blog/#cb9-6\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> window-status-activity-attr bold</span>\n<span id=\"cb9-7\"><a href=\"https://tylercipriani.com/blog/#cb9-7\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> pane-border-fg colour245</span>\n<span id=\"cb9-8\"><a href=\"https://tylercipriani.com/blog/#cb9-8\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> pane-active-border-fg colour39</span>\n<span id=\"cb9-9\"><a href=\"https://tylercipriani.com/blog/#cb9-9\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> message-fg colour16</span>\n<span id=\"cb9-10\"><a href=\"https://tylercipriani.com/blog/#cb9-10\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> message-bg colour221</span>\n<span id=\"cb9-11\"><a href=\"https://tylercipriani.com/blog/#cb9-11\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> message-attr bold</span>\n<span id=\"cb9-12\"><a href=\"https://tylercipriani.com/blog/#cb9-12\"></a><span class=\"co\"># Custom status bar</span></span>\n<span id=\"cb9-13\"><a href=\"https://tylercipriani.com/blog/#cb9-13\"></a><span class=\"co\"># Powerline</span></span>\n<span id=\"cb9-14\"><a href=\"https://tylercipriani.com/blog/#cb9-14\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-left-length 32</span>\n<span id=\"cb9-15\"><a href=\"https://tylercipriani.com/blog/#cb9-15\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-right-length 150</span>\n<span id=\"cb9-16\"><a href=\"https://tylercipriani.com/blog/#cb9-16\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-interval 5</span>\n<span id=\"cb9-17\"><a href=\"https://tylercipriani.com/blog/#cb9-17\"></a><span class=\"co\"># Lets add the current weather to our status bar—why? Well Why the french-toast not?</span></span>\n<span id=\"cb9-18\"><a href=\"https://tylercipriani.com/blog/#cb9-18\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-left <span class=\"st\">&#39;#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour238,nobold]#[fg=colour15,bg=colour238,bold] #(weathermajig boulder --short) #[fg=colour238,bg=colour234,nobold]&#39;</span></span>\n<span id=\"cb9-19\"><a href=\"https://tylercipriani.com/blog/#cb9-19\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> status-right <span class=\"st\">&#39;#[fg=colour245]❬ %R ❬ %d %b #[fg=colour254,bg=colour234,nobold]#(rdio-current-track-tmux)#[fg=colour16,bg=colour254,bold] #h &#39;</span></span>\n<span id=\"cb9-20\"><a href=\"https://tylercipriani.com/blog/#cb9-20\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> window-status-format <span class=\"st\">&quot;#[fg=white,bg=colour234] #I #W &quot;</span></span>\n<span id=\"cb9-21\"><a href=\"https://tylercipriani.com/blog/#cb9-21\"></a><span class=\"bu\">set</span> <span class=\"at\">-g</span> window-status-current-format <span class=\"st\">&quot;#[fg=colour234,bg=colour39]#[fg=colour16,bg=colour39,noreverse,bold] #I ❭ #W #[fg=colour39,bg=colour234,nobold]&quot;</span></span></code></pre></div></li>\n</ol>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/",

    "title": "Dotfile Boilerplate",
    "url": "https://tylercipriani.com/blog/2013/08/10/dotfiles-how-to-get-started/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "shell"

    ],

    "date_published": "2013-08-10T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>Earlier today I made a tweak to one of my ever-growing collection of\n<a href=\"https://github.com/thcipriani/dotfiles/\">dotfiles</a> and it\nreminded me that I’m not too happy with my dotfile’s\n<code>bootstrap</code> script.</p>\n<p>The <code>bootstrap</code> file that I have in my repo is from <a\nhref=\"http://errtheblog.com/posts/89-huba-huba\">a 2008 blog post</a> and\nI’ve never been too thrilled with it.</p>\n<p>The problems my old <code>boostrap</code> were</p>\n<ol type=\"1\">\n<li>It required that Ruby be installed—which was a pain on production\nservers where I never intended to have Ruby installed.</li>\n<li>It overwrote any existing dotfiles in <code>$HOME</code> without\nwarning</li>\n<li>It added every sub-directory/file in the .dotfiles directory—you\ncouldn’t add a README.md file without it being symlinked in the\n<code>$HOME</code> directory as <code>.README.md</code>—silly,\nright?!</li>\n</ol>\n<p>Long story short—I needed a new <code>bootstrap</code> file. I’m a\nbig believer in not reinventing the wheel, so I went looking for the\ncanonical example of the dotfile bootstrap file.</p>\n<p>I started perusing dotfile repos on github—which is always exciting\nto me (because I’m super nerdy) and there are some amazing dotfile\nresources on github:</p>\n<ul>\n<li><a href=\"http://dotfiles.github.io/\">Github ❤ ~/</a></li>\n<li><a href=\"https://github.com/mathiasbynens/dotfiles\">Mathias Bynens’\nSensible Hacker Defaults for OSX</a></li>\n<li><a href=\"https://github.com/gf3/dotfiles\">gf3’s Sexy Bash\nPrompt</a></li>\n<li><a\nhref=\"http://zachholman.com/2010/08/dotfiles-are-meant-to-be-forked/\">Zach\nHolman’s Bootstrap script</a></li>\n<li><a\nhref=\"https://github.com/addyosmani/dotfiles/blob/master/.aliases\">Addy\nOsmani’s Handy Aliases</a></li>\n<li><a href=\"https://github.com/pengwynn/dotfiles\">pengwynn’s There’s no\nplace like ~/</a></li>\n</ul>\n<p>Seeing all of this got me to thinking—wouldn’t it be great if there\nwere a project that amalgamated all of this fun stuff? Like HTML5\nBoilerplate for dotfiles.</p>\n<p>The project will keep canonical examples of files like the\n<code>bootstrap</code> script. It would also keep an opinionated list of\nfunctions, aliases and configurations that could help beginners get a\ngreat start and normalize dotfile distribution in the same way that\npathogen normalized vim plugins into bundles.</p>\n<section id=\"dotfile-boilerplate\" class=\"level2\">\n<h2>Dotfile Boilerplate</h2>\n<p>So there’s the starting point: <a\nhref=\"https://github.com/thcipriani/dotfile-boilerplate\">Dotfile\nBoilerplate</a></p>\n<p>At the very least it’s a solidly structured start with an amazing\nbootstrap script that I modfied based off of Zach Holman’s setup.</p>\n<p>So that’s the whole idea—the hope is that this repository can grow\nand collect great ideas, functions, and well-considered dotfiles from\ninteresting discussions and people around the internet.</p>\n<p>Beginners will have an amazing starting point and advanced users will\nhave a wellspring of ideas.</p>\n<p><a href=\"https://help.github.com/articles/using-pull-requests/\">Fork\n‘em if ya got ‘em.</a></p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2013/02/24/install-vim-from-source/",

    "title": "Installing Vim from source on CentOS&#xA0;6.3",
    "url": "https://tylercipriani.com/blog/2013/02/24/install-vim-from-source/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2013-02-24T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>…or, I suppose, other Linux-es…Linuxi…Linux distributions.</p>\n<p>Many of the Vim features on which I’ve come to depend simply aren’t\navailable in Vim pre-7.3.3. That’s fine if I’m working on an OS that\ncares about having up-to-date software like Ubuntu or OSX; however, it\nain’t so great if I’m working on a shared host that uses CentOS\n<strong><em>five point something dumb</em></strong> because the\nhosting-providers weren’t hugged as children (I’d guess).</p>\n<blockquote>\n<p><strong>edit</strong>—10/01/2013</p>\n<p>For installing on Ubuntu and additional source install tips see this\nlittle <a\nhref=\"https://github.com/Valloric/YouCompleteMe/wiki/Building-Vim-from-source\">post</a>\non the YouCompleteMe wiki</p>\n</blockquote>\n<section id=\"new-os-old-repo\" class=\"level2\">\n<h2>New OS, Old Repo</h2>\n<p>The only thing worse than working on an old OS, with an old version\nof Vim is working on a <em>new</em> OS with an old version of Vim. I\nrecently disovered that the yum-installable Vim (vim-enhanced) version\non CentOS 6.3 is v.7.2.411—WTF CentOS? What’s your deal, guy?</p>\n<p><strong>Some plugins that depend on version 7.3:</strong></p>\n<ul>\n<li>­<a href=\"http://majutsushi.github.com/tagbar/\">Tagbar</a></li>\n<li>­<a href=\"http://myusuf3.github.com/numbers.vim/\">Numbers.vim</a></li>\n<li>­<a href=\"http://valloric.github.com/YouCompleteMe/\">YouCompleteMe</a></li>\n</ul>\n<p>And, really, those are just the plugins that fail <em>loudly</em> for\nme. Like the ones that vomit, “Hey, WTF, guy?” to stdout every rootin’\ntootin’ time I fire up Vim. There would likely be other functionality\nthat I’d loose by not using Vim 7.3.3+.</p>\n<p>I don’t have to take this kind of guff from CentOS. No. I think that,\ninstead, I’m going to do something awesome.</p>\n<p>Compiling Vim from source means you don’t have to get pushed around\nby crummy distro repos and you look like a 1970s-era Fred Williams-level\nbadass…so…bonus points…</p>\n</section>\n<section id=\"retrieving-vim-source\" class=\"level2\">\n<h2>Retrieving Vim source</h2>\n<p>Vim keeps its source in a Mercurial repo on googlcode so you need to\ndownload it. To do that you should have Mercurial installed (which you\ncan, somewhat ironically, install from via yum <code>yum install\nmercurial</code>). You should switch to the root user for this install\nand for your sanity so use <code>su</code> or <code>sudo\nbash</code>:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> sudo bash</span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd /usr/local/src/</span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> hg clone https://vim.googlecode.com/hg/ vim</span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd vim</span></code></pre></div>\n</section>\n<section id=\"configuration-options\" class=\"level2\">\n<h2>Configuration options</h2>\n<p>There are quite a few configuration options (which you can view by\nrunning <code>./configure –help</code> in your newly created\n<code>vim</code> directory)—with respect to Vim installs I support going\nnuclear. Even at it’s most ginormous Vim will still be a small install\nrelative to other IDEs—Vim is my primary editor and IDE, so I’m down to\ndo it big. I’m also going to use the <code>/usr</code> prefix so that\nVim is installed system-wide.</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash lineNumbers\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> ./configure <span class=\"at\">--prefix</span><span class=\"op\">=</span>/usr <span class=\"at\">--with-compiledby</span><span class=\"op\">=</span><span class=\"st\">&quot;Tyler the Compiler&quot;</span> <span class=\"at\">--with-features</span><span class=\"op\">=</span>huge <span class=\"at\">--enable-rubyinterp</span> <span class=\"at\">--enable-pythoninterp</span></span></code></pre></div>\n</section>\n<section id=\"make-make-install\" class=\"level2\">\n<h2>make &amp;&amp; make install</h2>\n<p>Srsly, that’s it—</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash lineNumbers\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"fu\">make</span> <span class=\"kw\">&amp;&amp;</span> <span class=\"fu\">make</span> install</span></code></pre></div>\n<p>Congrats! You’re one bad mother Vim compiler.</p>\n<p>So… <code>which vim</code>? <code>/usr/bin/vim</code>. Boom. Yeah,\nthat’s right.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/",

    "title": " Vim, the OSX clipboard and Tmux",
    "url": "https://tylercipriani.com/blog/2013/02/09/vim-mac-osx-tmux-clipboard/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "shell",

     "tmux",

     "vim"

    ],

    "date_published": "2013-02-09T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>I’ve been an Ubuntu user for 4 years now. Since I started working at\nUpsync 3 months ago, I’ve found myself a very lonely desktop Linux user.\nAlso, since this job is my first heavy-duty exposure to back-end web\ndevelopment, I’ve found myself a very confused desktop Linux user.</p>\n<p>While there are many tools for working on a website backend available\nin Ubuntu, few are as shiny as those available in OSX (Charles Proxy,\nusable in Chrome. I want that. I want it hard.). Also, want to do any\niOS work? (you know I do)—then you <em>must</em> have a mac.</p>\n<p>On the flip side there is my natural inclination to be a bit of a\ncontrarian and principles and such…</p>\n<p>##…but it’s so shiny!</p>\n<p>I’ve caved. I’m a sell-out. I’m not the cool hardcore ideologue I\nonce believed myself to be. You know those hypothetical,\n<em>which-side-of-history-would-you-be-on-type</em>, questions? Well, I\ncan now safely say that I would <em>not</em> have been in the French\nResistance.</p>\n<p>I’m typing this on the beautiful back-lit keyboard of a brand-new,\ncore-i7-having, 8GB-RAM-possesing, 256GB-SSD-not-spinning monster that\nis a 13″ MacBook Air.</p>\n<p>##I thought this was supposed to be easy</p>\n<p>The first thing I did was get iTerm 2 up and running and then install\nHomebrew. After removing the dumb “Natural” scrolling and using\nPCKeyboard hack to remap some keys, I’m working exactly as I was before.\nI really can’t tell a difference. Which is a little anti-climactic for a\ncomputer that cost as much as my first car (oh, how I miss that purple\nTaurus!).</p>\n<p>It was really easy to get everything set up as it was before,\nexcept…Vim…my clipboard…Tmux…they didn’t work together and that was\nCRIPPLING! Seriously, I depend on those things working together.</p>\n<p>This post is written as a little reminder to myself of how I got it\nall up and running again.</p>\n<p>##The process</p>\n<ol type=\"1\">\n<li><p><strong>Install Homebrew:</strong><br />Instructions are\navailable on\n<a href=\"http://mxcl.github.com/homebrew/\" title=\"Homebrew\">Github</a>\nbut really all it boils down to is: <code>ruby -e “$(curl -fsSL\nhttps://raw.github.com/mxcl/homebrew/go)”</code></p></li>\n<li><p><strong>Install MacVim:</strong><br />And make sure it overrides\nthe system default Vim, which is pre-7.3 Vim and sucks (or it was last\nweek when my MacBook got here) use: <code>brew install macvim\n–override-system-vim</code></p></li>\n<li><p><strong>Install Tmux:</strong><br />Easy peesy lemon squeezy:\n<code>brew install tmux</code></p></li>\n<li><p><strong>Thank the good, sweet lord for Paul Hinze:</strong><br />\nInstall Paul’s reattach-to-user-namespace hack via homebrew: <code>brew\ninstall reattach-to-user-namespace\n–wrap-pbcopy-and-pbpaste</code></p></li>\n<li><p><strong>Append your <code>~/.tmux.conf</code>\nfile</strong>:<br />With this lovely gem: <code>set-option -g\ndefault-command “reattach-to-user-namespace -l zsh”</code> or you can\nuse bash, I guess, I don’t know because I use ZSH. That should be a step\nsomewhere…<code>chsh -s /bin/zsh</code>. Done.</p></li>\n</ol>\n<p>Now if only OSX Mountain Lion possessed the awesome power of moving\nwindows between workspaces using keyboard shortcuts. Someday…\nsomeday.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/",

    "title": "My ZSH (and bash) prompt",
    "url": "https://tylercipriani.com/blog/2012/12/18/zsh-prompt-customization/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "shell"

    ],

    "date_published": "2012-12-18T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<figure>\n<img\nsrc=\"http://tylercipriani-files.s3.amazonaws.com/blog/junkfoodtheme.png\"\nalt=\"Junkfood theme in git directory\" />\n<figcaption aria-hidden=\"true\">Junkfood theme in git\ndirectory</figcaption>\n</figure>\n<p>In order to become a card-carrying Linux user, I feel like you\n<em>need</em> to have spent a truly astounding amount of time fiddling\nwith your\n<a href=\"https://github.com/thcipriani/dotfiles\">dotfiles.</a></p>\n<p>Me? I’ve gone way beyond the point of diminishing returns. Past the\npoint where anyone who loves me can even feign interest. And now I’m\nquaffing the sweet nectar of victory, and that victory nectar\n<em>is</em> sweet. Oh yes, that’s right: my insanely customized prompt\nis now a part of\n<a href=\"http://github.com/robbyrussell/oh-my-zsh\">Bobby Russell’s\nOh-My-ZSH</a></p>\n<p>I’m feeling the pride, joy, and anxiety that can only come from\nwatching my little utf-8 baby move beyond my home directory and march\ndeep into the uncharted home directories of what I can only assume are\n<strong>BILLIONS</strong> of users.</p>\n<section id=\"all-your-oh-my-zsh-are-belong-to-us\" class=\"level2\">\n<h2>All your Oh-My-ZSH are belong to us!\n<a href=\"http://knowyourmeme.com/memes/all-your-base-are-belong-to-us\">*</a></h2>\n<p>…or it will when you update your theme. See, cause, oh-my-zsh uses\n<a href=\"http://github.com/robbyrussell/oh-my-zsh/tree/master/themes/\">themes</a>\nto specify how your prompt looks. You can define what theme you’d like\nto use in your <code>~/.zshrc</code> file. On or around line 8 you’ll\nwant to update the line that starts with <code>ZSH_THEME=…</code> to\nlook like this:</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash lineNumbers\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Set name of the theme to load.</span></span>\n<span id=\"cb1-2\"><a href=\"https://tylercipriani.com/blog/#cb1-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Look in ~/.oh-my-zsh/themes/</span></span>\n<span id=\"cb1-3\"><a href=\"https://tylercipriani.com/blog/#cb1-3\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># Optionally, if you set this to &quot;random&quot;, it&#39;ll load a random theme each</span></span>\n<span id=\"cb1-4\"><a href=\"https://tylercipriani.com/blog/#cb1-4\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># time that oh-my-zsh is loaded.</span></span>\n<span id=\"cb1-5\"><a href=\"https://tylercipriani.com/blog/#cb1-5\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"va\">ZSH_THEME</span><span class=\"op\">=</span><span class=\"st\">&quot;junkfood&quot;</span></span></code></pre></div>\n</section>\n<section id=\"almost-not-quite\" class=\"level2\">\n<h2>Almost, not quite…</h2>\n<p>Like any good dotfile obsessive, I’ve continued to make changes to\nthis prompt since I made my pull request to ole Robby! I’ve modified the\nprompt to show the same sort of branch information about SVN repos that\nit currently displays for git repos (e.g., current branch name and local\nmodifications). That little code chestnut is available over on\n<a href=\"https://github.com/thcipriani/oh-my-zsh\">my fork of the\noh-my-zsh build</a>.</p>\n</section>\n<section id=\"bash-junkfood-theme\" class=\"level2\">\n<h2>Bash Junkfood theme</h2>\n<p>I also have a version of this prompt for Bash that I’ve made in\npreperation for the undoubted overwhelming demand that I expect to begin\nany time now:</p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash lineNumbers\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"co\"># An extravagent PS1 http://blog.bigdinosaur.org/easy-ps1-colors/</span></span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">function</span><span class=\"fu\"> prompt</span> <span class=\"kw\">{</span></span>\n<span id=\"cb2-3\"><a href=\"https://tylercipriani.com/blog/#cb2-3\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 30m - Black</span></span>\n<span id=\"cb2-4\"><a href=\"https://tylercipriani.com/blog/#cb2-4\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 31m - Red</span></span>\n<span id=\"cb2-5\"><a href=\"https://tylercipriani.com/blog/#cb2-5\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 32m - Green</span></span>\n<span id=\"cb2-6\"><a href=\"https://tylercipriani.com/blog/#cb2-6\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 33m - Yellow</span></span>\n<span id=\"cb2-7\"><a href=\"https://tylercipriani.com/blog/#cb2-7\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 34m - Blue</span></span>\n<span id=\"cb2-8\"><a href=\"https://tylercipriani.com/blog/#cb2-8\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 35m - Purple</span></span>\n<span id=\"cb2-9\"><a href=\"https://tylercipriani.com/blog/#cb2-9\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 36m - Cyan</span></span>\n<span id=\"cb2-10\"><a href=\"https://tylercipriani.com/blog/#cb2-10\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 37m - White</span></span>\n<span id=\"cb2-11\"><a href=\"https://tylercipriani.com/blog/#cb2-11\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 0 - Normal</span></span>\n<span id=\"cb2-12\"><a href=\"https://tylercipriani.com/blog/#cb2-12\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"co\"># 1 - Bold</span></span>\n<span id=\"cb2-13\"><a href=\"https://tylercipriani.com/blog/#cb2-13\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">BLACK</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;30m\\]&quot;</span></span>\n<span id=\"cb2-14\"><a href=\"https://tylercipriani.com/blog/#cb2-14\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">BLACKBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;30m\\]&quot;</span></span>\n<span id=\"cb2-15\"><a href=\"https://tylercipriani.com/blog/#cb2-15\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">RED</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;31m\\]&quot;</span></span>\n<span id=\"cb2-16\"><a href=\"https://tylercipriani.com/blog/#cb2-16\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">REDBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;31m\\]&quot;</span></span>\n<span id=\"cb2-17\"><a href=\"https://tylercipriani.com/blog/#cb2-17\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">GREEN</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;32m\\]&quot;</span></span>\n<span id=\"cb2-18\"><a href=\"https://tylercipriani.com/blog/#cb2-18\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">GREENBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;32m\\]&quot;</span></span>\n<span id=\"cb2-19\"><a href=\"https://tylercipriani.com/blog/#cb2-19\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">YELLOW</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;33m\\]&quot;</span></span>\n<span id=\"cb2-20\"><a href=\"https://tylercipriani.com/blog/#cb2-20\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">YELLOWBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;33m\\]&quot;</span></span>\n<span id=\"cb2-21\"><a href=\"https://tylercipriani.com/blog/#cb2-21\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">BLUE</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;34m\\]&quot;</span></span>\n<span id=\"cb2-22\"><a href=\"https://tylercipriani.com/blog/#cb2-22\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">BLUEBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;34m\\]&quot;</span></span>\n<span id=\"cb2-23\"><a href=\"https://tylercipriani.com/blog/#cb2-23\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">PURPLE</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;35m\\]&quot;</span></span>\n<span id=\"cb2-24\"><a href=\"https://tylercipriani.com/blog/#cb2-24\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">PURPLEBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;35m\\]&quot;</span></span>\n<span id=\"cb2-25\"><a href=\"https://tylercipriani.com/blog/#cb2-25\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">CYAN</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;36m\\]&quot;</span></span>\n<span id=\"cb2-26\"><a href=\"https://tylercipriani.com/blog/#cb2-26\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">CYANBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;36m\\]&quot;</span></span>\n<span id=\"cb2-27\"><a href=\"https://tylercipriani.com/blog/#cb2-27\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">WHITE</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[0;37m\\]&quot;</span></span>\n<span id=\"cb2-28\"><a href=\"https://tylercipriani.com/blog/#cb2-28\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">local</span> <span class=\"va\">WHITEBOLD</span><span class=\"op\">=</span><span class=\"st\">&quot;\\[\\033[1;37m\\]&quot;</span></span>\n<span id=\"cb2-29\"><a href=\"https://tylercipriani.com/blog/#cb2-29\" aria-hidden=\"true\" tabindex=\"-1\"></a>  <span class=\"bu\">export</span> <span class=\"va\">PS1</span><span class=\"op\">=</span><span class=\"st\">&quot;</span><span class=\"va\">$WHITEBOLD</span><span class=\"st\"># </span><span class=\"va\">$GREEN</span><span class=\"st\">\\u</span><span class=\"va\">$WHITEBOLD</span><span class=\"st\">. </span><span class=\"va\">$BLUE</span><span class=\"st\">\\h</span><span class=\"va\">$WHITEBOLD</span><span class=\"st\">. </span><span class=\"va\">$YELLOW</span><span class=\"st\">\\d</span><span class=\"va\">$WHITE</span><span class=\"st\"> at </span><span class=\"va\">$PURPLE</span><span class=\"st\">\\@</span><span class=\"va\">$WHITEBOLD</span><span class=\"st\">. </span><span class=\"va\">$CYAN</span><span class=\"st\">\\w\\n  </span><span class=\"va\">$WHITE</span><span class=\"st\">&quot;</span></span>\n<span id=\"cb2-30\"><a href=\"https://tylercipriani.com/blog/#cb2-30\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"kw\">}</span></span>\n<span id=\"cb2-31\"><a href=\"https://tylercipriani.com/blog/#cb2-31\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">prompt</span></span></code></pre></div>\n</section>\n<section id=\"prompt-inspiration\" class=\"level2\">\n<h2>Prompt Inspiration</h2>\n<p>Most of the inspiration for moving to ZSH and for creating this\n<em>extravagant</em> (to borrow a phrase) prompt came from a blog post\nwritten by Mr. Steve Losh called,\n<a href=\"http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#oh-my-zsh\">\n“My Extravagant ZSH Prompt”</a>.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/10/21/move-existing-website-to-git/",

    "title": "Integrating git with your existing website",
    "url": "https://tylercipriani.com/blog/2012/10/21/move-existing-website-to-git/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "vcs"

    ],

    "date_published": "2012-10-21T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>Better git it in your\nsoul<a href=\"http://www.youtube.com/watch?v=SPoK1lryfh4\">*</a>.</p>\n<p>Git has a\n<a href=\"https://bitly.com/bundles/matthewmccullough/1\">lot</a> of\n<a href=\"http://try.github.com/levels/1/challenges/1\">great</a>\n<a href=\"https://peepcode.com/products/git\">tutorials</a> for getting\nstarted. There are also a number of great articles on\n<a href=\"http://daneden.github.com/github-workflow/\">how to use git and\ngithub</a> for your workflow.</p>\n<p>What I haven’t seen is an article on how to integrate git with your\ncurrent site without storing any code on github. I’m writing this blog\nto create a quick reference for how to get up and running using git on\nyour existing site.</p>\n<section id=\"needed\" class=\"level2\">\n<h2>Needed</h2>\n<p>I’m making the assumption that you have the following: <ul>\n<li>Knowledge of Linux</li>\n<li>­<a href=\"http://library.linode.com/lamp-guides/ubuntu-12.04-precise-pangolin\">\nA local development environment </a></li> <li>git-core installed both\nlocally and on your webserver</li> <li>rsync installed both locally and\non your webserver</li>\n<li>­<a href=\"http://www.commandlinefu.com/commands/view/771/copy-your-ssh-public-key-on-a-remote-machine-for-passwordless-login-the-easy-way\">\nKeyless SSH access to your webserver </a></li> </ul></p>\n<p>I’m using Ubuntu 12.04 locally, but I’d assume that most of this\nwon’t be too different on a different distribution or on a Mac—but I’m\nprobably totally wrong about that ☺</p>\n<hr />\n</section>\n<section id=\"step-one\" class=\"level2\">\n<h2>Step One:</h2>\n<p><strong>RSync your site to your local development\nenvironment</strong></p>\n<p>In order to begin to develop locally (and break the old\n<a href=\"http://www.bnj.com/cowboy-coding-pink-sombrero/\">cowboy-coding</a>\nhabits that you’ve undoubtedly developed over the years) you need a\nlocal copy of your site.</p>\n<ol type=\"1\">\n<li>Open your terminal emulator and <code>cd</code> to the directory in\nwhich you will be storing these files (i.e. <code>cd\n/srv­/www­/tylercipriani.com­/public_html</code>)</li>\n<li>Rsync the <code>htdocs</code> or <code>public_html</code> from your\nwebserver into this local directory:</li>\n</ol>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> rsync <span class=\"at\">-av</span> <span class=\"at\">-e</span> <span class=\"st\">&quot;ssh -p &lt;port&gt;&quot;</span> <span class=\"op\">&lt;</span>rsync-username<span class=\"op\">&gt;</span>@<span class=\"op\">&lt;</span>webserver<span class=\"op\">&gt;</span>:/path/to/public_html/ .</span></code></pre></div>\n<p>The command breaks down like this:</p>\n<ul>\n<li><code>a</code> means “Archive”—keeps permissions, mtimes, etc the\nsame</li>\n<li><code>v</code> means “Verbose”—increases verbosity of the\ncommand</li>\n<li><code>e</code> means “RSH”—allows you to use remote shell (same as\nRSH=command)</li>\n<li><code>:/path/to/htdocs/</code>—the path to you htdocs folder. The\ntrailing <code>/</code> is significant—it means copy the content of the\nhtdocs directory rather than the directory by name</li></li>\n<li><code>.</code> is the current directory</li>\n</ul>\n<hr />\n</section>\n<section id=\"step-two\" class=\"level2\">\n<h2>Step Two:</h2>\n<p><strong>Initialize git in local development environment.</strong></p>\n<p>This step will create a new git repository on your local machine and\nadd all the code that you’ve rsynced in the previous step to that\nrepo.</p>\n<ol type=\"1\">\n<li><p>­<code>cd</code> to the directory to which you previously rsynced\nyour site and initialize a git repository by running <code>git\ninit</code></p>\n<div class=\"sourceCode\" id=\"cb2\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb2-1\"><a href=\"https://tylercipriani.com/blog/#cb2-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> cd /srv/www/tylercipriani.com/public_html/</span>\n<span id=\"cb2-2\"><a href=\"https://tylercipriani.com/blog/#cb2-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git init</span></code></pre></div></li>\n<li><p>Add the contents of the current directory to the git repository\nby running <code>git add .</code></p></li>\n<li><p>Commit all your newly added files to the repo by running your\nfirst commit <code>git commit -m “First Commit”</code></p></li>\n</ol>\n<hr />\n</section>\n<section id=\"step-three\" class=\"level2\">\n<h2>Step Three:</h2>\n<p><strong>Setup a bare repo on your web server</strong></p>\n<p>You need a bare repo out on your webserver that will act as a mirror\nto your local development environment.</p>\n<ol type=\"1\">\n<li><p>ssh into your webserver and make a new directory, I usually make\nit above the webroot (i.e. <code>htdocs</code>)</p>\n<div class=\"sourceCode\" id=\"cb3\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb3-1\"><a href=\"https://tylercipriani.com/blog/#cb3-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> mkdir tylercipriani.com.git <span class=\"kw\">&amp;&amp;</span> <span class=\"bu\">cd</span> tylercipriani.com.git</span></code></pre></div></li>\n<li><p>Once inside the new directory initialize a bare repository by\nusing the <code>--bare</code> flag:</p>\n<div class=\"sourceCode\" id=\"cb4\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb4-1\"><a href=\"https://tylercipriani.com/blog/#cb4-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git init <span class=\"at\">--bare</span></span></code></pre></div></li>\n<li><p>Now we can define a new post-receive hook that will be triggered\nwhenever an update is pushed to this new bare repository. The\npost-receive hook can be any type of script you want, the script below\nis written in bash. <code>cd</code> into the <code>.git/hooks</code>\ndirectory and create a file called “post-receive”. Copy the code below\ninto the file:</p>\n<div class=\"sourceCode\" id=\"cb5\"><pre\nclass=\"sourceCode numberSource bash numberLines\"><code class=\"sourceCode bash\"><span id=\"cb5-1\"><a href=\"https://tylercipriani.com/blog/#cb5-1\"></a><span class=\"co\">#!/bin/bash</span></span>\n<span id=\"cb5-2\"><a href=\"https://tylercipriani.com/blog/#cb5-2\"></a><span class=\"va\">GIT_WORK_TREE</span><span class=\"op\">=</span>/path/to/your/htdocs/direcotry <span class=\"fu\">git</span> checkout <span class=\"at\">-f</span></span></code></pre></div>\n<p>make sure that this code is executable by running <code>chmod +x\n.git/hooks/post-receive</code></p></li>\n</ol>\n<hr>\n</section>\n<section id=\"youre-done\" class=\"level2\">\n<h2>You’re Done!</h2>\n<p><strong>Push to your new repo, you beautiful command-line ninja,\nyou!</strong></p>\n<p>Back on your local machine, in the webroot of your local development\nenvironment, add your bare webserver repo as your <code>remote</code>\nand push your git repo up to your server. The post-receive hook will\ntake care of the rest!</p>\n<div class=\"sourceCode\" id=\"cb6\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb6-1\"><a href=\"https://tylercipriani.com/blog/#cb6-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git remote add web ssh://user@tylercipriani.com/home/user/tylercipriani.com.git</span>\n<span id=\"cb6-2\"><a href=\"https://tylercipriani.com/blog/#cb6-2\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git push <span class=\"at\">-u</span> origin master</span></code></pre></div>\n<p>By using the <code>-u</code> flag you’re setting the upstream which\nmeans you can just run <code>git pull</code> without further arguments\nto merge origin and master.</p>\n</section>\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/08/15/step-by-step-amazon-product-api-album-art/",

    "title": "Using Amazon Product Advertising API to Grab Album Art",
    "url": "https://tylercipriani.com/blog/2012/08/15/step-by-step-amazon-product-api-album-art/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing"

    ],

    "date_published": "2012-08-15T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>At Custom Channels we have our own API for Album Art. Our Album Art\nAPI was designed before I got here, it was designed for the single\nuse-case of the Custom Channels standard flash player (i.e. 125×125 gif)\nand isn’t what you’d call “future proof”.</p>\n<p><strong>ANYWAY</strong>, we’re revisiting some of the Custom\nChannels’ site design and one idea I had is to show a handful of\nrecently played albums from a few channels on our homepage. And a\n125×125 gif ain’t gonna to cut the mustard!</p>\n<p>This brings us to the topic of this post—<strong>the Amazon Product\nAdvertising API</strong>—Step-by-Step.</p>\n<p>This assumes you’ve already got a development environment that runs\nPHP5.</p>\n<ul>\n<li><p>The first thing to do, if you haven’t already, is to <a\nhref=\"http://aws.amazon.com/\" title=\"AWS Register\">register</a> for\nAmazon Web Services</p></li>\n<li><p>After you’ve registered for a AWS account, login to your account\nand go to the “My Account/Console” pulldown at the top and click,\n“Security Credentials”</p></li>\n<li><p>Scroll down to “Access\nCredentials”<br><img src=\"http://tylercipriani-files.s3.amazonaws.com/blog/access_credentials.png\" alt=\"Access Credentials\"></p></li>\n<li><p>Copy your “Access Key ID”, click “Show” and copy your “Secret\nAccess Key”</p></li>\n<li><p>Go ahead and clone the <a\nhref=\"https://github.com/Exeu/Amazon-ECS-PHP-Library\"\ntitle=\"Amazon ECS PHP Library\">Amazon ECS PHP Library</a> to your\ndevelopment environment</p>\n<div class=\"sourceCode\" id=\"cb1\"><pre\nclass=\"sourceCode bash\"><code class=\"sourceCode bash\"><span id=\"cb1-1\"><a href=\"https://tylercipriani.com/blog/#cb1-1\" aria-hidden=\"true\" tabindex=\"-1\"></a><span class=\"ex\">$</span> git clone https://github.com/Exeu/Amazon-ECS-PHP-Library.git</span></code></pre></div></li>\n<li><p>You’ll only be using the file\n<code>lib/AmazonECS.class.php</code> so copy that wherever you’d\nlike</p></li>\n<li><p>Once you’ve got that file it’s easy-peasy-lemon-squeezy:\n<script src=\"https://gist.github.com/3364600.js?file=amazon-album-art.php\">\n</script> The code above will take the argument from the “track” url\nparameter and search Amazon’s digital music store and output the\nlarge-format album art for the top match.</p></li>\n</ul>\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/08/01/display-inline-block-extra-margin/",

    "title": "CSS display inline-block Extra Margin/Space",
    "url": "https://tylercipriani.com/blog/2012/08/01/display-inline-block-extra-margin/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "design"

    ],

    "date_published": "2012-08-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p><strong>TL;DR</strong>: The margin isn’t a margin—it’s a space. Try\nusing <code>display: block; float: left;</code> instead.</p>\n<p><strong>ALSO:</strong> Checkout the amazing list of techniques to\ncombat inline-block space-margins at <a\nhref=\"http://css-tricks.com/fighting-the-space-between-inline-block-elements/\"\ntitle=\"Fighting the Space Between inline-block Elements\">CSS\nTricks</a></p>\n<hr>\n<p>I’ve made a weird discovery about using the inline-block display. I\nuse inline-block elements on my <a href=\"http://www.tylercipriani.com,\"\ntitle=\"Tyler Cipriani\">homepage</a> in the <em>Recent Work</em>\nsection.</p>\n<p>I noticed that the math for these block elements wasn’t quite adding\nup—the element width + padding + margin + border should’ve enabled three\nitems on one line; however, the elements were wrapping.</p>\n<p>Here’s an example of what I’m talking about:</p>\n<iframe style=\"margin: 1em 0; width: 100%; height: 300px;\" src=\"https://jsfiddle.net/thcipriani/r7egr/embedded/result,html,css/\" allowfullscreen=\"allowfullscreen\" frameborder=\"0\">\n</iframe>\n<p>Even though the margin of each element is set to zero there is\nseemingly, a margin, between each element.</p>\n<p>This problem could be easily solved by removing the display property,\nfloating each gallery item and using a clearfix on the parent:</p>\n<iframe style=\"margin: 1em 0; width: 100%; height: 300px;\" src=\"https://jsfiddle.net/thcipriani/r7egr/2/embedded/result,html,css/\" allowfullscreen=\"allowfullscreen\" frameborder=\"0\">\n</iframe>\n<p>That solution, however, ignores <em>why</em> that space is being\nadded.</p>\n<p>The inline-block display property treats block level elements\n(e.g. <code>&lt;div&gt;</code>) as an inline element\n(e.g. <code>&lt;span&gt;</code>), and, just like if you had a line break\nbetween two <code>&lt;span&gt;</code> elements, the line-break between\nthe <code>&lt;div&gt;</code>s is creating a space between the\n<code>&lt;div&gt;</code>s. <strong>That extra margin is actually a\nspace—not a margin</strong>.</p>\n<p>Knowing what is creating an inline-block displayed\n<code>&lt;div&gt;</code>’s “margin” enables you to create a couple of\ndifferent solutions.</p>\n<ul>\n<li><strong>First</strong>, the dumb and breakable solution, you could\nremove the spaces and line-breaks in your html</li>\n<li><strong>Second</strong>, directly address the space by setting a\nnegative right margin or negative word-spacing for those elements</li>\n<li>Or, <strong>Finally</strong>, just use\n<code>display: block; float: left;</code></li>\n</ul>\n<p>Here’s an example of what the second solution would look like:</p>\n<iframe style=\"margin: 1em 0; width: 100%; height: 300px\" src=\"https://jsfiddle.net/thcipriani/r7egr/3/embedded/result,html,css/\" allowfullscreen=\"allowfullscreen\" frameborder=\"0\">\n</iframe>\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/20/library-thing/",

    "title": "Library Thing(s)",
    "url": "https://tylercipriani.com/blog/2016/08/20/library-thing/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2012-08-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "   \n\n\n\n\nEarlier this year, I stumbled across <a href=\"https://www.librarything.com\">Library\nThing</a> and almost immediately decided that\nI wanted to join—which is a rare thing for me concerning online\nservices.\n\nSo I did what any normal person would do and I bought a <a href=\"https://www.amazon.com/gp/product/B00406YZGK/ref=oh_aui_detailpage_o06_s01?ie=UTF8&psc=1\">barcode\nscanner</a>\nand wrote some python to build my catalog.\n\nThe <a href=\"https://github.com/thcipriani/dotfiles/blob/master/bin/LibraryThing\">python\nscript</a>\nis just a loop that shows a prompt and waits for an ISBN, <code>t</code> to input a\ntag, <code>q</code> to quit. Meanwhile it\'s generating a csv file that\ncan be uploaded to LibraryThing.\n\nThe fruits of this labor were/are my (and Blazey\'s) <a href=\"https://www.librarything.com/catalog/thcipriani\">Library Thing Catalog</a>\n\n"

},
{

    "id": "https://tylercipriani.com/blog/2016/08/20/to-read/",

    "title": "To Read",
    "url": "https://tylercipriani.com/blog/2016/08/20/to-read/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "books"

    ],

    "date_published": "2012-08-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "   \n\n\n\n\n* the green hills of earth - Heinlein\n* <a href=\"http://encore.coalliance.org/iii/encore/record/C__Rb15258367__SPeter%20Ludlow__P0%2C9__Orightresult__U__X4?lang=eng&suite=def\">Crypto anarchy, cyberstates, and pirate utopias</a> by Peter Ludlow\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/07/27/contrast-ratio-in-action/",

    "title": "Website Contrast Ratio in Practice",
    "url": "https://tylercipriani.com/blog/2012/07/27/contrast-ratio-in-action/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "design"

    ],

    "date_published": "2012-07-27T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>While perusing <a href=\"http://news.ycombinator.com/\"\ntitle=\"Hacker News\">Hacker News</a> I ran across a single-page site\ncalled <a href=\"http://contrastrebellion.com/\"\ntitle=\"Contrast Rebellion\">Contrast Rebellion</a>— which I understand\nhas created a bit of controversy.</p>\n<p>I think the point espoused by Contrast Rebellion is both well-made\nand well-taken (despite the host of straw-man style arguments to the\ncontrary); however, I feel that—in <em>most</em> designs—contrast arises\nfairly organically. If I can’t read my font, or there isn’t enough\ncontrast in my color palate, then I know that the people from whom I\nsolicit opinions are going to mention that before saying anything\nelse.</p>\n<p>If only we were all so lucky. ☺</p>\n<p>On the <a\nhref=\"http://www.w3.org/TR/WCAG10-CSS-TECHS/#style-color-contrast\"\ntitle=\"CSS Techniques for Web Content Accessibility Guidelines 1.0\">topic\nof color contrast</a> the W3C defines <a\nhref=\"http://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html\"\ntitle=\"Success Criterion 1.4.3\">Success Criterion 1.4.3</a> saying:</p>\n<blockquote>\n<p><strong>Contrast (Minimum)</strong>: The visual presentation of text\nand images of text has a contrast ratio of at least 4.5:1, except for\nthe following: (Level AA)</p>\n<ul>\n<li><strong>Large Text</strong>: Large-scale text and images of\nlarge-scale text have a contrast ratio of at least 3:1;</li>\n<li><strong>Incidental</strong>: Text or images of text that are part of\nan inactive user interface component, that are pure decoration, that are\nnot visible to anyone, or that are part of a picture that contains\nsignificant other visual content, have no contrast requirement.</li>\n<li><strong>Logotypes</strong>: Text that is part of a logo or brand\nname has no minimum contrast requirement.</li>\n</ul>\n</blockquote>\n<p>There is a formula for calculating the contrast of two colors\navailable at <a\nhref=\"http://www.paciellogroup.com/resources/contrast-analyser.html,\"\ntitle=\"Contrast Analyser\">the paciello group</a>— they also have a\nContrast Analyser that you can download for Mac and Windows.</p>\n<p>Alternately, you could skip the download and the hand-cranking of\nnumbers and enter your hex codes into the <a\nhref=\"http://juicystudio.com/services/luminositycontrastratio.php,\"\ntitle=\"Luminosity Colour Contrast Ratio Analyser\">Luminosity Colour\nContrast Ratio Analyser</a></p>\n<blockquote>\n<p><strong>edit</strong>—11/23/2012</p>\n<p>My new favorite tool for contrast checking is <a\nhref=\"http://leaverou.github.com/contrast-ratio/\">Lea Verou’s constrast\nchecker</a></p>\n</blockquote>\n<hr />\n<p><strong>Looking at popular websites contrast</strong></p>\n<p>The genesis of this exercise was to review websites I have built and\nto review some other popular sites so lets do that …</p>\n<hr />\n<p><strong>The contrast on this site</strong></p>\n<p>It’s pretty good right? The text you’re reading I mean— it’easy to\nread, contrast-wise anyway.</p>\n<ul>\n<li><strong>Text color</strong>: <a\nhref=\"http://www.colourlovers.com/color/444444\">#444444</a></li>\n<li><strong>Background color</strong>: <a\nhref=\"http://www.colourlovers.com/color/F8F8F8\">#f8f8f8</a></li>\n<li><strong>Contrast-ratio</strong>: 9.17:1</li>\n<li><strong>Analysis</strong>: Pretty amazing.</li>\n</ul>\n<blockquote>\n<p><strong>edit</strong>—11/23/2012</p>\n<p>You’re looking at Text color: <a\nhref=\"http://www.colourlovers.com/color/8f8d80\">#8f8d80</a> which means\nthat the contrast ratio here has dropped to 3.1:1—which meets the\nsuccess cirterion for the current text-size of 24px! (which is,\nadmittedly, very large, but whatever, I ain’t scared).</p>\n</blockquote>\n<hr />\n<p><strong>Apple’s nav bar</strong></p>\n<p><img class=\"blogImg\" src=\"http://tylercipriani-files.s3.amazonaws.com/blog/Apple-nav-bar.png\" alt=\"Apple\'s nav bar\"></p>\n<p>Apple’s nav bar is a gradient, so this analysis is for the color at\nthe lightest point of the gradient versus the text</p>\n<ul>\n<li><strong>Text color</strong>: <a\nhref=\"http://www.colourlovers.com/color/FFFFFF\">#FFFFFF</a></li>\n<li><strong>Background color</strong> (again, at the lightest part of\nthe gradient): <a\nhref=\"http://www.colourlovers.com/color/727272\">#727272</a></li>\n<li><strong>Contrast-ratio</strong>: 4.81:1</li>\n<li><strong>Analysis</strong>: Passed at Level AA for regular text, and\npass at Level AAA for large text (18pt or 14pt bold)—Apple’s nav text is\nSVG (ostensibly for the new retina displays), but it seems to be about\n13pt–14pt. A little low-contrast perhaps, but not too drastic.</li>\n</ul>\n<hr />\n<p><strong>Google’s account settings bar</strong></p>\n<figure>\n<img\nsrc=\"http://tylercipriani-files.s3.amazonaws.com/blog/google-account-settings.png\"\nalt=\"Google’s account settings bar\" />\n<figcaption aria-hidden=\"true\">Google’s account settings\nbar</figcaption>\n</figure>\n<p>The Google account settings bar has always seemed to be fairly\nlow-contrast to me—let’s test a theory.</p>\n<ul>\n<li><strong>Text color</strong>: <a\nhref=\"http://www.colourlovers.com/color/666666\">#666666</a></li>\n<li><strong>Background color</strong>: <a\nhref=\"http://www.colourlovers.com/color/F1F1F1\">#F1F1F1</a></li>\n<li><strong>Contrast-ratio</strong>: 5.08:1</li>\n<li><strong>Analysis</strong>: Passed at Level AA for regular text, and\npass at Level AAA for large text (18pt or 14pt bold)—better contrast\nthan Apple; however, the text in this image above is 13px/27px\nArial,sans-serif at the default font-weight which is close, but not\nquite ideal.</li>\n</ul>\n<p>Out of curiousity I decided to see what these recommendations would\nlook like for Google in practice—answer: more readable, arguably less\naesthetically appealing (see below).</p>\n<p><img class=\"blogImg\" src=\"http://tylercipriani-files.s3.amazonaws.com/blog/google-account-settings_large.png\" alt=\"Google\'s account settings bar—larger font\"></p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2012/07/26/alt-numpad-for-linux/",

    "title": "Alt-Numpad for Linux",
    "url": "https://tylercipriani.com/blog/2012/07/26/alt-numpad-for-linux/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "tags": [

     "computing",

     "keyboard",

     "unicode"

    ],

    "date_published": "2011-07-26T00:00:00Z",
    "date_modified": "2017-07-01T00:49:09Z",


    "content_html": "<p>In Ubuntu the alt+numpad ACSII codes don’t work—this <em>was</em> a\nmajor stumbling block for me since I am annoyingly <a\nhref=\"http://www.smashingmagazine.com/2011/08/15/mind-your-en-and-em-dashes-typographic-etiquette/\"\ntitle=\"Smashing Magazine—mind your em and en dashes\">picky about\ntypography</a>.</p>\n<p>After spending way too much time Googling I found that these steps\nwork:</p>\n<ul>\n<li>Hold <code>Ctrl+Shift+U</code></li>\n<li>Release the “U” key (while still holding Ctrl+Shift)</li>\n<li>Type the Unicode code for the special character you’d like to\nuse</li>\n<li>Find unicode characters by <a\nhref=\"http://www.wolframalpha.com/input/?i=em+dash\"\ntitle=\"em dash - Wolfram|Alpha\">searching on Wolfram Alpha</a></li>\n</ul>\n<p>Another great unicode character reference for math and science can be\nfound at <a\nhref=\"http://tlt.its.psu.edu/suggestions/international/bylanguage/mathchart.html\"\ntitle=\"Math Unicode Entities\">Penn State’s website</a>. Of course, if\nyou don’t want to remember these unicode characters,\nCopyPasteCharacter.com is a good <a\nhref=\"http://copypastecharacter.com/\"\ntitle=\"✿ Our favorite set — CopyPasteCharacter.com\">ACSII character\nresource</a>.</p>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/08/16/just-got-a-new-squeezebox/",

    "title": "Just Got A New Squeezebox",
    "url": "https://tylercipriani.com/blog/2009/08/16/just-got-a-new-squeezebox/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-08-16T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<figure>\n<img src=\"https://tylercipriani.com/static/images/squeezebox.jpg\" alt=\"Squeezebox\" />\n<figcaption aria-hidden=\"true\">Squeezebox</figcaption>\n</figure>\n<p>Just got a new sqeezebox. I got it set up with all of the Custom\nChannels Internet radio stations since that is my latest gig. Overall, a\npretty righteous gift.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/08/15/ninja-assassin/",

    "title": "Ninja Assassin",
    "url": "https://tylercipriani.com/blog/2009/08/15/ninja-assassin/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-08-15T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>This Movie looks Awesome - anything with ninjas is awesome, really.\nI’ve never been a ninja naysayer - even when all them other brotha’s be\nhatin’. Also, if you get your fingers just off the Home Keys on the\nkeyboard and try to type ninja, you end up typing “mom” and that’s not\nright. Mom is not equal to ninja.</p>\n<p><a\nhref=\"http://www.mtv.com/videos/movie-trailers/412608/ninja-assassin.jhtml\">Trailer</a></p>\n<p>found via a very awesome blog: <a\nhref=\"https://web.archive.org/web/20100124073108/http://subtielman.wordpress.com/\">SUBTIELMAN</a></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/08/14/terroir/",

    "title": "Terroir",
    "url": "https://tylercipriani.com/blog/2009/08/14/terroir/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-08-14T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<figure>\n<img src=\"https://tylercipriani.com/static/images/terroir.jpg\" alt=\"Terroir Longmont\" />\n<figcaption aria-hidden=\"true\">Terroir Longmont</figcaption>\n</figure>\n<p>Had an amazing meal tonight at Terroir in Longmont. Pictured is the\nmost amazing thing you will never taste. Booya!</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/07/04/field-notes-notebooks/",

    "title": "field-notes-notebooks",
    "url": "https://tylercipriani.com/blog/2009/07/04/field-notes-notebooks/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-07-04T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>This has been another recent obsession of mine. These simple field\nnotebooks are quite a step-up from a moleskine in design but a step down\nin price. Sweet.</p>\n<p>Also, be sure to check out the <a href=\"http://draplin.com/\">Draplin\nDesign company</a> and <a href=\"http://www.coudal.com/\">Coudal\nPartners</a> (the duo responsible for these mean little notepads).</p>\n<p>Also, check out Aaron Draplin on Vimeo to find out why <a\nhref=\"http://vimeo.com/1465284\">America is F*cked…Graphically at\nleast</a>.</p>\n<p>Also, I’m love Futura.</p>\n<p>That is all.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/07/01/july-1--2009/",

    "title": "July 1, 2009",
    "url": "https://tylercipriani.com/blog/2009/07/01/july-1--2009/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-07-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<blockquote>\n<p>The opposite of youth is compromise – Girl</p>\n</blockquote>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/06/22/why-is-there-so-much-unemployment-in-a-depression-/",

    "title": "Why Is There So Much Unemployment in a Depression?",
    "url": "https://tylercipriani.com/blog/2009/06/22/why-is-there-so-much-unemployment-in-a-depression-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-06-22T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<h2><a href=\"https://tylercipriani.com/web/20090820011215/http://correspondents.theatlantic.com/richard_posner/2009/06/why_is_there_unemployment_in_a_depression.php\"  target=\"_blank\" >Why Is There So Much Unemployment in a Depression?</a></h2>\n<p>Richard Posner helps to bridge the gap between a priori conclusions\nabout unemployment during a recession/depression with the observable\ntruths. Very interesting and highly recommended - if you’re a dorky\narmchair economist like myself.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2009/06/12/june-12--2009/",

    "title": "June 12, 2009",
    "url": "https://tylercipriani.com/blog/2009/06/12/june-12--2009/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2009-06-12T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<figure>\n<img src=\"https://tylercipriani.com/static/images/bulkgrain.jpg\" alt=\"Bulk grain banner\" />\n<figcaption aria-hidden=\"true\">Bulk grain banner</figcaption>\n</figure>\n<p>So we’re getting a bulk grain order together - like a pallet of bulk\ngrain. I’m pumped. Also I designed a pretty killer banner for the\nwebpage with the order info. It’s good to be da king. Word.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/23/boring-friday--make-paper-airplanes-/",

    "title": "Boring Friday? Make Paper Airplanes.",
    "url": "https://tylercipriani.com/blog/2007/07/23/boring-friday--make-paper-airplanes-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-23T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Is it just me, or are Fridays the longest, most boring, punishing,\nand brutal work day ever? Just me? Ok….well…ANYWAY, why spend your day\nworking when you could be making (or\n<a href=\"http://myspace.com/paperairplanes\">listening to</a>) paper\nairplanes? The one pictured above is the lecture dart, to me, creative\nnames for paper airplanes are almost as important as how well a plane\nflies; the world is about marketing, after all. Check out the\n<a href=\"http://www.theonlinepaperairplanemuseum.com/\">Online Paper\nAirplane Museum</a> I found on\n<a href=\"http://www.makezine.com/blog/archive/2007/07/the_online_paper_airplane.html\">MAKE</a>.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/23/my-favorite-bookmarklets/",

    "title": "My Favorite Bookmarklets",
    "url": "https://tylercipriani.com/blog/2007/07/23/my-favorite-bookmarklets/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-23T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Bookmarklets — I’ve heard the word. I never really cared about them;\njust one more thing online that I’m not interested in. This was my\nopinion before I actually knew what bookmarklets were. Now I know,\nbookmarklets are tiny bits of javascript that you bookmark to add\nfunctionality to your browser. It sounds pointless, but when you find\nsome useful bookmarklets, you’ll see a point. Added bonus? Finally use\nyour Firefox bookmark toolbar for good instead of evil. Before I get\nstarted on my list you might want to check out a useful\n<a href=\"http://weblog.infoworld.com/udell/gems/bookmarklet.html\">screencast\non using bookmarklets</a>.</p> <ul> <li>\n<a href=\"javascript:void(window.open(\'http://tinyurl.com/create.php?url=\'+document.location.href));\">TinyURL</a>\n- click this bookmark to create a tiny url for the page that you are\ncurrently viewing.</li> <li>\n<a href=\"javascript:q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22You%20didn\'t%20select%20any%20text.%20%20Enter%20a%20search%20phrase:%22,%20%22%22);%20if%20(q!=null)%20location=%22http://bugmenot.com/view.php?mode=bookmarklet&amp;url=%22%20+%20escape(q);%20void%200\">BugMeNot</a>\n- click this to open a window with a username and password for the site\nthat you’re currently viewing.</li> <li>\n<a href=\"javascript:(function()%7Bq=document.getSelection();%20if(!q)%7Bvoid(q=prompt(\'Wikipedia%20keywords:\',\'\'))%7D;%20if(q)location.href=\'http://en.wikipedia.org/w/wiki.phtml?search=\'+escape(q)%7D)()\">Wikipedia\nlookup</a> - highlight some text, click this bookmarklet and it\nautomagically searches for the highlighted text in wikipedia.</li> <li>\n<a href=\"javascript:location=\'http://translate.google.com/translate?u=\'%20+%20encodeURIComponent(location);\">Google\nTranslate</a> - Translates the page you’re view to english (google\ntranslate can also be\n<a href=\"http://www.oreillynet.com/pub/h/4807\">used as a proxy</a> to\nview restricted pages)</li> <li>\n<a href=\"javascript:q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22You%20didn\'t%20select%20any%20text.%20%20Enter%20a%20search%20phrase:%22,%20%22%22);%20if%20(q!=null)%20location=%22http://imdb.com/find?s=all&amp;q=%22%20+%20escape(q);%20void%200\">IMDb</a>\n- highlight the plain-text title of the movie you want to lookup on IMDb\nand click the bookmarklet</li> <li>\n<a href=\"javascript:%20s%20=%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(s%20==%20\'\')%20%7B%20l%20=%20parent.frames.length;%20if%20(l%20!=%201)%20%7B%20for%20(i%20=%200;%20i%20&lt;%20l;%20i++)%20%7B%20s%20=%20parent.frames%5Bi%5D.document.getSelection%20?%20parent.frames%5Bi%5D.document.getSelection()%20:%20parent.frames%5Bi%5D.document.selection.createRange().text;%20if%20(s)%20%7B%20break;%20%7D%20%7D%20%7D%20%7D%20if%20(s%20==%20\'\')%20%7B%20void(%20s%20=%20prompt(\'Oxford%20English%20Dictionary:%5CnEnter%20a%20term%20or%20mark%20some%20text.\',\'\')%20);%20%7D%20if%20(s)%20%7B%20s%20=%20String(s);%20s%20=%20s.replace(/%5E%5Cs*%7C%5Cs*%24/g,\'\');%20s%20=%20s.replace(/%5B%5C.%5C?!,:-%5D+%24/,%20\'\');%20s%20=%20escape(s);void(%20bmw%20=%20open(\'http://www.oup.com/oald-bin/web_getald7index1a.pl?search_word=\'+s+\'\',\'OxfordBM\'+String(Math.round(Math.random()*1000)))%20);%7D\">Oxford\nEnglish Dictionary</a> - highlight work and click for definition</li>\n<li>\n<a href=\"javascript:q%20=%20%22%22%20+%20(window.getSelection%20?%20window.getSelection()%20:%20document.getSelection%20?%20document.getSelection()%20:%20document.selection.createRange().text);%20if%20(!q)%20q%20=%20prompt(%22You%20didn\'t%20select%20any%20text.%20%20Enter%20a%20search%20phrase:%22,%20%22%22);%20if%20(q!=null)%20location=%22http://search.ebay.com/%22%20+%20escape(q);%20void%200\">Ebay</a>\n- highlight item name and click bookmarklet</li> </ul>That about does it\nfor my list of favorites. Check out\n<a href=\"http://www.smashingmagazine.com/2007/01/24/bookmarklets-favelets-and-snippets/\">this\nmuch longer list from Smashing Magazine</a>.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/20/write-u--op---p--sdn/",

    "title": "Write u&#x28D;op &#x1DD;p&#x131;sdn",
    "url": "https://tylercipriani.com/blog/2007/07/20/write-u--op---p--sdn/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-20T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>» <a href=\"http://www.revfad.com/flip.html\">Write uʍop ǝpısdn\n</a></p>\n<p>Cool little webpage which can ǝsɹǝʌǝɹ whatever text you type into it,\nnot only horizontally but also vertically. It got 6357 Diggs; therefore,\nit is beloved and you will love it.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/12/wayback-machine-fun/",

    "title": "Wayback Machine Fun",
    "url": "https://tylercipriani.com/blog/2007/07/12/wayback-machine-fun/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-12T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Most people on the internet have some favorite website that isn’t\naround anymore. Some people on the internet - me for instance - know\nwhere to find that website. If your website was popular enough, chances\nare it got archived and can now be found with the <a\nhref=\"http://www.archive.org/web/web.php\"\ntarget=\"_blank\">Wayback Machine</a> (I believe it was invented by a <a\nhref=\"http://en.wikipedia.org/wiki/Mr._Peabody\"\ntarget=\"_blank\">Mr.Peabody</a>, however, this fact is, as yet,\nunsubstantiated).<br /> The website I miss most in this world is\ncurrently working via the Wayback Machine. I am refering to every\nguitarist’s favorite website: OLGA.<br /> <img\nsrc=\"http://aycu02.webshots.com/image/19201/2004754860900368032_rs.jpg\"\nalt=\"online guitar archive olga\" /><br /> Not only is ole OLGA up, you\ncan still get <i>some</i> tabs from it. You can download any tab you\nwant and, from there, simply open it with <a\nhref=\"http://notepad-plus.sourceforge.net/uk/site.htm\"\ntarget=\"_blank\">Notepad++</a>, not just Windows default notepad,\nthings’ll look all weird. Anyway, this discovery made me pee a little\nwhen I found it, so I thought I’d share it.<br /> Also, you can use the\nWayback Machine to laugh at old incarnations of your favorite websites.\nSuch as <a\nhref=\"http://web.archive.org/web/19981202230410/http://www.google.com/\"\ntarget=\"_blank\">Google from December 2nd, 1998</a> where under the link\ntitled <a\nhref=\"http://web.archive.org/web/19981202230410/http://www.google.com/stickers.html\"\ntarget=\"_blank\">Google! Logos</a> I found a bitchin’ logo.<br /> .<br />\nAnyway, playing is for pleasure so have some fun and play around with\nthe Wayback Machine. See if you can find some other old school website\nthat still works, if you do, share it with *balloontoablimp via email or\nin my shout box (I’ve already tried using audiogalaxy [doesn’t work],\noriginal MP3.com [doesn’t work] and singingfish.com [also, not working]\n- by ‘not working’ I mean that their services no longer work, not the\nwebsite itself).<br />EL FIN.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/03/veoh-for-the-blogger-out-of-the-know/",

    "title": "Veoh for the Blogger Out-of-the-Know",
    "url": "https://tylercipriani.com/blog/2007/07/03/veoh-for-the-blogger-out-of-the-know/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-03T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>So, for an in-the-know, pop-culture savy,\nfinger-on-the-pulse-of-the-zeitgeist, hyphenated-word-(over-)using, tech\nblogger I’m pretty out-of-the-know. I just got turned on to a website\ncalled veoh by alexa traffic’s <a\nhref=\"https://web.archive.org/web/20070701212508/http://www.alexa.com/site/ds/top_sites?cc=US&amp;ts_mode=country&amp;lang=none\"\ntarget=\"_blank\">top 100 sites in the US</a> (it was #71 actually). I\njust started using the site tonight and so far I’m diggin’ it. I really\ndon’t think it’s necessary, however, to download the veoh player when\nyou can watch any video from the site online full-screen. TV on-demand\nonline, I just love it so darn much.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/01/navigate-your-computer-the-easy-way/",

    "title": "Navigate Your Computer the Easy Way",
    "url": "https://tylercipriani.com/blog/2007/07/01/navigate-your-computer-the-easy-way/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>Keyboard shortcuts are the ish nizzle, they speed up your computing,\nthey simplify navigation, they’re old school. If you can’t navigate your\nfilesystem/computer without touching your mouse, then you aren’t as cool\nas me, and that’s the straight dope. I’m writing this because I saw an\narticle today on the <a href=\"http://lifehacker.com/\"\ntarget=\"_blank\">lifehacker website</a> about <a\nhref=\"http://lifehacker.com/software/video-demonstration/master-the-windows-key-267179.php\"\ntarget=\"_blank\">mastering the windows key</a>. All the article really\nwas was <a\nhref=\"http://www.metacafe.com/fplayer/627735/8_uses_for_the__windows__key_on_your_keyboard__quite_useful.swf\"\ntarget=\"_blank\">this video</a>. Actually, the video was <i>kind of</i>\ninaccurate. Sure, it’s true that you use Windows Key+Pause/Break key to\nbring up System Properties, but what if you don’t have a combo\npause/break key? Well, if you’re using XP you use WINDOWS_KEY+Pause and\nif you’re using windows vista you use WINDOWS_KEY+break.<br /> Another\nthing about keyboard shortcuts is that you can <i>make</i> a keyboard\nshortcut for any program (or shortcut to a program) on your desktop by:\n(1) Right-clicking the icon (2) Clicking properties (3) clicking inside\nthe shortcut input field and (4) pressing the key that you want to use\nin conjunction with Ctrl and Alt for your shortcut (i.e. if I were to\nclick in the shortcut input box and press, “f” the shortcut to bring up\nthe program would be “Ctrl+Alt+f”).<br /> To learn more interesting\nshortcuts please check out the following:</p><ol><li><a\nhref=\"http://support.microsoft.com/kb/126449\"\ntarget=\"_blank\">Windows XP Keyboard Shortcuts</a></li> <li><a\nhref=\"http://windowshelp.microsoft.com/Windows/en-US/help/2503b91d-d780-4c80-8f08-2f48878dc5661033.mspx\"\ntarget=\"_blank\">Windows Vista Keyboard Shortcuts</a></li> <li><a\nhref=\"http://onlyubuntu.blogspot.com/2007/03/bash-shell-keyboard-shortcuts-for-linux.html\"\ntarget=\"_blank\">Ubuntu Linux Keyboard Shortcuts</a> [via the <a\nhref=\"http://onlyubuntu.blogspot.com/\"\ntarget=\"_blank\">Only Ubuntu Linux Blog</a>]</li> <li><a\nhref=\"http://www.mozilla.org/support/firefox/keyboard\"\ntarget=\"_blank\">Firefox, Opera, and IE Keyboard\nShortcuts</a></li></ol><br\n/>So that about wraps this little post up. If you have any favorite\nshortcuts, dear reader, that you’d like to share, post them in my\nshoutbox, or email them to me.<p></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/07/01/the-meraki-solar-powered-wifi-kit/",

    "title": "The Meraki Solar Powered WiFi Kit",
    "url": "https://tylercipriani.com/blog/2007/07/01/the-meraki-solar-powered-wifi-kit/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-07-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>So, if you know me (which you don\'t; DON\'T ACT LIKE YOU KNOW ME!) you know\nthat I loves me some WiFi. I\'m constantly setting up an encryption key on my\nrouter without looking to see if I can crack it, I enjoy building little\nantennas or cantennas to see how far down the street I can get before I lose my\nsignal, basically I\'m a geek with a penchant for WiFi. As such, I really want\nthis, what this is is a solar-powered WiFi kit. It\'s built for the outdoors and\nis supposed to increase wireless connectivity range about 700 feet (which means\nI could probably hop on <a\nhref=\"http://www.watermarkbooks.com/\"\ntarget=\"_blank\">Watermark Books</a>\' connection down the street). Plus it\'s\nsolar powered so no need for any extra wiring and it\'s saving the enviroment\n(score one for the dolphins, I guess). So if you want to wire me some cash or\njust send one of these bad boys straight to me, then feel free. As a side note\nI\'m also a huge fan of the wireless products over at <a\nhref=\"http://www.wlanparts.com/c=eCS4nzhiacnVPxPG0ovaEo2Zc/\"\ntarget=\"_blank\">Pasadena Networks</a>.</p>\n<p><a\nhref=\"http://nexus404.com/Blog/2007/06/05/meraki-solar-powered-wi-fi-kit/trackback/\"\ntarget=\"_blank\">Link</a> (via <a\nhref=\"http://nexus404.com/Blog/\" target=\"_blank\">Thoughts From the\nSidelines</a>)</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/06/07/find-your-phone-when-you-ve-got-no-friends-/",

    "title": "Find Your Phone When You&#x27;ve Got No Friends!",
    "url": "https://tylercipriani.com/blog/2007/06/07/find-your-phone-when-you-ve-got-no-friends-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-06-07T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>OK, so I don’t have many friends (aside from you, loyal readers\n[reader…whatever]) so when I lose my phone I can’t turn to my good\nfriend Pete (if I had a friend his name would be Pete) and say, “Hey,\nPete, Ole buddy of mine, call my phone.” No, when I lose a cell phone it\nstays lost. I’m not just writing this for pity email (although I\nwouldn’t mind some) I’m writing this because I have the answer to my\nproblems: <a\nhref=\"https://tylercipriani.com/web/20070701212606/http://maps.google.com/\" target=\"_blank\">Google\nMaps</a>! I know it’s probably old news to some blog junkies out there\n(like me <em>single tear</em>) but there are probably a lot of people\nwho don’t know this trick, and if school house rock has taught me\nanything it’s that knowlege is power (and how to <a\nhref=\"https://tylercipriani.com/web/20070701212606/http://www.youtube.com/watch?v=rtL_QYogCNo\"\ntarget=\"_blank\">unpack my adjectives</a>)! How-to website instructables\nshows you how to make Google maps call your cell phone for you.</p> <a\nhref=\"https://tylercipriani.com/web/20070701212606/http://www.instructables.com/id/EWDG1EIF2L4FTZH/?ALLSTEPS\"\ntarget=\"_blank\">Link</a> (via <a\nhref=\"https://tylercipriani.com/web/20070701212606/http://www.instructables.com/\"\ntarget=\"_blank\">Instructables</a>)</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/06/06/steampunk-no-2-is-here--and-it-s-still-free-/",

    "title": "Steampunk No.2 is Here (and it&#x27;s still free)",
    "url": "https://tylercipriani.com/blog/2007/06/06/steampunk-no-2-is-here--and-it-s-still-free-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-06-06T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I\'m not sure how many of my readers are aware of a little indie online \'zine\ncalled <a href=\"https://web.archive.org/web/20070701212704/http://www.steampunkmagazine.com/\"\ntarget=\"_blank\">Steampunk magazine</a>, but if you\'re not hip to it yet it\'s\ntime to check it out for yourself. Steampunk has some great narratives,\nfeatures (like this issues \'Guide to Body Hair\' and an exerpt from an 1887 book\nabout eagles), and interviews (like this issue\'s interview with I-Wei Huang who\ncreates steam-powered robots). Steampunk magazine is only in issue two, so you\nhaven\'t missed much, plus it\'s free to download. Where is the downside to\nsteampunk? Well, gosh darn it, I just don\'t know.<br />By the way...the quote\nabove is from the magazine, not just some random quote that has nothing to do\nwith anything.<br /><br /><a\nhref=\"https://web.archive.org/web/20070701212704/http://www.steampunk.com/\" target=\"_blank\">Link</a>\n(via <a\nhref=\"https://web.archive.org/web/20070701212704/http://www.boingboing.net/2007/05/31/steampunk_magazine_2.html\"\ntarget=\"_blank\">Boing Boing</a>)</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/06/04/troubleshoot-firefox-multimedia-plugins/",

    "title": "Troubleshoot Firefox Multimedia Plugins",
    "url": "https://tylercipriani.com/blog/2007/06/04/troubleshoot-firefox-multimedia-plugins/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-06-04T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p> OK, we\'ve all been there, lookin\' up some video in Firefox and when we find\nit, the player just sits there, no video plays, and we are sad. So, what do we\ndo? We push foward, whenever the little yellow bar comes on top of our screen\nwe mindlessly install the \"missing\" plugins but when it comes down to it,\ndo we <i>really</i> know what to do in a multimedia-plugin-related crisis?\nWhat happens when you can\'t watch the latest episode of the <a\nhref=\"https://web.archive.org/web/20070701212405/http://www.tomgreen.com/\" target=\"_blank\">Tom\nGreen</a> show when you <i>think</i> you\'ve got all your plugins\n<i>plugged-in</i>, so to speak? For most people, nothing happens;\npeople have a way of just going about their lives missing out on great\nonline video content simply because they can\'t figure out why the\nembeded video won\'t work. To this, I say, \"NAY!\" Ok, so maybe I\nwouldn\'t say <i>Nay</i> so much as I would say, \"That Sucks, I ain\'t\ngoin\' out like that!\" (Yeah, I\'m gangsta! WHAT!?!) That\'s why this\narticle is here, to help all the people adrift somewhere out in\nFirefox-internet-land without a plugin to save them.</p>\n<ul><li>The\nfirst thing you might want to check once inside Firefox is what plugins\nyou have installed. You can do this by keying up to Firefox\'s URL bar\n(Ctrl+L) and typing \"about:plugins\" without the quotes. This gives you\na list of all the plugins that are installed in Firefox. You should see\nthings like \"RealPlayer Version Plugin\", \"Windows Media Player Plug-in\nDynamic Link Library\", \"Java Plug-in\", and \"Microsoft® DRM\". If you\ndon\'t see some (or any) of those plugins don\'t sweat it, this article\nis <b>definitely</b> for you.</li> <li> Now that you know what you have\ninstalled you should test all of your plugins to make sure they\'re\nworking (this is also a good way to see what you might still need to\ninstall if you couldn\'t tell from \"about:plugins\"). You can test all of\nyour media plugins for Firefox <a\nhref=\"https://web.archive.org/web/20070701212405/http://kb.mozillazine.org/Testing_plugins\"\ntarget=\"_blank\">here.</a></li> <li> Alright, by now you probably know\nwhat\'s what. You know what\'s missing so now you just need to download\nthat ish. You can download most common Firefox plugins <a\nhref=\"https://web.archive.org/web/20070701212405/https://addons.mozilla.org/en-US/firefox/browse/type:7\"\ntarget=\"_blank\">here</a> and you can get more Firefox info (and more\nplugins) <a href=\"https://web.archive.org/web/20070701212405/http://plugindoc.mozdev.org/\"\ntarget=\"_blank\">here</a>. <b>BUT WAIT</b> I wouldn\'t just go mindlessly\ndownloading plugins (that\'s how you end up with embeded video that just\ndoesn\'t work) If I were you, which I am (don\'t question me!) I wouldn\'t\ndownload iTunes and Quicktime just to watch the occasional embeded\nQuicktime video. Instead I would just download the light-weight version\nof Quicktime -- Quicktime Alternative <a\nhref=\"https://web.archive.org/web/20070701212405/http://www.free-codecs.com/download/QuickTime_Alternative.htm\"\ntarget=\"_blank\">(Download Link)</a>. You should also download the\nalternative (to the much hated [by me]) RealPlayer -- RealPlayer\nAlternative <a\nhref=\"https://web.archive.org/web/20070701212405/http://www.free-codecs.com/download/Real_Alternative.htm\"\ntarget=\"_blank\">(Download Link)</a>. I also don\'t like to use the\nbloated Adobe Acrobat and instead opted for the light-weight and agile\n<a href=\"https://web.archive.org/web/20070701212405/http://www.foxitsoftware.com/\"\ntarget=\"_blank\">Foxit Reader</a>.</li> <li> So you think you\'re pretty\nhot stuff don\'t ya? You\'ve got all the plugins you need, huh? Think\nyou\'re better than me? Well, mister (or Ma\'am) it\'s time to put that\ntheory to the test. Go back to step 2 and test all the plugins you\nupdated or downloaded and make sure they work. If they don\'t work a\ngood first step is to check for solutions to your specific problem on\nGoogle. If your problem pertains to embeded WMV, RealPlayer, or\nQuicktime then I would refer to this little <a\nhref=\"https://web.archive.org/web/20070701212405/http://forums.mozillazine.org/viewtopic.php?t=206216\"\ntarget=\"_blank\">guide</a>. I had some trouble getting Quicktime\nAlternative to play embeded video, The procedure to solve that problem\nwas pretty simple: click Start &gt; Control Panel &gt; Quicktime &gt;\nclick on the browser tab &gt; make sure you have \"Play movies\nautomatically\" checked &gt; click \"MIME Settings...\" &gt; under \"MPEG -\nMPEG system, video, and audio files\" &gt; I selected (checkboxed) all\nexcept AAC Audio and AAC Audio Book &gt; click \"OK\" &gt; click \"Apply\";\nNow restart your Firefox and that should be it! If you are having\ntrouble with Windows Media Player (which is pretty common in Firefox)\ncheck out the amazingly detailed guide <a\nhref=\"https://web.archive.org/web/20070701212405/http://forums.mozillazine.org/viewtopic.php?t=206213\"\ntarget=\"_blank\">here</a> That guide is so good, even I can follow\nit!</li> </ul>\n<p>Alright, after reading this article you should be good\nto go as far as Firefox multimedia plugins are concerned. However,\nthere is one last plugin I would recommend to you: the *balloontoablimp\nsearch plugin! With the\n*balloontoablimp search plugin you can search *balloontoablimp from the\ndefault search box in the upper-right corner of your browser and the\nplugin is incredibly simple to set up (what have you got to lose?\nCoolness? I don\'t think so). All you have to do is download these two\nfiles (<a\nhref=\"https://web.archive.org/web/20070701212405/http://www.box.net/shared/9orrtfvepk\"\ntarget=\"_blank\">here</a> and <a\nhref=\"https://web.archive.org/web/20070701212405/http://www.box.net/shared/d0zo2lc113\"\ntarget=\"_blank\">here</a>) and save them both to C:\\Program\nFiles\\Mozilla Firefox\\search plugins, restart your Firefox, and that\'s\nit. You can key up to your search box (Ctrl+K) and select\n*balloontoablimp from the drop-down menu, now you can search our\nwebsite where ever ye be!<br /> So I guess that about does it. Happy\nFirefoxing (yeah, I used it as a verb, WHAT!?!).</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/06/01/tech-blog-of-the-week--me--that-s-cool-/",

    "title": "Tech Blog of the Week? Me? That&#x27;s Cool.",
    "url": "https://tylercipriani.com/blog/2007/06/01/tech-blog-of-the-week--me--that-s-cool-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-06-01T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>DUNDUNDaDUHH! (that\'s right it\'s a triumphant music sound. I can use\nonomatopoeia, I\'m the tech blog of the week!) As my five or six regular readers\nmay already know, there exists a fantastic website called <a\nhref=\"https://web.archive.org/web/20070701212822/http://www.dailycupoftech.com/\" target=\"_blank\">Daily\nCup of Tech</a> that I have featured on this website a few times (or maybe just\nonce, but really, who keeps track of these things?). You\nalso may or may not know that Daily Cup of Tech has a little award known as the\nTech Blog of the Week. For this week I share that title with one of my favorite\nwebsites, <a href=\"https://web.archive.org/web/20070701212822/http://www.howtogeek.com/\"\ntarget=\"_blank\">The How-To Geek</a>. This award is, as most awards tend to be,\nboth a blessing and a curse. Sure, now I get some of that sweet sweet\nrecognition that I so long for, but, at the same time, I have to update this\nsite on a more regular basis and maybe actually put some quality content on\nhere. I know right now it seems like a long row to hoe, but friends, I\nthink I am just the Joe to hoe it!<br /> So long story short, this blog is\nawesome and by extension you are awesome for reading it. Futhermore, this\nblog\'s awesomeness has been verified through the fine third-party reporting of\nDaily Cup of Tech. Kudos to the entire staff at DCoT for having amazing taste\nin tech, and \'much props\', as the kids say, to you, the reader, without which I\nwould be an insignificant amoeba lost and alone in the sad sea that is the\ninternet.<br /><br />...and on that note...</p>\n<h3>Here are a few of my\nfavorite Tech Blog\'s of the Week featured in past</h3>\n<ul><li><a\nhref=\"https://web.archive.org/web/20070701212822/http://www.freewaregenius.com/\"\ntarget=\"_blank\">Freeware Genius</a><br />DCoT says, \"If your hard drive is a\nbit empty, head over to Freeware Genius and say, \'Fill ‘er up!\'\" </li><li><a\nhref=\"https://web.archive.org/web/20070701212822/http://www.shankrila.com/\"\ntarget=\"_blank\">Shankri-la</a><br />DCoT says, \"With a very strong technology\nleaning, ShanKri-la has the potential to be a great blog.\"</li> <li><a\nhref=\"https://web.archive.org/web/20070701212822/http://nexus404.com/Blog/\" target=\"_blank\">Thoughts\nFrom the Sidelines</a><br />DCoT says, \"They have so much cool stuff that if I\nwere to buy everything that I wanted from their site, I’d have no money left\nfor other, less important necessities in life like food and shelter.\"</li>\n<li><a href=\"https://web.archive.org/web/20070701212822/http://www.pocketables.net/\"\ntarget=\"_blank\">Pocketables</a><br />DCoT says,\"Pocketables will help you\nkeep up with the tech Jones.\"</li> </ul>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/30/optimize-firefox-part-i--a-new-hope-for-search/",

    "title": "Optimize Firefox Part I: A New Hope for Search",
    "url": "https://tylercipriani.com/blog/2007/05/30/optimize-firefox-part-i--a-new-hope-for-search/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-30T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>This series of articles is about a subject that is near and dear to\njust about every geek’s heart, making Mozilla Firefox just a wee bit\nfaster and a wee bit more useful. For this part of the series you’re\ngoing to need two files.\n</p><ul><li><a href=\"https://web.archive.org/web/20070701212241/http://www.mozilla.com/en-US/firefox/\"\ntarget=\"_blank\">Firefox 2.0</a> - A must have when optimizing\nfirefox.</li>\n<li><a href=\"https://web.archive.org/web/20070701212241/http://www.box.net/shared/kcu2i7jk8b\"\ntarget=\"_blank\"><em>balloontoablimp’s Keyword Searches</a> - A list of\nbookmarks that I’ll show you how to install and use later.</li>\n</ul><p>Part I of this series deals with keyword searches. A keyword\nsearch allows a firefox user to search a website from their browser’s\nurl bar. If you, for instance, wanted to search Google for bears (after\nyou set up the quick search I outline below) it would simply be a matter\nof keying up to your url bar and typing <b>g bears</b> and hitting\n<b>Enter</b>. Keyword searches are so quick they will proably save you\nyears of your life. Lifehacker has an amazing article on how to set up\nkeyword searches, you should really <a\nhref=\"https://web.archive.org/web/20070701212241/http://lifehacker.com/software/geek-to-live/geek-to-live-fifteen-firefox-quick-searches-129658.php\"\ntarget=\"_blank\">check it out.</a> In case you hate lifehacker or just\nlove me, I’ll give you a brief tutorial on how to set up your own\nkeyword searches. </p><ol><li>In firefox go to a search engine with an\ninput box (like <a\nhref=\"https://web.archive.org/web/20070701212241/http://www.google.com/\"\ntarget=\"_blank\">Google</a>)</li> <li>Right-click inside of the input box\non the search engine</li> <li>From the drop down menu click <b>Add a\n<u>K</u>eyword for this Search…</b></li> <li>In the resulting dialog box\nin the <b><u>N</u>ame:</b> field type the name for this search, for\ninstance, if you used Google, type, “Google Keyword Search”</li> <li>In\nthe <b><u>K</u>eyword:</b> field type the keyword (or letter) that you\nwant to use for this search, for instance, for Google, you could simply\nuse the letter “g”</li> <li>Click <b>OK</b></li> </ol><p>This brings us\nto the file I had you download at the beginning of this article,\n“</em>balloontoablimp’s Keyword Searches.” This file is simply a\ncompiled list of 13 keyword searches that I’ve already put together in a\nhandy little package. To install, first, save the file somewhere on your\ncomputer. Then, inside firefox, on the menu bar, click\n<b><u>B</u>ookmarks &gt; Organize Bookmarks…</b> In the Bookmark Manager\nchoose <b><u>F</u>ile &gt; <u>I</u>mport…</b> Inside the Import Wizard\nmake sure the <b><u>F</u>rom File</b> radial button is selected and\nclick <b><u>N</u>ext&gt;</b>. Then simply locate where you saved the\nfile and click <b>Open</b> <br />So what’s in this amazing Keyword\nSearch package you ask? Well…First is the Google Keyword Search (once\nthe package is installed) go to your url and type <b>g “whatever you’re\nsearching for”</b> and a google search will pop up.<br /><br />The\nRemaining twelve keyword searches (and url commands)\nare:</p><ul><li>Dogpile Music Search; url command: <b>music “whatever\nyou’re searching for”</b></li> <li>Dictionary.com Search; url: <b>dict\n“whatever”</b></li> <li>Thesaurus.com Search; url: <b>thes\n“whatever”</b></li> <li>Ebay Search; url: <b>e “whatever”</b></li>\n<li>Wikipedia Search; url: <b>w “whatever”</b></li> <li>Amazon.com\nSearch; url: <b>a “whatever”</b></li> <li>Google Maps Search; url:\n<b>map “wherever”</b></li> <li>Google Image Search; url: <b>image\n“whatever”</b></li> <li>Google Video Search; url: <b>video\n“whatever”</b></li> <li>Technorati Search; url: <b>technorati\n“whatever”</b></li> <li>Bloomberg.com Stock Info; url: <b>quote “stock\nsymbol”</b></li> <li>Pirate Bay Search; url: <b>pirate\n“whatever”</b></li> <p>This concludes part I of my firefox optimization\nseries. Come around next weekish (give or take) for part II: Revenge of\nthe user.js File!</p></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/25/free-online-linux-courses/",

    "title": "Free Online Linux Courses",
    "url": "https://tylercipriani.com/blog/2007/05/25/free-online-linux-courses/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-25T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I wouldn’t have thought that I’d need a linux course what with my\nexperience with various live CD’s, but a live CD and a HDD install are\ntwo different things entirely. I can’t seem to find anything in the file\nsystem without the terminal. I just don’t know where things go when I\ndownload them, what various folders do, etc. etc. ad nausium. Whatever,\nanyway, I’m smart enough to know when I need help. That’s why when I was\nperusing the cleverly titled blog <a\nhref=\"https://web.archive.org/web/20070701212920/http://www.geeksaresexy.net/\">[Geeks\nAre Sexy]</a>, I was really pumped (for lack of a better sounding word)\nwhen I saw this post.</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/24/tyler-keeps-you-posted/",

    "title": "Tyler Keeps You Posted",
    "url": "https://tylercipriani.com/blog/2007/05/24/tyler-keeps-you-posted/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-24T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>I realize that this update is long overdue, in fact, that is the point of\nthis update. I have been kind of busy lately what with the end of semester and\nall, and I\'d just like to share with you (because you\'re interested) a few of\nthe things I\'ve been up to besides updating this blog.</p>\n<ol><li>Makin\' all\nA\'s</li><li>Studying non-stop\nfor my <a href=\"http://certification.comptia.org/a/\" target=\"_blank\">Comptia A+</a> exam.</li><li>Working all week at the <a href=\"http://webs.wichita.edu/?u=erp&amp;p=/index\"\ntarget=\"_blank\">WIN Office</a> on the Wichita State University campus. Yeah\nI maintain the website, not impressed? Yeah, it\'s not that\ngreat.</li><li>And Finally as of yesterday, <a\nhref=\"http://www.computermemoryupgrade.net/installing-laptop-memory.html\"\ntarget=\"_blank\">I installed new RAM into my Laptop</a> and then installed\nWindows XP Pro and <a\nhref=\"http://www.maximumpc.com/linux?page=0%2C0\"\ntarget=\"_blank\">Ubuntu 7.04 to dual boot</a>, which, when all was said and\ndone, killed my day (no, not cause I\'m stupid, just cause it\ndoes).</li></ol>\n<p>Well, I guess now everyone’s up to date on ole Tyler’s life right\nnow. It may not be entertaining, or interesting at all, but that’s how I\nroll son.<br /><br /></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/18/fantastic-five--the-5-best-search-engines-besides-google/",

    "title": "Fantastic Five: The 5 Best Search Engines Besides Google",
    "url": "https://tylercipriani.com/blog/2007/05/18/fantastic-five--the-5-best-search-engines-besides-google/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-18T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p>    <img\nsrc=\"http://i189.photobucket.com/albums/z273/thcipriani/fantastic.gif\"\nalt=\"fantastic five search engine beta\" /></p>\n<p>As everyone who has ever read\nthis blog knows, I\'m a Google junkie. This, recently, has begun to disturb me.\nI mean the connotation of the word junkie is rather negative when you think\nabout it; people who are always looking to get their fix etc. However, when I\nthought about the true meaning of the word junkie, negative connotation and\nall, I realized that\'s what I am, a <i>Google Junkie.</i> In light of my recent\nepiphany I have decided to try to kick the habit, or at least ween myself off\nof Google slowly, by doing some research into new (better perhaps?) search\nengines. The following list is the cream-of-the-crop of search engines sans\nGoogle.</p>\n<ol><li>Perhaps my favorite Google alternative of the moment is <a\nhref=\"http://www.hakia.com/\" target=\"_blank\">hakia\n(beta)</a>. Even though the engine is still in beta it does some things that\nGoogle doesn\'t, like (a) compliment you on your choice of search, (b) seems to\nrecognize questions versus search operators, (c) it categorizes your searches\nand then gives you a table of contents so you can find what you\'re looking for\neasier. A search for <a\nhref=\"http://www.hakia.com/search.aspx?q=golf\"\ntarget=\"_blank\">golf</a> shows produces an exceptional table of contents\nfeaturing Headlines, Rules of the Sport, Hall of Fame Players, and nine other\ncategories for you to peruse. <br /></li><li>My next favorite search engine in\nthe game is probably <a\nhref=\"http://www.exalead.com/search\"\ntarget=\"_blank\">exalead</a>. You can customize your homepage with some of your\nfavorite shortcuts (kind of the equivalent of Opera\'s speed dial). Not only is\nthat a neat feature but any search (like <a\nhref=\"http://www.exalead.com/search/results?q=golf&amp;x=494&amp;y=6\"\ntarget=\"_blank\">golf</a> for example) results page has a preview of the website\nright next to the url. Plus, in a right hand column, you can choose to narrow\nyour search to different file extensions, media types, languages, search terms,\nsite types, you name it, exalead\'s got it.</li><li>Number three on my list is\nlike almost like number one, except with less features, <a\nhref=\"http://clusty.com/\" target=\"_blank\">Clusty</a> - the\nclustering search engine. This search engine basically takes all of your\nresults and breaks them into meaningful \"clusters.\" This site, while not as\namazing as the two other search engines still warrants a mention on this\nlist.</li><li>Number four on this list is not an unknown in the wide world of\nsearch, most people have probably heard of it and have their own opinion on it,\n<a href=\"http://www.snap.com/\" target=\"_blank\">Snap</a>. I\nthink it has a lot of features that could be cool, if they were done right. For\ninstance the webpage preview window on their site was done much better with\nexalead. Snap also has some features that are kind of annoying. For instance\nthe suggestion drop down at the search box, who needs that? The only thing I\nuse it for is if I can\'t spell what I\'m searching for.</li><li>Finally a search\nengine that is kind of cheating from my Google cold-turkey resolution, <a\nhref=\"http://www.sputtr.com/\" target=\"_blank\">Sputtr</a>.\nSputtr is a meta search that lets you search almost any (popular) search site\nyou can think of all from the comfort of their stylish web 2.0 interface. Check\nit out, it\'s the bomb (people still do say bomb, right?).</li></ol>\n<p>Anyway, that’s my list of search engines I use besides Google.\nAlthough there should be an honorable mention for Dogpile.com just for\nthe music search. If any of my readers have a fav search engine that\nwasn’t mentioned here, tell me about it in my yell box.</p></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/14/freeme---an-introduction-to-open-source/",

    "title": "Freeme - An Introduction to Open Source",
    "url": "https://tylercipriani.com/blog/2007/05/14/freeme---an-introduction-to-open-source/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-14T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<p><a\nhref=\"https://web.archive.org/web/20070630124144/http://questionsplease.org/freeme/\">Freeme\n- Home of the free DVD on the web.</a> The DVD includes many different\ntypes of open source material. The DVD packs in a LOT including:</p>\n<ul>\n<li>A live-cd Linux Distro</li>\n<li>Movies that you can play on your DVD player</li>\n<li>Lots of ebooks that have fallen into Public Domain</li>\n</ul>\n<p>So check out the DVD and also check out their website for more links\nto open source and freeware ish and welcome to the information age. [via\n<a\nhref=\"https://web.archive.org/web/20070710205206/http://www.boingboing.net/2007/05/08/free_me_a_free_cultu.html\">Boing\nBoing</a>]</p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/05/07/greensburg-tornado-disaster-relief/",

    "title": "Greensburg Tornado Disaster Relief",
    "url": "https://tylercipriani.com/blog/2007/05/07/greensburg-tornado-disaster-relief/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-05-07T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<figure>\n<img src=\"https://tylercipriani.com/static/images/greensburg.jpg\" alt=\"Greensburg\" />\n<figcaption aria-hidden=\"true\">Greensburg</figcaption>\n</figure>\n<p>I know that this is a goofy little tech blog, but I think that a disaster that hit close to home (for me anyway) needs more attention than it\'s getting. My fear is that the Greensburg tornado will fade from the public mind just as quickly as it came. I would like to share with you all something about exactly how amazingly devastating this tornado was in a state where tornadoes, at least (I assume) in the national mindset, are thought to be commonplace. I have lived in Kansas my entire life and never once have I <i>even seen</i> a Tornado, I mean in real life. I have never known anyone who was affected by a tornado, and I have never seen a tornado (in my lifetime) cause as much damage as the tornado that touched down in Greensburg over the weekend. I feel terrible for the whole town, it\'s <i>unreal </i>how much damage the tornado did. I remember hearing on the news that the mayor said something like 95 percent of the town is destroyed. Since I live here in Kansas it\'s easy for me to donate to disaster relief, but if you live outside of Kansas and your city doesn\'t have a fund already set up you can send your donations to:</p>\n<p>Midway-Kansas Chapter, American Red Cross, P.O. Box 3726, Wichita, KS 67201 </p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

},
{

    "id": "https://tylercipriani.com/blog/2007/03/25/best-thing-s--of-all-time-ever-/",

    "title": "Best Thing(s) of All Time Ever.",
    "url": "https://tylercipriani.com/blog/2007/03/25/best-thing-s--of-all-time-ever-/",

    "author": {
        "name": "Tyler Cipriani"
    },


    "date_published": "2007-03-25T00:00:00Z",
    "date_modified": "2017-02-14T15:11:05Z",


    "content_html": "<h2>3♠25♠2007</h2>\n<p><br /><ul><li><a\nhref=\"https://web.archive.org/web/20070701212314/http://www.geocities.com/Colosseum/Field/9348/index2.htm\"\ntarget=\"_blank\">Steve Kerr</a> during the 1997 NBA\nChampionships.</li><li><a\nhref=\"https://tylercipriani.com/web/20070701212314/http://www.cinemainsomnia.com/\"\ntarget=\"_blank\">Cinema Insomnia</a> with Mr. Lobo</li><li>Firefox’s\ncustom <a\nhref=\"https://web.archive.org/web/20070701212314/http://www.mozilla.org/docs/end-user/keywords.html\"\ntarget=\"_blank\">keyword</a> searches.</li><li>SuckUK’s <a\nhref=\"https://web.archive.org/web/20070701212314/http://www.suck.uk.com/product.php?rangeID=55\"\ntarget=\"_blank\">Villain Chair</a>.</li><li>The Music video for <i>This\nis Hardcore</i> by Pulp<br /></li></ul></p>\n<blockquote>\n<p>I recovered this article from my old blog via the <a\nhref=\"https://archive.org\">Internet Archive</a>. If you found this\narticle useful or entertaining (or even if you didn’t) consider <a\nhref=\"https://archive.org/donate/\">donating to the Internet\nArchive</a></p>\n</blockquote>\n"

}

    ]
}
