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
/* | |
nightly-x86_64-unknown-linux-gnu | |
[dependencies] | |
serde = "^1.0" | |
tarpc = "0.12.0" | |
tarpc-plugins = "0.4.0" | |
*/ | |
#![feature(plugin, use_extern_macros, proc_macro_path_invoc)] | |
#![plugin(tarpc_plugins)] |
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 lex(inp): | |
tkns = list() | |
acc = list() | |
for ch in inp: | |
if ch.isspace() and acc: | |
tkns.append(''.join(acc)) | |
acc = list() | |
elif ch == '(' or ch == ')': | |
if acc: |
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
#include <algorithm> | |
#include <iostream> | |
#include <vector> | |
std::vector<int> create_graph(int sz) | |
{ | |
std::vector<int> graph; | |
graph.reserve(sz); | |
for (int i=0; i<sz; ++i) |
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
4 workers, 15 cores each, another shell with 40 cores running at the same time. | |
2tags, 100k securities, 2.5k pvs | |
I: input - the size of data input to all the tasks | |
O: ouput - the size of data output from all tasks | |
SR: shuffle read - the size of data read from other partitions | |
SW: shuffle write - the size of data written to other partitions | |
baseline: read from data table and write back to another table |
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
shuffle.partitions=200 | |
collect: 5s, 2 stages, 220 tasks | |
runJob: 8s, 6 stages, 660 tasks | |
shuffle.partitions=60 | |
collect: 5s, 2stages, 80 tasks | |
runJob: 8s, 6 stages, 240 tasks | |
collect: | |
stage 1 remains the same, 5s, 20 tasks, 1909.2MB input, 48.1MB shuffle write |
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 org.scalacheck.Properties | |
import org.scalacheck.Prop.{forAll, BooleanOperators} | |
import scala.util.Random | |
def quickSelect[A <% Ordered[A]](seq: Seq[A], n: Int, rand: Random = new Random): A = { | |
val pivot = rand.nextInt(seq.length); | |
val (left, right) = seq.partition(_ < seq(pivot)) | |
if (left.length == n) { | |
seq(pivot) | |
} else if (left.length < n) { |
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
total time = 132.70 secs (132702 ticks @ 1000 us, 1 processor) | |
run.img Main 427 1 0.0 0.0 98.2 97.6 | |
render RayTracer 428 1 0.0 0.0 98.2 97.6 | |
render.cs RayTracer 585 1 98.1 97.6 98.2 97.6 | |
compare RayTracer 639 3971855 0.0 0.0 0.0 0.0 | |
== Geometry3 638 1676386 0.0 0.0 0.0 0.0 | |
wLights RayTracer 637 1871708 0.0 0.0 0.0 0.0 | |
wAmbient RayTracer 636 1871708 0.0 0.0 0.0 0.0 | |
wImgHt RayTracer 633 3840000 0.0 0.0 0.0 0.0 |
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
type Point = (Float,Float) | |
type GridU = U.Vector Point | |
{- Explanation: colorPixel evaluates to the color of a pixel for a given world | |
- Antialiasing is tracing > 1 rays through each pixel and averaging the results. | |
- Soft shadows are shadows that do not have a hard edge, this requires sending multiple shadow rays to each light. | |
- Depth of field: only objects at a certain distance are in focus. To do this we send multiple rays though each antialising | |
- point with each base perturbed slightly. Objects are in focus if they are at the distance the view plane is at. | |
- | |
- Three arguments: |
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
{-# LANGUAGE FlexibleContexts #-} | |
{- Construct recursive descent parsers for the following grammars -} | |
import Text.Parsec | |
(<||>) :: ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a | |
p <||> q = try p <|> q | |
{- S -> + S S | - S S | a -} | |
data G1 = P1G1 G1 G1 | P2G1 G1 G1 | T1G1 deriving (Eq, Show) | |
g1 :: Stream s m Char => ParsecT s u m G1 |
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 time, string | |
from scrapy.spider import BaseSpider | |
from scrapy.http import FormRequest | |
from scrapy.item import Item, Field | |
from scrapy.selector import HtmlXPathSelector | |
from selenium import webdriver | |
from selenium.webdriver.support.wait import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as EC | |
from selenium.webdriver.common.by import By | |
from selenium.common.exceptions import NoSuchElementException |
NewerOlder