Skip to content

Instantly share code, notes, and snippets.

View korniichuk's full-sized avatar

Ruslan Korniichuk korniichuk

View GitHub Profile
@korniichuk
korniichuk / playing_card_20230609.ipynb
Last active June 9, 2023 15:28
Playing card (09.06.2023)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korniichuk
korniichuk / draw.py
Created December 17, 2021 17:25
Lucky draw machine
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Name: draw
# Version: 0.1a1
# Owner: Ruslan Korniichuk
# Maintainer(s):
import random
people = ['1', '2', '3', '4', '5', '6', '7', '8', '9'] # TODO
@korniichuk
korniichuk / google_phone_interview_2021.ipynb
Last active May 21, 2021 16:38
Solution for Google's phone interview 2021 (Python)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korniichuk
korniichuk / aws_phone_interview_2021.ipynb
Last active May 21, 2021 01:45
Solution for AWS's phone interview 2021 (Python)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korniichuk
korniichuk / drug_analyzer.ipynb
Last active September 20, 2022 17:27
Solution for Brainly's recruitment Python test
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korniichuk
korniichuk / pycode_2020_python_schedule.ipynb
Last active December 11, 2020 18:55
PyCode 2020 conference. DataOps 3.0 workshop
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@korniichuk
korniichuk / config
Created January 3, 2020 19:33
How to securely connect EC2 via SSH with AWS Systems Manager Session Manager
# SSH over AWS Systems Manager Session Manager
host i-* mi-*
ProxyCommand sh -c "aws ssm start-session --target %h --document-name AWS-StartSSHSession --parameters 'portNumber=%p'"
@korniichuk
korniichuk / s3fs_gz_pd.py
Created August 19, 2019 15:47
s3fs with gzip and pandas
# Version: 0.1a1
import gzip
import pandas as pd
import s3fs
src = 's3://bucket/file.gz'
@korniichuk
korniichuk / pit_depth.md
Last active November 2, 2022 12:14
Return the depth of the deepest pit in array

A non-empty zero-indexed array A consisting of N integers is given. A pit in this aray is any triplet of integers (P, Q, R) such that:

  • 0 <= P < Q < R < N;
  • sequence [A[P], A[P+1], ... , A[Q]] is strictly decreasing, i.e. A[P] > A[P+1] > ... > A[Q];
  • sequence A[P+1], ... , A[R] is strictly increasing, i.e. A[Q] < A[Q+1] < ... < A[R].

The depth of a pit(P, Q, R) is the number min{A[P] - A[Q], A[R] - A[Q]}.

For example, consider array A consisting of 10 elements such that:

A[0] = 0
@korniichuk
korniichuk / inner_join.py
Created July 24, 2019 17:58
INNER JOIN for sorted lists
def func(a, b):
result = []
x, y = 0, 0
while (x < len(a)) and (y < len(b)):
if a[x] > b[y]:
y += 1
elif b[y] > a[x]:
x += 1
else:
result.append(a[x])