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
merge :: Ord a => [a] -> [a] -> [a] | |
merge [] l = l | |
merge (a:l1) (b:l2) | |
| a <= b = a : merge l1 (b:l2) | |
| otherwise = b : merge l2 (a:l1) | |
mergeSort :: Ord a => [a] -> [a] | |
mergeSort [] = [] | |
mergeSort [a] = [a] | |
mergeSort l = |
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
# ----------------------------------------------------------------------------- | |
# Copyright (C) 2014 Jason Gedge | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# |
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 <array> | |
#include <chrono> | |
#include <iostream> | |
// Width of each dimension | |
constexpr size_t N = 200; | |
// Number of iterations for the test | |
constexpr size_t NUM_ITERATIONS = 100; |
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
variable "instances" {} | |
variable "flavor" {} | |
variable "ami" {} | |
variable "ami_list" {} | |
resource "aws_instance" "default" { | |
count = "${var.instances}" | |
ami = "${var.ami}" | |
instance_type = "${var.flavor}" | |
} |
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
resource "terraform_remote_state" "region" { | |
backend = "s3" | |
config { | |
bucket = "foo" | |
key = "bar" | |
region = "us-east-1" | |
} | |
} | |
module "sub1_zone" { |
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
// Directory layout | |
stacks/ | |
|__ us-east-1 | |
|__ test | |
|__ vpc | |
|__ services | |
|__ apps | |
|__ foo | |
|__ bar |
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
resource "aws_security_group_rule" "allow_all" { | |
count = "${length(split(",", var.security_group_ids))}" | |
type = "ingress" | |
from_port = 0 | |
to_port = 65535 | |
protocol = "tcp" | |
cidr_blocks = ["0.0.0.0/0"] | |
security_group_id = "${element(split(",", var.security_group_ids), count.index)}" |
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
// Foo has outputs "bar" and "baz" | |
module "foo" { | |
source = "..." | |
arg1 = "spam" | |
arg2 = "eggs" | |
} | |
// If you want `terraform output` or your remote state to show the outputs of | |
// `module.foo` you need to "forward" them along here: | |
output "bar" { value = "${module.foo.bar}" } |
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 timeit | |
def dot(a, b): | |
"""Dot product""" | |
return a[0]*b[0] + a[1]*b[1] + a[2]*b[2] | |
def rs_intersect(R0, d, C, r): | |
"""Ray/sphere intersection""" | |
R0 = (R0[0] - C[0], R0[1] - C[1], R0[2] - C[2]) |
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
class V1::WelcomeController < V1::ApplicationController | |
def index | |
respond_to do |format| | |
format.welcome { render plain: "testing v1" } | |
end | |
end | |
end |
OlderNewer