Skip to content

Instantly share code, notes, and snippets.

View kevinlondon's full-sized avatar

Kevin London kevinlondon

View GitHub Profile
@kevinlondon
kevinlondon / chownow_infra_coding_challenge.md
Last active January 18, 2017 01:20 — forked from maxgutman/adsnative_devops_coding_challenge.md
ChowNow: Infrastructure Engineer Coding Challenge

ChowNow: Infrastructure Engineer Coding Challenge

Get the Flask 'Hello World' app up and running on a Vagrant VM using your known best practices as well as the instructions in the guidelines below. You must use Ansible as your provisioner to install and configure everything. When you're done, we should be able to type vagrant up and our app will be running and reachable on http port 80 at http://192.168.33.15.

Guidelines:

  • The provisioner should clone a Github-hosted repo into the VM under /etc/chownow/infratest
  • The app should route through nginx and gunicorn or uWSGI.
  • The app should be running as a non-privileged user
  • The app should be automatically restarted if crashes or is killed
  • The app should maximize all of the available CPUs (have Vagrant virtualize multiple CPUs and use them)
#!/usr/bin/env python
"""
Plot histogram from list of dates
Usage
=====
Feed newline separated unix time via STDIN.
Ex.1: plot repository activity::
@kevinlondon
kevinlondon / migration.md
Created January 12, 2016 22:04 — forked from booherbg/migration.md
Migrating from Elixir to SQLAlchemy declarative

I have a project that's a few years old, but needs some maintenance. Since I last worked on the project, two major things have happened. First, Elixir -- a declarative layer on top of SQLAlchemy -- has not been maintained. Secondly, SQLAlchemy now has its own declarative layer.

Rather than continue using Elixir, I decided to migrate my data models to use the new SQLAlchemy declarative layer, which interestingly enough appear to be relatively compatible with Elixir's philosophy.

The first thing I did was do a direct mapping in my model columns and update the import statements.

# from Elixir import Entity, Field, DateTime, Unicode, Integer, Boolean, setup_all, create_all, session, metadata
from sqlalchemy import Column, DateTime, String, Integer, ForeignKey, Boolean
from sqlalchemy.ext.declarative import declarative_base
#
# Google I/O 2014 secret invite code finder
#
# Blake Caldwell, 2014
#
# Blog Post: http://blakecaldwell.net/blog/2014/4/23/solving-a-2014-google-io-secret-invite-puzzle.html
#
# Repeatedly hit https://developers.google.com looking two-colored "I/O" on the page,
# with a secret code in comments below it. Using the color codes of the "I" and "O",
# calculate the 6-character Google URL-shortened link code, and print the code out.