With buf.gen.yaml as:
version: v2
plugins:
- remote: buf.build/grpc/ruby:v1.71.0
out: gen
include_imports: true
- remote: buf.build/protocolbuffers/ruby:v30.2
out: gen| # Following datadog patterns, see: | |
| # https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/tracing/contrib/karafka/distributed/propagation.rb | |
| # https://github.com/DataDog/dd-trace-rb/blob/master/lib/datadog/tracing/contrib/karafka/patcher.rb#L27-L49 | |
| class MyCustomPropagation < Datadog::Tracing::Distributed::Propagation | |
| def initialize( | |
| propagation_style_inject:, | |
| propagation_style_extract:, | |
| propagation_extract_first: | |
| ) | |
| super( |
| name | age | |
|---|---|---|
| john doe | 12 | |
| albert francis | 16 |
With buf.gen.yaml as:
version: v2
plugins:
- remote: buf.build/grpc/ruby:v1.71.0
out: gen
include_imports: true
- remote: buf.build/protocolbuffers/ruby:v30.2
out: gen| require 'bundler/inline' | |
| gemfile do | |
| source 'https://rubygems.org' | |
| gem 'dry-configurable' | |
| end | |
| require "singleton" | |
| class Settings |
| require 'readline' | |
| def __flush_history | |
| Readline::HISTORY.slice!(0..-1) | |
| end | |
| def __restore_history(irb_history) | |
| __flush_history | |
| irb_history.each { |line| Readline::HISTORY << line } | |
| end |
Linting an open api description
npx @redocly/cli lint swagger/openapi.jsonGenerating doc hmtl page for the description
npx @redocly/cli build-docs swagger/openapi.json
| # frozen_string_literal: true | |
| # rubocop:disable Style/Documentation | |
| IRB.conf[:SAVE_HISTORY] = 10_000 | |
| alias r require | |
| %w[json securerandom yaml pp pry pry-byebug redis zlib base64].each do |lib| | |
| r lib | |
| rescue LoadError |
| #!/bin/sh | |
| ## Requires openssl, nodejs, jq | |
| pack() { | |
| # Remove line breaks and spaces | |
| echo "$1" | sed -e "s/[\r\n]\+//g" | sed -e "s/ //g" | |
| } | |
| generate_keys_and_token() { | |
| local prefix=$1 |
| { | |
| "keyMappings": "map gc closeOtherTabs\n\n\" option-f on a mac\nmap <a-ƒ> LinkHints.activateModeWithQueue\n\n\" option-p on a mac\nmap <a-π> togglePinTab\n\n\" \\-esc should pass esc (to close a modal on a site)\nmap \\ passNextKey", | |
| "newTabUrl": "pages/blank.html", | |
| "searchEngines": "w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia\ng: https://www.google.com/search?q=%s Google\ny: https://www.youtube.com/results?search_query=%s Youtube\ngm: https://www.google.com/maps?q=%s Google maps\nd: https://duckduckgo.com/?q=%s DuckDuckGo\naz: https://www.amazon.co.uk/s/?field-keywords=%s Amazon\n\n# More examples.\n#\n# (Vimium supports search completion Wikipedia, as\n# above, and for these.)\n#\n# g: https://www.google.com/search?q=%s Google\n# l: https://www.google.com/search?q=%s&btnI I'm feeling lucky...\n# y: https://www.youtube.com/results?search_query=%s Youtube\n# gm: https://www.google.com/maps?q=%s Google maps\n# b: https://www.bing.com/search?q=%s Bing\n# d: https://d |
| function __github_org_current_users \ | |
| --argument-names org_name | |
| set -l users '[]' | |
| for i in (seq 1000) | |
| set -l page_users (gh api "/orgs/$org_name/members?page=$i" | jq 'map(.login)') | |
| test "$page_users" = '[]' && break | |
| set users (jq -n --argjson users "$users" --argjson page_users "$page_users" '[$users, $page_users] | add') | |
| sleep 0.1 | |
| end |