Skip to content

Instantly share code, notes, and snippets.

LangChain Router + Branch — как это работает (Mermaid)


Полный pipeline (Mermaid)

flowchart LR
    A["User Input: How many users in Neo4j?"] --> B["routerPrompt (ChatPromptTemplate)"]
    B --> C["ChatOpenAI (gpt-4o-mini)"]
@ro31337
ro31337 / howto.md
Created December 13, 2025 21:35
iTerm2 MacOS option-left option-right

Run this:

mkdir -p ~/iterm2

cat > ~/iterm2/emacs-navigation.itermkeymap <<'EOF'
{
  "Key Mappings": {
    "0xf702-0x300000-0x7b": { "Label": "Cursor Start ⌘←", "Action": 11, "Text": "0x01" },
 "0xf703-0x300000-0x7c": { "Label": "Cursor End ⌘→", "Action": 11, "Text": "0x05" },
@ro31337
ro31337 / docker_completion_for_zsh.md
Created August 13, 2017 02:12
Zsh docker completion

Docker Completion for Zsh (Official)

  • mkdir -p ~/.oh-my-zsh/plugins/docker/
  • curl -fLo ~/.oh-my-zsh/plugins/docker/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
  • Add docker to plugins section in ~/.zshrc
  • exec zsh
Write-Host "Installing MinGW..." -ForegroundColor Cyan
$mingwPath = "C:\MinGW"
if(Test-Path $mingwPath) {
Write-Host "Removing existing MinGW installation..."
Remove-Item $mingwPath -Recurse -Force
}
# download installer
@ro31337
ro31337 / app3.rb
Created June 20, 2022 01:58
Slot machine app
require 'hidapi'
@coin_acceptor = HIDAPI::open(0x0079, 0x0006)
@coin_dispenser = HIDAPI::open(0x14d4, 0x0000)
# Ожидание монеты
def wait_for_coin
loop do
packet = @coin_acceptor.read
confidence = packet[2].unpack('H*')[0][0].to_i
@ro31337
ro31337 / gist:fde256c19074356e4f847a48f696658c
Last active October 15, 2023 16:59
Bulma font-awesome icons for Rails 6

Единственная запара возникла при подключении иконок к рельс6, решается так (app/javascript/packs/fa.scss)

@import "bulma/bulma";

$fa-font-path: '~@fortawesome/fontawesome-free/webfonts';
@import '~@fortawesome/fontawesome-free/scss/fontawesome';
@import '~@fortawesome/fontawesome-free/scss/solid'; // fas prefix
@import '~@fortawesome/fontawesome-free/scss/brands'; // fab prefix
// see https://fontawesome.com/how-to-use/with-the-api/setup/importing-icons for more prefixes
@ro31337
ro31337 / rabbitmq.md
Last active April 12, 2023 08:51
Easiest RabbitMQ setup

Install RabbitMQ:

docker run -d --hostname my-rabbit --name blabla-rabbit -p 5672:5672 -p 8080:15672 rabbitmq:3-management

RabbitMQ works based on hostname:

One of the important things to note about RabbitMQ is that it stores data based on what it calls the "Node Name", which defaults to the hostname

@ro31337
ro31337 / gist:237f982080a859ef9a44
Last active October 31, 2022 18:04
Install ssl certificates for winfows (to avoid error on Windows OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed). Make sure you added SSL_CERT_FILE environment variable!
require 'net/http'
ruby_install_dir = 'c:\Ruby200-x64'
cacert_file = "#{ruby_install_dir}\\cacert.pem"
Net::HTTP.start("curl.haxx.se") do |http|
resp = http.get("/ca/cacert.pem")
if resp.code == "200"
open(cacert_file, "wb") { |file| file.write(resp.body) }
puts "\n\nA bundle of certificate authorities has been installed to"
@ro31337
ro31337 / mysong.txt
Created May 23, 2022 19:50
Here is my song and chords
# I’ve got a cat blues (Roman Pushkin)
# Questions? roman.pushkin@gmail.com
Intro: (**Bm G Bm G) x 2**
**Bm G**
I’ve got a cat... I found him on empty street
alias gcm='git checkout master'
alias gcb='git checkout -b '
alias gs='git status'
alias gal='git add --all .'
alias gdd='git diff HEAD'
alias cm='git commit -m'
alias gc='git checkout'
alias gup='git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`'
alias far='far2l > /dev/null&!'