Skip to content

Instantly share code, notes, and snippets.

View kstromeiraos's full-sized avatar
🏠
Working from home

Jose López kstromeiraos

🏠
Working from home
View GitHub Profile
@kstromeiraos
kstromeiraos / regexCheatsheet.js
Created September 9, 2019 14:30 — forked from sarthology/regexCheatsheet.js
A regex cheatsheet 👩🏻‍💻 (by Catherine)
let regex;
/* matching a specific string */
regex = /hello/; // looks for the string between the forward slashes (case-sensitive)... matches "hello", "hello123", "123hello123", "123hello"; doesn't match for "hell0", "Hello"
regex = /hello/i; // looks for the string between the forward slashes (case-insensitive)... matches "hello", "HelLo", "123HelLO"
regex = /hello/g; // looks for multiple occurrences of string between the forward slashes...
/* wildcards */
regex = /h.llo/; // the "." matches any one character other than a new line character... matches "hello", "hallo" but not "h\nllo"
regex = /h.*llo/; // the "*" matches any character(s) zero or more times... matches "hello", "heeeeeello", "hllo", "hwarwareallo"
@kstromeiraos
kstromeiraos / create_standard_postgres_rds.md
Last active March 16, 2021 15:55
Create a standard user for a RDS DB instance running PostgreSQL

Create standard role

CREATE ROLE api;   

Grant access to all existing tables/sequences/functions

GRANT ALL PRIVILEGES ON SCHEMA public to api;
@kstromeiraos
kstromeiraos / create_read_only_postgres_rds.md
Created October 29, 2018 12:09
Create a read-only user for a RDS DB instance running PostgreSQL

Create read_only role

CREATE ROLE readonly;   

Grant access to all existing tables

GRANT CONNECT ON DATABASE  TO readonly;
@kstromeiraos
kstromeiraos / create_master_postgres_rds.md
Last active October 29, 2018 12:06
Create master user for a RDS DB instance running PostgreSQL

Create user

CREATE ROLE master_user WITH PASSWORD 'password' LOGIN;   

Grant rds_superuser role to user

GRANT rds_superuser TO master_user; 
@kstromeiraos
kstromeiraos / ec2ssh.py
Created September 10, 2018 11:51
Python script to list EC2 running instances and their private IPs
#!/usr/bin/env python
'''
List EC2 running instances and their private IPs
'''
import boto3
import sys
from subprocess import call
import argparse

Keybase proof

I hereby claim:

  • I am kstromeiraos on github.
  • I am kstromeiraos (https://keybase.io/kstromeiraos) on keybase.
  • I have a public key ASCTasJGEED-yZwVMjyVzSRymkrGlZH6gEWi51kW3DQZZAo

To claim this, I am signing this object:

@kstromeiraos
kstromeiraos / wasabi_mysql_dump.sql
Created August 2, 2018 21:32
Dump of MySQL DB generated by Wasabi
-- MySQL dump 10.13 Distrib 5.6.41, for Linux (x86_64)
--
-- Host: localhost Database: wasabi
-- ------------------------------------------------------
-- Server version 5.6.41
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
@kstromeiraos
kstromeiraos / create_read_only_user_redshift.sql
Created May 28, 2018 16:23
Create a read-only user on Redshift
-- Create Read-Only Group
CREATE GROUP ro_group;
-- Create User
CREATE USER ro_user WITH password 'XXX';
-- Add User to Read-Only Group
@kstromeiraos
kstromeiraos / deploy_wasabi.md
Last active August 17, 2018 15:40
Deploy Wasabi (Intuit) using a remote Cassandra cluster and RDS

Deploy Wasabi using a remote Cassandra cluster and RDS

What's Wasabi?

Wasabi is a real-time, 100% API driven, A/B Testing platform. The platform offers companies and individuals the opportunity to perform experiments on the web, mobile and desktop for back-end and front-end, products and marketing.

Do you want to know more? Meet Wasabi, an Open Source A/B Testing Platform

Architecture behind Wasabi

@kstromeiraos
kstromeiraos / dump_restore_wasabi.md
Last active August 14, 2018 11:24
Dump/restore Cassandra and MySQL data for Wasabi

Dump/restore Cassandra and MySQL data for Wasabi

If you have an existing installation of Wasabi on Docker containers and you want to save existing data, follow these steps.

Dump/restore Cassandra data

docker exec -ti wasabi-cassandra bash
apt update && apt install -y git python-pip && pip install cassandra-driver && git clone https://github.com/gianlucaborello/cassandradump && cd cassandradump && python cassandradump.py --keyspace wasabi_experiments --export-file wasabi_cassandra_dump.cql
exit