Skip to content

Instantly share code, notes, and snippets.

View juliensimon's full-sized avatar

Julien Simon juliensimon

View GitHub Profile
@juliensimon
juliensimon / Spark5.java
Last active August 29, 2015 14:20
Spark5.java - no lambda
PairFunction<String, String, String> keyFunc =
new PairFunction<String, String, String>() {
public Tuple2<String, String> call(String x) {
return new Tuple2<String, String>(x.split(" ")[0], x.split(" ")[1]);
}
};
JavaPairRDD<String, String> pairRDD = inputRDD.mapToPair(keyFunc);
@juliensimon
juliensimon / Spark5.java
Created May 11, 2015 20:33
Spark5.java - lamba
JavaPairRDD<String, String> pairRDD =
inputRDD.mapToPair(x-> new Tuple2<String,String>(x.split(" ")[0], x.split(" ")[1]));
#!/bin/bash
# Author: Julien Simon <[email protected]>
# ECS tool in the spirit of ecs-cli :)
# default cluster should be configured : ecs-cli configure
if [ -z $1 ]
then
echo "ecs-find services : list services running on the current cluster"
#!/bin/bash
# Author: Julien Simon <[email protected]>
# Connect to a Redshift cluster using psql
if ([ -z $1 ] || [ -z $2 ] || [ -z $3 ])
then
echo "Usage: psqlRedshift CLUSTER_NAME DATABASE_NAME USER_NAME"
exit
AWS re:Invent 2014 | (MBL202) NEW LAUNCH: Getting Started with AWS Lambda
https://www.youtube.com/watch?v=UFj27laTWQA
AWS re:Invent 2015 | (DEV203) Amazon API Gateway & AWS Lambda to Build Secure and Scalable APIs
https://www.youtube.com/watch?v=ZBxWZ9bgd44
AWS re:Invent 2015 | (DVO209) JAWS: The Monstrously Scalable Serverless Framework
https://www.youtube.com/watch?v=D_U6luQ6I90
https://github.com/serverless/serverless
@juliensimon
juliensimon / polly.py
Created December 1, 2016 01:32
Polly
import os, boto3
defaultRegion = 'us-east-1'
defaultUrl = 'https://polly.us-east-1.amazonaws.com'
def connectToPolly(regionName=defaultRegion, endpointUrl=defaultUrl):
return boto3.client('polly', region_name=regionName, endpoint_url=endpointUrl)
def speak(polly, text, format='mp3', voice='Brian'):
resp = polly.synthesize_speech(OutputFormat=format, Text=text, VoiceId=voice)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, boto3
defaultRegion = 'us-east-1'
defaultUrl = 'https://polly.us-east-1.amazonaws.com'
def connectToPolly(regionName=defaultRegion, endpointUrl=defaultUrl):
return boto3.client('polly', region_name=regionName, endpoint_url=endpointUrl)
***
*** Inscrivez vous aux webinaires 2017 : https://attendee.gotowebinar.com/register/7239291589398918401
***
Webinaire "Présentation des principaux services AWS" :
https://www.youtube.com/watch?v=FC--jteXU_8
http://www.slideshare.net/JulienSIMON5/presentation-des-services-aws
Webinaire "Modèle de sécurité AWS" :
https://www.youtube.com/watch?v=1QeKH-5nTIc
@juliensimon
juliensimon / gist:e17e6179b5bfa91c35ae6e2b23ae7e31
Last active November 22, 2022 16:58
Create Athena table for GDELT
CREATE EXTERNAL TABLE IF NOT EXISTS gdelt.events (
`globaleventid` INT,`day` INT,`monthyear` INT,`year` INT,`fractiondate` FLOAT,
`actor1code` string,`actor1name` string,`actor1countrycode` string,`actor1knowngroupcode` string,
`actor1ethniccode` string,`actor1religion1code` string,`actor1religion2code` string,
`actor1type1code` string,`actor1type2code` string,`actor1type3code` string,
`actor2code` string,`actor2name` string,`actor2countrycode` string,`actor2knowngroupcode` string,
`actor2ethniccode` string,`actor2religion1code` string,`actor2religion2code` string,
`actor2type1code` string,`actor2type2code` string,`actor2type3code` string,
`isrootevent` BOOLEAN,`eventcode` string,`eventbasecode` string,`eventrootcode` string,
`quadclass` INT,`goldsteinscale` FLOAT,`nummentions` INT,`numsources` INT,`numarticles` INT,`avgtone` FLOAT,
@juliensimon
juliensimon / queries.sql
Last active February 27, 2022 09:21
GDELT queries
-- Count total events
SELECT COUNT(*) as nb_events FROM gdelt.events;
nb_events
440374991
-- Find the number of events per year
SELECT year,
COUNT(globaleventid) AS nb_events
FROM gdelt.events