Skip to content

Instantly share code, notes, and snippets.

View sergeyklay's full-sized avatar
🇺🇦

Serghei Iakovlev sergeyklay

🇺🇦
View GitHub Profile
@sergeyklay
sergeyklay / CMakeLists.txt
Last active April 6, 2024 18:52
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 / journalctl-cheatsheet.md
Last active March 20, 2024 21:45
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 / phpenv-install.md
Last active March 3, 2024 10:45
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 \
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 July 8, 2023 01:44
Sed Cheatsheet

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@sergeyklay
sergeyklay / gpg-import-and-export-instructions.md
Last active August 30, 2022 23:15 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys

GPG: Import and export instructions

Every so often I have to restore my gpg keys and I'm never sure how best to do it. So, I've spent some time playing around with the various ways to export/import (backup/restore) keys.

Export keys and ownertrust

gpg --export --armor 1E0B5331219BEA88 > 1E0B5331219BEA88.pub.asc
gpg --export-secret-keys --armor 1E0B5331219BEA88 > 1E0B5331219BEA88.priv.asc
gpg --export-secret-subkeys --armor 1E0B5331219BEA88 > 1E0B5331219BEA88.sub_priv.asc

gpg --export-ownertrust > ownertrust.txt

@sergeyklay
sergeyklay / hpd.md
Last active July 15, 2021 08:36
Happy PHP Debugging

Happy PHP Debugging

Usage

gdb --args /usr/bin/php script.php
(gdb) source ~/src/php/7.2.1/.gdbinit
@sergeyklay
sergeyklay / no-omit-frame-pointer.md
Last active July 6, 2021 10:57
GCC/Clang -fno-omit-frame-pointer and -fsanitize=address

Description

Frame pointer omission does make debugging significantly harder. Local variables are harder to locate and stack traces are much harder to reconstruct without a frame pointer to help out. Also, accessing parameters can get more expensive since they are far away from the top of the stack and may require more expensive addressing modes.

The -fno-omit-frame-pointer option direct the compiler to generate code that maintains and uses stack frame pointer for all functions so that a debugger can still produce a stack backtrace even with optimizations flags.

Irrespective if you use the flag, not every function needs a frame pointer in the first place, so you can't always expect a difference with the flag.

Also, whether the function has a frame pointer is an implementation detail. Compilers can differ in implementation details (and usually they do).

@sergeyklay
sergeyklay / pyenv-install.md
Last active July 4, 2021 13:04
Multiple Python versions using pyenv and python-build

Multiple Python versions using pyenv and python-build

Installation

Install pyenv

git clone git@github.com:pyenv/pyenv.git ~/.pyenv
cd ~/.pyenv && src/configure && make -C src

My Personal WeeChat Cheat Sheet

Requirements

You need at least WeeChat 3.2-dev

Install

Ubuntu/Debian