Skip to content

Instantly share code, notes, and snippets.

View Jeckerson's full-sized avatar
Today I work hard to get a dinner!

Anton Vasiliev Jeckerson

Today I work hard to get a dinner!
View GitHub Profile
git config --global core.eol lf
git config --global core.autocrlf input
# In case cache
git rm -rf --cached .
git reset --hard HEAD
find . -type f -exec rename 's/\.zep//' '{}' \;
@Jeckerson
Jeckerson / FilesProvider.php
Created April 29, 2021 11:03
FilesProvider
<?php
declare(strict_types=1);
namespace App\Providers;
use Aws\S3\S3Client;
use League\Flysystem\AwsS3V3\AwsS3V3Adapter;
use League\Flysystem\AwsS3V3\PortableVisibilityConverter;
use League\Flysystem\FilesystemAdapter;
@Jeckerson
Jeckerson / phalcon.dockerfile
Created March 18, 2021 09:30
FrameworkBenchmarks dockerfile for Phalcon with PHP8
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
RUN apt-get update -yqq > /dev/null && \
apt-get install -yqq nginx git unzip curl \
php8.0-cli php8.0-fpm php8.0-mysql php8.0-mbstring wget > /dev/null
# Makefile flags
MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
export MAKEFLAGS
# Run makefiles with Max CPU parallelism
# see: export MAKEFLAGS
if [[ -n "$(command -v gmake 2>/dev/null || true)" ]]; then
alias make='gmake'
fi
@Jeckerson
Jeckerson / C
Last active January 21, 2021 23:02
static void zephir_get_class_ns(zval *result, zval *object, int lower)
{
int found = 0;
unsigned int i, class_length;
char *cursor, *class_name;
zval *z = Z_ISREF_P(object) ? Z_REFVAL_P(object) : object;
if (Z_TYPE_P(z) != IS_OBJECT) {
if (Z_TYPE_P(z) != IS_STRING) {
ZVAL_NULL(result);
@Jeckerson
Jeckerson / model-paginator-object.php
Last active May 5, 2021 09:10
Model Paginator with object instead array
<?php
declare(strict_types=1);
/**
* Change this namespace to your and put this file whenever you want,
* according to your project structure. This is just example name.
*/
namespace App\Phalcon\Paginator\Adapter;
@Jeckerson
Jeckerson / gist:616769b800f0c3b54bc105c8d5a8120a
Created October 4, 2020 18:26
Upgrade MySQL 5.5 to 5.7 on CentOS 6
# Make sure yum is up-to-date
yum update yum
# Install yum-utils (it provides yum-config-manager)
yum install yum-utils
# Backup: dump all databases to all_dbs.sql
mysqldump --lock-all-tables --all-databases -uroot -ped8a5f47cbf39f0b5eda6715c85c0ae0 >/root/all_dbs.sql
# Stop MySQL daemon
@Jeckerson
Jeckerson / README.md
Last active August 6, 2020 19:29
Benchmark function usage inside for loop

Results

Run # Benchmark 1 (sec) BenchMark 2 (sec)
1 0.2886860370636 0.16710495948792
2 0.31771802902222 0.16766691207886
3 0.27882695198059 0.17383599281311
4 0.2907509803772 0.17733597755432
5 0.28123903274536 0.17464399337769