Skip to content

Instantly share code, notes, and snippets.

View mistercrunch's full-sized avatar

Maxime Beauchemin mistercrunch

View GitHub Profile
name economy (mpg) cylinders displacement (cc) power (hp) weight (lb) 0-60 mph (s) year
AMC Ambassador Brougham 13 8 360 175 3821 11 73
AMC Ambassador DPL 15 8 390 190 3850 8.5 70
AMC Ambassador SST 17 8 304 150 3672 11.5 72
AMC Concord DL 6 20.2 6 232 90 3265 18.2 79
AMC Concord DL 18.1 6 258 120 3410 15.1 78
AMC Concord DL 23 4 151 3035 20.5 82
AMC Concord 19.4 6 232 90 3210 17.2 78
AMC Concord 24.3 4 151 90 3003 20.1 80
AMC Gremlin 18 6 232 100 2789 15 73
@mistercrunch
mistercrunch / vimrc
Last active July 29, 2016 21:06
vimrc
filetype plugin indent on
set colorcolumn=80
set nobackup
set nowritebackup
set noswapfile
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
set autoindent
@mistercrunch
mistercrunch / gist:91d90ab05af77c76e1f9
Created June 15, 2015 19:27
Airflow plugin example
from airflow.hooks.base_hook import BaseHook
from airflow.models import BaseOperator
from airflow.executors.base_executor import BaseExecutor
from airflow import AirflowViewPlugin, AirflowMacroPlugin
from flask_admin import expose
class PluginHook(BaseHook):
pass
class PluginOperator(BaseOperator):
def stage_check_exchange(
task_id_prefix,
hql_stage,
sql_check,
exchange_statement,
default_args):
'''
Used to abstract the common pattern of:
* loading into a staging
* performing data quality checks
SELECT generate_aggregate_2_filters( 'video_views_102384', '2016-06-01 00:00:00', '{ ds }' ,'viewer_application_name','viewer_os_version');
should be
SELECT generate_aggregate_2_filters( 'video_views_102384', '2016-06-01 00:00:00', ds ,'viewer_application_name','viewer_os_version');
SELECT generate_aggregate_2_filters( 'video_views_102384', '2016-06-01 00:00:00', '{ ds }' ,'viewer_application_name','viewer_os_version');
should be
SELECT generate_aggregate_2_filters( 'video_views_102384', '2016-06-01 00:00:00', ds ,'viewer_application_name','viewer_os_version');
node_modules/eslint/bin/eslint.js --ignore-path=.eslintignore --ext .js . javascripts/SqlLab/components/*.jsx

Airflow recap since 1.7.1 (Jun 23rd)

  • 243 PRs by 61 committers
  • 437 messages on the mailing list
  • 40 companies
  • Upcoming unsolicited talk: "A Practical Introduction to Airflow" at PyBay by MattDavis (Clover health)

No wonder it's hard to keep up!

Committers with 1 + Commit

Airflow recap since 1.7.1 (Jun 23rd)

  • 243 PRs by 61 committers
  • 437 messages on the mailing list
  • 40 companies
  • Upcoming unsolicited talk: "A Practical Introduction to Airflow" at PyBay by MattDavis (Clover health)

No wonder it's hard to keep up!

Committers with 1 + Commit

class AirbnbAuthRemoteUserView(AuthRemoteUserView):
def add_role_if_missing(self, sm, user_id, role_name):
found_role = sm.find_role(role_name)
session = sm.get_session
user = session.query(sm.user_model).get(user_id)
if found_role and found_role not in user.roles:
user.roles += [found_role]
session.commit()