Managing a Growing Project

I am no Project Manager in even the loosest sense of the word. Despite that I find myself learning more and more of the processes of PM. This is especially true when projects start to expand and grow. Specifically I am speaking about the NHL API project I started almost two years ago. This lead me to the rabbit hole that is permissions and how to manage the project overall going forward. The projects roots are very rough, even today I still generally commit directly to master. Now the repository has grown to over 70 commits, two distinct files and 17 contributors.

Balance

I am constantly trying to be cognizant of is becoming overly possessive of the project. While it may have started as a one-man show I want and enjoy contributions from others. The converse of worrying about becoming possessive is that there are times when steering is necessary. One of the instances that comes to mind is the suggestion of including example code. The goal of the project is documentation, so I declined such suggestions. Unmaintained code becomes a hindrance over time and I don’t want to add that complexity to the project.

Growth

There is often a pressure to grow projects, to make them expand over time and change. Its a common thing for businesses to always want growth and it seems that mentality has spread to software. Something like the NHL API is a very slow changing thing, just looking at the commit history shows this. Weeks and months will go by without new contributions or even me looking at the API itself. I dabbled with ideas such as using Swagger to generate more appealing documentation. Every time I tried to add something new and unique I realized it felt forced. This ultimately forced me to accept that growth will not be happening, the project has likely reached its zenith.

Looking Forward

The next steps are likely small quality-of-life things such as the recent Gitter.im badge. Things that make it easier for people to interact but don’t change the project overall. My knowledge of the API makes for fast answers so I try to help out when I am able.

scripting: system-help

We have this handy script at work that pulls all kinds of useful details from a system and saves us a ton of time checking by hand, so I took a stab at making my own version for generic use. Its not very good at all but it kinda works and probably could be expanded upon to do something actually useful.

#!/bin/bash

SCRIPT_VERSION="0.1"
# things to check
# internal ip, external ip, dns server, connectivity to google
# filesystem usage, current system load, memory usage

> log.log
date >> log.log
IP=`ip addr | grep -P -o 'd{1,3}.d{1,3}.d{1,3}.d{1,3}/24'`
EXT_IP=`curl -s www.ipchicken.com | grep -o -P 'd{1,3}.d{1,3}.d{1,3}.d{1,3}'`
DNS_1=`grep -P -o 'd{1,3}.d{1,3}.d{1,3}.d{1,3}' /etc/resolv.conf`

echo "Internal IP:" $IP >> log.log
echo "External IP:" $EXT_IP >> log.log
echo "DNS Server 1:" $DNS_1 >> log.log

MEM_USAGE=`free -m`
echo -e "nMemory Informationn" >> log.log
echo -e "$MEM_USAGE" >> log.log 

DISK_USAGE=`df -h`
echo -e "nDisk Usagen" >> log.log
echo -e "$DISK_USAGE" >> log.log

TOP_SNAPSHOT=`top -n 1 -b`
echo -e "nTop Processesn" >> log.log
echo -e "$TOP_SNAPSHOT" >> log.log

UPTIME_SNAPSHOT=`uptime`
echo -e "nUptimen" >> log.log
echo -e "$UPTIME_SNAPSHOT" >> log.log

# now lets try some active tests
echo -e "nPing Testn" >> log.log
if eval "ping -q -c 1 google.com> /dev/null"
then
	echo -e "Ping Test: Successful!" >> log.log	
else
	echo -e "Ping Test: Failed!" >> log.log	
fi

Repo on Gitlab

SSH Connection Script

Ever have a shitty environment where you have tons of devices that you need to connect to and don’t feel like typing out (and invariably mis-typing the hostname)?  Then this dirt simple script might be what you are looking for.

#!/usr/bin/env python
#
# requires file 'hosts' to exist in same directory as the script
# can accept either ip addresses or hostnames in this file

import os
import pwd

user = pwd.getpwuid( os.getuid() )[ 0 ]

f = open('hosts', 'r')

hosts = f.readlines()

id=0

print "=== SSH Console v1 ===nn"
for host in hosts:
        print str(id)+": "+host.rstrip("n")
        id += 1 

print "n"
choice = raw_input('Host >')
choice = int(choice)

os.system("ssh "+user+"@"+hosts[choice])

Just make sure the host file exists and has a hostname on each line rather than smashed together with some delimiter.  Its not elegant, has zero configuration but so far folks at work have found it somewhat handy to save some time, maybe you will too.

Git as a Backup System

So I have a co-worker on a coding project who has all but refused to use any kind of version control  ( and in general prefers to do most of his work in production ) so I’ve been kicking around ways to either force him to do the work, or at least make changes get committed to to a repository without his interaction at all. Took a little reading around to figure out the flags necessary but I managed to get everything working with shared ssh keys added into my bit-bucket settings as well as a cron job that runs at set intervals (in my case at about 10 am when the co-worker’s shift has ended) and pushes all changes including new files to the repository so that I can review what work he has done and the things he has broken. Unfortunately as I got all of this working it seems the web proxy between the server and the outside world shit the bed and I can’t push commits out to my external (and not under the control of the co-worker) repository.

Powerball number picker

So I spent a little time the other day applying what little I know of Python to the concept of picking Powerball lottery numbers because I had nothing much else to do that the time.  In the interest of not only content put putting more of my terrible code out there for people to laugh at I present my simple powerball picker script.

#!/usr/bin/python
from array import *
from random import *
num = array('i')

def create_array():

        for i in range(0,59):
                ins = i + 1
                num.insert(i, ins)
        return num
def pick_a_number():
        your_number = ''
        for n in range(1,6):
                ca = create_array()
                pick = randrange(0,len(ca))
                your_number += str(ca[pick])
                your_number += '  '
                # now we exclude the number
                num.pop(pick)
        print "Your Picks >> "+your_number+" Powerball: "+str(randrange(1,36))

start = 1;
stop = int(raw_input("How many picks would you like to generate? "))

for p in range(start, stop+1):
        pick_a_number()

* note – if you win a huge jackpot with numbers from this send a few bills my way!

Account Info Script

Had to do a quick crontab job at work to grab user details out of /etc/passwd and email the details in a report, here is the resulting script

#!/bin/bash
> account-report.txt
date > account-report.txt
echo -e "=== Account Report ===n" >> account-report.txt
Nlist=${1:-nodelist.txt}
hName=( $(awk '{print $1}' $Nlist) );
for name in "${hName[@]}"; do

        users=$(cat <<EOL
                cat /etc/passwd | grep "/bin/bash" | grep "[1-9][0-9][0-9]" | cut -d: --fields=1,5

EOL
)
        echo "Host: $name" >> account-report.txt
        ssh -o StrictHostKeyChecking=no ${name} "$users" >> account-report.txt
        echo -e "End of $name accountsnn" >> account-report.txt
done

mailx -s "Monthly Account Report" user@host.tld < account-report.txt

It grabs a list of hostnames from nodelist.txt and utilizes a ssh key-trust to connect to the hosts without supplying a password.  We lucked out bigtime that there was a trust already setup otherwise the whole process would have been overly complicated requesting permission to setup a trust in the first place.

Close Bitnami banner
Bitnami