Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Artem Ostretsov ostretsov

🏠
Working from home
Block or report user

Report or block ostretsov

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
@ostretsov
ostretsov / token_test.go
Created Feb 1, 2020
Compare perfect hash function performance with `IsKeyword()` method
View token_test.go
package main
import (
"go/token"
"testing"
)
func BenchmarkIsKeyword(b *testing.B) {
for n := 0; n < b.N; n++ {
for i := token.BREAK; i < token.VAR; i++ {
@ostretsov
ostretsov / eco_map_ru.md
Last active Jan 15, 2019
Карта экологически опасных территорий РФ
View eco_map_ru.md

Карту составляю исключительно для себя. Карта не претендует на точность данных: составлена грубо.

Сама карта с нанесением экологически опасных территорий РФ: https://drive.google.com/open?id=1O_F4tiXFL5-2gQUIlq1KXLRzKqQfyU5R&usp=sharing

Источники:

View EventRequestProjectionFactory.php
<?php
final class EventRequestProjectionFactory
{
/**
* @var EventRepository
*/
private $eventRepository;
/**
@ostretsov
ostretsov / Dockerfile
Last active Feb 28, 2018
TeX to PDF async server (aerys, amphp)
View Dockerfile
FROM php:7.2.2-cli-stretch
# tex
RUN apt-get update && apt-get install -y texlive-full\
biber\
tar\
libarchive-tools
# composer
RUN curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/bin
View ImageUtil.php
class ImageUtil
{
/**
* @see https://github.com/recurser/exif-orientation-examples for test samples
*
* @param string $absoluteFilePath
* @return bool
*/
public static function fixOrientation(string $absoluteFilePath): bool
{
View initials.json
[
{
"prepared_children": [
{
"id": 974,
"title": "Московская область"
},
{
"id": 985,
"title": "Красноярский край"
@ostretsov
ostretsov / prototype.md
Last active Sep 28, 2017
Prototype design pattern explanation (russian)
View prototype.md

Насколько clone быстрее new в случае простых объектов?

Клонирование (clone) в треть (30-35%) производительнее создания нового объекта (new), если операций создания более нескольких тысяч. Иначе разница не существенна.

View run-as-user
#!/bin/sh
##############################################################################
# If a PUID/PGID enviroment variable exists, use those values for the `uid`
# and `gid` when executing scripts, otherwise change the dev user's uid and
# gid to match the user that owns the project directory and run a command as
# that user. If a ~/.ssh directory exists and it's not owned by root then
# switch and run as that user instead in order to take advantage of public key
# authentication.
##############################################################################
View run-as-user
#!/bin/sh
##############################################################################
# If a PUID/PGID enviroment variable exists, use those values for the `uid`
# and `gid` when executing scripts, otherwise change the dev user's uid and
# gid to match the user that owns the project directory and run a command as
# that user. If a ~/.ssh directory exists and it's not owned by root then
# switch and run as that user instead in order to take advantage of public key
# authentication.
##############################################################################
View run-as-user.sh
#!/bin/sh
##############################################################################
# If a PUID/PGID enviroment variable exists, use those values for the `uid`
# and `gid` when executing scripts, otherwise change the dev user's uid and
# gid to match the user that owns the project directory and run a command as
# that user. If a ~/.ssh directory exists and it's not owned by root then
# switch and run as that user instead in order to take advantage of public key
# authentication.
##############################################################################
You can’t perform that action at this time.