A simple ruby/http client for Basecamp 4.
Getting an oauth 2 token for basecamp is no fun.
Try this: https://github.com/pcreux/doorkeeper-sinatra-client-for-basecamp
A simple ruby/http client for Basecamp 4.
Getting an oauth 2 token for basecamp is no fun.
Try this: https://github.com/pcreux/doorkeeper-sinatra-client-for-basecamp
init_config: | |
# `datadog/prerun.sh` will inject instances below on boot | |
instances: |
#!/usr/bin/env ruby | |
# Usage: ruby dbt-log-to-csv.rb PATH_TO_DBT_LOGS | |
Model = Struct.new(:schema, :table, :rows_str, :size_str, :duration_str) do | |
def rows | |
rows = rows_str.to_f | |
rows = case rows_str | |
when /\d$/ | |
rows |
require 'active_model' | |
require 'dry-struct' | |
require 'benchmark/ips' | |
require 'benchmark/memory' | |
class AMUser | |
include ActiveModel::Model | |
include ActiveModel::Attributes | |
attribute :id, :integer |
results = [] | |
queue = Queue.new | |
mutex = Mutex.new | |
THREAD_COUNT = 3 | |
threads = Array.new(THREAD_COUNT) do | |
Thread.new do | |
while (value = queue.pop) |
# Strings: | |
["Hello", | |
"Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! Hi! ", | |
"Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woooot! Woo |
#!/usr/bin/env ruby | |
# Generate a dbdiagram for dbdiagram.io from a dbt project. | |
# | |
# Usage: | |
# 1. Run `dbt docs generate` first. | |
# 2. Run `dbt_to_dbdiagram.rb` | |
# 3. Paste the output in https://dbdiagram.io/ | |
require 'yaml' | |
require 'json' |
require_relative './credentials' | |
class SonosClient | |
BASE_URL = 'https://api.ws.sonos.com/control/api/v1' | |
Error = Class.new(StandardError) | |
def get(path) | |
r = HTTP.auth("Bearer #{access_token}") | |
.get(BASE_URL + path) |