This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Selective list of Clang-Tidy checks. | |
--- | |
# All checks: https://clang.llvm.org/extra/clang-tidy/checks/list.html | |
Checks: " | |
-*, \ | |
bugprone-*, \ | |
cppcoreguidelines-*, \ | |
misc-*, \ | |
performance-*, \ | |
readability-*, \ |