After recently setting up a new Rackspace Cloud Server with the Cloud Monitoring agent, I was annoyed by the length of the install Knowledge Center article. I decided to write a script to assist in and speed up the install of this agent.
Before running this script, you will need the following:
curlinstalled on your server.
To install the Cloud Monitoring agent, simply run this command from your Cloud server:
sudo bash -c "$(curl -s https://raw.githubusercontent.com/amussey/blog-posts/master/2014/10_Rackspace-Monitoring-Agent-Installer/install.sh)"
This script has been tested with all currently available Performance flavor Cloud servers that have OSes supported by the Cloud Monitoring Agent Knowledge Center article (as of Oct 2014). For more information on compatibility and to view the contents of the script, visit the github repo for this blog post. As always, pull requests and comments are welcome!
During the summer, Rackspace Blacksburg set on a consistent schedule of office-wide tech talks. These talks ranged in subject from conference presentations to new technologies to managerial styles. Above are some of the talks that have been given in the last couple months that I have had a chance to record and post to the Racksburg YouTube channel.
I’ll admit it: I’ve been completely sucked into webscript.io. Webscript.io is a site that allows for small Lua scripts to be hosted on user-selected URLs. A coworker and I have spent the last two weeks designing new dashboards for our Rackspace team, scraping websites, and throwing small scripts back and forth. The number of written lines of Lua between the two of us has easily broken into the thousands.
While working on a recent script, I ran into a situation where JSON would need to be input and parsed. Unfortunately, the built-in webscript.io
JSON.parse function does not have any sort of decent error handling. If there is a problem, your script 500s and the user receives a blank response.
There are a lot of incredibly in-depth Lua JSON libraries, but keeping with webscript.io’s spirit of “small scripts”, I was hesitant to import any of them in their entirety. All I needed from these libraries was validation - is this string valid JSON, or are there missing brackets and broken syntax?
This led to the creation of a Lua JSON Validator. The module does exactly as described above: takes a string as input and returns true or false if it’s valid JSON.
To use the module, you simply need to import it via a
local validJson = require "amussey/lua-json-validator/validJson" if validJson(jsonString) then -- interact with valid JSON else -- report invalid JSON end
A series of test cases are also provided with the module.
To view the source code, visit the github repo:
As always, pull requests on the repo or comments on this post are welcome!
I had the opportunity to film the Racksburg (Rackspace Blacksburg) response to the ALS Ice Bucket challenge from Graham Weston last week. Awesome to see so many participating Rackers!
While constructing the Github Team Pull Request Highlighter, I ran into the need to translate color codes back and forth between hex (
#ff0000) and RGB/RGBA (
rgba(255, 0, 0, 1)).
hexToRgb returns an object with r, g, and b properties.
var color = hexToRgb("#1fbcff"); color.toString(); // rgb(31, 188, 255) color.r; // 31 color.g; // 188 color.b; // 255
hexToRgb can also accept an
alpha value has a second parameter. This allows the output of
var color = hexToRgb("#1fbcff", 0.5); color.toString(); // rgba(31, 188, 255, 0.5) color.r; // 31 color.g; // 188 color.b; // 255 color.alpha; // 0.5
rgbToHex returns a hex string in the format
#ffffff. It can accept a wide variety of inputs.
rgbToHex(31, 188, 255); // #1fbcff rgbToHex("rgb(31, 188, 255)"); // #1fbcff rgbToHex("rgba(31, 188, 255, 0.5)"); // #1fbcff
rgbToHex can also accept the color objects produced by
var color = hexToRgb("#1fbcff"); rgbToHex(color); // #1fbcff var color2 = hexToRgb("#1fbcff", 0.5); rgbToHex(color2); // #1fbcff
The repo for this library is available here (or click here if you want save time and go directly to the library).
A little over a year ago, I posted about a secret project I had been working on: the official iOS and Android app for Get Drunk Not Fat. There have a been a couple big updates since then, but today I have another to show off.
The latest interface update inherits the flat-UI style of iOS 7, along with a more appealing color scheme. Along side that, the performance has been improved, so you should see all around speed ups on your device.
While working with videos for a couple blogs, I’ve run across performance issue while embedding multiple videos on a page. Once you get past 2-3 embedded videos on a page (something that isn’t terribly challenging if that’s a primary focus of the site), the scroll speed slows to a crawl and over-all user performance begins to deteriorate.
Here’s how the page appears with and without the library:
This requires no modification to the existing code (unless you’re adding custom styling to the iframes). All you need is to embed the script:
If you run into any bugs or problems, let me know in the comments or on the github page!