Skip to content

Instantly share code, notes, and snippets.

View maltoe's full-sized avatar

Malte Rohde maltoe

View GitHub Profile
@maltoe
maltoe / this_doesnt_work.ex
Last active October 9, 2024 11:42
Appsignal: Handling exceptions in plug in endpoint
@impl Plug
# naively copied version from Appsignal.Plug
def call(%{path_info: ["webhook", "my-webhook"]} = conn, opts) do
Appsignal.instrument(fn span ->
_ = Appsignal.Span.set_namespace(span, "http_request")
try do
MyUnderlyingPlug.call(conn, opts)
catch
kind, reason ->
@maltoe
maltoe / Dockerfile
Last active September 30, 2024 07:54
Chromium v128 headless failure
# Both broken:
#FROM hexpm/elixir:1.17.2-erlang-26.2.5.2-alpine-3.20.2
#FROM hexpm/elixir:1.17.2-erlang-26.2.5.3-alpine-3.20.3
# Works:
FROM hexpm/elixir:1.17.2-erlang-26.2.5.2-alpine-3.19.3
RUN apk add --no-cache --update chromium && rm -rf /var/cache/apk/*
RUN adduser -D -u 1001 deploy
USER 1001
@maltoe
maltoe / footer_bug.exs
Last active December 13, 2023 13:41
footer bug in chromic_pdf
username="a25...<redacted>"
password="Brz...<redacted>"
base_url="https://box-i...<redacted>"
basic=$(echo -n "$username:$password" | base64 -w0)
curl -X POST \
-v \
-H 'accept: application/json' \
-H 'content-type: application/json' \
build:
image: docker:19.03.15
services:
- docker:19.03.15-dind
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/group/project/image:latest .
- docker push $CI_REGISTRY/group/project/image:latest
variables:
# This is *the way* to disable TLS for dockerd 19. dockerd 20 does not understand this!
build:
image: docker:20.10.7
services:
# hab dem auch mal einen alias gegeben, theoretisch muesste der als "docker" erreichbar sein
- docker:20.10.7-dind
variables:
# versucht mit oder ohne
DOCKER_DRIVER: overlay2
# versucht mit oder ohne (deaktiviert TLS)
DOCKER_TLS_CERTDIR: ""
@maltoe
maltoe / Gemfile
Last active November 18, 2016 16:43
dry-validation: array of hashes doesn't convey the nested input
source 'https://rubygems.org'
gem 'dry-validation'
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
@maltoe
maltoe / rbx_compile_output.log
Created March 17, 2015 10:07
stacktrace for rubinius case-when issue
$ rbx compile test.rb >log 2>&1
Failed compiling test.rb
An exception occurred running compile:
undefined method `body' on an instance of CodeTools::AST::PushArgs. (NoMethodError)
Backtrace:
Kernel(CodeTools::AST::PushArgs)#body (method_missing) at kernel/delta/kernel.rb:78
## app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
@@silenced_actions = [:home]
def home
end
end