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
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 / 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
@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
@dblock
dblock / clickhacking.html
Created September 22, 2014 01:30
Clickjacking test.
<html>
<head>
<title>Clickjacking Test</title>
</head>
<body>
<p>If you can see the website below, it's vulnerable to clickjacking.</p>
<iframe src="https://artsy.net/" width="500" height="500"></iframe>
</body>
</html>
I am attesting that this GitHub handle dblock is linked to the Tezos account tz1ivFsNqtfLTSDh7uzqJ6pArNRG13pkJt4a for tzprofiles
sig:edsigtshxfYo5JbUmy38XPrRPwJY98j3nd79WEkVdrhBLVPxMAGSsyR4ai41QTnbygucGMENiRw7axCrFFKk6Cy41zcydx1o9JE
@dblock
dblock / carrierwave.rb
Created January 31, 2012 13:55
Delayed image processing with CarrierWave
CarrierWave.configure do |config|
...
end
Mongoid::Document::ClassMethods.send(:include, DelayedImageProcessing)
module CarrierWave
# http://sleeplesscoding.blogspot.com/2011/09/recreate-single-version-of.html
# Note: is_processing_delayed should be set before calling recreate_version! if the version depends on it.
@dblock
dblock / getWeek.js
Created July 13, 2011 22:49
get week of the year in JavaScript
function( d ) {
// Create a copy of this date object
var target = new Date(d.valueOf());
// ISO week date weeks start on monday
// so correct the day number
var dayNr = (d.getDay() + 6) % 7;
// Set the target to the thursday of this week so the