Skip to content

Instantly share code, notes, and snippets.

View nk9's full-sized avatar
🏗️
Building a better world, one bit at a time

Nick Kocharhook nk9

🏗️
Building a better world, one bit at a time
  • London, UK
View GitHub Profile
@nk9
nk9 / largestFiles.py
Last active November 14, 2023 09:47
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
#
[tool.isort]
profile = "black"
multi_line_output = 3
known_first_party = ["tests"]
skip_glob = ["migrations/*"]
[tool.black]
extend-exclude = "^/migrations/"
line-length = 120
@nk9
nk9 / views.py
Last active January 13, 2024 15:17
Flask-Security registration with pending role
from flask_security.decorators import anonymous_user_required
from flask_security.utils import encrypt_password
from flask_security.confirmable import send_confirmation_instructions
@bp.route('/register/', methods=['GET', 'POST'])
@anonymous_user_required
def register():
form = ExtendedRegistrationForm(request.form)
if form.validate_on_submit():