Skip to content

Instantly share code, notes, and snippets.

View sergeyklay's full-sized avatar

Serghei Iakovlev sergeyklay

View GitHub Profile
@sergeyklay
sergeyklay / journalctl-cheatsheet.md
Last active November 10, 2025 01:51
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
@sergeyklay
sergeyklay / sed-cheatsheet.md
Last active September 14, 2025 21:03
Sed Cheatsheet

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example

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,
@sergeyklay
sergeyklay / CMakeLists.txt
Last active December 30, 2024 16:37
CMakeLists.txt for PHP-extension. This CMake file is just for syntax highlighting in CLion.
cmake_minimum_required(VERSION 3.5)
project(extname
VERSION 1.0.0
LANGUAGES C)
message(STATUS "Begin cmaking of PHP extension ...")
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING
@sergeyklay
sergeyklay / phpenv-install.md
Last active November 10, 2024 14:36
Multiple PHP versions using phpenv and php-build

Multiple PHP versions using phpenv and php-build

Install dependecies

Debian/Ubuntu users

sudo apt install \
  autoconf \
  bison \