Skip to content

Instantly share code, notes, and snippets.

View sergeyklay's full-sized avatar

Serghei Iakovlev sergeyklay

View GitHub Profile
package main
import (
"fmt"
"golang.org/x/net/context"
cc "golang.org/x/oauth2/clientcredentials"
"io/ioutil"
"net/http"
"os"
)
@sergeyklay
sergeyklay / sed-cheatsheet.md
Last active August 23, 2026 00:14
Sed Cheatsheet

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@sergeyklay
sergeyklay / journalctl-cheatsheet.md
Last active August 6, 2026 05:16
Journalctl Cheat Sheet

Journalctl Cheat Sheet

Configuration

Permissions

To see messages from other users and the system as well as performing various log operations from a regular user add it to the group:

sudo usermod -aG systemd-journal $USER

My Personal WeeChat Cheat Sheet

Requirements

You need at least WeeChat 3.2-dev

Install

Ubuntu/Debian

{
"mcpServers": {
"knowledgebase_db": {
"type": "stdio",
"command": "uv",
"args": [
"run",
"python",
"./.cursor/postgres.py",
"--db",
@sergeyklay
sergeyklay / hpd.md
Last active June 12, 2025 14:50
Happy PHP Debugging

Happy PHP Debugging

Usage

gdb --args /usr/bin/php script.php
(gdb) source ~/src/php/7.2.1/.gdbinit
@sergeyklay
sergeyklay / langchain_utils.py
Created June 2, 2025 16:04 — forked from o-nix/langchain_utils.py
LangChain/LangGraph `@tool` support for class-level methods
import functools
import inspect
from typing import Callable, Literal, Optional
from langchain_core.tools import BaseTool, StructuredTool
from langchain_core.tools.base import ArgsSchema
def class_bound_tool(
*args,
@sergeyklay
sergeyklay / simple-rag-example.py
Last active January 23, 2025 19:50
A Retrieval-Augmented Generation (RAG) proof-of-concept that uses Dense Passage Retrieval (DPR) and GPT-2 to answer questions from a document.
import sys
from typing import List, Optional, Tuple
import faiss
import numpy as np
import torch
from transformers import (
AutoModelForCausalLM,
AutoTokenizer,
DPRContextEncoder,
#!/usr/bin/env bash
# Copyright (C) 2025 Serghei Iakovlev <gnu@serghei.pl>
#
# This file is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This file is distributed in the hope that it will be useful,