Skip to content

Instantly share code, notes, and snippets.

View and-semakin's full-sized avatar

Andrey Semakin and-semakin

View GitHub Profile
@and-semakin
and-semakin / 3.10-ipython.txt
Last active November 12, 2021 17:02
Python 3.10 vs. 3.11 comparison
❯ ipython
Python 3.10.0 (default, Oct 25 2021, 23:33:57) [GCC 11.2.1 20210728 (Red Hat 11.2.1-1)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.29.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: def no_check(a, b):
...: return a / b
...:
...:
...: def try_check(a, b):
2020-12-05 21:32:39,120 12136 [DEBUG] - Using 'https://chocolatey.org/api/v2/'.
2020-12-05 21:32:39,121 12136 [DEBUG] - - Supports prereleases? 'True'.
2020-12-05 21:32:39,121 12136 [DEBUG] - - Is ServiceBased? 'True'.
2020-12-05 21:32:39,939 12136 [DEBUG] - Package 'docker-desktop' found on source 'https://chocolatey.org/api/v2/'
2020-12-05 21:32:39,940 12136 [WARN ] -
You have docker-desktop v2.4.0.0 installed. Version 2.5.0.1 is available based on your source(s).
2020-12-05 21:32:40,040 12136 [DEBUG] - Backing up existing docker-desktop prior to operation.
2020-12-05 21:32:40,043 12136 [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\docker-desktop'
to 'C:\ProgramData\chocolatey\lib-bkp\docker-desktop'
2020-12-05 21:32:42,062 12136 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\lib\docker-desktop".
from math import *
import itertools
def CalculateSquareRoot (Number ):
return sqrt(Number )
def append_item(item, l=[]):
l.append(item)
return l
@and-semakin
and-semakin / README.md
Last active November 26, 2022 02:02
Awesome weather script

Скрипт, показывающий погоду

Для запуска нужно иметь Python 3.6+ и установленные зависимости:

pip install -r requirements.txt

Ещё для запуска нужен API-ключ к сервису OpenWeatherMap. Смотрите инструкцию в файле weather.py.

@and-semakin
and-semakin / fish_prompt.fish
Created December 3, 2019 14:51
My favorite Fish prompt
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_show_informative_status 1
end
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1
end
@and-semakin
and-semakin / 5c2b70c3275376a95d8ce9fe39756f01871ea81b
Created December 1, 2019 11:27
MyTetra experimental cppcheck report
~/g/mytetra_dev (experimental|✔) $ cppcheck --quiet --enable=all app
[app/src/controllers/attachTable/AttachTableController.cpp:404]: (style) Variable 'fromFileName' is assigned a value that is never used.
[app/src/controllers/recordTable/RecordTableController.cpp:794]: (performance) Prefer prefix ++/-- operators for non-primitive types.
[app/src/controllers/shortcutSettings/ShortcutSettingsController.cpp:7]: (warning) Member variable 'ShortcutSettingsController::view' is not initialized in the constructor.
[app/src/controllers/shortcutSettings/ShortcutSettingsController.cpp:7]: (warning) Member variable 'ShortcutSettingsController::model' is not initialized in the constructor.
[app/src/libraries/DiskHelper.cpp:156] -> [app/src/libraries/DiskHelper.cpp:157]: (style) Condition 'result' is always false
[app/src/libraries/Downloader.cpp:24]: (performance) Variable 'saveDirectory' is assigned in constructor body. Consider performing initialization in initialization list.
[app/src/libraries/GlobalParameters.cpp:26
@and-semakin
and-semakin / tox-asdf tox output
Created November 21, 2019 07:31
tox-asdf tox output
$ tox
GLOB sdist-make: /home/br0ke/git/tox-asdf/setup.py
py27 create: /home/br0ke/git/tox-asdf/.tox/py27
py27 installdeps: mock, pytest, pytest-mock, tox
py27 inst: /home/br0ke/git/tox-asdf/.tox/.tmp/package/1/tox-asdf-0.1.1.dev0.zip
py27 installed: DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.,atomicwrites==1.3.0,attrs==19.3.0,configparser==4.0.2,contextlib2==0.6.0.post1,filelock==3.0.12,funcsigs==1.0.2,importlib-metadata==0.23,mock==3.0.5,more-itertools==5.0.0,packaging==19.2,pathlib2==2.3.5,pluggy==0.13.0,py==1.8.0,pyparsing==2.4.5,pytest==4.6.6,pytest-mock==1.12.1,scandir==1.10.0,six==1.13.0,toml==0.10.0,tox==3.14.1,tox-asdf==0.1.1.dev0,virtualenv==16.7.7,wcwidth==0.1.7,zipp==0.6.0
py27 run-test-pre: PYTHONHASHSEED='3137834157'
py27 run-test: commands[0] | pytest
===============================================================================
@and-semakin
and-semakin / PostgreSQL logs
Last active September 27, 2019 11:11
osm2pgsql problem
CONTEXT: COPY planet_osm_point, line 1
STATEMENT: COPY planet_osm_point (osm_id,"access","addr:housename","addr:housenumber","addr:interpolation","admin_level","aerialway","aeroway","amenity","area","barrier","bicycle","brand","bridge","boundary","building","capital","construction","covered","culvert","cutting","denomination","disused","ele","embankment","foot","generator:source","harbour","highway","historic","horse","intermittent","junction","landuse","layer","leisure","lock","man_made","military","motorcar","name","natural","office","oneway","operator","place","population","power","power_source","public_transport","railway","ref","religion","route","service","shop","sport","surface","toll","tourism","tower:type","tunnel","water","waterway","wetland","width","wood","z_order",tags,way) FROM STDIN
ERROR: unexpected message type 0x58 during COPY from stdin
CONTEXT: COPY planet_osm_line, line 1
STATEMENT: COPY planet_osm_line (osm_id,"access","addr:housename","addr:housenumber","addr:interpolation","admin_
2019-09-03 11:16:13,952 (23963/MainThread) pgcli.main WARNING - import keyring failed: ModuleNotFoundError("No module named 'keyring'").
2019-09-03 11:16:16,636 (23963/MainThread) pgcli.main ERROR - traceback: 'Traceback (most recent call last):\n File "/home/br0ke/.local/share/virtualenvs/pgcli_test-ns5XQy2A/lib/python3.7/site-packages/pgcli/main.py", line 555, in connect\n pgexecute = PGExecute(database, user, passwd, host, port, dsn, **kwargs)\n File "/home/br0ke/.local/share/virtualenvs/pgcli_test-ns5XQy2A/lib/python3.7/site-packages/pgcli/pgexecute.py", line 215, in __init__\n self.connect(database, user, password, host, port, dsn, **kwargs)\n File "/home/br0ke/.local/share/virtualenvs/pgcli_test-ns5XQy2A/lib/python3.7/site-packages/pgcli/pgexecute.py", line 255, in connect\n conn = psycopg2.connect(**conn_params)\n File "/home/br0ke/.local/share/virtualenvs/pgcli_test-ns5XQy2A/lib/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect\n conn = _connect(dsn, connection_factor
@and-semakin
and-semakin / .pre-commit
Last active August 8, 2019 14:43
pre-commit hook to check source formatting with black & isort
#!/usr/bin/env python3
import subprocess
import sys
def compose_up(service):
subprocess.run(["docker-compose", "up", "-d", service])
def compose_exec(service, command) -> bool: