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 random | |
def count_step(n): | |
cnt = 0 | |
while n > 1: | |
n = (n << 1) + n + 1 if n & 1 else n >> 1 | |
cnt += 1 | |
return cnt |
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 cmd | |
import dircache | |
class MyCmd(cmd.Cmd): | |
def __init__(self): | |
cmd.Cmd.__init__(self) | |
self.prompt = '(MyCmd)' |
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 time | |
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice | |
device = MonkeyRunner.waitForConnection() | |
while 1: | |
device.touch(132, 572, MonkeyDevice.DOWN_AND_UP) | |
time.sleep(1) | |
device.touch(210, 650, MonkeyDevice.DOWN_AND_UP) | |
time.sleep(1) |
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 sys | |
import math | |
import subprocess | |
from itertools import izip | |
exfile = "./example" | |
tfile = "./train.dat" |
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 sys | |
import math | |
from itertools import izip | |
def main(args): | |
real = [map(int, l.strip().split(",")) for l in file("./example-ans.dat")] | |
predict = [map(int, sys.stdin.readline().split()) for i in range(1000)] |
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 sys | |
out = file(sys.argv[1] + ".py", "w") | |
out.write( | |
"""#!/usr/bin/env python | |
# this file is auto-generated from Reptree output file. | |
import sys |
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
#include <stdio.h> | |
#include <unistd.h> | |
int main(int argc, char* argv[]) { | |
int opt; | |
while ((opt = getopt(argc, argv, "ab:")) != -1) { | |
switch (opt) { | |
case 'a': | |
printf("option a\n"); |
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
package main | |
import ( | |
"os" | |
"syscall" | |
"fmt" | |
"strconv" | |
"encoding/csv" | |
) |
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 sys | |
out = file("reptree.go", "w") | |
out.write("func reptree() {\n") | |
pre_indent = -1 | |
for l in file(sys.argv[1]): | |
line = l.strip().split(" ") |
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 | |
prime_map = [0] | |
def isPrime(n): | |
if (n < 2): | |
return 0 | |
elif n == 2: | |
return 1 |