Skip to content

Instantly share code, notes, and snippets.

View oleg-andreyev's full-sized avatar
🎯
Focusing

Oleg Andreyev oleg-andreyev

🎯
Focusing
  • Riga, Latvia
View GitHub Profile
@oleg-andreyev
oleg-andreyev / DiskUsage.java
Last active December 22, 2019 17:36 — forked from imotov/DiskUsage.java
DiskUsage.java for 5.x
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@oleg-andreyev
oleg-andreyev / Improved Persistent Login Cookie Best Practice.md
Created January 10, 2019 20:44
Improved Persistent Login Cookie Best Practice
@oleg-andreyev
oleg-andreyev / remove-all-brew-packages.sh
Created April 14, 2019 13:24
Remove all brew packages
brew remove --force $(brew list) --ignore-dependencies
brew cleanup
@oleg-andreyev
oleg-andreyev / install-php-macos-mojave.sh
Created April 15, 2019 22:44
installing PHP7 on Mojave using phpenv + php-build + brew
# https://stackoverflow.com/a/52900711/1205171
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew install re2c [email protected] openssl libjpeg libpng icu4c mcrypt
export PATH="/usr/local/opt/[email protected]/bin:/usr/local/opt/openssl/bin:/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/icu4c/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/icu4c/include $CPPFLAGS"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
@oleg-andreyev
oleg-andreyev / nproc-alias.sh
Created April 15, 2019 22:45
nproc alias on macOS
alias nproc="sysctl -n hw.physicalcpu"
@oleg-andreyev
oleg-andreyev / gist:8d809dea15dcb7becdc3a45cff2c3841
Created June 22, 2019 21:33
macOS-php-732-bug-timelib_get_time_zone_info
curl -L https://raw.githubusercontent.com/phpenv/phpenv-installer/master/bin/phpenv-installer | bash
PHP_BUILD_EXTRA_MAKE_ARGUMENTS="-j$(nproc)" phpenv install 7.3.2
git clone https://github.com/oleg-andreyev/MinkSelenium2Driver -b fix-master-build
cd MinkSelenium2Driver
composer install
docker run -p 4444:4444 -v /dev/shm:/dev/shm --shm-size 2g selenium/standalone-firefox:2.53.1
php -dmemory_limit=3G -S localhost:8002 -t ./vendor/mink/driver-testsuite/web-fixtures
phpenv local 7.3.2
@oleg-andreyev
oleg-andreyev / install-php7.4-macos-mojave.sh
Last active March 11, 2020 18:06
install php 7.4snapshot on MacOS Majova using brew and phpenv
# Follow https://gist.github.com/oleg-andreyev/05fae22548ccdff8deebde144c4cbe7f
# nproc alias https://gist.github.com/oleg-andreyev/053b90ef33d2c29446ef466a2817d01c
# avoid brew cleanup
export HOMEBREW_NO_INSTALL_CLEANUP=1
# icu4c must be >= 64.0
brew install icu4c [email protected] krb5 oniguruma libedit
export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:/usr/local/opt/bison/bin:/usr/local/opt/krb5/bin:/usr/local/opt/krb5/sbin:/usr/local/opt/[email protected]/bin:$PATH"
# Follow https://gist.github.com/oleg-andreyev/05fae22548ccdff8deebde144c4cbe7f
# nproc alias https://gist.github.com/oleg-andreyev/053b90ef33d2c29446ef466a2817d01c
function is_osx {
local uname=$(uname)
if [ "$uname" = "Darwin" ]; then
return 0
else
return 1
@oleg-andreyev
oleg-andreyev / ref.yaml
Created January 9, 2020 22:26
APIP YAML reference
<FQCN>:
shortName: <string>
description: <string>
iri: <string>
itemOperations:
get:
method: GET
produces: ~
summary: ~
description: ~
@oleg-andreyev
oleg-andreyev / vif.php
Created February 22, 2020 19:25
Vincenty inverse formula for ellipsoids
/**
* Calculates the geodesic distance between two points specified by radian latitude/longitude using
* Vincenty inverse formula for ellipsoids (vif)
*/
function vif($lng1, $lat1, $lng2, $lat2)
{
$lng1 = deg2rad($lng1);
$lat1 = deg2rad($lat1);
$lng2 = deg2rad($lng2);
$lat2 = deg2rad($lat2);