Skip to content

Instantly share code, notes, and snippets.

View toolittlecakes's full-sized avatar

Nikolay Sheyko toolittlecakes

  • CodeSignal
  • Yerevan, Armenia
View GitHub Profile
@toolittlecakes
toolittlecakes / st_local_storage.py
Created August 18, 2024 12:57
st_local_storage
# `pip install streamlit_js`
# See "https://discuss.streamlit.io/t/saving-data-in-local-storage-via-streamlit/28785/20"
import json
import uuid
from typing import Any
import streamlit as st
from streamlit_js import st_js, st_js_blocking
@toolittlecakes
toolittlecakes / st_invisible_container.py
Created August 18, 2024 12:34
st_invisible_container
from typing import Literal
import streamlit as st
from streamlit.components.v1 import html
INVISIBLE_CONTAINER_CSS = """
div[data-testid="stVerticalBlockBorderWrapper"]:has(div.invisible-marker-container):not(:has(div.not-invisible-marker-container)) {
display: none;
}
div[data-testid="stVerticalBlockBorderWrapper"]:not(:has(div.invisible-marker-container)):has(div.not-invisible-marker-container) {

Манипуляции

Конфликт может включать в себя манипулирование Защищающимся. (Агрессор манипулирует)

Манипуляция - это скрытое воздействие на эмоции с целью получения рациональной выгоды или повышения своего авторитета.

В каких конфликтах бывают манипуляции:

  • В рациональных конфликтах манипуляции могут использоваться, как инструмент достижения цели.
  • В эмоциональных конфликтах манипуляции могут быть следствием необработанных эмоций
  • В манипулятивных конфликтах манипуляции используются для изменения социальной роли, а не для достижения рациональной цели
@toolittlecakes
toolittlecakes / hidden_data.py
Last active December 7, 2024 17:16
Tiny utils module that allow you to store **any** json-able data into aiogram message and read it back (from `message.html_text`)
import json
import re
from ast import literal_eval
from urllib import parse
# Functions for read and write url params
def url_loads(url_params: str) -> dict:
parsed = parse.parse_qs(url_params)
# parse_qs returns a dict of lists,
@toolittlecakes
toolittlecakes / dummy_async.py
Created April 21, 2024 09:22
Simple implementation showing the idea of async code. Doesn't use async/await keywords or real event_loop for the sake of simplicity and clarity
import time
from collections import deque
from pprint import pprint
START_TIME = time.time()
def run(func):
gen = func()
while True:
@toolittlecakes
toolittlecakes / function_polymorphism.py
Last active April 17, 2024 03:44
Inspired by this article about unobvious usage of polymorphism in order to embrace functional approach to create alternative solution
import syslog
from dataclasses import dataclass
from typing import Callable, Generic, Literal, Protocol, Type, TypeVar, TypeVarTuple
# Initial solution with classes
#
# class Filter(Protocol):
# def filter(self, message: str) -> bool: ...
# class TextFilter(Filter):
@toolittlecakes
toolittlecakes / st_fixed_container.py
Last active October 12, 2024 12:11
Sticky/fixed container for streamlit apps. Supports dynamic width change as well as dynamic color updates. Both top/bottom positions are available.
from typing import Literal
import streamlit as st
from streamlit.components.v1 import html
"""
st_fixed_container consist of two parts - fixed container and opaque container.
Fixed container is a container that is fixed to the top or bottom of the screen.
When transparent is set to True, the container is typical `st.container`, which is transparent by default.