Skip to content

Instantly share code, notes, and snippets.

Serghei Iakovlev sergeyklay

Block or report user

Report or block sergeyklay

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sergeyklay
sergeyklay / CMakeLists.txt
Last active Aug 11, 2019
CMakeLists.txt for PHP-extension
View CMakeLists.txt
cmake_minimum_required(VERSION 3.6)
project(extname C)
message("Begin cmaking of PHP extension ...")
# -std=gnu99
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb -O0 -Wall -std=gnu99 -fvisibility=hidden")
set(ENV{PROJECT_ROOT} "${CMAKE_HOME_DIRECTORY}")
@sergeyklay
sergeyklay / phpenv-install.md
Last active Aug 10, 2019
Multiple PHP versions using phpenv and php-build
View phpenv-install.md

Multiple PHP versions using phpenv and php-build

Setting up environment variables

Create $HOME/.php_build_configure_opts file with the following contents:

--enable-debug --with-gettext --disable-fpm
View bash.generate.random.alphanumeric.string.sh
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
View sed-cheatsheet.md

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@sergeyklay
sergeyklay / journalctl-cheatsheet.md
Last active Jul 18, 2019
Journalctl Cheat Sheet
View journalctl-cheatsheet.md

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 / template.service
Created Jul 14, 2019 — forked from chrj/template.service
Sample service unit file for systemd
View template.service
[Unit]
Description=My service
[Service]
ExecStart=/usr/local/bin/my-service \
-argument value \
-otherargument othervalue
# Setuid/Setgid
User=nobody
@sergeyklay
sergeyklay / gpg-import-and-export-instructions.md
Last active Jul 14, 2019 — forked from chrisroos/gpg-import-and-export-instructions.md
Instructions for exporting/importing (backup/restore) GPG keys
View gpg-import-and-export-instructions.md

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.

Method 1

Backup the public and secret keyrings and trust database

cp ~/.gnupg/pubring.gpg /path/to/backups/
cp ~/.gnupg/secring.gpg /path/to/backups/
@sergeyklay
sergeyklay / version-compare.clj
Created Jun 22, 2019
Simple version compare using clojure
View version-compare.clj
(defn- normalize-verison
[version]
(let [[x y z] (map read-string (clojure.string/split version #"\."))
z (or z 0)]
(+ (* x 10000) (* y 100) z)))
(defn version-compare
[a b]
(let [left (normalize-verison a)
right (normalize-verison b)]
@sergeyklay
sergeyklay / telnet-imap
Last active May 30, 2019
Playing with Gmail via Telnet
View telnet-imap
$ telnet-ssl -z ssl imap.gmail.com 993
Trying 173.194.222.109...
Connected to gmail-imap.l.google.com.
Escape character is '^]'.
* OK Gimap ready for requests from 193.201.216.169 z8mb75199760ljk
a1 LOGIN xxxxxxxx@gmail.com my-password-here
* CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH UTF8=ACCEPT LIST-EXTENDED LIST-STATUS LITERAL- SPECIAL-USE APPENDLIMIT=35651584
a1 OK xxxxxxxx@gmail.com authenticated (Success)
a2 LIST "" "*"
* LIST (\HasNoChildren) "/" "INBOX"
View discord-badge.md
[![Discord Server](https://img.shields.io/badge/Discord-blue.svg?logo=discord)](https://phalcon.link/discord)

Discord Server

You can’t perform that action at this time.