Skip to content

Instantly share code, notes, and snippets.

View Elijas's full-sized avatar
🦸
If nobody in the room does the right thing, that means it's your job.

Elijas Dapšauskas Elijas

🦸
If nobody in the room does the right thing, that means it's your job.
View GitHub Profile
@Elijas
Elijas / findLastUsedRowsAndCols.py
Last active January 22, 2022 21:00
xlwings find used range boundaries (last used row and last used column)
import xlwings as xl
import xlwings.constants
s = xl.Book('doc.xlsx').sheets[0]
RR2 = s.api.Cells.Find(What="*",
After=s.api.Cells(1, 1),
LookAt=xlwings.constants.LookAt.xlPart,
LookIn=xlwings.constants.FindLookIn.xlFormulas,
SearchOrder=xlwings.constants.SearchOrder.xlByRows,
SearchDirection=xlwings.constants.SearchDirection.xlPrevious,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Elijas
Elijas / car-registration-assignment-solution.py
Last active August 21, 2019 15:49
Solution for Assignment "Car registration"
## Note: del b doesn't call __del__, because it's not guaranteed. Probably because there's a still reference to it in the _registered_cars dictionary
import re
from enum import Enum, auto
class REGISTRATION_STATUS(Enum):
SUCCESS = auto()
INVALID_NUMBER = auto()
ALREADY_REGISTERED = auto()
NUMBER_CHANGED = auto()
@Elijas
Elijas / colaboratory-cell-at-the-top-of-the-notebook.py
Last active September 8, 2019 17:55
How to run CS231n assignments in Google Colab (with Google Drive)
import sys, os
from google.colab import drive
drive.mount('/content/gdrive')
%cd /content/gdrive/My\ Drive/-dev/stanford-cs231n-2019spring/assignment1/
!pip install -r requirements.txt
%cd ./cs231n/datasets/
@Elijas
Elijas / modifier-key-hotkey-single-press.ahk
Created October 2, 2019 21:38
Modifier key hotkeys on single press only
;Source: https://www.autohotkey.com/boards/viewtopic.php?t=34909 "Modifier key hotkeys on single press only" by func
#SingleInstance Force
#InstallKeybdHook
~LShift Up::
if (A_PriorKey = "LShift")
send, {tab}
return
~LControl Up::
@Elijas
Elijas / proof-of-concept_ml-model-saving-to-redis.ipynb
Last active October 25, 2019 00:54
Proof of Concept: ML model saving to Redis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Elijas
Elijas / logid.cfg
Last active July 2, 2021 20:05
Gesture macros for all keys for Logitech MX Master 3, Logiops linux driver
// Location: /etc/logid.cfg
devices: ({
name: "MX Master 3";
smartshift: { on: true; threshold: 6; };
hiresscroll: { hires: false; invert: false; target: false; };
dpi: 1500; // max=4000
buttons: (
// Forward button
{ cid: 0x56; action = { type: "Gestures"; gestures: (
{ direction: "None"; mode: "OnRelease"; action = { type: "Keypress"; keys: [ "KEY_LEFTMETA" ];}},
from typing import List
def split_message(input_msg: str, max_length: int, allocated_chars=None) -> List[str]:
allocated_chars_arg = allocated_chars
max_length_arg = max_length
if allocated_chars_arg is None:
allocated_chars = 6
assert max_length > 1 + allocated_chars
max_length -= allocated_chars
@Elijas
Elijas / utils.py
Created October 27, 2020 23:13
Python Utils
import logging
import signal
logger = logging.getLogger(__name__)
class ExitSignalHandler(metaclass=Singleton):
def __init__(self):
self._cleanup_functions = []
@Elijas
Elijas / pull_from_upstream.sh
Last active November 25, 2020 04:46
Pull upstream changes
#!/bin/bash -xe
UPSTREAM_REPO_URL=...
git remote add upstream "$UPSTREAM_REPO_URL" || true
git pull origin main
git checkout main
git fetch upstream
git merge upstream/main