Skip to content

Instantly share code, notes, and snippets.

@brycesch
brycesch / webvtt.rb
Last active March 22, 2019 16:38
Ruby library to generate webvtt formatted transcripts from an array of timestamped words.
module Webvtt
DEFAULT_MAX_CHAR_LENGTH = 40
class Cue
attr_accessor :start, :end, :words
def initialize(words)
self.words = words
end
def to_s
@brycesch
brycesch / artillery_ws_config.yml
Last active May 15, 2019 19:37
artillery load testing config for phoenix channels
config:
target: "ws://localhost:4000/socket/websocket?client_id=fb55a707-8f3a-4900-b095-0b971550c61d&vsn=2.0.0"
phases:
- duration: 60 # Test for 60 seconds
arrivalRate: 100 # Every second, add 10 users
rampTo: 1000 # And ramp it up to 100 users in total over the 60s period
name: "Ramping up the load"
- duration: 120 # Then resume the load test for 120s
arrivalRate: 100 # With those 100 users we ramped up to in the first phase
rampTo: 1000 # And keep it steady at 100 users
@brycesch
brycesch / Gemfile
Last active February 5, 2020 05:24
stream w2json to kafka
source 'https://rubygems.org'
gem 'eventmachine'
gem 'eventmachine-tail'
gem 'yajl'
gem 'ruby-kafka'
require 'pg'
uri = ''
file = File.open('tmp/write.txt', 'w')
while true do
begin
conn = PG.connect( uri )