whateverthing.com

Portfolio and Technology Blog
by Kevin Boyd

Raspberry Pi Microproject

I've had a Raspberry Pi for some time, and I'm still wondering what I should do with it. Occasionally I have an idea and I go to start it up and ... realize I've forgotten the password.

Oops.

Well, this blog post isn't about that, but I'll mention a fix at the end just for my own reference, along with some links to a Raspberry Pi starter kit & camera modules.

What I need is for a freshly-booted, headless, keyboardless Raspberry Pi to somehow tell me its IP address.

This microproject took me about an hour to complete, including recovering the password. The idea stems from the fact that when I connect the Pi to a network that dispenses IP addresses using DHCP, I can't guess what address it'll get. Sure, on networks I control, I can pin the MAC Address of the Pi to a specific IP - but I don't always control the network.

Read more of this post »

January 29, 2016

Tags: coding, dev, development, command-line, howto, administration, composer, starter-kit, password-recovery


The Llama Commander

When I'm in an experimental mood, or working on a proof of concept, I like to code in a scrappy way. Anonymous functions allow me to avoid pausing my train of thought to think of a name for something. However, when I'm using the Symfony Console Component to write command-line utilities, it seems that I have to write a class for each command.

No more, I say!

I've created a tiny library called beryllium/llama that lets me set the configuration and execution logic of console commands using anonymous functions, right in the constructor. When I found myself using the technique across several projects, I did what anyone would do - I gave it a silly name and threw it on GitHub and Packagist.

Read more of this post »

October 19, 2015

Tags: coding, dev, development, silex, command-line


Sculpin Tips: HTML Snippets with Twig Macros

Sculpin is a PHP-based static website generator, ideal for powering websites that don't need dynamic DB-driven features or web-based administration. It's commonly used for blogging, but can be used for pretty much any marketing site you need, such as corporate websites, online portfolios, or even emergency downtime pages for when your WordPress site has been hacked ... (Kidding! Proper maintenance and security practices will make WordPress downtime a rarity.)

When running a website, you'll often want to reuse snippets of HTML. Many editors and IDEs have this functionality built in, but the problem with using editor snippets is maintainability. If you want to alter the snippet, you have to suss out every place it was used and manually edit it.

Sculpin uses the Twig templating engine, which has a feature that solves this problem. Twig macros are kind of like functions, like you would find in PHP or Javascript. They can be a bit tricky to get started with, so check out the tips below for help.

Read more of this post »

July 21, 2015

Tags: dev, development, coding, howto, twig, sculpin