Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Luc Perkins lucperkins

🎯
Focusing
View GitHub Profile
View todo_controller.ex
defmodule TasksAppWeb.TodoController do
use TasksAppWeb, :controller
use Plug.ErrorHandler
alias TasksApp.Todos
alias TasksApp.Todos.Todo
def index(conn, _params) do
todos = Todos.list_todos()
conn
@lucperkins
lucperkins / package.json
Created Jun 6, 2019
Failing package.json
View package.json
{
"private": true,
"dependencies": {
"event-stream": "^4.0.1",
"express": "^4.17.1",
"left-pad": "^1.3.0"
}
}
@lucperkins
lucperkins / main.workflow
Last active Jun 18, 2019
Open Policy Agent CI example (GitHub Actions workflow)
View main.workflow
workflow "OPA evaluation" {
on = "push"
resolves = ["install"]
}
# Determines whether the policy has been violated
action "evaluate" {
uses = "docker://openpolicyagent/opa:0.11.0"
args = [
"eval",
@lucperkins
lucperkins / ci.rego
Created Jun 6, 2019
Open Policy Agent CI example
View ci.rego
package ci
# The package.json is presumed faulty
default allow = false
# Packages that aren't allowed
blacklist = {
"event-stream",
"left-pad"
}
View do-k8s-setup-macos.sh
# Install doctl (DigitalOcean CLI tool)
brew install doctl
# Install kubectl
brew install kubernetes-cli
# Log into DigitalOcean
export DO_ACCESS_TOKEN=...
doctl auth login init --access-token ${DO_ACCESS_TOKEN}
@lucperkins
lucperkins / # coredns - 2019-01-31_09-32-03.txt
Created Feb 1, 2019
coredns on macOS 10.14.2 - Homebrew build logs
View # coredns - 2019-01-31_09-32-03.txt
Homebrew build logs for coredns on macOS 10.14.2
Build date: 2019-01-31 09:32:03
View todo-service.js
const {GetTodoRequest} = require(./todos_pb.js’);
const {TodoServiceClient} = require(./todos_grpc_web_pb.js’);
const todoService = new proto.todos.TodoServiceClient(‘http://localhost:8080’);
const todoId = 1234;
var getTodoRequest = new proto.todos.GetTodoRequest();
View protoc-gen.sh
protoc echo.proto \
--js_out=import_style=commonjs:./output \
--grpc-web_out=import_style=commonjs:./output
View todos.proto
syntax = “proto3”;
package todos;
message Todo {
string content = 1;
bool finished = 2;
}
message GetTodoRequest {
View envoy-grpc-web-config.yaml
static_resources:
listeners:
- name: listener_0
address:
socket_address: { address: 0.0.0.0, port_value: 8080 }
filter_chains:
- filters:
- name: envoy.http_connection_manager
config:
codec_type: auto
You can’t perform that action at this time.