Skip to content

Commit

Permalink
Added some crappy scripts to check for simple cheating
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
  • Loading branch information
powerjg committed Oct 18, 2017
1 parent fd2f7de commit a5bd0c9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/compare_stats.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python
import os
import subprocess
import sys

out = subprocess.check_output(['find . -name \"*txt\"'], shell=True)

stats = out.split('\n')

import hashlib
stats_md5 = [(fname, hashlib.md5(open(fname, 'rb').read()).digest())
for fname in stats if fname]

for i in stats_md5:
for j in stats_md5:
if i[0]==j[0]: continue
if i[1]==j[1]:
namei = i[0].split('/')[1]
namej = j[0].split('/')[1]
if namei != namej:
print "Match!", i[0], j[0]
30 changes: 30 additions & 0 deletions scripts/sort_subs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python
import os
import subprocess

class cd:
"""Context manager for changing the current working directory"""
def __init__(self, newPath):
self.newPath = os.path.expanduser(newPath)

def __enter__(self):
self.savedPath = os.getcwd()
os.chdir(self.newPath)

def __exit__(self, etype, value, traceback):
os.chdir(self.savedPath)

def tryinflate(dir, name):
if not name.endswith('gz'): return

with cd(dir):
subprocess.call(["tar", "xzf", name])

for i in os.listdir('.'):
if os.path.isdir(i): continue
name = i.split('_')[0]
if not os.path.isdir(name):
os.mkdir(name)
os.rename(i, name+'/' + i)

tryinflate(name, i)

0 comments on commit a5bd0c9

Please sign in to comment.