This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/grpc/grpc-node/tree/master/packages/grpc-health-check | |
import { service as healthServiceDefinition } from 'grpc-health-check'; | |
// https://github.com/grpc/grpc-node/tree/master/packages/grpc-js | |
import { credentials, makeClientConstructor } from '@grpc/grpc-js'; | |
const HealthClientConstructor = makeClientConstructor(healthServiceDefinition, 'grpc.health.v1.HealthService'); | |
const serverAddress = '0.0.0.0:50051'; | |
const healthClient = new HealthClientConstructor(serverAddress, credentials.createInsecure()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Single file starter with broken test using only the Ruby standard library. | |
# | |
def mymeth(a,b) | |
a + b | |
end | |
require "minitest/autorun" | |
class TheTest < Minitest::Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "json" | |
require "net/http" | |
require "ostruct" | |
require "amazing_print" | |
user_summaries = [] | |
req_total_ms = 0 | |
host = "api.github.com" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gh api graphql --paginate -f query=' | |
query { | |
viewer { | |
repositories(first: 100, isArchived: false) { | |
nodes { nameWithOwner } | |
} | |
} | |
} | |
' | jq -r '.data.viewer.repositories.nodes[]."nameWithOwner"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Set Indicator Light for SWITCH on Scene Controller with State Overwrite | |
description: For Zooz ZEN32. Sets the indicator color when switch is off or on. | |
domain: automation | |
input: | |
zooz_switch: | |
name: Zooz Switch | |
description: List of available Zooz ZEN32 switches. | |
selector: | |
device: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# karafka.rb | |
class KarafkaApp < Karafka::App | |
setup do |config| | |
# setup | |
end | |
# Unique consumer group for our dynamic consumers | |
DYNAMIC_CONSUMER_GROUP_NAME = "#{ENV['KAFKA_PREFIX']}dyn-group" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "redis-client" | |
## | |
# Emulate the methods of the Redis gem for HealthMonitor | |
# so we can use RedisClient gem instead. | |
# | |
class HealthMonitorRedisClient | |
def initialize | |
# REDIS_CONNECTION_SETTINGS should be defined elsewhere | |
@client = RedisClient.config(**REDIS_CONNECTION_SETTINGS).new_client |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## | |
# Construct an exclusion search query for Datadog log search for Tenable IP address ranges. | |
# | |
# Datadog does not seem to be able to reliably use CIDR notation but | |
# if we know the start and end of each IP address range we can construct a single compound query. | |
# Here we retreive the latested published list of IP address ranges and filter that down to | |
# the short list of regions we care about. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Run this with different versions of Ruby and BigDecimal to see different results. | |
# | |
# https://ruby-doc.org/3.2.1/exts/bigdecimal/BigDecimal.html | |
# | |
require "bigdecimal/util" | |
result_float_math = ((111.87 - 99) * 2) | |
puts "= Ruby v#{RUBY_VERSION}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
require "benchmark" | |
# https://github.com/zverok/wheretz | |
require "json" # Should be required by wheretz but it isn't currently | |
require "wheretz" | |
# https://github.com/HarlemSquirrel/tzf-rb | |
require "tzf" |
NewerOlder