barinek.com: the official website

Below you'll find a quick stream of consciousness that includes photos, quotes, code snippets, and possibly even a full post. enjoy!

nginx with passenger and rails

The below script walks you through setting up Nginx with Phusion Passenger and Rails. The script is intended for use with RightScale and Amazon Web Services (AWS).

Here are the links to the software detailed in the script.

The first part of the script removes pre-configured ruby packages and installs ruby and rubygems from scratch.

The second part of the script installs nginx with ssl support and then sets up an example rails application.

Here is the full example

the #golf swing…unfortunately how I didn’t spend my xmas break

the #golf swing…unfortunately how I didn’t spend my xmas break

nagios ejabberd check via ruby

Below is an example of using Ruby and xmpp4r to check ejabberd’s status from within nagios

You’ll need to define the below nagios command within you nagios config file and then include the below ruby.

define command {
  command_name check_xmpp
  command_line ruby /opt/nagios/plugins/check_xmpp.rb --hostname $HOSTADDRESS$ --jid username@domain.com --password password
}
Here is the ruby example

Alice’s adventures in algebra: Wonderland solved http://bit.ly/7nB2oI barinek

aws snapshots with capistrano

Here’s a quick example using Capistrano and amazon-ec2 gems to create Amazon Web Services (AWS) snapshots. instances is a convenience method within our larger cap file.

First and current mountain bike

First and current mountain bike

aws base script

I thought I’d post a quick example of how to use aws and rightscale to setup a basic instance with your local user account. The below is really a mix of our rpm pre- and post- install scripts, although should give you and idea on how to create you own base instance.

The below script installs a few commonly used packages, moves home and opt directories to the ephemeral drive, and creates your user account. The script also adds the user to the sudoers files and gives the root account user a password.

It’s a pretty quick script to setup your local account on aws. Basically we follow a similar path although execute a few of the below commands within our rpm, something like `yum install -y base`. Kind of cool.

here’s the script…

#!/bin/sh

yum install -y wget ntp

The below is a rightscale wrapper around the ec2 meta data api that fetches and sets environment variables. In the below example I’m using the script to populate the ip address and then set the hostname.

source "/var/spool/ec2/meta-data.sh"

echo "$EC2_LOCAL_IPV4        $HOST_NAME" >> /etc/hosts
hostname $HOST_NAME
echo "HOSTNAME=$HOST_NAME" >> /etc/sysconfig/network

Next I create a tmp directory on the ephemeral drive and setup the network time protocol. More info here http://www.ntp.org/

mkdir /mnt/tmp
chmod 1777 /mnt/tmp

modprobe capability
/etc/init.d/ntpd start

I then move /opt and /home directories to the ephemeral drive. There are several instance types to choose from on ec2, I typically use a large instance that includes 2×420 GB plus 10 GB root partition.

mv /opt /mnt
ln -s /mnt/opt /opt

mv /home /mnt
ln -s /mnt/home /home

The below are basic commands for creating user accounts. The difference here is that I’m grabbing a few things that are available via rightscale’s rightscripts. First both user password and public key are used to create the user account.

useradd -m -G wheel -p $USER_PASSWORD username

mkdir /home/username/.ssh
mv $ATTACH_DIR/id_rsa.pub /home/username/.ssh/authorized_keys
chown -R username:username /home/username/.ssh
chmod 0600 /home/username/.ssh/authorized_keys

Next I grab a sudoers file and disable root login to the instance.

mv $ATTACH_DIR/sudoers /etc/sudoers

chmod 0440 /etc/sudoers

head --lines=-1 /etc/ssh/sshd_config > /tmp/sshd_config
echo "PermitRootLogin no" >> /tmp/sshd_config
mv -f /tmp/sshd_config /etc/ssh/sshd_config

/usr/sbin/usermod -p $ROOT_PASSWORD root

Finally I restart sshd.

/etc/init.d/sshd restart

The above $USER_PASSWORD should be substituted with actual values. For example, you could use openssl passwd to generate crypted passwords. Rightscale allows you to inspect your script during design and then included as inputs when you spin up your instance. Any feedback is welcome.

Here’s the full script

gnip 3 iteration average velocity 15 - low of 8, high of 23 since .rb barinek
daily fruit plates

daily fruit plates

finally integrated rcov with cruise for gnip - 64% unit 67% integration coverage, starting to slack barinek
dinosaur, jr.

dinosaur, jr.

Real-time E9-1-1 Notification of Potentially Hazardous Airborne Conditions through In-Vehicle Telematics

An E9-1-1 In-Vehicle Telematics Geographic Information System (GIS) for detecting potentially hazardous airborne conditions and notifying Public Safety Answering Points of the condition has been developed in response to a proof of concept request by Greater Harris County 9-1-1 Emergency Network (GHC). Led by Intrado Inc., in conjunction with Ford Motor Company, eLutions Inc., Cross Country Automotive Services Inc. (CCAS), the University of Houston Institute for Multi-dimensional Air Quality Studies (IMAQS), Trinity Consultants Inc., and the National Center for Atmospheric Research (NCAR), the system shall be combined with an outbound calling platform enabling the notification and evacuation of potentially effected rural and urban communities.

Livernois Vehicle Development, under the auspice of Ford Motor Company, developed a vehicle-level architecture incorporating nuclear, biological, and chemical sensing; automatic collision notification; and bi-directional data and wireless voice communications. Concept systems were installed in 270 police vehicles throughout Greater Harris County, of which 30 vehicles included sensors for detecting CO2. Vehicle readings containing latitude, longitude, and chemical sensor data taken every five minute were transmitted via eLutions wireless network to CCAS, interpreted, and then forwarded to Intrados Emergency Call Relay Center.

Intrado, in collaboration with IMAQS, Trinity Consultants, and NCAR, contributed a real-time GIS for predicting CO2 dispersion and notifying first responders of potentially hazardous conditions. The dispersion or nowcast model is calculated using Trinitys modified SLAB algorithm and forecast weather information collected by IMAQS. The first responder notification includes a digital base map created using ESRI ArcGIS Server technologies that describes police vehicle location and CO2 release. The police vehicle was assumed to be the point source, rural and urban topologies were not considered in the concept solution.

System and method for providing accurate local maps for a central service

Lucent Technologies Inc. US Patent 7127352

A system and method that provides economical and accurate data for a selected area (jurisdiction) from a centralized location by generating a base-line map from commercially available information and distributing portions of this map to local jurisdictions. Inaccuracies and other information only available locally are stored in a local database. Periodically these databases are uploaded to a central location and reconciled with the base line map. Advantageously, such reconciliation may include a rules based reconciliation wherein the geo-coordinates from the commercial vendors are used and applied to the local data. A new base line map is then generated and distributed back to the local user. In this manner, the local user has an accurate yet economical map.