This file contains 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 python3 | |
import argparse | |
import os | |
import shutil | |
from xattr import xattr | |
top_folder = "." | |
CACHE_FOLDERS = {"__pycache__", ".pytest_cache", ".cache"} |
This file contains 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
def iterelements(tree): | |
""" Tree is a list, generate the element with the logic of the problem | |
element can be a value or a list, when a list recur | |
""" | |
for el in tree: | |
if isinstance(el, list): | |
yield el # when a list, iterate the list first, then the child | |
yield from iterelements(el) | |
else: | |
yield el |
This file contains 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 python | |
# coding=utf-8 | |
import os | |
import sys | |
from subprocess import call, Popen, PIPE | |
VIDEO_EXTENSIONS = {'mov', 'mpeg', 'avi', 'mvk', 'mp4'} | |
This file contains 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
from __future__ import print_function | |
import logging | |
import smtplib | |
from email.mime.text import MIMEText | |
from logging.handlers import BufferingHandler | |
class BufferedSmtpHandler(BufferingHandler): | |
""" This is a memoryhandler buffer, that never flush with big capacity (just to split MB emails) | |
that will send a mail using configured smtp at the end |
This file contains 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/python | |
import collections | |
__author__ = "Dario Varotto" | |
""" This was thought while I was showering, sorry :) """ | |
def stevie(): | |
stack = collections.deque() | |
stack.append("from the bottom") |
This file contains 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
#!/bin/env python | |
# @author: Dario Varotto | |
""" | |
Script for creating a complex mongodb shard for testing purpose on the local machine. | |
Wrote for the Mongodb 102 course (week6) to facilitate the setup. | |
Change the settings on the top of the script and run it. | |
All commands are passed to mongo via subprocess, no pyMongo required. | |
I keep it as mongo shell reference. |