Skip to content

Instantly share code, notes, and snippets.

View Markbnj's full-sized avatar

Mark Betz Markbnj

View GitHub Profile
@Markbnj
Markbnj / gce_project.sh
Created October 9, 2015 16:48
Grab Google compute engine project ID into environment variable
export GCLOUD_PROJ=$( gcloud info | awk '$1 == "Project:" {print $2}' | tr -d '[][:space:]' )
@Markbnj
Markbnj / check_docker.sh
Created October 17, 2015 17:35
Check kernel configuration for docker compatibility
curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh | bash
# yes, I know
import threading
from contextlib import closing
import requests
from Queue import Queue
input_file = u"test_input.txt"
def on_download_complete(url, file_name):
swagger: '2.0'
info:
title: My Cars API
description: Simple API for demonstrating json validation
version: 1.0.0
host: localhost
schemes:
- http
produces:
- application/json
definitions:
Registration:
type: object
required:
- state
- plate_number
properties:
state:
type: string
description: Two letter state abbreviation code
Car:
type: object
required:
...
properties:
...
registration:
$ref: '#/definitions/Registration'
paths:
/swagger:
get:
summary: Return swagger API specification
description: |
Returns the My Cars API spec as a json swagger doc.
tags:
- Meta
responses:
'200':
import json
import os
import syslog
import validator
from flask import Flask, request, make_response
from jsonschema.exceptions import ValidationError
class BadRequestError(Exception):
""" Signals a malformed request body
import json
import os
from bravado_core.spec import Spec
from bravado_core.validate import validate_object
from yaml import load, Loader, dump, Dumper
def validate_car(car):
validate_object(spec, Car, car)

Keybase proof

I hereby claim:

  • I am markbnj on github.
  • I am markbnj (https://keybase.io/markbnj) on keybase.
  • I have a public key ASAurAAcEgjhAvcXHWw1ujCICb_8e98HV3FWERnAIkDu5go

To claim this, I am signing this object: