Skip to content

Instantly share code, notes, and snippets.

@nickav
nickav / ReadDirectoryChangesW_craziness.cpp
Last active October 3, 2024 03:51
Example of how to poll ReadDirectoryChangesW on Windows
int main() {
char *path = "/path/to/my/directory";
print("watching %s for changes...\n", path);
HANDLE file = CreateFile(path,
FILE_LIST_DIRECTORY,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED,
@DonnchaC
DonnchaC / torrent-file-size.py
Last active July 14, 2022 03:06
Get total file sizes of contents for a set of .torrent files
import os
import sys
import bencodepy
import humanize
import argparse
def total_size_files_torrent(file_name):
try:
parsed = bencodepy.decode_from_file(file_name)