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
19:41:20 [ alisdair@charmander ] $ iex | |
Erlang/OTP 20 [erts-9.0] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace] | |
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help) | |
iex(1)> defmodule A do | |
...(1)> def a(), do: true | |
...(1)> end | |
{:module, A, | |
<<70, 79, 82, 49, 0, 0, 3, 96, 66, 69, 65, 77, 65, 116, 85, 56, 0, 0, 0, 81, 0, | |
0, 0, 9, 8, 69, 108, 105, 120, 105, 114, 46, 65, 8, 95, 95, 105, 110, 102, |
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
defmodule MyApp.Db.Tests do | |
use MyApp.Db.Case, async: true | |
## tests go here | |
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
function assertNever(x: never): never { | |
throw new Error("Unexpected object: " + x); | |
} | |
function area(s: Shape) { | |
switch (s.kind) { | |
case "square": return s.size * s.size; | |
case "rectangle": return s.height * s.width; | |
case "circle": return Math.PI * s.radius ** 2; | |
default: return assertNever(s); // error here if there are missing cases | |
} |
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
defmodule Gateway do | |
use GenServer | |
@timeout 5000 # timeout in ms | |
def init(process), do: %{ process: process, q: :undefined } | |
def handle_call(call, from, %{ process: process, q: q }) do | |
# add call to priority queue | |
newq = add_to_q(q, :call, call, from) |
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
--- | |
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "cloudtrail logs and topic" | |
Resources: | |
Cloudtrail: | |
DependsOn: [ "CloudtrailBucketPolicy", "CloudtrailTopicPolicy" ] | |
Type: "AWS::CloudTrail::Trail" | |
Properties: | |
EnableLogFileValidation: true | |
IncludeGlobalServiceEvents: true |
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
--- | |
## aws access roles | |
## | |
## roles that can be assumed by users to grant various levels of access to the | |
## account | |
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "account access roles" | |
Parameters: | |
AccountId: | |
Description: "the account id from which permitted user accounts may assume these roles" |
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
defmodule Filter do | |
require Ecto.Query | |
@max_id 2147483647 | |
@max_clock 9223372036854775807 | |
@max_limit 1000 | |
defstruct valid?: true, query: nil, limit: 1000, errors: [] |
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
--- | |
## aws access roles | |
## | |
## roles that can be assumed by users to grant various levels of access to the | |
## account | |
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "account access roles" | |
Parameters: | |
AccountId: | |
Description: "the account id from which permitted user accounts may assume these roles" |
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 2.7.13 (default, Dec 18 2016, 07:03:39) | |
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import json | |
>>> json.loads("1e309") | |
inf | |
>>> json.loads("1e308") | |
1e+308 | |
>>> json.loads("1e1") | |
10.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
#!/bin/bash | |
set -e | |
# changes color of info and then resets back to default | |
function info { | |
tput setaf 6; echo $1; tput sgr0 | |
} | |
# install from brew if not already installed |