This file contains 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
""" | |
Parses JSON response from https://www.youtube.com/youtubei/v1/get_transcript | |
and converts to Markdown document | |
""" | |
import json | |
import sys | |
def get_segments(data): | |
return data['actions'][0]['updateEngagementPanelAction']['content']['transcriptRenderer']['content']['transcriptSearchPanelRenderer']['body']['transcriptSegmentListRenderer']['initialSegments'] |
This file contains 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: | |
# crystal src/main.cr \ | |
# -redis-url='redis://localhost:6379' \ | |
# -namespace=sidekiq \ | |
# -queue-name=foo \ | |
# -class-name=Foo::BarProcessor \ | |
# -arg1=123 \ | |
# > filtered_jobs.jsonl | |
require "json" |
This file contains 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
def raw_object | |
self[:raw_object] | |
rescue ArgumentError => e | |
raw = raw_object_before_type_cast | |
raw.gsub!(%r{!ruby/object:MyNamespace::Fixme}, '!ruby/object:MyNamespace::Corrected') | |
Psych.load(raw, symbolize_names: true) | |
end |
This file contains 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
# FILE: config/initializers/fix_yaml_column.rb | |
# serializes the columns that break because of memoized cache | |
# | |
# alternatively, we could have just removed the string for the memoized cache, but that sounded too dangerous | |
# hard-require to load the class | |
require 'active_record/coders/yaml_column' | |
class ActiveRecord::Coders::YAMLColumn |
This file contains 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
Signal.trap("INT") { throw :exit_loop } | |
def aaa | |
catch :exit_loop do | |
loop do | |
puts 'foo' | |
p Benchmark.realtime { sleep 1 } | |
puts 'bar' | |
end | |
end | |
Signal.trap('INT', 'DEFAULT') |
This file contains 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
Rails.application.routes.draw do | |
get '/health', to: proc { [200, {}, ['ok']] }, as: :app_health_check | |
get '/dd', to: proc { | |
port_is_open = Socket.tcp('localhost', 8126, connect_timeout: 5) { true } rescue false | |
res = "Datadog port is open: #{port_is_open}" | |
[200, {}, [res]] | |
}, as: :dd_health_check | |
end |
This file contains 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
""" | |
This demo program outputs raw SQL query by analyzing table, which is run by agent executer, via SQL adapter. | |
""" | |
import os | |
import sqlite3 | |
from langchain.agents import * | |
from langchain.sql_database import SQLDatabase | |
from langchain.chains import create_sql_query_chain | |
from langchain_community.llms import OpenAI |
This file contains 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
Я: | |
расскажи про проблемы языков программирования C, C++, C# в стиле хайку | |
ИИ: | |
Конечно, в стиле хайку: | |
C и C++: Память - дикая, Утечки, ошибки, страх. Указатели власть. | |
C#: Графика, сети, Управляй, безопасность. .NET, удобство. | |
This file contains 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
version: "3" | |
services: | |
opensearch: | |
image: opensearchproject/opensearch:${OPENSEARCH_VERSION} | |
restart: "${OPENSEARCH_RESTART:-unless-stopped}" | |
environment: | |
- cluster.name=opensearch-cluster | |
- node.name=opensearch-node1 | |
- discovery.type=single-node |
This file contains 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
# using ripgrep on macos | |
for f in $(rg --files-with-matches -F '2.7.6/'); do sed -i '' 's/\/2\.7\.6\//\/2\.7\.7\//' $f; done |
NewerOlder