I have been using Powershell to manage pieces of Azure on and off for about a year and half now. I had heard tell of Azure Automation but never really had a good reason to justify spending the time climbing that particular mountain (hill really…).

Then the request came through… let’s scale AzureSQL databases up and down based on time of day for a given project… If you have worked in Azure you know Microsoft has built in a fairly robust and relatively easy to use auto scale-out configuration interface for Azure App services. Not so for “up/down” scale operations (increasing/decreasing the size of a single-instance). Hence, my foray into Azure Automation.

I have done a fair bit of Azure Powershell scripting just using the ISE interface and keeping scripts on my desktop. I started out with “AzureRM” and migrated to “AZ” as Microsoft starting a couple of years ago pretty much said “AZ” is the future… switch now.

With that background in place, I will state that I found starting out on Azure Automation to be a bit of a bumpy ride. I wanted to hopefully save you the reader some of the time I spent chasing my tail…
(more…)

A lot of my bash scripting experience has been, in one sense, relatively simple. I have several scripts that span several hundred lines and do fairly complex things across multiple systems. From that perspective they aren’t necessarily simple. However it wasn’t until recently that I had to really starting thinking about managing when scripts run and particularly keeping them from “stepping all over each other” when multiple instances of the same script must be run… enter the topic of “Job Control” or “Controlled Execution.”

A common scenario is that your bash script is written to access some shared resource. A few examples of such shared resources:
-An executable file that can only have one running instance at any given time
-A log file that must be written to in a certain order
-Sensitive system files (such as the interfaces file).

What happens if a bash script gets executed once, and then before the first instance finishes running a second instance is fired off? The short answer is typically unexpected/bad stuff that tends to break things.

So the solution is to introduce some job control logic into your scripts. And to that end I want to talk about two methods of controlling job execution that I have started to employ heavily for one of my projects: Simple Lock Files, and the more involved FLOCK application built into most newer Linux distributions. For reference, most of this article is based on a system running Debian Jessie. (more…)

I have been learning a ton of PHP lately in an effort to build a significant amount of custom functionality into a Drupal website. As I am not a developer by trade it has been a steep climb upward. Lately I have been refactoring a lot of my code using functions. Being a noob however, I ran into some issues in that I didn’t understand how PHP scoped the usage of variables.

Case in point, I had written a function to generate a bunch of variables dynamically based on some input into the function, but I wasn’t able to use those variables outside of the function. (more…)

Need to administer some drupal stuff from the command-line? DRUSH is the answer. But first you need to get it installed. I am putting the commands to run here to do just that for my own future reference. Hope this is of benefit to everyone else!

Elevate yourself:

sudo -s

Check if Pear is installed:

pear version

If not, install it…

sudo apt-get install php-pear

Add the drush channel to pear:

pear channel-discover pear.drush.org

Install drush

pear install drush/drush

Finally, a common use for drush for me is updating modules..

drush pm-update --no-core

Cheers!

This tutorial is going to be a bit to the point so there is an assumption that you have a level of comfort with Linux and with basic file manipulation, ownership, etc. I recently launched a new site, www.mtkfirmware.com, that is focused on collecting firmware for Mediatek based devices. The majority of the site is dedicated to firmware download collection. However there is a subset of the site called “dev-tools” that is specifically a collection of software and tutorials on how to modify Mediatek roms. In this case, we are focusing on roms that can be flashed using the SPflash tool which means their format is a series of .img files, a scatter file, etc. Many Mediatek devices are for the Chinese/Asian market and therefore come with a lot of software that is of little interest to western users. Many just come with bloatware that is of interest to no one. Therefore it is often desirable to modify the firmware for these devices and remove all the bloat as well as do a bunch of other things.
(more…)