Improved Jekyll Build Script... Using Bash

18 Jan 2018

I’ve written about my Jekyll build script before. I use this script to deploy this site among others. It is terribly overengineered and unnecessary.

Here is the new and improved version. Instructions for use are below the code itself.

Features
  • JS Minification
  • JS Babel Compiler
  • HTML Minification
  • CSS Minification
  • Thumbnail Generation
  • Intelligent Image Compression
  • Favicon Generation
  • Jekyll Build Process
  • Automatic Upload to S3
  • Setup Mode (Installs Dependencies)
  • Sane Image Names (jpeg, JPG, etc to jpg)
How to Use

Copy the script into a new text file and save the file in the root of your Jekyll directory as upload.sh.

Make sure to set up the options under # BUILD OPTIONS - EDIT THESE in upload.sh.

Install dependencies by running sh upload.sh -s. Requires homebrew.

Then, run the build script by running sh upload.sh -c.

Sample Build Output
daviseford$ sh upload.sh -c
Generated 126 thumbnails (1 new) in ./public/img/thumbnails/
Now running -o7 level compression on 1 .png files in ./public/img/
Finished image tasks
Configuration file: /Users/davisford/Documents/daviseford-jeykll/_config.yml
            Source: /Users/davisford/Documents/daviseford-jeykll
       Destination: /Users/davisford/Documents/daviseford-jeykll/_site
 Incremental build: disabled. Enable with --incremental
      Generating...
         AutoPages: Disabled/Not configured in site.config.
        Pagination: Complete, processed 1 pagination page(s)
                    done in 3.856 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
Babelified JS
Minified JS
Minified CSS
Minified HTML
upload: _site/public/img/misc/aws_cert/AWS_Certified_Logo.png to s3://daviseford-website-code/blog/public/img/misc/aws_cert/AWS_Certified_Logo.png
upload: _site/public/img/thumbnails/misc/aws_cert/AWS_Certified_Logo.png to s3://daviseford-website-code/blog/public/img/thumbnails/misc/aws_cert/AWS_Certified_Logo.png
Uploaded to S3
Created build_log.txt
Done!

Any problems, just email me.


A Klein Bottle from Cliff Stoll

17 Jan 2018

I purchased a Klein Bottle from Cliff Stoll on January 16th, 2018 - a cold, bitter morning. I sent him this note, along with my credit card number and presumably all of the information needed to ruin my life.

Cliff, I hope you read this. I was born in 1989 and grew up reading the Cuckoo's Egg.[1] I even baked the chocolate chip cookies you were so kind to provide the recipe for.[2]

Many years later I am a software developer and professional tinkerer. I was profoundly influenced by your book and your mad hatter approach to computer science.

I am sure you hear this often, but I thank you very much for your contribution to my world.

I am different, and better, for having ingested your peculiar way of conveying stories. Even reading this website had me in stitches.

Happy to have purchased something with sentimental value, I worked for the next few hours.

By lunch, I had received a reply from the man himself.

Hi Davis,

Thank you for your smiling comments about Cuckoo's Egg - oh, but that sends me back a quarter century (when there were payphones, modems, and pocket pagers). You actually tried those chocolate chip cookies? The back story: we used to make these once or twice a week. Well, while writing that chapter, I was making a batch of 'em and got some butter or grease on my keyboard. Figuring that this was some kind of omen, I decided to put it right into the book, at the very place where I was writing. So, in an indirect way, you were just following the storyline of my life in the 1980's. I'm especially happy to hear that you tinker around with software (and, I assume, hardware) ... so much of software work seems to be just library calls and managing releases. Gone are the days of building things...

Thanks, of course, for your Klein bottle order! I've just signed your medium sized Klein bottle and then snuggled it into a 9x5x5 inch box along with an invoice and the usual Acme topological propaganda. I scribbled a greeting on the packing slip as well.

While packing the glass manifold, I took a few photos, several of which seem to be in focus. In my next email, I'll send these photos to you. But if you're on a slow internet connection, there's no need to download them - the files may be fairly large.

