Skip to content

Instantly share code, notes, and snippets.

View christianklotz's full-sized avatar

Christian Klotz christianklotz

View GitHub Profile
package jsonapi
import (
"fmt"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
type PublishStatus int
package jsonapi
import (
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
type TaggedPost struct {
package main
import (
"database/sql"
"errors"
"fmt"
"strconv"
"github.com/manyminds/api2go/jsonapi"
)
{
"swagger": "2.0",
"info": {
"title": "Swagger Sample",
"description": "Sample API Playground.",
"version": "1.0.0"
},
"basePath": "/v1",
"schemes": [
"http"
@christianklotz
christianklotz / food-request-validation-failed.json
Last active September 9, 2016 10:36
Error response for a food request resulting in a validation error
{
"message": "validation failed",
"code": 1234,
"errors": [{
"code": 5678,
"message": "not so healthy",
"field": "food",
"suggested_value": "🍎"
}]
}
@christianklotz
christianklotz / install-ortools.sh
Created October 17, 2016 09:22
Shell script to install Google's OR tools
#!/bin/bash
echo "Dowloading Google's Operations Research tools...";
ORTOOLS_TAR=or-tools.python.examples_v4.4.3842.tar.gz;
ORTOOLS_TAR_URL=https://github.com/google/or-tools/releases/download/v4.4/${ORTOOLS_TAR};
curl -O -L ${ORTOOLS_TAR_URL};
tar -xzf ${ORTOOLS_TAR}; cd ortools_examples; python setup.py install;
@christianklotz
christianklotz / package-ortools-app.sh
Created October 17, 2016 09:31
Create Python app package for Amazon AWS Lambda including Google's ortools dependencies
#!/bin/bash
DEST_DIR=$(dirname $(realpath -s $0));
echo "Copy all native libraries...";
mkdir -p ./lib && find $directory -type f -name "*.so" | xargs cp -t ./lib;
echo "Create package...";
zip -r dist.zip your-python-script.py lib;
rm -r ./lib;
@christianklotz
christianklotz / circle.yml
Created May 9, 2017 12:06
Circle CI configuration with deployment stages
general:
artifacts:
- "coverage/lcov-report"
machine:
node:
version: 7.6.0
# environment:
# set the following variables in CircleCI project settings
# AWS_ACCESS_KEY_ID
# AWS_SECRET_ACCESS_KEY

Keybase proof

I hereby claim:

  • I am christianklotz on github.
  • I am christianklotz (https://keybase.io/christianklotz) on keybase.
  • I have a public key whose fingerprint is C379 1DED 2328 2727 E094 4D67 E8B9 609E 233F D8AC

To claim this, I am signing this object:

package main
import (
"fmt"
"math/rand"
"time"
)
func generate(nums ...int) chan int {
out := make(chan int)