Skip to content

Instantly share code, notes, and snippets.

@edgarrmondragon
edgarrmondragon / Disinfectants for Coronavirus.ipynb
Last active March 15, 2020 05:19
[Disinfectants for Coronavirus] #cov #covid19
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edgarrmondragon
edgarrmondragon / serverless.yaml
Last active February 21, 2020 13:26
Serverless SSM
service: my-simple-lambda
provider:
name: aws
runtime: python3.7
custom:
myVar: ${ssm:/path/to/myVar}
package:
@edgarrmondragon
edgarrmondragon / keybase.md
Created January 20, 2020 17:19
Keybase proof

Keybase proof

I hereby claim:

  • I am edgarrmondragon on github.
  • I am edgarrmondragon (https://keybase.io/edgarrmondragon) on keybase.
  • I have a public key ASAyrg5lD7ZDcJQ0JAqTKn3fwJ2vgR5SurYejl3cm9Zkswo

To claim this, I am signing this object:

@edgarrmondragon
edgarrmondragon / row_size.sql
Created January 17, 2020 17:18
[Disk usage per row in Postgres] Computes how much disk space each row in a table uses in average #sql #postgresql
SELECT pg_relation_size('"my_schema"."my_table"') / COUNT(*)
FROM "my_schema"."my_table";
@edgarrmondragon
edgarrmondragon / order.md
Created December 26, 2019 01:11
[SQL] #sql #rdbms

Processing Order of SQL syntax

  1. FROM
  2. ON
  3. JOIN
  4. WHERE
  5. GROUP BY
  6. HAVING
  7. SELECT
  8. DISTINCT
@edgarrmondragon
edgarrmondragon / server_side_cursor.ipynb
Last active December 20, 2019 18:42
[Server-side cursors] Using named cursors for a smaller memory footprint with psycopg2 #sql #postgres #profiling #etl
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@edgarrmondragon
edgarrmondragon / compare-ga.sql
Last active December 18, 2019 18:56
[Compare Google Analytics into PostgreSQL pipelines] check if differently built pipelines for getting data from Google Analytics into Postgres, yield the same results. #sql #data-pipeline #google-analytics
SELECT t1."ga:pageviews" - t2."ga:pageviews"
FROM staging.ga_hotspot_views t1
JOIN staging.ga_hotspot_views t2
ON t1."ga:dimension3" = t2."ga:dimension3"
AND t1."ga:date" = t2."ga:date"
WHERE t1."ga:pageviews" - t2."ga:pageviews" > 0
@edgarrmondragon
edgarrmondragon / test_sns.py
Created November 12, 2019 23:00
Unit Testing SNS
def publish_event(payload, sns, topic_arn):
"""Publish a SendGrid event to an SNS topic.
:param payload: Payload.
:type payload: dict
:param sns: SNS boto3 client.
:type sns: botocore.client.SNS
:param topic_arn: The Topic's arn identifier.
:type topic_arn: str
"""
@edgarrmondragon
edgarrmondragon / limesurvey.py
Created October 20, 2019 21:21
Small python script to pull data from LimeSurvey's RemoteControl 2 API using requests and pandas
import json
import io
import base64
import requests
import pandas as pd
URL = 'http://localhost:8080/index.php/admin/remotecontrol'
get_session_key = {
@edgarrmondragon
edgarrmondragon / Anscombe.ipynb
Created October 7, 2019 03:51
Anscombe's Quartet
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.