Skip to content

Instantly share code, notes, and snippets.

View OElesin's full-sized avatar

Olalekan Fuad Elesin OElesin

View GitHub Profile
@srcecde
srcecde / Install ffmpeg & ffprobe on Amazon Linux
Created November 19, 2021 08:19
Install & configure ffmpeg, ffprobe on SageMaker (Amazon Linux)
cd /usr/local/bin
sudo mkdir ffmpeg && cd ffmpeg
# check https://johnvansickle.com/ffmpeg/ for latest build
sudo wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
sudo tar -xf ffmpeg-release-amd64-static.tar.xz
sudo ln -s /usr/local/bin/ffmpeg/ffmpeg-4.4.1-amd64-static/ffmpeg /usr/bin/ffmpeg
sudo ln -s /usr/local/bin/ffmpeg/ffmpeg-4.4.1-amd64-static/ffprobe /usr/bin/ffprobe
@dasgoll
dasgoll / EMR_cluster.template
Created August 3, 2017 08:15
EMR cluster cloudformation template
{
"Conditions": {
"WithSpotPrice": {
"Fn::Not": [
{
"Fn::Equals": [
{
"Ref": "SpotPrice"
},
"0"
@jcbf
jcbf / lambda.py
Last active October 20, 2020 08:26
Make queries to Elasticsearch from a lambda in python
# Run get info from Elasticsearch from AWS Lambda.
from __future__ import print_function
import boto3
import certifi
import yaml
from aws_requests_auth.aws_auth import AWSRequestsAuth
from elasticsearch import Elasticsearch, RequestsHttpConnection
def handler(event, context):
@nmarley
nmarley / dec.py
Last active August 8, 2023 13:55
AWS KMS encryption/decryption using Python/Boto3
import boto3
import base64
if __name__ == '__main__':
session = boto3.session.Session()
kms = session.client('kms')
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw=='
binary_data = base64.b64decode(encrypted_password)
@leonardofed
leonardofed / README.md
Last active April 24, 2024 01:47
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Generating Flame Graphs for Apache Spark

Flame graphs are a nifty debugging tool to determine where CPU time is being spent. Using the Java Flight recorder, you can do this for Java processes without adding significant runtime overhead.

When are flame graphs useful?

Shivaram Venkataraman and I have found these flame recordings to be useful for diagnosing coarse-grained performance problems. We started using them at the suggestion of Josh Rosen, who quickly made one for the Spark scheduler when we were talking to him about why the scheduler caps out at a throughput of a few thousand tasks per second. Josh generated a graph similar to the one below, which illustrates that a significant amount of time is spent in serialization (if you click in the top right hand corner and search for "serialize", you can see that 78.6% of the sampled CPU time was spent in serialization). We used this insight to spee

@yefim
yefim / Dockerrun.aws.json
Last active April 7, 2023 16:11
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<AWS_ACCOUNT_ID>.dkr.ecr.us-east-1.amazonaws.com/<NAME>:<TAG>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "443"
}
@fancellu
fancellu / ConsumerExample.scala
Last active June 28, 2023 15:35
Kafka Producer/Consumer Example in Scala
import java.util
import org.apache.kafka.clients.consumer.KafkaConsumer
import scala.collection.JavaConverters._
object ConsumerExample extends App {
import java.util.Properties
@jkbradley
jkbradley / LDA_SparkDocs
Created March 24, 2015 23:56
LDA Example: Modeling topics in the Spark documentation
/*
This example uses Scala. Please see the MLlib documentation for a Java example.
Try running this code in the Spark shell. It may produce different topics each time (since LDA includes some randomization), but it should give topics similar to those listed above.
This example is paired with a blog post on LDA in Spark: http://databricks.com/blog
Spark: http://spark.apache.org/
*/
import scala.collection.mutable
@arnaldorusso
arnaldorusso / Help_arial_seaborn_tex.py
Created January 20, 2015 15:54
Help Arial font Seaborn using Tex
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import seaborn as sns
# This line is a patch to Seaborn deal with mpl last version.
# sns.set_context(rc={'lines.markeredgewidth': 0.1}) # deal with mpl markers
xs = np.arange(200)