Skip to content

Instantly share code, notes, and snippets.

@dieter-medium
dieter-medium / ci.yml
Created May 12, 2025 13:06
Quick Docker commands to troubleshoot networking in GitHub Actions runners—inject host.docker.internal and test reachability, including auto-detecting private IP.
check-env:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
@dieter-medium
dieter-medium / bidi-example.rb
Last active May 5, 2025 06:59
This proof of concept demonstrates how to generate a PDF from a local HTML file using plain Ruby and WebDriver BiDi. The script starts Chromedriver in headless mode, creates a new browsing context via BiDi, navigates to the specified local file (using a placeholder for the file path), and prints the page as a PDF over a WebSocket connection. No …
#!/usr/bin/env ruby
# see:
# https://w3c.github.io/webdriver-bidi/#command-browsingContext-print
# https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-printToPDF
# https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/examples/print_example.py
# https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/examples/_helpers.py
require 'net/http'
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'matplotlib'
gem 'numpy'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dieter-medium
dieter-medium / template.rb
Created March 28, 2022 11:36
A application template file for rails
def say_custom(text)
say "\033[1m\033[36mcustom template\033[0m #{text}"
end
say_custom "Adding additional gems"
gem_group :development do
gem "selenium-webdriver"
gem "webdrivers"
gem "simplecov", require: false
@dieter-medium
dieter-medium / Dockerfile.dev
Last active March 18, 2022 07:58
A docker compose environment for Ruby on Rails development
ARG RUBY_VERSION=3.1.0-jemalloc
FROM quay.io/evl.ms/fullstaq-ruby:2.7.5-jemalloc-bullseye-slim
RUN apt-get update -qq && apt-get install -y nodejs npm default-mysql-client default-libmysqlclient-dev libsqlite3-dev build-essential libxml2 libxml2-dev zlib1g-dev libxslt-dev git procps wget
RUN apt-get update -qq && apt-get install -y libvips
RUN wget --no-verbose -O /tmp/chrome.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_93.0.4577.82-1_amd64.deb && apt install -y /tmp/chrome.deb
RUN npm install --global yarn
WORKDIR /myapp