Historically I've been more on the sales side of sales engineering. My first gig I was a borderline demo-donkey for the first couple years, didn't ever even need to touch a terminal (or command prompt as it was at that time). As anyone will tell you, it's really easy to get in a comfort zone where you're the big fish in a small pond.
In the spirit of not being the guy who isn't getting any better, I developed some strong relationships with the engineers at my company and dove headfirst into the world of coding (sort of). I've written "scripts" before to do specific tasks... that of course meaning I would come up with an idea, fail at writing the first function and then go bother my dev friends for help. Once the first function was working I would continue to repeat this process until the script was complete.
One of my extremely intelligent colleagues developed a visualization tool called OpenGraphiti that can take any relational dataset formatted in JSON and graph it in 3d (this is a gross over-simplification and doesn't even come close to doing justice to just how amazing this thing is). It's a brilliant piece of software and it can do amazing things, but it's complicated to get running, putting it out of reach for most sales-leaning engineers like myself. So, as a public service, I decided to take a run at writing an install script for all the prerequisites.
Step 1: Figure out everything that needs to be installed.
This part was easy, it's all listed on the OG site. The challenge is you have to install things before you can install other things (yodawg) so I grouped them together accordingly to keep track.
Installers and Repositories:
git
brew
Core Components:
xcode (mac)
python
Packages:
requests
investigate
shodan
geoip2
networkx
Software:
opengraphiti
miner script
Other stuff:
datasets
Step 2: Decide what language to use to write the installer.
Since I am most familiar with bash I decided to use that.
Step 3: Write the script
This took a few tries to get working. Logic states that to install packages, you need package installers. And from previous experience, I know that in order to get any code at all to work on a mac, you need xcode. After much fettling, I learned that there's no easy (or fast) way to install xcode, so I just put some text at the beginning of the script to let people know that they need to have this first:
echo "Automated OpenGraphiti installer 1.0 created by mrbarrett"
echo "IMPORTANT: You must have xcode installed (mac) before running this script!"
Step 4: Test
This was the extent of the niceties in the script. Everything else was just a lump of brew installs and git-pulls. Worked great on my machine, sweet. Then, inevitably, we hit a roadblock. Of the 15 people I sent this to, 13 of them reported errors... fml.
After some more head-banging I figured it out. It was a mixture of not having Xcode installed (RTFM), not running Xcode before installing (RTFM) and having the wrong version of python installed (I found out later 2.7.10 isn't installed with brew, you need an old-fashioned download from python.org).
Eventually we got everyone installed... but not before me being "your company's computer guy" and physically sitting in front of everyone's machine individually and getting it running. The phrase "no good deed goes unpunished" comes to mind... Regardless, it was a good exercise. I continue to practice writing stuff and understand the basic structure but it's like any other skill... if you don't use it regularly you forget.
For the .000001% of you that are reading this because you're struggling getting OpenGraphiti installed, you can find my script here (it also grabs some baked datasets from my own personal git):
#!/bin/bashruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" &&brew install git &&brew install glew &&brew install cmake &&brew install pkgconfig &&brew tap homebrew/versions && brew install glfw3 &&pip install networkx &&pip install pygeoip &&mkdir ~/OG_Demo(cd /home &&git clone https://github.com/ThibaultReuille/graphiti.git --recursive ~/OG_Demo/graphiti &&git clone https://github.com/ThibaultReuille/raindance.git --recursive ~/OG_Demo/raindance) &&(cd ~/OG_Demo/raindance && make) &&(cd ~/OG_Demo/graphiti && cmake . && make) &&mkdir -p ~/OG_Demo/datasets(cd /home &&git clone https://github.com/mrbarrett/baked-graphs.git ~/OG_Demo/datasets)echo "Done!"
No comments:
Post a Comment