Skip to content

Instantly share code, notes, and snippets.

ALLOWED_HOSTS = ['*']
AUTH_PASSWORD_VALIDATORS = [{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'}, {'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'}, {'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'}, {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'}]
BASE_DIR = PosixPath('/app') ###
CONCURRENCY_AUTO_CREATE_TRIGGERS = True ###
CONCURRENCY_CALLBACK = 'concurrency.views.callback' ###
CONCURRENCY_ENABLED = True ###
CONCURRENCY_FIELD_SIGNER = 'concurrency.forms.VersionFieldSigner' ###
CONCURRENCY_HANDLER409 = 'concurrency.views.conflict' ###
CONCURRENCY_MANUAL_TRIGGERS = False ###
CONCURRENCY_POLICY = 1 ###
@ruchej
ruchej / nifi.logs
Last active October 31, 2022 06:43
2022-10-31 06:26:42,289 ERROR [Timer-Driven Process Thread-9] o.a.nifi.processors.standard.ExecuteSQL ExecuteSQL[id=184880c5-0184-1000-2f62-2cc2fb99ff55] Failed to process session due to java.lang.AbstractMethodError; Processor Administratively Yielded for 1 sec: java.lang.AbstractMethodError
java.lang.AbstractMethodError: null
at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
at org.apache.commons.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:897)
at org.apache.commons.dbcp2.PoolableConnection.validate(PoolableConnection.java:270)
at org.apache.commons.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:630)
at org.apache.commons.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:118)
at org.apache.commons.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:665)
at org.apache.commons.dbcp2.BasicDataSource.createDataSource(BasicDataSource.jav
CREATE OR REPLACE PROCEDURE CREATE_TABLE_TRANSFORMED_DATA()
LANGUAGE 'plpgsql'
AS $$
CREATE TABLE IF NOT EXISTS public.transformed_data
(
value_timestamp timestamp without time zone NOT NULL,
CONSTRAINT transformed_data_pkey PRIMARY KEY (value_timestamp)
);
DECLARE names ARRAY;
version: '3.4'
services:
postgres:
env_file: .env
container_name: 'postgres_database'
image: postgres:12.3
shm_size: '256m'
volumes:
- db_data:/var/lib/postgresql/data
@ruchej
ruchej / cut.py
Last active August 18, 2022 10:31
#-*- coding: utf-8 -*-
import copy
import json
import monotonic
class MyEncoder(json.JSONEncoder):
def default(self, obj):
return obj.__dict__
@ruchej
ruchej / gist:6c28215954345a811ff241f71a5438e3
Last active January 8, 2023 18:40
docker-compose.yml
user nginx;
worker_processes 2;
events {
worker_connections 4096;
}
http {
include /etc/nginx/mime.types;
client_max_body_size 100m;
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_METRICS'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2022-08-13 08:11:14 1 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
def parsing_one_group(url: str) -> Dict[str, list[str]]:
'''
Парсинг одной группы по букве.
Возвращает список животных в словаре
{"А": "Аардоникс"}
'''
page = requests.get(url).text
soup = BeautifulSoup(page, 'lxml')
group = soup.find(id='mw-pages').find('div', class_='mw-category-group')
letter = group.find('h3').text
def nace_childs(data, parent=''):
return list(filter(lambda x: x['Parent'] == parent, data))
def nace_code_tree(data, parent='', max_level=4):
nodes = nace_childs(data, parent)
for node in nodes:
if node['Level'] < max_level:
childs = nace_code_tree(data, node['Code'], max_level)
else:
[
{
"Level": 1,
"Code": "A",
"Parent": "",
"Description": "PRODUCTS OF AGRICULTURE, FORESTRY AND FISHING"
},
{
"Level": 2,
"Code": "1",