Skip to content

Instantly share code, notes, and snippets.

View yamnikov-oleg's full-sized avatar

Oleg Yamnikov yamnikov-oleg

  • Self-employed
  • Orenburg, Russia
View GitHub Profile
@yamnikov-oleg
yamnikov-oleg / formulas.py
Last active July 24, 2023 09:31
An example implementation of a formula evaluator written on top of Python's AST package. See https://blog.oyam.dev/python-formulas/
"""
An example implementation of a formula evaluator written on top of Python's AST package.
See https://blog.oyam.dev/python-formulas/
Usage:
>>> evaluate_formula("a + b", {"a": 1, "b": 2})
3
"""
@yamnikov-oleg
yamnikov-oleg / Program.cs
Last active March 12, 2018 11:42
Пример получения списка сертификатов КриптоПро CSP
var hStore = Libcapi.CertOpenSystemStoreA(IntPtr.Zero, "MY");
Console.WriteLine("hStore = {0}", hStore);
Console.WriteLine("GetLastError: {0}", Librdrsup.GetLastError());
var pCtx = Libcapi.CertEnumCertificatesInStore(hStore, IntPtr.Zero);
while (pCtx.ToInt32() != 0)
{
var ctx = Marshal.PtrToStructure<Libcapi.CertContext>(pCtx);
var info = Marshal.PtrToStructure<Libcapi.CertInfo>(ctx.pCertInfo);
@yamnikov-oleg
yamnikov-oleg / LICENSE
Last active May 9, 2024 04:56
Shared (interprocess) mutexes on Linux
MIT License
Copyright (c) 2018 Oleg Yamnikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@yamnikov-oleg
yamnikov-oleg / calling_conventions.md
Created February 20, 2016 09:19
Linux Syscalls Reference

Source: man syscall

Architecture calling conventions

Every architecture has its own way of invoking and passing arguments to the kernel. The details for various architectures are listed in the two tables below.

The first table lists the instruction used to transition to kernel mode, (which might not be the fastest or best way to transition to