Skip to content

Instantly share code, notes, and snippets.

View sergeyklay's full-sized avatar
🇺🇦

Serghei Iakovlev sergeyklay

🇺🇦
View GitHub Profile
@sergeyklay
sergeyklay / get-the-weather-data-for-my-city.el
Last active April 2, 2019 10:14
get the weather data for my city
(require 'json)
(defvar owm/base-api-url "api.openweathermap.org")
(defvar owm/base-api-ver 2.5)
(defvar owm/api-key "PUT_API_KEY_HERE")
(defvar owm/default-scheme "https")
(defun owm/build-url (appid lat lon lang units)
(let* ((local (format "data/%s/weather" owm/base-api-ver))
@sergeyklay
sergeyklay / .dir-local.el
Last active March 29, 2020 16:21
.dir-local.el for PHP-extension
;;; Directory Local Variables
;; For more information see (info "(emacs) Directory Variables")
((nil . ((indent-tabs-mode . t)
(fill-column . 80)))
(c-mode . ((c-file-style . "k&r")
(tab-width . 4)
(c-basic-offset . 4)
(flycheck-checker . c/c++-gcc)
(flycheck-disabled-checkers c/c++-clang)
@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 / 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 / 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 / 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 / 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 / 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

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 / 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"