Skip to content

Instantly share code, notes, and snippets.

View sergeyklay's full-sized avatar
🇺🇦

Serghei Iakovlev sergeyklay

🇺🇦
View GitHub Profile
@sergeyklay
sergeyklay / get_phalcon_events.sh
Last active September 15, 2020 12:26
Phalcon : Get list of all events from source
$ pwd
/home/klay/projects/c/cphalcon
$ git branch
2.0.0
* 2.0.x
master
$ php --ri phalcon | grep 'Version =>'
@sergeyklay
sergeyklay / zep_to_php.sh
Last active April 8, 2017 20:53
Phalcon IDE stubs: Convert zep to php
find . -type f -name "*.zep.php" | sed -e 'p' -E -e "s/.zep.php/.php/g" | xargs -n2 mv
@sergeyklay
sergeyklay / makeauthority.sh
Last active January 26, 2016 13:47 — forked from richieforeman/makeauthority.sh
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@sergeyklay
sergeyklay / install.sh
Last active October 18, 2020 11:03
Install Nginx with Nchan
#!/usr/bin/env bash
# Works fine on Ubuntu 14.0.4 LTS
NGINX_VERSION="1.9.9"
NCHAN_VERSION="0.97"
HEADERS_MORE_VERSION="0.29"
DEV_KIT_VERSION="0.2.19"
ECHO_VERSION="0.58"
FANCY_INDEX_VERSION="0.3.5"

Here's how to test whether a parameter is unset, or empty ("Null") or set with a value:

+--------------------+----------------------+-----------------+-----------------+
|                    |       parameter      |     parameter   |    parameter    |
|                    |   Set and Not Null   |   Set But Null  |      Unset      |
+--------------------+----------------------+-----------------+-----------------+
| ${parameter:-word} | substitute parameter | substitute word | substitute word |
| ${parameter-word}  | substitute parameter | substitute null | substitute word |
| ${parameter:=word} | substitute parameter | assign word     | assign word     |
| ${parameter=word}  | substitute parameter | substitute null | assign word     |
@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 / 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 / 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 \
@sergeyklay
sergeyklay / nginx.conf
Created December 2, 2017 00:45 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@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