Skip to content

Instantly share code, notes, and snippets.

View nkhitrov's full-sized avatar
🏠
Elixir/Python Backend Developer

Nick Khitrov nkhitrov

🏠
Elixir/Python Backend Developer
View GitHub Profile
@nkhitrov
nkhitrov / ArchLinuxWSL2.md
Created May 10, 2024 14:35 — forked from ld100/ArchLinuxWSL2.md
Steps for setting up Arch Linux on WSL2

Migrating from Ubuntu on WSL to ArchLinux on WSL2

Obsolete notice

This document was created back in 2020 and might not be actual nowadays. It is not supported anymore, so use thise information at your own risk.

Upgrading to WSL 2

  • Download WSL2 Kernel
  • run wsl --set-default-version 2 in windows command line, so that all future WSL machine will use WSL2.
@nkhitrov
nkhitrov / Flake8.txt
Created May 3, 2023 23:54 — forked from tossmilestone/Flake8.txt
Flake8 integrated with PyCharm
How to manually setup flake8 as PyCharm external tool
File / Settings / Tools / External Tools / Add
Name: Flake8
Program: $PyInterpreterDirectory$/python
Parameters: -m flake8 --max-complexity 10 --ignore E501 $FilePath$
Working directory: $ProjectFileDir$
Output Filters / Add
Name: Filter 1
@nkhitrov
nkhitrov / gunicorn_structlog_setup.py
Created April 18, 2023 18:28 — forked from airhorns/gunicorn_structlog_setup.py
Gunicorn structlog integration
import os
import logging.config
import structlog
from .app import app
timestamper = structlog.processors.TimeStamper(fmt="iso")
pre_chain = [
# Add the log level and a timestamp to the event_dict if the log entry is not from structlog.
structlog.stdlib.add_log_level,
from typing import Optional
import base64
from passlib.context import CryptContext
from datetime import datetime, timedelta
import jwt
from jwt import PyJWTError
from pydantic import BaseModel
#!/usr/bin/python
# A Wake on LAN program that allows you to send magic packets over the Internet
import socket, struct
class Waker():
def makeMagicPacket(self, macAddress):
# Take the entered MAC address and format it to be sent via socket
splitMac = str.split(macAddress,':')
# Pack together the sections of the MAC address as binary hex