Skip to content

Instantly share code, notes, and snippets.

Avatar

Mauricio Klein mauricioklein

View GitHub Profile
View jekyll-scheduled-action.yml
name: Daily Build
on:
# Trigger build manually
workflow_dispatch:
# Runs every day at 3pm GMT
schedule:
- cron: '0 15 * * *'
View s3-remediation.yaml
AWSTemplateFormatVersion: 2010-09-09
Description: S3 bucket remediation automation using AWS Config and AWS Service Manager
Parameters:
Versioning:
Type: String
AllowedValues: [ "true", "false" ]
Default: "true"
@mauricioklein
mauricioklein / check-ebs-snapshots.sh
Created Aug 11, 2019
Script to check EBS snapshots vulnerability
View check-ebs-snapshots.sh
#!/bin/bash
#
# RUN:
# AWS_PROFILE=[profile] AWS_REGION=[region] ./check-ebs-snapshots.sh
#
AWS_ACCOUNT_ID=$(aws sts get-caller-identity --output text --query 'Account')
snapshots=$(aws ec2 describe-snapshots \
View exercise_1.ts
const uuidv1 = require('uuid/v1');
class OrderId {
id: string
constructor(id: string) {
this.id = id
}
static fromString(id: string): OrderId {
View ncco_service_approval.json
[
{
"action": "talk",
"text": "Hello! This is an automated call from ACME company.",
"voiceName": "Brian",
"bargeIn": false
},
{
"action": "talk",
"text": "Please confirm the service request for Max Mustermann, PNR: B, C, X, 4, 5, 1, 3.",
View api.js
import request from 'superagent';
export const getWeatherForCity = (city, country) => {
return new Promise((resolve, reject) => {
request
.get('http://api.openweathermap.org/data/2.5/weather')
.query({
q: `${city},${country}`,
units: 'metric',
APPID: 'ABC123'
@mauricioklein
mauricioklein / routes.js
Last active Nov 21, 2016
Server side rendering <noscript>
View routes.js
import React from 'react';
import {Route, Redirect} from 'react-router';
import {
App,
NotFound,
Panel
} from 'containers';
export default () => {
return (
@mauricioklein
mauricioklein / anagram.rb
Last active Oct 6, 2016
Anagram generator
View anagram.rb
#
# ANAGRAM GENERATOR
#
# Author: Mauricio Klein (mauricio [dot] klein [dot] msk [at] gmail [dot] com)
# Date: October 6th, 2016
#
#
# USAGE:
# $ ruby anagram.rb <a word>
@mauricioklein
mauricioklein / friend.rb
Created Sep 12, 2016
Rom Repository relation
View friend.rb
require 'equalizer'
require 'dry/data'
module Entities
class Friend < Dry::Data::Struct
include Equalizer.new(:id, :source_id, :target_id)
attribute :id, 'int'
attribute :source_id, 'int'
attribute :target_id, 'int'
View command.rb
module Persistence
module Commands
class CreateUserCompany < ROM::Commands::Create[:sql]
input Dry::Data['hash'].schema(
user_id: 'int',
company_id: 'int'
)
relation :user_company
register_as :create