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
# add this to the end of your site.py | |
# (side effects? who cares?) | |
class clear: | |
def __repr__(self): | |
return '\n'*24 | |
builtins.clear = clear() |
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
import java.io.*; | |
public class BinarySearch { | |
private static void sort(String [] words) { | |
int length = words.length; | |
for(int i=0; i<length; i++) { | |
for(int j=i; j<length; j++) { | |
if(words[i].compareTo(words[j]) > 0) { | |
String temp = words[i]; | |
words[i] = words[j]; |
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
def generate(inp): | |
inp.reverse() | |
C = int(inp.pop()) | |
C_D = dict() | |
for i in xrange(C): | |
_t = inp.pop() | |
C_D[_t[:2]] = _t[2] | |
C_D[_t[:2][::-1]] = _t[2] |
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
#!/usr/bin/python | |
import subprocess, cv2, os | |
PATH = os.environ.get('GITPIC_PATH') | |
def main(): | |
sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() | |
repo_name = os.path.basename(subprocess.check_output(["git", "rev-parse", "--show-toplevel"])).strip() | |
try: | |
os.makedirs(os.path.join(PATH, repo_name)) |
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
#!/usr/bin/python | |
import subprocess, cv2, os | |
PATH = '/home/aviraldg/Pictures/gitpic/' | |
def main(): | |
sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() | |
repo_name = os.path.basename(subprocess.check_output(["git", "rev-parse", "--show-toplevel"])).strip() | |
try: | |
os.makedirs(os.path.join(PATH, repo_name)) |
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
#!/usr/bin/env python | |
import shutil, sys, os | |
def main(): | |
srcname = sys.argv[1] | |
destname = os.path.abspath(sys.argv[2]) | |
base = os.path.dirname(srcname) | |
srcname = os.path.basename(srcname) | |
def copy(arg, fname, fnames): | |
if os.path.basename(fname).startswith('drawable'): |
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
import java.io.*; | |
import java.util.*; | |
/** Decomposes a number into sums */ | |
public class Decompose { | |
public static final int MAX_NO = 20; | |
/** | |
* n - The number to sum up to. | |
* m - The number to start with (to sum up) |
NewerOlder