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
abstract class Tree | |
case class Add(l: Tree, r: Tree) extends Tree | |
case class Sub(l: Tree, r: Tree) extends Tree | |
case class Mul(l: Tree, r: Tree) extends Tree | |
case class Square(c:Const, b: Tree, e:Const) extends Tree | |
case class Var(n: String) extends Tree | |
case class Const(v: Int) extends Tree | |
trait Comparable { | |
def < (that: Any): Boolean |
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
pandoc \ | |
--latex-engine=xelatex \ | |
--template=template.tex \ | |
-V geometry:margin=1.25in \ | |
-o Final\ Paper.pdf \ | |
Final\ Paper.md |
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
char* concat(char *s, char *t) { | |
char strbuf[BUF_SIZE]; | |
strcpy(strbuf, s); | |
strcpy(strbuf+strlen(s), t); | |
return strbuf; | |
} |
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
from multiprocessing import Pool | |
from collections import Counter | |
from operator import add, itemgetter | |
import os, sys | |
import csv | |
def substrings(s): | |
n = len(s) | |
for i in xrange(0, 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
def substrings(s): | |
n = len(s) | |
for i in xrange(0, n): | |
for j in xrange(i+1, n+1): | |
yield s[i: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
ps aux | grep translator/apache | awk '{ mem+=$6 } END { print mem } ' |
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
SELECT CASE | |
WHEN text_length < 10 THEN '< 10' | |
WHEN text_length BETWEEN 10 AND 100 THEN '< 100' | |
WHEN text_length BETWEEN 100 AND 1000 THEN '< 1000' | |
WHEN text_length BETWEEN 1000 AND 10000 THEN '< 10000' | |
ELSE '> 10000' END AS length_bucket, | |
COUNT(*) AS qty | |
FROM (SELECT *, length(original_text) AS text_length FROM translation) AS t GROUP BY length_bucket; |
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
# Takes any arbitray data, splits it into multiple peices and encode into QR code. | |
# python-qrcode package can be obtained from https://github.com/lincolnloop/python-qrcode | |
import qrcode | |
import base64 | |
from multiprocessing import Pool | |
BLOCK_SIZE = 100 # in bytes |
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
************* Module spider.spider | |
C: 47,0: Line too long (90/80) | |
C:125,0: Line too long (87/80) | |
C:137,0: Line too long (94/80) | |
W: 74,0: FIXME: This does not cover all possible forms of URLs, but we'll | |
C: 1,0: Missing docstring | |
W: 1,0: Relative import 'proxy', should be 'spider.proxy' | |
W: 2,0: Relative import 'database', should be 'spider.database' | |
F: 5,0: Unable to import 'bs4' | |
W: 6,0: Relative import 'utils', should be 'spider.utils' |
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.net.URL; | |
import de.l3s.boilerpipe.extractors.ArticleExtractor; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
URL url = new URL("http://m.bbc.co.uk/news/science-environment-22307863"); | |