Clear - Node Module

Posted by Dave Eddy on Aug 15 2012 - tags: tech

Clear the terminal screen if possible

I wrote up a super small module to mimic clear on the command line for Node.js. I was surprised when I didn’t find a module that already did this in npm.

View the Project page on GitHub

Usage

var clear = require('clear');
clear();

Example

Node Clear

Read More...


Musicnamer

Posted by Dave Eddy on Aug 04 2012 - tags: tech

Organize your music collection

I wrote this module as a way to help organize my collection of flac and mp3 files. It can automatically inspect your music files metadata tags, and rename the files based on them.

Check out musicnamer on GitHub

Description

Rename music files to clean filenames based on their music tags. By default, musicnamer can take your music files and rename them to a format like:

%artist%/%album%/%trackno% - %title%.%ext%

This package is not meant to be used as a Node module, but rather as a command line tool

Read More...


Chromium Install Script for Mac

Posted by Dave Eddy on Jul 25 2012 - tags: tech

Install and upgrade chromium on OS X.

Chromium

I like to have both Chromium and Chrome installed on my mac, but installing Chromium is not as easy as installing Chrome. Chromium required me to find the tarballs that were generated from the Chromium source control, and to make sure that I was only pulling the tarball if my Chromium version was out of date. Because of this, mac-chromium was born.

View the project page on github

Read More...


(De) struct - Node Module

Posted by Dave Eddy on Jul 18 2012 - tags: tech

Easily unpack C Structs and binary buffers

I wrote destruct to tackle the problem of unpacking binary buffers in Node easily. Based off the unpack function in Perl, and inspired by prustat by Brendan Gregg, this module makes it simple to take a binary buffer object, and a format string to unpack values. There were other modules that claimed to have the same functionality, but most of them were too poorly documented with the source code almost unreadable, while the others were overcomplicated and didn’t support a simple format string.

This module does not handle all data types, it has only been tested on SmartOS, and was built for making it easier to extend the proc Node module by @dshaw.

Check out the project page here https://github.com/bahamas10/node-destruct.git

Read More...


Autocast - Node Module

Posted by Dave Eddy on Jul 17 2012 - tags: tech

Easily and automatically cast common datatypes in JavaScript

I was working on parsing output from the command line while creating the Node SMF module. This required me to inspect the elements individually and write case statements to expect certain data types be returned.

What I mean by this is…

When you parse the command line, everything gets returned as a string. So, you must do some post-processing to cast items that look like numbers to numbers, strings that look like keywords to keywords, ie 'false' to false, etc.

So, autocast was born. This module will do all of that inspection for you and return what it thinks the object should be.

Check out the project page here https://github.com/bahamas10/node-autocast

Read More...


Realtime DTrace Visualization

Posted by Dave Eddy on Jul 12 2012 - tags: tech

Check out my YouTube video of realtime latency graphs using DTrace and gnuplot.

Scripts here https://github.com/bahamas10/realtime-dtrace-visualization

The graph on the left shows read system call latency, and the graph on the right shows write system call latency (syscall::read*:entry and syscall::write*:entry respectively). The bottom portion is a modified oneliner to show files opened by a process (excluding gnuplot) taken from Brendan Gregg’s DTrace oneliners.

At 0:45, I induced latency by reading /usr/share/dict/words and writing the contents out to the screen in a 1 second loop. This becomes visible in large spikes on the graph showing write latency, but the read latency graph is almost unaffected.

The X-axis on both graphs show time (ticking every second) in the form of MM:SS. The Y-axis represents the time in milliseconds, and each point is a 1 second average aggregation of the latency.

Because of the nature of gnuplot in this experiment, the Y-axis adapts to the visible metrics, so when the latency is induced, the Y-axis grows from ~.005ms to ~2ms.


Node DTrace Examples on Github

Posted by Dave Eddy on Jun 16 2012 - tags: tech

Working on performance analysis with an interpreted language poses some interesting problems. Fortunately, Node.js has built in support for DTrace thanks to the guys at Joyent. These built-in facilities make it easy to trace Node.js, and profile its time on the CPU to get an in-depth view of the execution of the program. Tools also exist that use DTrace’s ability to profile Node.js to create visual representations of the execution stack, such as Brendan Gregg’s Flame Graph Tool.

However, when tracking latency from an application-aware point-of-view, it is necessary to inject probes into the code itself, setting checkpoints, or entry and return points. Using the DTrace Provider Node.js Module written by Chris Andrews, I’ve created a repository of examples on Github showing the DTrace provider in action.

Check out the repository here https://github.com/bahamas10/node-dtrace-examples/.

Read More...


Acer Aspire One + Xubuntu

Posted by Dave Eddy on Feb 03 2012

Acer Aspire One

A couple of weeks ago I bought an Acer Aspire One! It never even made it to the “Welcome to Windows” screen; it was boot up with an Ubuntu USB key. I tried desperately to get used to gnome 3, and unity, and I just couldn’t do it. Besides painfully slow, I’m just not a fan of fullscreen apps, dynamic desktop space allocation, lack of customizability, etc.

After a couple days of that I decided to try out Xubuntu. I wanted to get a Linux experience I was used to, but have a window manager that I actually like using. Xfce has turned out to be amazing! it’s extremely light weight, and it has the full customizability that I loved from Gnome-2.

I upgraded the ram from 1G to 2G, and upgraded the internal 250GB hard drive to a 60GB SSD. After doing some tuning in the system to disable atime, use a different queue scheduler for the disk, and offload the chrome cache directory into a tmpfs, this thing flies. It’s still a little difficult getting used to the small size of it.. but i love it.


Scripts Repo

Posted by Dave Eddy on Jan 30 2012

Check out my scripts repository on github. I have written a bunch of random scripts that needed a home, so I put them up on github. These scripts are put on all of my servers in my ~/bin folder, controlled through puppet. In the repo you’ll find a flac-to-v0 script that acts just like cp, in that you give it 1 or more source files, and a single destination, and it will convert the given input files (as flac) to mp3. I also have a php rss parser, a shoutcast/di.fm parser/player, and other random stuff, check it out!

https://github.com/bahamas10/scripts


Github Account

Posted by Dave Eddy on Jan 01 2012

Github

Check out my github account at github.com/bahamas10. Right now I don’t have much code on there, only a single repository for my various dot files. As I write more code I’ll be pushing it up to github, in the works right now is a script to automatically rename mp3/flac files based on their artist/album/song tags.