This file contains hidden or 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
from __future__ import print_function | |
import re | |
import sys | |
import hashlib | |
from select import select | |
from getpass import getpass | |
from base64 import b64encode | |
from os.path import expanduser | |
b64c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" |
This file contains hidden or 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
########### hw 4 ############# | |
print([num for num in xrange(1000) if sum(map(int, str(num))) == 10]) | |
################ hw 5 ################ | |
def occ(n, specific): | |
for num in xrange(n): | |
times = len([x for x in str(num) if str(specific) == x]) | |
yield (num, times) |
This file contains hidden or 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
#!/bin/bash | |
echo "before expanstion: $@" | |
eval "echo after expansion: $@" | |
This file contains hidden or 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
FROM ubuntu | |
ENTRYPOINT ["/root/expand.sh"] | |
ADD do.sh /root/expand.sh | |
RUN chmod u+x /root/expand.sh | |
CMD ["a b c d $variable"] |
This file contains hidden or 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
from collections import defaultdict | |
from pyquery import PyQuery | |
import csv | |
# the format for the id | |
url_format = url_format = "http://genealogy.math.ndsu.nodak.edu/id.php?id=%d" | |
# the response message when there is no id | |
# I hope there are no spaces in between, that is: | |
# id 3 exists, id 4 doesn't but id 5 does exist. |
This file contains hidden or 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.util.Arrays; | |
public class Functions { | |
public static int powerOfTwo(int x) { | |
int num = x*x; | |
System.out.printf("%d^2: %d\n", x, num); | |
return x*x; | |
} |
This file contains hidden or 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
public class ToDecimal { | |
public static void main(String[] args) { | |
if (args.length == 0) { | |
System.out.println("illegal input"); | |
return; | |
} | |
String decimalInBinary = args[0]; | |
if (!decimalInBinary.matches("^(0|1)+$")) { |
NewerOlder