Skip to content

Instantly share code, notes, and snippets.

View dmitrijbes's full-sized avatar
🌍

Dima Beskrestnov dmitrijbes

🌍
View GitHub Profile
@dmitrijbes
dmitrijbes / download_dis_attachments.py
Created October 5, 2025 10:37
[Python] Small script to download attachments from Discord messages based on privacy export.
# Download attachments from Discord messages based on privacy export.
# This script expects dir with server dirs, each with messages.json.
# It goes through all servers and messages, downloading attachments to attachments dir in each server dir.
# File name collisions are avoided by adding message timestamp or file counter.
import os
import json
import time
import requests
from urllib.parse import urlparse
from datetime import datetime
@dmitrijbes
dmitrijbes / list_large_dirs.py
Created October 5, 2025 10:26
[Python] Small script to list dirs larger than specified size.
# List all subdirs from specified base dir, which are larger than specified size in KB.
import os
def get_dir_size(dir_path):
dir_size = 0
for path, dir_names, file_names in os.walk(dir_path):
for file in file_names:
file_path = os.path.join(path, file)
@dmitrijbes
dmitrijbes / rename_files.py
Created October 27, 2023 15:36
[Python] Small script for quick rename of multiple files.
import os, sys
DEFAULT_PATH = "C:/some/path/"
def main():
files_path = DEFAULT_PATH
if files_path == DEFAULT_PATH:
print("Error: path not specified!", file=sys.stderr)
return
@dmitrijbes
dmitrijbes / update_sources.sh
Last active October 27, 2023 15:33
[Shell] Update git repos recursively.
#!/usr/bin/env bash
sources_path="C:\sources"
cd $sources_path
for dir in $(find . -maxdepth 2 -mindepth 2 -type d)
do
case $dir in
"./local"*) continue ;;
"./gists/8b5e76c94b7ad3d34bdbb1b6da8967f3"*) continue ;;
@dmitrijbes
dmitrijbes / hetero_container.cpp
Last active December 23, 2021 06:29
[C++] Naive implementation of heterogenous (different types), dynamic size container.
#include <cstdio>
#include <iostream>
#include <tuple>
#include <vector>
template <typename... Ts> class HeteroContainer {
std::tuple<std::vector<Ts>...> internal_storage;
public:
template <typename T> void update(T item) {
@dmitrijbes
dmitrijbes / clang_checks.yaml
Last active December 23, 2021 06:57
[C++] Selective list of Clang-Tidy checks.
# Selective list of Clang-Tidy checks.
---
# All checks: https://clang.llvm.org/extra/clang-tidy/checks/list.html
Checks: "
-*, \
bugprone-*, \
cppcoreguidelines-*, \
misc-*, \
performance-*, \
readability-*, \