Skip to content

Instantly share code, notes, and snippets.

View akrisanov's full-sized avatar

Andrey Krisanov akrisanov

View GitHub Profile
@akrisanov
akrisanov / Makefile
Last active January 11, 2024 13:49
Makefile for FastAPI project
.PHONY: psql up down venv check-deps update-deps install-deps isort black mypy flake8 bandit lint test migrate serve
ifneq (,$(wildcard ./.env))
include .env
export
endif
VENV=.venv
PYTHON=$(VENV)/bin/python3
@akrisanov
akrisanov / LLM.md
Created April 18, 2023 22:22 — forked from rain-1/LLM.md
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@akrisanov
akrisanov / sprint3_1.py
Last active April 18, 2023 17:45
Yandex.Praktikum 🍂
import pandas as pd
data = pd.read_csv("/datasets/visits.csv", sep="\t")
data['local_time'] = (
pd.to_datetime(data['date_time'], format='%Y-%m-%dT%H:%M:%S')
+ pd.Timedelta(hours=3)
)
data['date_hour'] = data['local_time'].dt.round('1H')
data['too_fast'] = data['time_spent'] < 60
data['too_slow'] = data['time_spent'] > 1000
@akrisanov
akrisanov / 02_let.ml
Last active February 19, 2023 20:07
OCaml From Very Beginning
let isvowel c =
c = 'a' || c = 'e' || c = 'i' || c = 'o' || c = 'u';;
let isconsonant c = not (isvowel c);;
let rec factorial n =
if n <= 0 then 1
else n * factorial (n - 1);;
@akrisanov
akrisanov / bcoin_client.py
Last active November 29, 2022 11:27
Trading cryptocurrencies
import logging
from http import HTTPStatus
import requests
from mnemonic import Mnemonic
class BcoinClient:
"""
Simple wrapper around Bcoin REST API.
@akrisanov
akrisanov / sprint_2_theme_3_task_3.py
Last active November 8, 2022 11:09
Yandex.Praktikum 🍂
import pandas as pd
stock = pd.read_csv('/datasets/stock_upd.csv')
stock['item_lowercase'] = stock['item'].str.lower()
apple = stock[stock['item_lowercase'].str.contains('apple')]['count'].sum()
samsung = stock[stock['item_lowercase'].str.contains('samsung')]['count'].sum()
stock['item_lowercase'] = stock['item_lowercase'].drop_duplicates()
stock = stock.dropna().reset_index(drop=True)
@akrisanov
akrisanov / conftest1.py
Created May 4, 2020 18:19
Pytest Fixtures
import pytest
# Environment Variables
@pytest.fixture(autouse=True)
def env_setup(monkeypatch):
monkeypatch.setenv('MY_SETTING', 'some-value')
#!/bin/bash
export PATH=/usr/bin:/bin:/usr/sbin:/sbin
# Create subfolder to store renamed files
createDestination() {
destination="$(dirname "$file")/sorted"
mkdir -p "$destination"
}
# See explanation of linters at https://golangci-lint.run/usage/linters/
linters:
disable-all: true
enable:
- bodyclose
# Disabled due to flakes: https://github.com/sourcegraph/sourcegraph/issues/33183
# - depguard
- forbidigo
- gocritic
- goimports