Skip to content

Instantly share code, notes, and snippets.

View egordm's full-sized avatar

Egor Dmitriev egordm

View GitHub Profile
@egordm
egordm / data_project__data_project__pipelines_stack_1.py
Created January 24, 2024 14:11
Luminis Blog — Deploying SageMaker Pipelines Using CDK
# Define the pipeline (this step uploads required code and packages by the pipeline to S3)
pipeline = pipeline_factory.create(
pipeline_name=pipeline_name,
role=sm_execution_role_arn,
sm_session=sagemaker_session,
)
pipeline_def_json = json.dumps(json.loads(pipeline.definition()), indent=2, sort_keys=True)
@egordm
egordm / pactmp.sh
Created June 1, 2021 22:28
Pacman wrapper to remember installed packages for later removal
# Usage:
# Install needed tmp packages
# pactmp -S junk package
# Remove the packages when not needed anymore
# pactmp -R
function pactmp() {
MODE=$1; shift
if [[ "$MODE" == "-S" ]]; then
sudo pacman -S $@; echo $@ >> ~/.pactmp
else
@egordm
egordm / collab_ds_cache_load.py
Last active April 15, 2021 16:03
Google Collab Snippets
#@title Load cached dataset from google drive
drive_project_root = "MyDrive/Colab" #@param {type:"string"}
dataset_name = "stanford40_augmented.tar.gz" #@param {type:"string"}
import os
from google.colab import drive
drive.mount('/content/drive')
drive_dataset_path = os.path.join('/content/drive', drive_project_root, dataset_name)
!test -e $drive_dataset_path \
@egordm
egordm / gc.js
Created January 12, 2021 10:05
Google Collab Periodic Conneciton Check
# https://stackoverflow.com/a/59226569
interval = setInterval(function() {
console.log("working")
var selector = "#top-toolbar > colab-connect-button"
document.querySelector(selector).shadowRoot.querySelector("#connect").click()
setTimeout(function() {
document.querySelector(selector).shadowRoot.querySelector("#connect").click()
}, 1000)
}, 60*1000)
@egordm
egordm / dataset_atlas.png
Last active October 25, 2020 15:46
MIR3D Projection
dataset_atlas.png
@egordm
egordm / format_numeric.rs
Created September 3, 2020 14:29
Rust macro to format numbers into a given string. Numbers are are ascending accoriding to given tokens
macro_rules! format_numeric {
(($s: expr; $i: expr, $x: ident) -> ($($body:tt)*)) => {format!($s, $($body)* $i)};
(($s: expr; $i: expr, $x: ident, $($y: ident),+) -> ($($body:tt)*)) => {format_numeric!(($s; $i + 1, $($y),+) -> ($($body)* $i,))};
[$s: expr; $($y: ident),+] => { format_numeric!(($s; 1, $($y),+) -> ()) };
}
assert_eq!(
format_numeric!["{}, {} and {}"; a, b, c],
"1, 2 and 3"
)
@egordm
egordm / drop-the-bytes-music.py
Created April 13, 2018 21:03
Converting all flacs and copying all meta. All folders & files are mirrored including images. Run like this `python drop-the-bytes-music.py "D:\Library\Music" "D:\Library\PhoneMusic" -v -j 4`
import argparse
from mutagen import File
from mutagen.flac import FLAC
from mutagen.easyid3 import EasyID3
import os
import shutil
from subprocess import call
from multiprocessing import Pool
@egordm
egordm / songsterr_premium.js
Last active March 9, 2025 08:45
Enable Songsterr Premium
// ==UserScript==
// @name Enable Songsterr Premium
// @version 0.1
// @description Enable songsterr premium
// @author EgorDm
// @grant none
// @include *songsterr.com*
// @include songsterr.com*
// @include *songsterr.com
// @include songsterr.com
@egordm
egordm / database_reader.py
Created July 31, 2017 18:34
Python osu!.db read and filter
from struct import unpack_from
class DatabaseReader:
def __init__(self, file):
self.cursor = 0
self._db = file.read()
def read_num(self, length):
type_map = {1: 'B', 2: 'H', 4: 'I', 8: 'Q'}