Firstly, you need to install v4l2loopback and obs-v4l2sink. On arch linux with yay:
yay -Syu obs-v4l2sink v4l2loopback-dkms
Then, set up a systemd service:
koyoko% cat /etc/systemd/system/v4l2loopback.service
| require 'thread/local' | |
| class Searchable | |
| extend Thread::Local | |
| def initialize | |
| @index = "rubygems" | |
| end | |
| Sync do | |
| query = subject.call(<<~SQL * 10) | |
| SELECT PG_SLEEP(0.1) AS LIFE; | |
| SQL | |
| query.results do |result| | |
| Console.logger.info(query) {"#{result.count} #{result.field_names}"} | |
| result.each do |row| | |
| Console.logger.info(result, row) | |
| end |
| # gem install async-container | |
| gem "async-container" | |
| require 'async/clock' | |
| require 'async/container' | |
| def fibonacci(n) | |
| if n < 2 | |
| return n |
| require_relative 'lib/async/websocket/version' | |
| Gem::Specification.new do |spec| | |
| spec.name = "async-websocket" | |
| spec.version = Async::WebSocket::VERSION | |
| spec.authors = ["Samuel Williams"] | |
| spec.email = ["[email protected]"] | |
| spec.summary = %q{An async websocket library on top of websocket-driver.} | |
| spec.homepage = "" |
| #!/usr/bin/env ruby | |
| # This script reads a list of PIDs from the command line and dumps all readable memory regions. | |
| REGION_PATTERN = /(\h+)-(\h+) (r)/ | |
| ARGV.each do |pid| | |
| maps = File.open("/proc/#{pid}/maps") | |
| mem = File.open("/proc/#{pid}/mem") |
Firstly, you need to install v4l2loopback and obs-v4l2sink. On arch linux with yay:
yay -Syu obs-v4l2sink v4l2loopback-dkms
Then, set up a systemd service:
koyoko% cat /etc/systemd/system/v4l2loopback.service
| require 'benchmark/ips' | |
| require 'dry/monads/result' | |
| extend Dry::Monads::Result::Mixin | |
| def pure_square(x) | |
| value = x ** 2 | |
| if value > 50 |
| #!/usr/bin/env ruby | |
| require 'async' | |
| require 'async/http/internet' | |
| Async do |task| | |
| internet = Async::HTTP::Internet.new | |
| # Effectively a connection timeout: | |
| response = task.with_timeout(10) do |
| #!/usr/bin/env ruby | |
| require 'process/pipeline' | |
| def process_group_pids(pids) | |
| pids.flat_map do |pid| | |
| buffer = Process::Pipeline.("pstree -p #{pid}").read | |
| buffer.scan(/(?<=\()\d+(?=\))/) | |
| end.sort.uniq |
| #!/usr/bin/env RBENV_VERSION=2.7.0 ruby | |
| gem 'async' | |
| require 'async' | |
| Async do |task| | |
| Async.logger.info("Incoming request...") | |
| Async(logger: task.logger.with(name: "request-id-1234")) do | |
| Async.logger.info("Database Query") |