Skip to content

Instantly share code, notes, and snippets.

William Hayes wshayes

Block or report user

Report or block wshayes

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wshayes
wshayes / fastapi_demo.py
Last active May 15, 2019
[FastAPI Single File Demo] Example fastapi single file testable example #fastapi
View fastapi_demo.py
import logging
from fastapi import FastAPI
from starlette.responses import RedirectResponse
from starlette.testclient import TestClient
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
app = FastAPI()
@wshayes
wshayes / conftest.py
Created May 13, 2019
Example conftest.py for fastapi/sqlalchemy
View conftest.py
# From @euri10 -- https://gitter.im/tiangolo/fastapi?at=5cd915ed56271260f95275ac
import asyncio
import pytest
from sqlalchemy import create_engine
from sqlalchemy_utils import create_database, database_exists, drop_database
from starlette.config import environ
from starlette.testclient import TestClient
@wshayes
wshayes / conftest.py
Created Apr 24, 2019
Running docker servers in pytest
View conftest.py
# Example of code to startup docker containers for use in the tests
# pip install pytest-docker-tools
from pytest_docker_tools import container, fetch
arangodb_image = fetch(repository="arangodb:3.4")
elasticsearch_image = fetch(repository="elasticsearch:6.7.1")
arangodb_session = container(
@wshayes
wshayes / .bumpversion.cfg
Last active Feb 14, 2019
Bumpversion configuration
View .bumpversion.cfg
[bumpversion]
current_version = 0.0.0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
{major}.{minor}.{patch}
[bumpversion:part:release]
View concourse_badges.md

Concourse CI Badge notes

Job Badge

http(s)://concourse-server/api/v1/pipelines/pipeline-name/jobs/job-name/badge

Example Job Badge

The sslip.io project has a Concourse CI pipeline consisting of one job.

The pipeline is sslip.io (same name as the project, a simple naming scheme), and the job’s name is check-dns.

@wshayes
wshayes / ExampleDataSetArray.json
Created Jan 30, 2018
Example JSON and YAML for a Medium article
View ExampleDataSetArray.json
[
{
"key": "value1"
},
{
"key": "value2"
}
]
@wshayes
wshayes / Dockerfile
Created Sep 8, 2017
Keycloak Docker setup
View Dockerfile
FROM jboss/keycloak-postgres:2.3.0.Final
ADD enableProxy.xsl /opt/jboss/keycloak/
RUN java -jar /usr/share/java/saxon.jar \
-s:/opt/jboss/keycloak/standalone/configuration/standalone.xml \
-xsl:/opt/jboss/keycloak/enableProxy.xsl \
-o:/opt/jboss/keycloak/standalone/configuration/standalone.xml; \
java -jar /usr/share/java/saxon.jar \
-s:/opt/jboss/keycloak/standalone/configuration/standalone-ha.xml \
-xsl:/opt/jboss/keycloak/enableProxy.xsl \
@wshayes
wshayes / CLA.md
Created Jul 5, 2017 — forked from balloob/CLA.md
CLA for Apache 2.0 license
View CLA.md

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the Apache 2.0 license; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the Apache 2.0 license; or

@wshayes
wshayes / Dockerfile-es
Last active Feb 9, 2019
Elasticsearch and Kibana using docker-compose (v3)
View Dockerfile-es
FROM docker.elastic.co/elasticsearch/elasticsearch:5.5.1
RUN \
mv /usr/share/elasticsearch/plugins/x-pack /usr/share/elasticsearch/plugins/.removing-x-pack && \
mv /usr/share/elasticsearch/plugins/.removing-x-pack /usr/share/elasticsearch/plugins/x-pack && \
/usr/share/elasticsearch/bin/elasticsearch-plugin remove x-pack
@wshayes
wshayes / countries.js
Created Mar 23, 2017
ViewEngineHooks Aurelia example
View countries.js
// Here's an example from Rob Eisenberg
// filename: resources/data/countries.js
import {viewEngineHooks} from 'aurelia-templating';
let countries = [
{ abbreviation: "AF", name: "Afghanistan" },
{ abbreviation: "AL", name: "Albania" },
{ abbreviation: "DZ", name: "Algeria" },
...
You can’t perform that action at this time.