Skip to content

Instantly share code, notes, and snippets.

View akrisanov's full-sized avatar

Andrey Krisanov akrisanov

View GitHub Profile
@akrisanov
akrisanov / Gemfile
Created November 20, 2020 22:59 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@akrisanov
akrisanov / decimal_places.py
Last active November 5, 2020 05:49
hyperskill.org – Python
# Round the number from input to the required number of decimals.
#
# The input format:
# Two lines: the first with a floating-point number, the second with an integer representing the decimal count.
#
# The output format:
# A formatted string containing the rounded number.
number = float(input())
precision = int(input())
@akrisanov
akrisanov / Dockerfile
Created September 29, 2020 21:23
Dockerize Go App
FROM golang:1.13.6-stretch AS builder
RUN apt-get update && apt-get install git ca-certificates && update-ca-certificates
ENV GO111MODULE=on\
CGO_ENABLED=0
WORKDIR /build
# Cache go modules – they don't change much often
@akrisanov
akrisanov / pgex.md
Last active April 7, 2022 20:43
Postgres Intro Exercises

Postgres Intro Exercises

Простые запросы

Задача #1

Кто летел позавчера рейсом Москва (SVO) — Новосибирск (OVB) на месте 1A, и когда он забронировал свой билет?

select t.passenger_name,

pprof

$ go test -bench=. -benchmem -cpuprofile=cpu.out -memprofile=mem.out -x .

$ go tool pprof 13_pprof_console.test cpu.out

$ go tool pprof 13_pprof_console.test mem.out
@akrisanov
akrisanov / cURL.md
Created August 22, 2020 13:41
cURL Cheatsheet
$ curl -I --http2 --insecure https://localhost:8080/
@akrisanov
akrisanov / formatting.md
Last active August 16, 2020 17:20
Go: Formatting

Основные флаги форматирования в Go

Общие

  • %v – представление по умолчанию для типа
  • %#v – вывести как Go код (удобно для структур)
  • %T – вывести тип переменной
  • %% - вывести символ %

Целые

@akrisanov
akrisanov / conftest1.py
Created May 4, 2020 18:19
Pytest Fixtures
import pytest
# Environment Variables
@pytest.fixture(autouse=True)
def env_setup(monkeypatch):
monkeypatch.setenv('MY_SETTING', 'some-value')