Skip to content

Instantly share code, notes, and snippets.

View tatterdemalion's full-sized avatar
🤖
Robots have feelings

Can Mustafa Özdemir tatterdemalion

🤖
Robots have feelings
View GitHub Profile
@tatterdemalion
tatterdemalion / neforganize.py
Created November 23, 2014 22:26
organize nikon raw files in an external drive
import os
import sys
import shutil
import filecmp
from datetime import datetime
def get_outpath(path, to):
timestamp = os.path.getctime(path)
created = datetime.fromtimestamp(timestamp)
@tatterdemalion
tatterdemalion / post-checkout
Created December 11, 2015 21:19
git post-checkout hook to check django migrations
#!/usr/bin/env python
import sys
import subprocess
from collections import defaultdict
fn, previous_head, current_head, is_branch = sys.argv
if not is_branch == '1':
sys.exit(0)
diff = defaultdict(list)
@tatterdemalion
tatterdemalion / fetch_manager.py
Last active December 28, 2015 08:26
Combines only, select_related, prefetch_related into a single function
from django.db import models
class FetchManager(models.Manager):
"""
combines only, select_related, prefetch_related into a single function
Example models:
---------------
@tatterdemalion
tatterdemalion / lazyuser.py
Last active October 15, 2016 09:58
My contribution to a program
"""My contribution to your program."""
import os
try:
input = raw_input # For backwards compatibility
except NameError:
pass
output = """