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
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"iam:GetSSHPublicKey", | |
"iam:ListSSHPublicKeys" | |
], | |
"Resource": [ |
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
defmodule Dice do | |
def sum_probability(dice, target) do | |
prob = :math.pow(6, dice) |> round | |
total = 6 * dice | |
"#{sum_probability(dice, target, total)} / #{prob}" | |
end | |
defp sum_probability(dice, target, _total) when target < dice do | |
0 |
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
$odds = 0 | |
def sumProbability(dice, target) | |
if dice == 1 | |
"1 / 6" | |
else | |
prob = 6 ** dice | |
total = 6 * dice | |
if target < dice |
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 fac(n: Int): BigInt = n match { | |
case 0 => 1 | |
case _ => n * fac(n - 1) | |
} | |
def facTail(n: Int, acc: BigInt = 1): BigInt = n match { | |
case 0 => acc | |
case _ => facTail(n - 1, n * acc) | |
} |
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
package io.reactive.sandbox.actors | |
import java.sql.DriverManager | |
import org.postgresql.PGConnection | |
import akka.actor.{Actor, ActorLogging, ActorRef} | |
case class Subscription(channel: String) | |
case class UnSubscription(channel: String) |
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
package main | |
import ( | |
"fmt" | |
"math/big" | |
"runtime" | |
) | |
func main() { | |
runtime.GOMAXPROCS(runtime.NumCPU()) |
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
Show hidden characters
{ | |
"browser": true, // specifies globals exposed by modern browsers | |
"strict": true, // specifies that restricted JavaScript is used | |
"indent": 2, // indentation should consistently be 2 spaces | |
"nonew": true, // prevents using constructers for side effects | |
"noarg": true, // prevents using deprecated caller,callee methods | |
"eqeqeq": true, // prevents equality == and != operators from being used | |
"bitwise": true, // prevents bitwise & and | operators from being used |
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 akka.actor.{Actor, ActorLogging, ActorSystem, Props} | |
object Factorial extends App { | |
val factorials = List(200000, 180000, 320000, 280000, 220000, 420000, 550000, 480000) | |
val system = ActorSystem("factorial") | |
val collector = system.actorOf(Props(new FactorialCollector(factorials)), "fac-coll") | |
system.awaitTermination() |
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
# Git Prompt | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*\)/(\1)/' | |
} | |
export PS1="\u@\h \W\$(parse_git_branch)$ " |
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
# Create the datadog user with select only permissions: | |
# CREATE USER datadog WITH PASSWORD '<complex_password>'; | |
# | |
# Grant select permissions on a table or view that you want to monitor: | |
# GRANT SELECT ON <schema>.<table> TO datadog; | |
# | |
# Grant permissions for a specific column on a table or view that you want to monitor: | |
# GRANT SELECT (id, name) ON <schema>.<table> TO datadog; | |
# | |
# Let non-superusers look at pg_stat_activity in a read-only fashon. |