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 / prompt.md
Last active January 11, 2018 22:21
Prompt with git branch and last command exit code (smiley)

Prompt with git branch and last command exit code (smiley)

screen shot 2018-01-11 at 23 18 59

Add this to the bottom of ~/.bash_profile file.

# Prompt
parse_git_branch() {
 git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
@kstromeiraos
kstromeiraos / cloudSqlDump.py
Last active January 30, 2018 18:21
Python script to create a dump of a Google Cloud SQL DB and import it into another DB
import google.cloud.storage
import random
from subprocess import call
projectId = 'YOUR_PROJECT_ID';
bucketName = 'sqldumpbucket-' + str(random.randint(100000, 999999));
exportDbInstance = 'YOUR_EXPORT_DB_INSTANCE';
exportDbServiceAccount = 'YOUR_EXPORT_DB_SERVICE_ACCOUNT';
exportDbName = 'YOUR_EXPORT_DB_NAME'
@kstromeiraos
kstromeiraos / create_user_wasabi.md
Last active August 29, 2018 15:11
Create user Wasabi

Edit userDirectory file on Wasabi container

docker exec -it wasabi-main bash -c 'vi $(echo "$WASABI_HOME")/conf/userDirectory.properties'

Clean and restart wasabi

cd wasabi && ./bin/wasabi.sh clean && docker restart wasabi-main

@kstromeiraos
kstromeiraos / redash_upgrade.md
Last active May 8, 2018 11:11
Upgrade Redash from v3 to v4

Upgrade from Redash v3 to v4

  1. Change Docker image tag
  2. Connect to redash server container: docker exec -it redash_server bash
  3. sudo su redash
  4. set -a; . /opt/redash.env; set +a
  5. bin/run ./manage.py db upgrade
@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
@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 / 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 / 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 */;

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 / 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