Skip to content

Instantly share code, notes, and snippets.

View danhawkins's full-sized avatar

Danny Hawkins danhawkins

View GitHub Profile

This is an example of github rendering mermaidjs

sequence TD
  one --> two
  two --> three
  two --> four
@danhawkins
danhawkins / vail-webhook.md
Created December 20, 2022 02:51
Vail Webhook.md

Vail Webhook Ideas

In order to get more insights that can make for more interesting live and post game stats, we would like to get more information from the webhook

Terms

To avoid abigutiy for the sake of these examples

  • Lobby is the a lobby that has been created, regardless of how many maps played until the lobby is closed
  • Map full map played to 11 points
@danhawkins
danhawkins / command.ex
Created September 7, 2022 04:31
Command macro
defmodule Cmd.Command do
@moduledoc """
Utility for command definition, wrapping a design pattern into code
For our commands we will used type_embedded_schema to design an in memory schema
which will be used for the command payload
As well as this we require the developer to implement a changeset/2 function
"""
@danhawkins
danhawkins / reset_projections.ex
Created August 29, 2022 11:39
Reset Commanded projections (domain specific)
defmodule Mix.Tasks.ResetProjections do
@moduledoc """
Reset all system projects from events
"""
use Mix.Task
@projection_modules ~w(
Ivrl.Tournaments.Projectors.Tournament
Ivrl.Teams.Projectors.Team
Ivrl.Players.Projectors.Player
@danhawkins
danhawkins / rules.yaml
Last active August 1, 2022 10:03
Rules yaml
rules:
- index: 1
title: Code of Conduct
rules:
- text: |
Every participant in the International Virtual Reality League
("IVRL" or "the league") is expected to behave with respect towards
other players (not just league players), IVRL staff, officials,
production team, and game developers. By joining IVRL you become a
representative of the league and shall act accordingly. The
#!/bin/sh
# Name for the pod
LIVEBOOK_NAME="danny-livebook"
echo "Starting livebook"
kubectl run $LIVEBOOK_NAME \
--image=livebook/livebook
@danhawkins
danhawkins / start-livebook-pod.sh
Last active April 27, 2022 15:56
Start Livebook Pod
#!/bin/sh
# Name of our app/service and executable name from the release
SVC_NAME="test-svc"
EXEC_NAME="test_svc"
# Name for the pod
LIVEBOOK_NAME="danny-livebook"
# Fetch the require env from the service pod
@danhawkins
danhawkins / deploy.yaml
Last active April 19, 2022 15:36
K8s Deploy for test_svc
apiVersion: apps/v1
kind: Deployment
spec:
template:
spec:
containers:
- env:
- name: PHX_SERVER
value: "true"
- name: PHX_HOST
@danhawkins
danhawkins / mix.exs
Last active April 19, 2022 15:41
Add releases
defmodule TestSvc.MixProject do
use Mix.Project
def project do
[
app: :test_svc,
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:gettext] ++ Mix.compilers(),
@danhawkins
danhawkins / env.sh.eex
Created April 19, 2022 15:31
Elixir env.sh for K8S
#!/bin/sh
export POD_A_RECORD=$(echo $POD_IP | sed 's/\./-/g')
export RELEASE_DISTRIBUTION=name
export RELEASE_NODE=test_svc@${POD_A_RECORD}.${NAMESPACE}.pod.cluster.local