Skip to content

Instantly share code, notes, and snippets.

View mlabouardy's full-sized avatar
☁️
Subscribe to my newsletter ➡️ https://devopsbulletin.com

LABOUARDY Mohamed mlabouardy

☁️
Subscribe to my newsletter ➡️ https://devopsbulletin.com
View GitHub Profile
@mlabouardy
mlabouardy / komiser-apis.yaml
Created May 12, 2019 16:42
Google APIs to enable
appengine.googleapis.com
bigquery-json.googleapis.com
compute.googleapis.com
cloudfunctions.googleapis.com
container.googleapis.com
cloudresourcemanager.googleapis.com
cloudkms.googleapis.com
dns.googleapis.com
dataflow.googleapis.com
dataproc.googleapis.com
@mlabouardy
mlabouardy / main.go
Created April 16, 2019 21:03
Create BigQuery tables from schema
func handler(ctx context.Context) error {
client, err := bigquery.NewClient(ctx, os.Getenv("PROJECT_ID"))
if err != nil {
return err
}
err = RemoveDataSet(client)
if err != nil {
return err
}
@mlabouardy
mlabouardy / entrypoint.sh
Created April 16, 2019 18:44
load and transform csv to bigquery
#!/bin/bash
echo "Download BigQuery Credentials"
aws s3 cp s3://$GCP_AUTH_BUCKET/auth.json .
echo "Upload CSV to GCS"
mkdir -p csv
rm tables
@mlabouardy
mlabouardy / Dockerfile
Created April 16, 2019 18:43
Install BigQuery on Docker
FROM alpine:latest
LABEL Author mlabouardy
ENV SDK_URL https://dl.google.com/dl/cloudsdk/channels/rapid/google-cloud-sdk.zip
ENV CLOUDSDK_PYTHON_SITEPACKAGES=1
ENV PATH /google-cloud-sdk/bin:$PATH
ENV HOME /
ENV BUILD_DEPS \
g++ \
gcc \
@mlabouardy
mlabouardy / app.py
Created April 16, 2019 18:42
Load csv to BigQuery
import mysql.connector
import os
import time
from mysql.connector import Error
from google.cloud import bigquery
bigquery_client = bigquery.Client()
def mapToBigQueryDataType(columnType):
if columnType.startswith('int'):
@mlabouardy
mlabouardy / Fastfile
Created April 15, 2019 17:38
Fastfile for iOS
default_platform(:ios)
platform :ios do
lane :tests do
scan(
scheme: options[:scheme],
clean: true,
skip_detect_devices: true,
build_for_testing: true,
@mlabouardy
mlabouardy / Jenkinsfile
Last active April 15, 2019 19:09
CI/CD for iOS apps on Jenkins
def bucket = 'mobile-artifacts-foxintelligence'
node('mac') {
try {
stage('Checkout') {
checkout scm
notifySlack('STARTED')
}
stage('Install Dependencies') {
@mlabouardy
mlabouardy / Jenkinsfile
Last active April 15, 2019 20:45
CI/CD for Android app on Jenkins
def bucket = 'mobile-artifacts-foxintelligence'
node('android') {
try {
stage('Checkout') {
checkout scm
notifySlack('STARTED')
}
stage('Clean & Prepare') {
@mlabouardy
mlabouardy / create-subscription.sh
Created January 21, 2019 10:42
Create filter subscription on log group
aws logs put-subscription-filter --log-group-name "/aws/lambda/Fibonacci" \
--filter-name "parse-logs" --filter-pattern '[timestamp=*Z, request_id="*-*", event]' \
--destination-arn "arn:aws:logs:AWS_REGION:ACCOUNT_ID:destination:kinesis-stream"
@mlabouardy
mlabouardy / cloudwatch-destination.sh
Created January 21, 2019 10:40
Create CloudWatch destination to stream logs to Kinesis
aws logs put-destination --destination-name kinesis-stream \
--target-arn "arn:aws:kinesis:AWS_REGION:ACCOUNT_ID:stream/cloudwatch-logs" \
--role-arn "arn:aws:iam::ACCOUNT_ID:role/CloudWatchStreamToKinesisRole"