Skip to content

Instantly share code, notes, and snippets.

☕️
Coding

Serghei Iakovlev sergeyklay

☕️
Coding
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 / get_phalcon_events.sh
Last active Apr 8, 2017
Phalcon : Get list of all events from source
View get_phalcon_events.sh
$ 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 Apr 8, 2017
Phalcon IDE stubs: Convert zep to php
View zep_to_php.sh
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 Jan 26, 2016 — forked from richieforeman/makeauthority.sh
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
View makeauthority.sh
# 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 Aug 10, 2018
Install Nginx with Nchan
View install.sh
#!/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"
View bash-tips.md

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     |
View sed-cheatsheet.md

Sed Cheat Sheet

Sed command line options

sed [options] sed-command [input-file]
Option Description Example
@sergeyklay
sergeyklay / CMakeLists.txt
Last active Mar 25, 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 Jun 16, 2019
phpenv/php-build stuff
View phpenv-install.md

phpenv tips

Setting up environment variables

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

--enable-debug --with-gettext --disable-fpm
@sergeyklay
sergeyklay / nginx.conf
Created Dec 2, 2017 — 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/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@sergeyklay
sergeyklay / whiteboardCleaner.md
Created Dec 21, 2017 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!
View whiteboardCleaner.md

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

You can’t perform that action at this time.