Skip to content

Instantly share code, notes, and snippets.

View philippefutureboy's full-sized avatar
🎆
Expanding

Philippe Hebert philippefutureboy

🎆
Expanding
View GitHub Profile
@philippefutureboy
philippefutureboy / _expressions.py
Created August 26, 2023 17:45
TagSkipPythonOperator Implementation
r"""
@source https://github.com/pytest-dev/pytest/blob/main/src/_pytest/mark/expression.py
Evaluate match expressions, as used by `-k` and `-m`.
The grammar is:
expression: expr? EOF
expr: and_expr ('or' and_expr)*
and_expr: not_expr ('and' not_expr)*
@philippefutureboy
philippefutureboy / airflow-scheduler.log
Last active March 19, 2022 03:16
apache/airflow #22282 gist
/home/airflow/.local/lib/python3.8/site-packages/airflow/configuration.py:357 DeprecationWarning: The dag_concurrency option in [core] has been renamed to max_active_tasks_per_dag - the old setting has been used, but please update your config.
/home/airflow/.local/lib/python3.8/site-packages/airflow/configuration.py:357 DeprecationWarning: The processor_poll_interval option in [scheduler] has been renamed to scheduler_idle_sleep_time - the old setting has been used, but please update your config.
/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/cli.py:149 SAWarning: relationship 'DagRun.serialized_dag' will copy column serialized_dag.dag_id to column dag_run.dag_id, which conflicts with relationship(s): 'BaseXCom.dag_run' (copies xcom.dag_id to dag_run.dag_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are part
@philippefutureboy
philippefutureboy / Pipfile
Last active March 25, 2020 00:29
pyenv + pipenv: Linting fails: E0401 Unable to import <module> (import-error)
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[scripts]
start = "python main.py"
[dev-packages]
pylint = "*"
@philippefutureboy
philippefutureboy / RollupOrderedDrilldownTable.jsx
Created January 14, 2020 01:07
Cube.js Client Wrapper Gist
import React from 'react';
import * as R from 'ramda';
import cube from '../../utils/cube';
import TableContainer from './Table';
import { getAllResultSetDataFromResultSetDict } from '../../utils/cube.utils';
import {
sortByRowRollupValue,
sumColumnRollupRecordsToGrandTotalRecord,
} from '../helpers/rollupOrderedPatientAgeGroupDrilldownTableHelpers';
@philippefutureboy
philippefutureboy / cognitoForceResetPassword.js
Created September 18, 2019 20:36
Node.js script using AWS-Amplify to automatically force reset password for admin-generated cognito users
/**
* Example command:
./node_modules/.bin/cross-env \
COGNITO_REGION=ca-central \
COGNITO_USERPOOL_ID=userpool_id \
COGNITO_CLIENT_ID=client_id \
COGNITO_USER_USERNAME=username \
COGNITO_USER_INITIAL_PASSWORD=pass \
COGNITO_USER_NEW_PASSWORD=newpass \
COGNITO_USER_EMAIL=email \
@philippefutureboy
philippefutureboy / cognito.test.js
Created September 18, 2019 20:34
e2e test for cognito-express
/* eslint-disable vars-on-top */
global.fetch = require('node-fetch');
const Amplify = require('aws-amplify');
const jwt = require('jsonwebtoken');
const { authenticationMiddleware } = require('./cognito');
const {
COGNITO_USER_EXPIRED_TOKEN,
COGNITO_USER_IMPROPERLY_FORMATTED_TOKEN,
} = process.env;
cube_1 | 🚀 Cube.js server is listening on 4000
cube_1 | {"message":"Load Request","query":"{\"measures\":[\"Orders.totalAmount\"],\"dimensions\":[\"Orders.status\"],\"order\":{\"Orders.status\":\"desc\"},\"renewQuery\":true}","authInfo":{"databaseName":"96ffad74cf0452e89e0bde1a96c94c90","iat":1562792645,"exp":1565384645}}
cube_1 | {"message":"Compiling schema","version":"default_schema_version"}
cube_1 | {"message":"Query started","query":"SELECT `orders`.status `orders.status`, sum(`orders`.amount) `orders.total_amount` FROM Orders AS `orders` GROUP BY 1 ORDER BY 1 DESC LIMIT 10000","params":[]}
cube_1 | {"message":"Requested renew","cacheKey":["SELECT\n `orders`.status `orders.status`, sum(`orders`.amount) `orders.total_amount`\n FROM\n Orders AS `orders`\n GROUP BY 1 ORDER BY 1 DESC LIMIT 10000",[],[]]}
cube_1 | {"message":"Missing cache for","cacheKey":["select count(*) from Orders AS `orders`",[]]}
cube_1 | {"message":"Added to queue","priori
@philippefutureboy
philippefutureboy / axios.js
Created June 20, 2019 18:18
MockAxios with call operator support
const defaultResponse = { data: {} };
class ExtensibleFunction extends Function {
constructor(f) {
return Object.setPrototypeOf(f, new.target.prototype);
}
}
export class MockAxios extends ExtensibleFunction {
static instances = new WeakMap();
var AJV = require('ajv');
var schema = {
"properties": {
"name": { "type": "string" },
"type": { "type": "string" },
"constraints": {
"properties": {
"PRIMARY_KEY": { "type": "boolean" },
"FOREIGN_KEY": {
@philippefutureboy
philippefutureboy / karma.conf.js
Created February 3, 2018 14:10
DefinePlugin karma-webpack configuration
'use strict'
// Set BABEL_ENV to use proper preset config
process.env.NODE_ENV = 'test'
process.env.BABEL_ENV = 'test'
const path = require('path')
const merge = require('webpack-merge')
const webpack = require('webpack')