Skip to content

Instantly share code, notes, and snippets.

View dimmy2000's full-sized avatar

Dmitrii Samoilenko dimmy2000

  • Moscow
View GitHub Profile
@dimmy2000
dimmy2000 / vpn.md
Created May 28, 2023 13:44 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@dimmy2000
dimmy2000 / sharepoint.py
Last active March 14, 2022 10:02
Подключение к Sharepoint с помощью принципов App-Only
"""
Чтобы установить необходимую библиотеку, выполните в командной строке команду:
pip install Office365-REST-Python-Client
Для работы с эксель файлами установите библиотеку openpyxl:
pip install openpyxl
или xlsxwriter:
pip install XlsxWriter
"""
@dimmy2000
dimmy2000 / to_roman.py
Created July 7, 2021 16:33
Convertation arabic to roman & vice versa
def descending(pair):
return -pair[1]
def to_roman(number):
result = ''
for roman, arabic in sorted(NUMERALS.items(), key=descending):
repetitions_count = number // arabic
number -= arabic * repetitions_count
result += roman * repetitions_count
@dimmy2000
dimmy2000 / dict.py
Last active July 7, 2021 16:33
Инициализация новых значений в словаре и defaultdict
# Инициализация новых значений
if key not in dictionary:
dictionary[key] = [] # инициализируем список
dictionary[key].append(value) # изменяем список
# или
dictionary.setdefault(key, []).append(value)
>>> from collections import defaultdict
>>> d = defaultdict(int)
>>> d['a'] += 5
@dimmy2000
dimmy2000 / poetry_config.sh
Last active July 7, 2021 16:35
Config poetry to store venv into the project folder
poetry config virtualenvs.in-project true
@dimmy2000
dimmy2000 / primes.py
Created June 10, 2021 11:01
List comprehension for prime numbers
primes = [x for x in range(m, n+1) if all(x % y != 0 for y in range(2, x))]