I'll bike to the post office today (Tuesday the 16th) and send it via First-Class Mail. In theory, the box oughta arrive on Friday January 19, give or take an aeon. It's hard to predict exactly, what with the weather, the political situation, the economy, global warming, continental drift, the expansion of the universe, and the uncertainty principle.

So, from across the continent and around our three spatial dimensions, here's my one-sided cheers to you. I'm sure you'll like the Klein bottle - and my warm wishes that you put together a few stories...

-Cliff (on a misty Tuesday morning in Oakland)

I was stunned to get a personalized touch - and I got to hear about the book that I grew up devouring.

A second email sat in my inbox. Inside were pictures of my Klein bottle teleporting around Cliff’s house. We traveled from his workshop to his wife’s garden.


His workshop, by the way, has been a huge YouTube hit for years. This video will delight you if you’ve never seen it.


The reason I was so enthralled to hear from Cliff? He’s one of the men who taught me to troubleshoot.

The Cuckoo’s Egg is all about tracking down the tiniest details using the software and hardware available at the time. Cliff races baud modems and phone trunks to pinpoint his guy - all because of a seventy-something-cent error in the Berkeley accounting program. The book is a terrific read and extraordinarily detailed. The amount of patient troubleshooting displayed throughout the book was foundational for my understanding of how to take apart a computer-driven jigsaw puzzle.

I have never read such a thoroughly entertaining book. Cliff’s mad scramble to deal with printers and track keystrokes and save emails - hysterical. I’ve often thought of Cliff while debugging RealSimpleEmail, my email platform. There were a lot of strange routing bugs that I needed to learn about the email world, and I felt kinship with a young Cliff Stoll, poking around in areas he probably shouldn’t in order to understand the bigger picture.

Cliff Stoll was a childhood hero of mine because of Cuckoo’s Egg.

He was an adolescent hero of mine because I began my career tinkering with computers and understanding the complexity of the systems we have today.

He is an adult hero of mine because he took time to respond to a lifelong fan.

I thought it would be only fitting, since he was sharing his art with me, that I share some with him.

Given that I’ve been tinkering with generating word art from novels, I figured it was only natural to run Cuckoo’s Egg through my script.[3]

I emailed him this little piece of generated art. I do hope he enjoys it.

The Cuckoo's Egg - 1,349 sentences
Sentences containing 'hacker' are highlighted red.
Start/End = Light/Dark Green Dot

  1. The Cuckoo’s Egg: Tracking a Spy Through the Maze of Computer Espionage by Cliff Stoll
  2. “Two eggs, 1 cup brown sugar, 1/2 cup regular sugar, 2 sticks softened butter. Fold in 2 1/4 cups flour, 1/2 teaspoon salt, 1 teaspoon baking soda, and a couple tablespoons of vanilla. For an extra chocolate jag, toss in 3 tablespoons of cocoa. Oh, don’t forget 2 cups of chocolate chips. Bake ‘em at 375 degrees for 10 minutes.”
  3. The script calculates the number of sentences in a given text input (1,349 in this case). Once the script has reduced the book to a list of sentences, we then transform those sentences into a number representing the number of words in a sentence. The previous sentence, for example, would be represented by 28 (28 words). We then draw a path using Python and SVG. Each straight line represents a sentence in the book - and its length is determined by how many words are in the sentence. At the end of each sentence, the path turns left 90 degrees.

SCSS Media Queries - Responsive Breakpoint Mixins

10 Jan 2018

Here are some utility mixins for SCSS that you can use for quickly mocking up responsive CSS.

// Screen size variables
$screen-xs-min: 425px;  // Tiny phones
$screen-sm-min: 576px;  // Small tablets and large smartphones (landscape view)
$screen-md-min: 768px;  // Small tablets (portrait view)
$screen-lg-min: 992px;  // Tablets and small desktops
$screen-xl-min: 1200px; // Large tablets and desktops

