Skip to content

Instantly share code, notes, and snippets.

View maximepeschard's full-sized avatar

Maxime Peschard maximepeschard

View GitHub Profile
@ian-whitestone
ian-whitestone / notes.md
Last active March 1, 2023 01:45
Best practices for presto sql

Presto Specific

  • Don’t SELECT *, Specify explicit column names (columnar store)
  • Avoid large JOINs (filter each table first)
    • In PRESTO tables are joined in the order they are listed!!
    • Join small tables earlier in the plan and leave larger fact tables to the end
    • Avoid cross joins or 1 to many joins as these can degrade performance
  • Order by and group by take time
    • only use order by in subqueries if it is really necessary
  • When using GROUP BY, order the columns by the highest cardinality (that is, most number of unique values) to the lowest.
@janniks
janniks / prepare-commit-msg.sample
Last active September 29, 2019 19:17
MOVED https://github.com/janniks/prepare-commit-msg - Automatically prefix commit messages with the current branches issue number
MOVED TO:
https://github.com/janniks/prepare-commit-msg
@gVallverdu
gVallverdu / capp_treemaps.py
Last active October 3, 2023 16:52
Treemaps with python and matplotlib
#!/usr/bin/env python3
# coding: utf-8
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import squarify
import platform
# print versions
@niranjv
niranjv / change_lambda_logger_format.py
Last active February 7, 2024 11:03
Change Python logger format in AWS Lambda
# Python logger in AWS Lambda has a preset format. To change the format of the logging statement,
# remove the logging handler & add a new handler with the required format
import logging
import sys
def setup_logging():
logger = logging.getLogger()
for h in logger.handlers:
logger.removeHandler(h)
@eprev
eprev / QLMarkdown.md
Last active January 25, 2021 22:08
GitHub Markdown style for QLMarkdown

GitHub Markdown style for QLMarkdown

Based on GitHub Markdown CSS.

Installation:

  1. Got to /Library/Quick Look or ~/Library/Quick Look and find QLMarkdown.qlgenerator.
  2. Open contextual menu for it and choose Show Package Contents.
  3. Go to Contents/Resources and find styles.css.
  4. Open it and replace its contents with the contents of this Gist.
@angstwad
angstwad / dict_merge.py
Last active March 1, 2024 23:53
Recursive dictionary merge in Python
# Copyright 2016-2022 Paul Durivage
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@JamesMGreene
JamesMGreene / gitflow-breakdown.md
Last active July 3, 2024 20:30
`git flow` vs. `git`: A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@subelsky
subelsky / large_redshift_tables.sql
Created April 18, 2014 17:39
Quick SQL command to find large tables in redshift
-- based on http://stackoverflow.com/questions/21767780/how-to-find-size-of-database-schema-table-in-redshift
SELECT name AS table_name, ROUND((COUNT(*) / 1024.0),2) as "Size in Gigabytes"
FROM stv_blocklist
INNER JOIN
(SELECT DISTINCT id, name FROM stv_tbl_perm) names
ON names.id = stv_blocklist.tbl
GROUP BY name
ORDER BY "Size in Gigabytes" DESC
@magicznyleszek
magicznyleszek / jekyll-and-liquid.md
Last active January 12, 2024 03:46
Jekyll & Liquid Cheatsheet

Jekyll & Liquid Cheatsheet

A list of the most common functionalities in Jekyll (Liquid). You can use Jekyll with GitHub Pages, just make sure you are using the proper version.

Running

Running a local server for testing purposes: