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
--Dropping schema public | |
DROP SCHEMA public CASCADE; | |
-- Removing access from other users | |
REVOKE connect ON DATABASE ${dbName} FROM PUBLIC; | |
-- Creating schema | |
CREATE SCHEMA ${schemaName} AUTHORIZATION ${userName}; | |
-- Grant privileges for user on schema | |
GRANT ALL ON ALL TABLES IN SCHEMA ${schemaName} TO ${userName}; | |
GRANT ALL ON ALL SEQUENCES IN SCHEMA ${schemaName} TO ${userName}; | |
/*=== To set default privileges for future objects ===*/ |
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 boto3 | |
region = 'us-west-2' | |
def lambda_handler(event, context): | |
instances = event['instance'] | |
ec2 = boto3.client('ec2', region_name=region) | |
ec2.start_instances(InstanceIds=[instances]) | |
print 'stopped your instances: ' + str(instances) |
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 boto3 | |
region = 'us-west-2' | |
instances = ['i-091e60ababe060baa'] | |
def lambda_handler(event, context): | |
ec2 = boto3.client('ec2', region_name=region) | |
ec2.stop_instances(InstanceIds=instances) | |
print 'Desligando a Instancia: ' + str(instances) | |
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": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents" | |
], |
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
library(tidyverse) | |
library(summarytools) | |
df <- churn %>% | |
mutate_if(sapply(churn, is.character), as.factor) %>% | |
mutate_if(sapply(churn, is.double), as.factor) | |
dfSummary(df, style = "grid", justify = "r", round.digits = 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
const express = require("express"); | |
const app = express(); | |
app.get("/apis", (req, res) => { | |
let get = app._router.stack.filter(r => r.route && r.route.methods.get).map(r => r.route.path); | |
let post = app._router.stack.filter(r => r.route && r.route.methods.post).map(r => r.route.path); | |
let put = app._router.stack.filter(r => r.route && r.route.methods.put).map(r => r.route.path); | |
let del = app._router.stack.filter(r => r.route && r.route.methods.del).map(r => r.route.path); | |
res.send({ "get": get, "post": post, "delete": del, "put": put}); | |
}); |
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
select table_schema, | |
table_name, | |
ordinal_position as position, | |
column_name, | |
data_type, | |
case when character_maximum_length is not null | |
then character_maximum_length | |
else numeric_precision end as max_length, | |
is_nullable, | |
column_default as default_value |
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 RECURSIVE subordinates AS ( | |
SELECT | |
ur.user_id, | |
ur.owner_id | |
FROM | |
users.user_roles ur | |
WHERE | |
ur.user_id = 87 --DESIRED USER ID | |
UNION | |
SELECT |