// Mixins
@mixin xs { @media (min-width: #{$screen-xs-min}) {@content;} } // Tiny devices
@mixin sm { @media (min-width: #{$screen-sm-min}) {@content;} } // Small devices
@mixin md { @media (min-width: #{$screen-md-min}) {@content;} } // Medium devices
@mixin lg { @media (min-width: #{$screen-lg-min}) {@content;} } // Large devices
@mixin xl { @media (min-width: #{$screen-xl-min}) {@content;} } // Extra large devices

Use like so:

/* A class that will respond differently in different resolutions */
.sample-padding-class {
  
  padding-bottom: 200%; // Default property, this will be applied to all screen sizes
  color: #FFF;          // Unless overriden below
  
  @include sm {         // 576px window width and more
    padding-bottom: 100%;
    color: #000;
  }
  
  @include md {         // 768px window width and more
    padding-bottom: 50%;
  }
  
  @include lg {         // 992px window width and more
    padding-bottom: 10%;
  }

  @include xl {         // 1200px window width and more
    padding-top: 20%;
    padding-bottom: 0;
    color: #1337;
  }
}

In Defense of Crypto - and Some Baseless Predictions

08 Jan 2018

I was going through my documents and organizing things yesterday when I stumbled across an old Bitcoin cold storage wallet that I’d placed in my files a few years ago. I turned to my girlfriend with a smile and said “Do you think I left anything on here?”

I checked the wallet’s public address for transactions - 9 BTC in! My heart stopped. That’s ~$135,000 USD today.

And unfortunately... 9 BTC out. Probably to buy hardware or getting scammed. Good decision making, 2015-era Davis.

I’ve said since 2012 to anyone who would listen (three people) that Bitcoin was a proof of concept for the next thing. I have always contended that, much like 28k baud connections to a central Unix server, or bulky, room-filling 8MB hard-drives, Bitcoin is showing us a rough sketch of the future.

In digital terms, I found a wallet under my couch, so to speak, and then checked that wallet’s balance out using a globally distributed, generally trustless, peer-driven and verified accounting system. Wow, buzzwords - yeah, sure, whatever. I just casually checked the public balance of this wallet, as anyone could have done. That’s one of the value propositions of this technology.

The ease with which we can maintain, deploy, and tinker with money itself will bring new possibilites to the world.


Ugly Beginnings

No one ever thinks it’ll work.

IBM's RAMDAC 305 - 1956 - Each hard drive held 5MB of data, weighed over a ton, had to be moved around with forklifts, and was delivered via large cargo airplanes.
ARPANET - 1969 - TCP/IP wouldn't be invented for 13 more years. Talk about scaling issues!

Let me ask you a hypothetical question - is it possible that the lay observer in 1960 may have scoffed at the notion of a hard drive? After all, the only reference point they would have is monstrous cabinets like the impractical, burdensome RAMDAC 305. A quote from the RAMDAC Wikipedia page reveals that people of that time, just as now, were unsure of how to use new technology.

"the storage capacity of the drive could have been increased beyond five megabytes, but IBM's marketing department at that time was against a larger capacity drive, because they didn't know how to sell a product with more storage."

It’s interesting to me to watch the general public pick up on Bitcoin. What has been especially interesting is how everyone that I talk to about Bitcoin knows two things - a.) It’s expensive internet funbux and b.) It’s got issues.

Arguments like “I’ve heard it uses too much electricity,” “It’s too slow for global applications,” or “Who will even use this thing?” are reminiscent of questions that have been asked of most of our technological revolutions. From the famed Luddites to people who just don’t like using GPS and insist on giving you street by street directions, new technology has always been questioned on the following principles:

  • Expense - It’s always too expensive, at first.
  • Practicality - Too loud! Too slow! Too big! Impractical!
  • Distributability - Even if this works, no one will want a hard drive in their living room.
  • Doesn’t X Already Do This? - I call this the Hacker News Expert Opinion. (Hacker News, an internet forum full of venture capitalists and those who worship them, famously panned Dropbox’s release. Their reasoning? Anyone could already sync folders across computers with judicious use of rsync and ssh and bash and cronjobs and.. you get the picture)

If you read histories of new technologies, especially computing technologies, everything has to endure these questions. While it may seem obvious that someone’s first product is usually not their best, humans have a strange habit of demanding perfection from newly-formed creations. It’s not enough to be new - it’s got to be new, cheap, small, fast, and most of all, relevant to me.

Well, aren’t the doubters right?

Yes.

Yes, Bitcoin has issues. Yes, Bitcoin is probably not the global revolution that it’s currently being hyped up to be. Yes, Bitcoin is controlled by a few parties, and it used to be linked to drugs, and Yes to all of the other things you have heard.

Yes, it has severe scaling issues. Yes, it is falling devastatingly far behind in pending transactions on the blockchain. Yes, BCH and BTG and all of the other BTC competitors are chomping at it.

Yes, all of that is true. You’re not wrong.

But the technology that matters is the blockchain. Not Bitcoin.

The failings of a Model T are not very relevant to our discourse about cars today. They were expensive, prone to failure, and not very customizable. The roads sucked (if they existed). People were maimed working on the engines. Dangerous bootleggers used cars to evade police and move contraband.

Yet, we don’t talk about cars failing. We don’t care that VW’s last model sucked or that maybe a 2012 Ford Whatever is a good car but overpriced. We don’t talk about how cars are used by terrorists and pedophiles. We simply exist in a world where cars are - they’re not new to you.

In 30 years, the concepts of a blockchain will be just as integral to that generation. I’m not saying that all of them will be blockchain developers - just in the same way not everyone is a mechanic. But the way they bank, transact, and invest will be informed from the lessons learned as a society over the next decade or two while we experiment with blockchain technology at a global level. This generation has been gifted the opportunity to take part in a historical shift in wealth creation and management.

At least in my opinion, ignoring the future integration of cryptocurrency into society is a foolish mistake. These currencies will only become more trusted, easier to use, and their spread will be prolific.

Predictions

Anyways, here are some probably outlandish predictions for the year 2018. It’s totally worth noting that I have never even been close to calling the crypto market, so take this with a Jupiter-sized grain of salt.

I am assuming we see “market-cap” growth close to $2 trillion (cryptocurrency currently occupies around $800B of market-cap potential) - however, I’d really like to protest the use of market-cap to measure these currencies. However, that’s an argument for another article, so suffice it to say - I expect a few of these coins to double or triple.

Want my cynical reasoning? Simple:

  • 24/7 Global Markets
    • Hello gambling addicts, take a seat at the altcoin roulette. You can bet anytime, anywhere, on anything.
  • Availability to Average Joes
    • The floodgates are open as far as price goes, and I attribute a lot of that to places like Coinbase and Gemini - exchanges that have worked hard on becoming legitimate, user-friendly entities.
  • Broad Financial Ignorance
    • Penny stocks are not a new scheme. Selling people on pump and dumps - not a new scheme. All of the dark financial tricks of the world are available right now - barely anyone knows what they’re doing. Dumb money does interesting things.
  • Fear Of Missing Out
    • This is the number one human desire to watch out for. There is no force more powerful than a large group of human beings desperate to have something.

Quick disclaimer - I own all of the below coins and obviously stand to profit from their success. I am extraordinarily biased.

If you asked me at gunpoint which coin I’d most like to own in 2018, it’s Ethereum, by a long shot.

Without further ado:

CurrencyHighLowEOY 2018
Ethereum$3,535$650$3,100
Bitcoin$32,000$9,300[1]$28,300
Litecoin$1,010$189[2]$987
OmiseGO (OMG)$107.00$17.33[4]$62.00
Golem Network Token$3.49$0.69[3]$2.29

I will come back periodically and mark my predictions right or wrong.


So far, here’s how I’m doing.

  1. Bitcoin dropped under $6,900 on 2/6/18
  2. Litecoin dropped under $125 on 2/6/18
  3. GNT dropped under $0.27 on 2/6/18
  4. OMG dropped under $18 on 2/6/18