Skip to content

Instantly share code, notes, and snippets.

View taion809's full-sized avatar
:shipit:
what are statuses for?

Nicholas Johns taion809

:shipit:
what are statuses for?
View GitHub Profile
@taion809
taion809 / main.go
Created November 8, 2023 04:33
HTMX SSE K8S Demo
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/go-chi/chi"
@taion809
taion809 / ring.go
Created April 20, 2023 04:35
Simple ring buffer
package main
import (
"fmt"
"strings"
)
type Ring struct {
buffer []string
size int
@taion809
taion809 / ofms.md
Created April 28, 2019 20:53
Observable F# Microservices

Observable FSharp Microservices (dotnetcore2.2+)

Let us define an observable microservice as one that exposes its internal state through events, metrics, and trace data. Ideally we can aggregate this data in some sort of centralized observability system for alerting and diagnostics. In my opinion there are tools that work much better than others and I will use those in this example but the most important part is that you have a starting point and your services can be observed and alerted on somehow. If your company does not have the means to setup all of this infrastructure you should consider buying one of the many SaaS options out today.

Disclaimer: I am not a native .net or F# developer, I think at this point in my career I've logged 2 weeks on an F# dev team so the implementations given below may not be idiomatic, however, my experience comes from being apart of both Devops and microservices dev teams in other teams and organizations.

That being said; let's start building an "observable" micro

@taion809
taion809 / d.fs
Created March 3, 2019 21:22
F# json.net deserialize
namespace PoeIngester
open HttpFs.Client
open System.Net.Http
open Hopac
open Newtonsoft.Json
module Bookmark =
type responseBody = {
[<JsonProperty(PropertyName="next_change_id")>]
NextChangeId: string;
load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
def envoy_package():
native.package(default_visibility = ["//visibility:public"])
# Compute the final copts based on various options.
def envoy_copts(repository, test = False):
return [
"-Wall",
"-Wextra",
Output the state of the DAG when a task executes (output to logs)
Save the version of your workflow and the task code you used (so you can check logs later and recreate data as needed)
script a way to prune the data from any point in the DAG that will also prune data downstream so you can rerun workflows.
log task ids, hadoop application ids, etc when the task executes.
package transceiver
import (
"context"
"strings"
"github.com/confluentinc/confluent-kafka-go/kafka"
)
type Tx interface {
@taion809
taion809 / gist:6510212
Created September 10, 2013 14:29
PHP Nested set to multidimensional array
private function _formatTreeIntoArray(&$tree, $current_depth = 0)
{
$formattedTree = array();
while($leaf = current($tree))
{
if($leaf->DEPTH > $current_depth)
{
$formattedTree[] = $this->_formatTreeIntoArray($tree, $leaf->DEPTH);
}
elseif($leaf->DEPTH < $current_depth)
{
"$schema": "http://json-schema.org/draft-04/schema",
"title": "Package",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
"description": "Package name, including 'vendor-name/' prefix."
},
@taion809
taion809 / Dockerfile
Last active December 27, 2015 19:59
Simple nodejs Dockerfile
FROM ubuntu
MAINTAINER Nicholas Johns "nicholas.a.johns5@gmail.com"
# Force update
# install python-software-properties for adding PPA's
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y python-software-properties