Skip to content

Instantly share code, notes, and snippets.

View aleksandarristic's full-sized avatar

Aleksandar Ristic aleksandarristic

View GitHub Profile
@egeulgen
egeulgen / boto3_progress_bar.py
Last active October 28, 2024 12:22
To display progress bar and percentage when downloading with boto3
class ProgressPercentage(object):
''' Progress Class
Class for calculating and displaying download progress
'''
def __init__(self, client, bucket, filename):
''' Initialize
initialize with: file name, file size and lock.
Set seen_so_far to 0. Set progress bar length
'''
self._filename = filename
@hrldcpr
hrldcpr / tree.md
Last active December 17, 2025 03:44
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@alobato
alobato / start-stop-example.sh
Created March 3, 2012 23:09
start-stop-example
#!/bin/sh
# Quick start-stop-daemon example, derived from Debian /etc/init.d/ssh
set -e
# Must be a valid filename
NAME=foo
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/local/bin/bar