Skip to content

Instantly share code, notes, and snippets.

View asilichenko's full-sized avatar
Let's Java

Oleksii Sylichenko asilichenko

Let's Java
View GitHub Profile
@asilichenko
asilichenko / prison_break.py
Created August 30, 2025 16:58
The Riddle That Seems Impossible Even If You Know The Answer
# See Veritasium's video: https://www.youtube.com/watch?v=iSNsgj1OCLA
import numpy as np
from numba import njit
@njit
def process(n: int = 100, series: int = 10_000) -> int:
retval: int = 0
@asilichenko
asilichenko / get_keyboard_state.py
Created August 18, 2025 16:12
How to make Win32 GetKeyboardState work
import atexit
import ctypes
import sys
from ctypes import wintypes
from enum import Enum
import keyboard
from win32con import *
user32 = ctypes.windll.user32
@asilichenko
asilichenko / map_virtual_key.py
Created August 15, 2025 14:39
Python win32api MapVirtualKey - Documentation and usage examples
"""
win32api.MapVirtualKey - Documentation and usage examples
================================================================
SIGNATURE:
-----------
win32api.MapVirtualKey(uCode, uMapType) -> int
PARAMETERS:
----------
@asilichenko
asilichenko / hkl_to_klid_example.py
Created August 14, 2025 20:20
Convert Keyboard Layout ID (HKL) to KLID in Python Win32
from threading import Thread
from typing import List
from win32api import SendMessage, GetKeyboardLayoutName, GetKeyboardLayoutList
from win32con import WM_INPUTLANGCHANGEREQUEST
from win32gui import WNDCLASS, GetModuleHandle, RegisterClass, CreateWindow, PumpMessages
INPUTLANGCHANGE_SYSCHARSET: int = 0x0001
hidden_window_hwnd: int = 0
@asilichenko
asilichenko / howto_cuda_const_array_python.py
Created October 26, 2024 14:54
How to use CUDA const array in Python
import random
from numba import cuda
import numpy as np
import cupy as cp
H_DATA = np.random.uniform(0, 40, 128).astype(np.float32)
@cuda.jit
@asilichenko
asilichenko / multiprocessing_example.py
Created October 21, 2024 11:38
Python Multiprocessing: Shared Value and Shared Array
import multiprocessing
from datetime import datetime
from multiprocessing import Process
from typing import List
import numpy as np
NUM_ITERATIONS: int = 1_000_000
KEY_SIZE: int = 20
@asilichenko
asilichenko / running-python-code-on-gpu-using-cuda-technology.ipynb
Last active October 5, 2024 19:35
Running Python Code on GPU using CUDA Technology
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@asilichenko
asilichenko / lookup_generator.py
Last active July 24, 2024 20:06
Li-Ion Open Circuit Voltage (OCV) by Depth of Discharge (DOD) lookup table generator
# MIT License
#
# Copyright (c) 2024 Oleksii Sylichenko
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@asilichenko
asilichenko / ExampleUnitTest.java
Last active September 9, 2023 11:58
JUnit5 Jupiter unit and parametrized tests example
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.stream.Stream;
/**
@asilichenko
asilichenko / gist:56346131a1e977112c406aafda95f513
Last active August 3, 2023 05:30 — forked from sunmeat/gist:e579076368145450d8e0d2a269428541
nice example for google street view android
activity_maps.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<fragment