How to evaluate a string of code in Erlang at runtime

Erlang has the ability to read in a string, representing a line of code to execute, at runtime. It can parse it out, evaluate it and return the value. Contents 1 Evaluating Simple Expressions 2 Security Considerations 2.1 What’s an SQL injection attack? (bear with me) 2.2 What’s that have to do with Erlang?! 3 Intercepting Local Function Calls 4 Intercepting Non-Local Function Calls 5 What else? Evaluating Simple Expressions At its most basic, we can just read any expression passed in and execute it. -module(parser). -export([ evaluate_expression/1 ]). -spec evaluate_expression(string) -& »

5 Ways to Reclaim Space on Your Android Phone

I have a Moto E smartphone, which has pretty minimal specs (including internal memory), so I’m regularly looking for ways to make the most of limited resources. It’s barebones, but it gets the job done and I paid $100 for it. 2 years ago. Since that’s what the new Samsung and iPhone models cost every few months on the monthly plan, I’m cool with it. At least until I can figure out how to make this happen… You’re here, so I can safely assume you’re in the same boat. I mean, unless you searched »

What is "charlieplexing"? (a short demo using the Raspberry Pi)

While I was reading Raspberry Pi Cookbook, I came across a few things that looked interesting to demo. One of them was the concept of “charlieplexing“. On past projects, when I needed multiple LEDs (like in my Simon clone), I just connected each individual LED to its own GPIO pin. I was fully aware that current had to travel through the LED in one direction and that it wouldn’t light in the other direction, but it hadn’t occurred to me to take advantage of that fact. This is where charlieplexing comes in – we arrange multiple LEDs such that »

Creating Your Own Indoor Vegetable Garden

Since building my first raised garden bed a couple years ago (there’s a second one next to it now), I’ve really enjoyed growing our own veggies. It’s a fun project if you’re into that sorta thing – fairly easy to setup, cathartic in its rhythm (weed, water, harvest, repeat…), and the payoff half-way through summer is a lot of fresh snacks! Pretty much every weekend… End-of-summer harvest of basil We had lots of caprese salad! It can be a good activity for the whole family too. Most of the work is on me, which is fine since »

Cooking with Simon Monk - Raspberry Pi Cookbook

It’s been too long since I messed with the Raspberry Pi. It started with Hacktoberfest a few months ago, then we had a baby, and then I got it in my head to write a Chrome extension and… life happened. So I picked up a copy of Raspberry Pi Cookbook by Simon Monk to jump-start things again. I assumed it’d have “recipes” for some cool projects, but it ended up being much more comprehensive. It takes you from the very basics of unpacking your Pi and setting it up, to installing Raspbian and creating your first Python script, »

What is a Git alias, and how do I use it?

If you’re unfamiliar with Git’s “alias” feature, it provides a way to create shortcuts for other Git commands, which can save you a lot of time. They’re easy to setup and maintain too. Using Aliases for Shortcuts You can create aliases for short commands, like assigning “checkout” to “co”: git config --global checkout Or longer commands, like this one that displays a unique log view: git config --global alias.hist "log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short" And what if you’re the sole developer of some project and »


Book Review: Getting Things Done, Part 1

Do you ever get exhausted, thinking of everything that needs to be done? I do. I always have this feeling that there’s tons of “stuff” to do – some that needs to get done and a lot I want to get done, some at the forefront of my thought and some I just have a nagging feeling about. There’s stuff I wanted to do years ago that I still kind of intend to do, maybe, if and when I magically formulate a plan. Or more like, when the plan formulates itself. Most of it’s so vague that I »

5 Things You Can Do With a Locally Cloned GitHub Wiki

If you’ve been developing software for any length of time you’ve probably used GitHub, whether as free hosting for your own personal project, or searching for a library to use, or collaboration on a team. There’s a feature of every GitHub repo that in my experience doesn’t get a ton of love, and that's the GitHub wiki. In all fairness, I'm not sure how much love it deserves. Sure you can take notes in it, but its lack of short-codes/widgets (such as easily adding a table of contents to the top of your pages) and »

Creating My First Google Chrome Extension – Part 3

PART 1 | PART 2 | PART 3 I was looking forward to wrapping this extension up within the first couple days of xmas break (my workplace shuts its doors between Christmas and New Year’s), but then every single one of my kids got sick in turn. All of them. It was a crappy week. But now it’s finally done (I also wrote about it here and here), and I can generate bookmarks from Pinboard tags the way I wanted. All in all, a good learning experience. If you want to check it out, it’s in the Chrome store. »

Creating My First Google Chrome Extension - Part 2

PART 1 | PART 2 | PART 3 I started writing my first browser extension a couple weeks ago, and though my spare time has been pretty limited I've made some (never as much I'd like) progress. I left off last time with (finally!) figuring out how to authenticate to the Pinboard API. As with so many things, once I knew the answer I couldn't believe I didn't figure it out sooner. There are a number of reasons it might fail, but in my case I needed to add the API URL to the list of permissions in the manifest.json file. »