Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Developers who use spaces make more money than those who use tabs. Let's automate that!
#!/usr/bin/env python
# So.. developers who use spaces make more money than those who use tabs huh?
# We can automate that promotion!
from __future__ import print_function
import os
import fnmatch
from fileinput import FileInput
def instant_promotion(file_pattern):
for path, dirs, files in os.walk(os.path.expanduser("~"), topdown=True):
files = [os.path.join(path, filename) for filename in fnmatch.filter(files, file_pattern)]
dirs[:] = [d for d in dirs if not d[0] == '.']
for l in FileInput(files, inplace=True, backup=".old"):
exit("dont't run random code from the internet..")
Copy link

davidrouten commented Jun 15, 2017

Thank you for this, just fantastic. I just ran this script over all of my most recent merge requests and was almost immediately called into my boss's office and offered a 15% raise! Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment