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
with nums as ( | |
select * from (values (18), (3), (3), (2), (4), (2), (5), (3), (12), (0.00003), (4), (2)) as n (x) | |
), a as ( | |
select | |
stddev(nums.x) as sdev, | |
abs(avg(nums.x)) as aavg, | |
numrange( | |
(abs(avg(nums.x) - stddev(nums.x))), | |
(abs(avg(nums.x) + stddev(nums.x))) | |
) as bounds |
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
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Configure Config Rules | |
Resources: | |
ConfigS3BucketPublicReadProhibitedRule: | |
Type: AWS::Config::ConfigRule | |
Properties: | |
ConfigRuleName: s3-bucket-public-read-prohibited | |
Description: Checks that your Amazon S3 buckets do not allow public read access. The rule checks the Block Public Access settings, the bucket policy, and the bucket access control list (ACL). | |
MaximumExecutionFrequency: TwentyFour_Hours |
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
let fs = require("fs"); | |
let path = require("path"); | |
let AWS = require("aws-sdk"); | |
let cliPath = path.resolve(process.env.HOME, ".aws", "cli"); | |
/* | |
NOTES: Make sure you alias the SHA1 fingerprinted cache token to the profile name | |
E.G. ln -s ~/.aws/cli/cache/09a19nczc3zvza58zrftetyfso7yw9d48u6ugsel.json profile |
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
#!/bin/bash | |
filepath="/data/postgresql/9.1/main-backups" | |
cd $filepath | |
for database in `ls $filepath/daily`; do | |
filename=`date +"$filepath/daily/$database/$database-daily-%w-%a.dmp" | tr '[:upper:]' '[:lower:]'` | |
if [ -e $filename ]; then |
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
namespace :db do | |
desc "Migrates the database to the target version, or to the lastest version if no target is given" | |
task :migrate, [:target, :current] => :environment do |t, args| | |
opts = {} | |
opts[:target] = args[:target].to_i if args[:target] | |
opts[:current] = args[:current].to_i if args[:current] | |
Sequel::Migrator.run(DB, "db/migrate", opts) | |
Rake::Task["db:dump"].invoke if Rails.env.development? | |
end |
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
require 'spec_helper' | |
describe Api::V9::Authenticatable, :type => :controller do | |
before do | |
class EndpointsController < ActionController::Base | |
include Api::V9::Authenticatable | |
def index | |
render :text => 'foo' |
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
backend default { | |
.host = "127.0.0.1"; | |
.port = "3000"; | |
} | |
acl admin { | |
"127.0.0.1"; | |
} | |
sub vcl_recv { |
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 |