Or, How I Learned to Stop Worrying and Love the Blog
A Long and Winding Road
I’ve been blogging since 1999, first via extremely cringe LiveJournal posts and later documenting my experiences from a Rotary exchange program to Japan in 2004 (including a nostalgic return last year). Over the years I’ve used various platforms, but none have felt quite right.
The Tumblr Era: A Love-Hate Relationship
For a long time, Tumblr was my go-to platform. It was easy to use and had a great community. However, as Tumblr evolved, it became clear that it wasn’t the ideal solution for my needs. The lack of HTML support and the platform’s overall instability made it difficult to maintain my blog.
I wanted to add an Age Gate / Age Verification pop…
I wanted to add an Age Gate / Age Verification pop-up for Squarespace. The top search engine result had some code, but it A) didn’t work B) didn’t look very good and C) didn’t have any functionality for tracking cookies. Instead, use this code:
First, put this into the injected code in the Header
<!– Age Verification Pop-up HTML –> <div id=“age-verification-popup”> <div class=“popup-content”> <h2>ARE YOU 21+?<div class=“image-circle-container” style=“margin-bottom: 24px;”> <img src=“https://images.squarespace-cdn.com/content/6788837817ec6330feff09fe/a0416e38-e21f-4f14-88b3-0a8c8589e435/lambi_lamb_black.png” alt=“LAMBI” class=“centered-image” fetchpriority=“high” loading=“eager” decoding=“async” data-loader=“raw”>
Ethics is a hot topic in technology. In the 80’s nerds were shoved into lockers. In the 90’s and 2000’s they were on the front page of Time. In the 2010’s, algorithmic bias and the negative effects of social media were starting to be felt and the nerds were now testifying in front of congress. Who knows how this decade will unfold as we’re witnessing a never-ending fountain of technological innovation and associated nebulous anxiety.
Larry Wall, creator of the Perl programming language, offers the following “three great virtues” of a programmer:
Laziness
The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer. See also impatience and hubris.
One of my favorite things about howdoi is the portability - meaning that you can get instant coding answers anywhere (not just on the command line). Contributors have created integrations for howdoi on Slack, Telegram, Discord, Visual Studio Code, and Alfred (just to name a few!).
As an Emacs user, you can use the code snippet below to get instant answers inside Emacs.
(defun howdoi (start end command)
(interactive
(let ((command "xargs -0 howdoi"))
(if (use-region-p)
(list (region-beginning) (region-end) command)
(list (line-beginning-position) (line-end-position) command))))
(let ((response (shell-command-on-region-to-string start end command)))
(kill-new response)
(save-excursion
(end-of-visual-line)
(newline)
(insert (shell-command-on-region-to-string start end command)))))
(defun shell-command-on-region-to-string (start end command)
(with-output-to-string
(shell-command-on-region start end command standard-output)))
Then, when you want to know how to # format a date in bash you can invoke M-x howdoi on that line and voila!
As usual, I blame digitization. When you had to lug 30 lbs of vinyl up a creaky warehouse stairwell, there was a pretty good chance you were going to play some fire. Serato was alright, because at least you still had the turntablism. With the advent of CDJs and Rekordbox, it was all over.
Back in the day, when you wanted to get some data into Python, it was easy enough to load the whole .csv or .txt file into memory, do the kind of operations you needed, and be done with it. Then came generators and streaming formats for stuff that wouldn’t quite fit into RAM. Nowadays, even lazy iterators can fail you from time to time, especially when dealing with big data and resource constrained machines, like Google Colab.
I am again excited to be participating in the MLH Fellowship, a 12-week program pairing promising young developers with mentors and experts working in the world of open-source software development. It is a fantastic program that has allowed me to work together with talented students all over the world.
This semester’s fellows are assisting with the development of howdoi, a simple tool for finding answers to common programming questions.
These days it feels like privacy is at a premium. Data sovereignty is a relatively overlooked concept as we continue to pour our personal data into the well-lined pockets of large companies. Some folks are trying to shift the balance of power but there is a long road ahead.
As I think of my own digital footprint, I was reminded that in addition to not having sovereignty over my data I also don’t have control over the machines that keep and serve it.
Every now and again I miss the library. A hall of wisdom, quiet and serene, with stacks and stacks of worlds to explore. Nowadays, the internet has largely replaced the role of trawling through shelves of books and reams of microfilm.
Software development, once a bastion of deep thought and planning, has in the modern era been reduced to the tying together of disparate APIs and the inevitable Quest for the most pertinent StackOverflow page. Howdoi, a simple tool for finding answers to common programming questions, was largely a response to the seemingly never-ending shuffle between the code editor and the web browser. When spending time in the latter, there’s a pretty good chance you might find yourself distracted from the task at hand.
Because you you should blog more.
– Charlotte Brontë
Because there’s no motivation like peer pressure.
– Joseph Stalin
Because doing things for beer is never a bad idea.
– Franz Kafka
Like to write? Want to write more? Enjoy beer and good company?
Join the Iron Blogger Challenge, which has helped me keep writing and building things on a regular basis.
The premise is simple – submit one post or creation a week. Miss a week and put $5 toward an evening of free drinks for the group. Stay innovative and meet cool people.
Howdoi is a code search tool that has been used by countless developers, hacker schools, and students to help with common coding tasks. It was a pleasure to write and has dozens of contributors to the codebase on Github.
Recently howdoi was featured in Kenneth Reitz’s Hitchhiker’s Guide to Python published by O’Reilly. There is a section on writing great code that recommends reading others’ work to learn how to craft better code. I’m honored howdoi was chosen as an exemplary project.
The age of the algorithm is upon us and technical knowledge rules the day. However, without proper communication there is no opportunity for teaching and learning. At MIT I taught 6.UAT, an oral communication course that might as well by titled Teaching Nerds to Talk.
Here’s a classic video from a lecture where I explain the specifics behind peer-to-peer file sharing (think BitTorrent, Soulseek, Napster, and Kazaa). I’m surprised how well a 2008 talk holds up today, where P2P is still a large percentage of internet traffic.
The (Almost) Perfect HoloLens Development Environment
In true Microsoft fashion, the HoloLens is an incredibly interesting piece of technology that is hamstrung by a thick layer of jank smeared over the device and development process, especially for those on a Mac. After shaving numerous yaks that I thought I would never have to revisit (DirectX drivers? Really Microsoft??), here’s a relatively sane tutorial on getting your HoloLens environment and emulator up and running.
Understanding the history and artistry of algorithms reveals an interesting vantage point from which to explore the importance and implications of software systems and their associated movements.
Nadia Eghbal has penned a brief yet engaging history of open source and offers a glimpse into the future of what she calls the “Post-Open Source World.” The details reveal a captivating, frothy battle where tyrannical choices alter the adoption and success of budding technologies. A brave new world indeed.
Around 1,800 BCE, the world’s first known algorithms were exquisitely impressed on clay tablets by Babylonians living along the Tigris and Euphrates rivers. To mark their novel creation, the earliest algorithmistsstamped their works with the phrase “This is the procedure,” marking a critical turning point in the history of civilization.
Thousands of years later, those seminal algorithms have evolved into beautiful, living works with the ability to reach into our hearts, minds, and bodies. Alongside them, technologists themselves have risen as a powerful new creative class, sculpting imaginative, provocative algorithms expressed in today’s most dynamic and abundant raw material: pure code.
When deploying pet projects on remote servers, I dislike the extra step of logging into the remote machine to execute a git pull (and perhaps a server reload) every time I push new code. Sure there’s Jenkins and all sorts of bazooka-like solutions, but this is a knife fight. Poking around an old PHP repo, I found a nifty line of code that will update your app via a URL endpoint.
Metaprogramming — writing code that generates other code — can be particularly useful when dealing with languages that are widely adopted yet lack advanced features. With the help of metalanguages like LESS and SCSS you can use advanced constructs (variables, looping, string formatting, etc.) to make your CSS DRYer and more fun to write.
Often in CSS you’ll find repetitive structures like the following:
The above rules are used to create 18 mahjong tiles (9 in each suit) represented by CSS rules .tile-0 through .tile-17. Here’s an example of what the tiles look like when rendered.
Sharing is Caring: Using JavaScript on the Frontend and the Backend
A major benefit of using a shared language on the browser and the server is a smaller amount of duplicate code in your codebase. Let’s assume you want to be able to share the file shared.js between the client and the server:
There are a number of libraries that can be used to facilitate this type of sharing including RequireJS, gemini, or node-browserify. If you’re looking to stay away from libraries here are two patterns for creating sharable JavaScript files that can be used on both the client and the server.
The Southwest Airlines boarding process has a rich and colorful history. Bucking the industry standard of providing assigned seats in different cabins, Southwest has historically offered an “open seating” policy that favors an assigned boarding order to determine who is first to enter the plane and choose a seat. Beginning 24 hours before a flight’s departure, passengers are arranged into groups (A1-A60, B1-B60, and C1-?) according to a formula determined by Southwest:
Wrangling Toy Applications with Supervisor and Nginx
I am a toymaker. Some toys are simple, others complex, and some are just plain wacky. What unites these toys are that they are:
Awesome
Stand alone applications that don’t share a common codebase
Written in a variety of languages
Showcasing, hosting, and monitoring applications can be difficult, especially if you want to have them all live under one domain or URL path (e.g. http://gleitzman.com/apps/appname). Whether you’re working in Python, Javascript, or Ruby you need a reverse-proxy that can receive requests and delegate to a specific application’s server. I’ve tried a number of techniques but ultimately landed with supervisor and nginx.
MIDI.js: Playing Audio in the Browser with Javascript
“Everything old is new again.”
–Peter Allen
The evolution of the web browser is in many ways the repackaging and reintroduction of technologies that have existed on the desktop for decades. Consider WebGL replacing OpenGL with the help of the <canvas> tag and HTML5 video replacing ActionScript/Flash with the <video> element.
At the well-run Science Hack Day SF I was able to dive into these new browser technologies along with Jade and Rich to build Symphony of Satellites, an app that generates music based on the trajectories of satellites currently overhead. Using data calculated live from NORAD, musical notes ride and set as satellites appear and disappear over the horizon. The velocity of the satellite, its elevation, and other aspects of its trajectory determine the instrument, pitch, and rhythm of notes generated by that satellite and the visualization on the page. The promo video for the app is worth watching.
The team at Meteor is turning out a great product and last week’s Meteor Devshop did not disappoint. I met some interesting folks building a wide range of awesome Meteor apps.
Here is my lightning talk explaining the motivation for my Choose Your Own Adventure rotary phone and how Meteor helped me turn it into an app I could share with the world (my mom).
Having dabbled with a number of application launchers, I eventually settled on Alfred for its slick design and Powerpack features. Recently Alfred v2 introduced Workflows to automate anything and everything with the touch of a key.
Here’s a custom workflow for howdoi that displays answers via Growl and also copies the result to the clipboard.
When sharing URLs from a project with deep directories (Scala/Java) it can be a real pain to open github.com, pick a branch, and then click through src/com/blah/blah folders until you find the file. Instead, use this command-line Python script to generate a Github URL directly from a file or directory. Also included is an elisp function to generate URLs from Emacs.
As technology continues to roll toward a more standards-driven regime, a delightful bit of nostalgia can be gleaned from the rich and varied history of the chat application. Not unlike the lineage of the User-Agent string during the browser wars, Instant Messenge applications were written, rewritten, copied, and abandoned while efforts to standardize the protocols of the big three IM companies (AOL, Microsoft, and Yahoo!) foundered.
As I’ve mentioned before, the lovely folks over at The Fox is Black have been releasing a treasure trove of awesome desktop designs as a part of the Desktop Wallpaper Project.
There is little argument that GitHub has revolutionized the way open source projects are managed. Gone are the days of hunting down a project’s maintainer and negotiating needed changes in the hope that your email with attached patch file was accepted into the master branch (although some projects still require such pomp and circumstance). This generally opaque process was replaced by GitHub’s fork + pull request model. You might say that git itself contains a robust pull request system but GitHub added the special social sauce and dead-simple pull request generation system making it the lingua franca of the open source community.
Howdoi – Instant Coding Answers via the Command Line
One of my favorite collaborations to come out of the illustrious Oxidized Bismuth Blogger (OxBiz) ideation list is howdoi, a tool for instant coding answers via the command line.
The idea is simple – ask a question and get an answer.
$ howdoi format date bash
> DATE=`date +%Y-%m-%d`
Howdoi solves life’s little coding mysteries like the always frustrating command line flags for tar (as illustrated by XKCD).
Programming with Meteor has a bit of a learning curve but the included examples are an excellent place to start. Below are some thoughts are observations – follow along at home with the code at https://github.com/gleitz/meteorcyoa.
Emacs has wonderful Unicode support. Copy and paste text from a Word document and Emacs will happily preserve your smart quotes, ellipses, and em dashes. There isn’t a canonical way, however, to strip these “special” characters into their more sane ASCII counterparts.
The unix command tidy does a good job of converting Unicode characters but you are left with ugly HTML equivalents like € instead of the usual quote character. We’ll need an alternative for Emacs, preferably written in Emacs lisp.
The lovely folks over at The Fox is Black have been releasing a treasure trove of awesome desktop designs as a part of the Desktop Wallpaper Project. I found the webpage to be a little slow to load and there is unfortunately no way to download all backgrounds as a bundle. I wrote a little script to grab all the background in 1400x900.
People have been sending lots of love and great feedback for AutomaticDJ, the passive music selection system that plays tunes from the Hunch API based on your face. I’ve released the code on GitHub and am looking forward to see what people can create.
Here is a video showing AutomaticDJ in action:
Note that you need not have any music likes (or any likes at all!) on your Facebook profile for this to work. That’s the magic of the Hunch API.
This, the 12th incarnation of Music Hack Day (brainchild of SoundCloud’s Dave Haynes) featured over 70 teams hacking around the clock on more than 20 APIs offered by a flock of cutting-edge startups (including my own beloved Hunch API, presented via Emacs).
I enjoy a good commit message as much as the next coder. (For the non-nerds in the audience, a commit message is a short description of the changes you made to the source code). At Hunch we found that greping through commit logs was a bit of a pain and instead wrote CommitBot, a script for audibly broadcasting commit messages. You can see it in action here:
A name is an extremely powerful device. From the Grimm Brother’s Rumpelstiltskin to He-Who-Must-Not-Be-Named, literary texts are filled with examples of the power of names.
The same principles hold in the world of computer science. When programming, once you’ve determined the name of an object you wield tremendous power over it. However, names can often be a burden. I can’t fathom how many times I’ve used the following construct:
Nice to See You – Recognizing Faces using Face.com
Last month, and to a small amount of fanfare, Face.com released an API for performing facial recognition on an arbitrary set of images. Most exciting is its support for recognizing friends on Facebook and Twitter.
Benjamin Gleitzman is a technologist, artist, and founder.
He is the CTO at Replicant AI. He is also a founder of the hacker collective Ruse Laboratories, creator of the The Algorithm Auction, originator of Pup's Pool Party, and producer at Sublimate NYC.
Gleitzman was a visiting researcher at Google Research in Mountain View, California where he built App Inventor for Android, a graphical programming language for creating Android phone applications that is now at the core of the MIT Center for Mobile Learning.
He is the founder of NextStep Tech, an organization teaching software engineering, creative thinking, and entrepreneurship to junior and high school students.
In his spare time he enjoys creating electronic music, discussing programming concepts, and playing WikiMaze, his remake of Encarta 95's classic trivia game.
He also posts useful bits of knowledge on gleitzman.com.