Skip to content

Instantly share code, notes, and snippets.

View dblock's full-sized avatar
🐝
Alexa, ask the future of America to be great again! (try it)

Daniel (dB.) Doubrovkine dblock

🐝
Alexa, ask the future of America to be great again! (try it)
View GitHub Profile
@dblock
dblock / expand_refs.py
Created July 16, 2024 19:07
Expabnd Refs
def expand_refs(element: Any, data: Any) -> Any:
"""
Recursively expand $ref's.
"""
if isinstance(element, dict):
if "$ref" in element:
common_schema_path_ref = element["$ref"].split("/")[-1]
schema = data["components"]["schemas"][common_schema_path_ref]
del element["$ref"]
@dblock
dblock / bench_sync.py
Last active July 24, 2023 23:30
Micro-benchmark for sync. vs. async Python
#!/usr/bin/env python
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
import asyncio
from threading import Thread
awscurl "$ENDPOINT/vectors" \
--request PUT \
--service $SERVICE \
--region $AWS_REGION \
--header "Content-Type: application/json; charset=utf-8" \
--data "\
{ \
\"settings\": { \
\"index.knn\": \"true\" \
}, \
@dblock
dblock / process-logstash-output.rb
Created June 30, 2023 23:02
Process logstash output.
require 'active_support'
if ARGV.length < 1
puts "usage: process [file]"
exit
end
class Request
attr_reader :conn
attr_reader :verb
@dblock
dblock / process-logstash-output.rb
Created June 30, 2023 23:02
Process logstash output.
require 'active_support'
if ARGV.length < 1
puts "usage: process [file]"
exit
end
class Request
attr_reader :conn
attr_reader :verb
require 'json'
require 'net/http'
require 'optparse'
require 'set'
require 'uri'
require 'octokit'
options = {}
OptionParser.new do |opt|
opt.on('-s', '--start BUILD_NUMBER', 'Require start') { |o| options[:start] = o }
@dblock
dblock / maintainers.txt
Last active December 1, 2022 13:49
Issues that need action in OpenSearch Project
$ ./bin/project -q maintainers missing
https://github.com/opensearch-project/dashboards-notebooks
https://github.com/opensearch-project/ux
I am attesting that this GitHub handle dblock is linked to the Tezos account tz1ivFsNqtfLTSDh7uzqJ6pArNRG13pkJt4a for tzprofiles
sig:edsigtshxfYo5JbUmy38XPrRPwJY98j3nd79WEkVdrhBLVPxMAGSsyR4ai41QTnbygucGMENiRw7axCrFFKk6Cy41zcydx1o9JE
/*
Create Element:
$Rainb.el('div',{'attribute':"value",style:{"color":"red"}},[ (childnodes) ])
becomes: <div attribute="value" style="color: red;"></div>
Append Element
$Rainb.add(element,elementToAppend)
Get Element By Id
$Rainb.id(id);
Create TextNode
$Rainb.tn(text);
@dblock
dblock / test.rb
Created August 13, 2018 23:33
Kramdown parser repro
require 'kramdown'
text = <<-MARKDOWN
# Example
The quick brown fox jumps over the lazy dog.
```ruby
# one