Skip to content

Instantly share code, notes, and snippets.

View rgordeev's full-sized avatar

Roman Gordeev rgordeev

View GitHub Profile
@rgordeev
rgordeev / postgres_queries_and_commands.sql
Created March 31, 2020 22:23 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
CT64QX32MJ-eyJsaWNlbnNlSWQiOiJDVDY0UVgzMk1KIiwibGljZW5zZWVOYW1lIjoiVHZlciBUZWNobmljYWwgU3RhdGUgVW5pdmVyc2l0eSIsImFzc2lnbmVlTmFtZSI6IlJvbWFuIEdvcmRlZXYiLCJhc3NpZ25lZUVtYWlsIjoicm9tYS5nb3JkZWV2QGdtYWlsLmNvbSIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMjAtMDUtMDUifSx7ImNvZGUiOiJBQyIsInBhaWRVcFRvIjoiMjAyMC0wNS0wNSJ9LHsiY29kZSI6IkRQTiIsInBhaWRVcFRvIjoiMjAyMC0wNS0wNSJ9LHsiY29kZSI6IlBTIiwicGFpZFVwVG8iOiIyMDIwLTA1LTA1In0seyJjb2RlIjoiR08iLCJwYWlkVXBUbyI6IjIwMjAtMDUtMDUifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAyMC0wNS0wNSJ9LHsiY29kZSI6IkNMIiwicGFpZFVwVG8iOiIyMDIwLTA1LTA1In0seyJjb2RlIjoiUlMwIiwicGFpZFVwVG8iOiIyMDIwLTA1LTA1In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMjAtMDUtMDUifSx7ImNvZGUiOiJSRCIsInBhaWRVcFRvIjoiMjAyMC0wNS0wNSJ9LHsiY29kZSI6IlBDIiwicGFpZFVwVG8iOiIyMDIwLTA1LTA1In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMjAtMDUtMDUifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAyMC0wNS0wNSJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDIwL
@rgordeev
rgordeev / test.md
Last active October 23, 2019 06:49
Тестовое задание

ТЗ на записную книжку

Phonebook - записная книжка

Действия:

  • Добавить персону.
  • Удалить персону.
  • Найти персону по любому из атрибутов (атрибуты персоны: ФИО, дата рождения; полнотекстовый поиск).
  • Создать контакт у персоны необходимого типа: e-mail, телефон, адрес, skype.
  • Поиск персоны по контактным данным.
@rgordeev
rgordeev / App.java
Created March 27, 2019 09:16 — forked from thomasdarimont/App.java
Spring Boot JPA example with custom Table based Identifier generation with PostgreSQL
package demo;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.springframework.boot.SpringApplication;
@rgordeev
rgordeev / combining-git-repositories.md
Created March 14, 2019 18:02 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

[
{
"Execution Time": 479344.31,
"Planning Time": 2.009,
"Plan": {
"Partial Mode": "Finalize",
"Temp Written Blocks": 16114,
"Node Type": "Aggregate",
"Strategy": "Sorted",
"Actual Total Time": 478954.944,
@rgordeev
rgordeev / logging.properties
Created January 22, 2019 13:55
Tomcat logging rotation
# 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
#
# Unless required by applicable law or agreed to in writing, software
@rgordeev
rgordeev / nginx.conf
Created January 21, 2019 11:00 — forked from atma/nginx.conf
Nginx + nodejs + socket.io websockets
# Add to nginx.conf http section
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
@rgordeev
rgordeev / nginx.conf
Created January 21, 2019 10:47
Configure Nginx to handle WSS connections
# First configure reverse proxy before server,
# that will transfer WSS inbound traffic to unsecure local server, namely:
server {
# This is your reqular configuration for SSL connections to website
# Set port to listen ssl connections
listen 443 ssl;
# Set hosts names to handle
server_name example.com www.example.com
# Set sertificate configuration
@rgordeev
rgordeev / dev1.md
Last active January 3, 2018 17:31
Postgresql DEV1

Темы

Базовый инструментарий

  1. Установка и управление, psql

Архитектура

  1. Общее устройство PostgreSQL
  2. Изоляция и многоверсионность
  3. Буферный кэш и журнал

Организация данных

  1. Логическая структура
  2. Физическая структура