Skip to content

Instantly share code, notes, and snippets.

View IanVaughan's full-sized avatar

Ian Vaughan IanVaughan

View GitHub Profile
IanVaughan / leads_csv.rb
Created May 16, 2023 10:34
Matching SalesForce Leads
# frozen_string_literal: true
require 'csv'
require 'restforce'
username: '',
password: ENV['SFDC_PASSWORD'],
client_id: '',
client_secret: ENV['SFDC_CLIENT_SECRET'],
IanVaughan / scrape.rb
Created May 13, 2023 22:18
Scrape price data
require 'csv'
require 'nokogiri'
require 'open-uri'
require 'pry'
urls ='urls.txt').split("\n")'scraped_data.csv', 'wb') do |csv|
urls.each do |url|
html =
IanVaughan / load-test.rb
Created April 25, 2023 13:23
Load test streaming prod data into staging
#!/usr/bin/env ruby
require 'delivery_boy'
# topic = 'raw-transactions-truelayer'
topic = ARGV[0]
command = "stream-kafka #{topic}"
brokers: [''],
IanVaughan / karafka.rb
Created March 31, 2023 08:02
karafka errors on 3rd consumer_group
# frozen_string_literal: true
module Karafka
class App
CONFIG = Rails.application.credentials.kafka
setup do |config|
config.client_id = 'cas_client'
config.kafka = {
IanVaughan / server.rb
Last active October 3, 2022 08:09
Simple ruby server
require 'socket'
socket =
loop do
client = socket.accept
first_line = client.gets
verb, path, _ = first_line.split
if verb == 'GET'
ccloud kafka topic create --partitions 1 test-topic

ccloud kafka topic produce test-topic --value-format avro --schema /path/to/schema.json

Finish Getting Started with Schema Registry

2021-07-29T11:29:38.0007456Z ##[group]Starting datadog-agent service container
2021-07-29T11:29:38.0009102Z ##[command]/usr/bin/docker pull datadog/agent:latest
2021-07-29T11:29:39.4210209Z latest: Pulling from datadog/agent
2021-07-29T11:29:39.7656448Z 1127acbecdf7: Pulling fs layer
2021-07-29T11:29:41.8115266Z 1127acbecdf7: Verifying Checksum
2021-07-29T11:29:41.8115918Z 1127acbecdf7: Download complete
2021-07-29T11:29:50.9679094Z 1127acbecdf7: Pull complete
2021-07-29T11:29:50.9742704Z Digest: sha256:da43df11da9f6052d1a8691c87c5b1df60e79352f94c4ed7a53465e1a51dac04
2021-07-29T11:29:50.9761841Z Status: Downloaded newer image for datadog/agent:latest
IanVaughan / cred-diff
Last active April 26, 2023 15:17
#!/usr/bin/env bash
# Usage
# cred-diff <env> (<branch|ref>|master)
# eg
# cred-diff production master
git checkout $REF --quiet
printf .
IanVaughan / diff-creds
Last active June 25, 2021 15:04
Show difference in rails creditials
#!/usr/bin/env bash
# Usage:
# diff-creds production
git checkout master --quiet
printf .
rails credentials:show --environment $1 > /tmp/prod
printf .
git checkout - --quiet
printf .
2021-06-08T11:59:41.3519967Z ##[section]Starting: Request a runner to run this job
2021-06-08T11:59:42.1598461Z Can't find any online and idle self-hosted runner in current repository that matches the required labels: 'ubuntu-latest'
2021-06-08T11:59:42.1598552Z Can't find any online and idle self-hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-06-08T11:59:42.1598921Z Found online and idle hosted runner in current repository's account/organization that matches the required labels: 'ubuntu-latest'
2021-06-08T11:59:42.3122458Z ##[section]Finishing: Request a runner to run this job
2021-06-08T11:59:51.7098919Z Current runner version: '2.278.0'
2021-06-08T11:59:51.7127239Z ##[group]Operating System
2021-06-08T11:59:51.7128229Z Ubuntu
2021-06-08T11:59:51.7128778Z 20.04.2
2021-06-08T11:59:51.7129289Z LTS