-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some crappy scripts to check for simple cheating
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |