Skip to content

Instantly share code, notes, and snippets.

@alexgaribay
alexgaribay / temp.ex
Created September 28, 2020 17:41
Enum suggestion
types = %{
my_enum: {:parameterized, Ecto.Enum, values: [:a, :b, :c]}
}
# https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/type.ex#L771
defp cast_fun({:parameterized, mod, init_params}), do: &mod.cast(&1, mod.init(init_params))
@alexgaribay
alexgaribay / registry-caprover.json
Created May 17, 2020 17:00
Create a hosted docker registry on Caprover
{
"captainVersion": "2",
"documentation": "Based on https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-docker-registry-on-ubuntu-18-04",
"displayName": "Docker Container Registry",
"dockerCompose": {
"version": "3.3",
"services": {
"$$cap_appname": {
"image": "registry:2",
"containerHttpPort": "5000",
@alexgaribay
alexgaribay / ghost-caprover-install.json
Last active January 22, 2022 10:12
One-click installer for Ghost on Caprover
{
"captainVersion": "2",
"documentation": "Taken from https://docs.ghost.org/",
"displayName": "",
"description": "Ghost is a free and open source blogging platform written in JavaScript and distributed under the MIT License",
"dockerCompose": {
"services": {
"$$cap_appname": {
"depends_on": [
"$$cap_appname-db"
@alexgaribay
alexgaribay / lounge-caprover.json
Last active May 14, 2020 05:17
Caprover one-click install for The Lounge IRC
{
"captainVersion": "2",
"documentation": "Adapted from https://thelounge.chat/docs/install-and-upgrade#docker.",
"description": "The Lounge is a self-hosted web IRC client with modern features, persistent connections, and multi-user support.",
"displayName": "The Lounge",
"dockerCompose": {
"version": "3.3",
"services": {
"$$cap_appname": {
"image": "thelounge/thelounge:$$cap_lounge_version",
@alexgaribay
alexgaribay / drone-gitbhub-captain.json
Last active March 5, 2022 18:46
Capserver definition for Drone with Github integration
{
"captainVersion": "2",
"documentation": "Taken from https://docs.drone.io/intro/gitea/single-machine/",
"displayName": "Drone.io",
"description": "Drone is a self-service Continuous Delivery platform for busy development teams",
"dockerCompose": {
"version": "2",
"services": {
"$$cap_appname-runner": {
"image": "drone/drone-runner-docker:$$cap_drone_runner_version",
;; -*- mode: emacs-lisp; lexical-binding: t -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Layer configuration:
This function should only modify configuration layer settings."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@alexgaribay
alexgaribay / spacemacs-cheshe.md
Created March 23, 2019 02:41 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
defmodule MyAppWeb.AcmeChallengeController do
@moduledoc """
Controller used for cerbot renewal.
This module reads a file's contents and provides a value back for domain validation.
With this module you'll need to add a new route to the router.
# router.ex
scope "/.well-known/acme-challenge", ProgressPlumWeb do

Keybase proof

I hereby claim:

  • I am alexgaribay on github.
  • I am alexgaribay (https://keybase.io/alexgaribay) on keybase.
  • I have a public key ASCwCbE6fa5y9oWo5QBhQ2-eEGCH7eWbreCwqgMIuUfz8Ao

To claim this, I am signing this object:

defmodule App.Worker do
def do_work(topic, user) do
# async work goes here
App.Endpoint.broadcast! topic, "work_done", %{ "user" => user }
end
end
defmodule App.Channel do