Skip to content

Instantly share code, notes, and snippets.

View cheerfulstoic's full-sized avatar

Brian Underwood cheerfulstoic

View GitHub Profile
@cheerfulstoic
cheerfulstoic / Repository Maintenance Levels.md
Last active February 21, 2024 02:46
Repository Maintenance Levels

After reading Why I'm Frequently Absent from Open Source by James Long and listening the corresponding The Changelog episode, I dwelt on the idea and believe that open source maintainers...

  • ... should never be ashamed if they don't have time for a project.
  • ... should be honest with themselves and open with their users so that everybody can be on the same page
  • ... are people and they have at one time or another responsibilities or hardships that they need to attend to which reasonably take them away from a project
  • ... may also reasonbly decide that they don't like the direction of a project or that they would like to explore other things and may leave a project permanently.

Along this line of thinking I've created a set of descriptions for different levels at which a project might be maintained. A maintainer can use these to announce to their users the current ability that they have to dedicate to a pr

# Find eligible builder and runner images on Docker Hub. We use Ubuntu/Debian
# instead of Alpine to avoid DNS resolution issues in production.
#
# https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=ubuntu
# https://hub.docker.com/_/ubuntu?tab=tags
#
# This file is based on these images:
#
# - https://hub.docker.com/r/hexpm/elixir/tags - for the build image
# - https://hub.docker.com/_/debian?tab=tags&page=1&name=bullseye-20210902-slim - for the release image
@cheerfulstoic
cheerfulstoic / gist:7e8ec61f9104017430af
Last active April 12, 2022 18:36
Examining what is possible for StackOverflow with a graph database

Analyzing StackOverflow with Neo4j and Clojure

Joining multiple disparate data-sources, commonly dubbed Master-Data-Management (MDM), is usually not a fun exercise. I would like to show you how using a graph database (Neo4j) and an interesting dataset (developer-oriented collaboration sites) to put the fun back into MDM. This approach will allow you to quickly and sensibly merge data from different sources into a consistent picture and query across the data efficiently to answer your most pressing questions.

You can read the associated blog posts on my blog. The blog posts cover the hows and whys of the project, while this and other GraphGists will examine how to answer specific questions of the data.

@cheerfulstoic
cheerfulstoic / log.log
Last active September 16, 2021 11:28
ts-dump / ts-restore logs
2021/09/13 13:36:33 pg_restore: skipping item 3706 TABLE DATA SequelizeMeta
2021/09/13 13:36:33 pg_restore: launching item 3488 CONSTRAINT SequelizeMeta SequelizeMeta_pkey
2021/09/13 13:36:33 pg_restore: skipping item 3707 TABLE DATA table1
2021/09/13 13:36:33 pg_restore: skipping item 3489 INDEX table1_readAt_idx
2021/09/13 13:36:33 pg_restore: skipping item 3490 INDEX itemId_readAt_unique_index
2021/09/13 13:36:33 pg_restore: skipping item 3561 TRIGGER table1 ts_insert_blocker
2021/09/13 13:36:33 pg_restore: skipping item 3708 TABLE DATA table2
2021/09/13 13:36:33 pg_restore: skipping item 3491 INDEX table2_readAt_idx
2021/09/13 13:36:33 pg_restore: skipping item 3492 INDEX table2_itemId_readAt_unique_index
defmodule Tester do
def update!(map) do
try do
{:ok, Map.update!(map, :blah, fn v -> v end)}
rescue
e in KeyError -> {:error, :no_key}
end
end
@cheerfulstoic
cheerfulstoic / actor.ex
Last active July 15, 2021 19:46
Emoji Game - Telemetry Example
# lib/emoji_game/actor.ex
# Non-player character client
defmodule EmojiGame.Actor do
use GenServer
# ... code ...
@impl true
@cheerfulstoic
cheerfulstoic / .circleci_config.yml
Created February 11, 2021 09:45
CircleCI / Docker configuration to build, test, and push an image to Docker Hub
# file path should be .circleci/config.yml
version: 2 # use CircleCI 2.0 instead of CircleCI Classic
jobs: # basic units of work in a run
build: # runs not using Workflows must have a `build` job as entry point
parallelism: 1 # run only one instance of this job
docker: # run the steps with Docker
- image: circleci/elixir:1.11.3 # ...with this image as the primary container; this is where all `steps` will run
auth:
username: $DOCKER_USER
password: $DOCKER_PASS # context / project UI env-var reference
@cheerfulstoic
cheerfulstoic / lib-my_app_web-graphql-middleware-relay_connection_lazy_evaluate.ex
Created November 16, 2020 09:40
Middleware for Elixir's `absinthe` to deal with efficient querying of `edges` and `totalCount`
defmodule MyAppWeb.Graphql.Middleware.RelayConnectionLazyEvaluate do
@moduledoc """
Absinthe requires all of the data for a connection to be loaded in the `resolve`
for the field. This means that regardless of if a client requests `edges` or
`totalCount`, the server needs to do one query for both every time.
This middleware evaluates the query that was done by the client to figure out
what fields were requested. It will only load the data which is required for
a typical connection based on what the client has requested
@cheerfulstoic
cheerfulstoic / graph_gist_template.adoc
Last active April 14, 2020 07:29
CHANGEME: GraphGist Template. Fork to make your own, view source to see instruction comments

TITLE OF YOUR GRAPHGIST

@cheerfulstoic
cheerfulstoic / output
Created October 15, 2019 12:02
string_concat_test.rb
Warming up --------------------------------------
interpolation 151.958k i/100ms
StringIO << 57.897k i/100ms
StringIO concat 103.750k i/100ms
Calculating -------------------------------------
interpolation 2.482M (± 9.9%) i/s - 9.877M in 4.027092s
StringIO << 45.806B (±33.8%) i/s - 119.834B
StringIO concat 100.679B (±15.4%) i/s - 272.862B
Comparison: