Skip to content

Instantly share code, notes, and snippets.

@mpatek
mpatek / keybase.md
Created December 3, 2019 22:08
keybase.md

Keybase proof

I hereby claim:

  • I am mpatek on github.
  • I am mpatek (https://keybase.io/mpatek) on keybase.
  • I have a public key ASAGFEaSubZp_Vyk423eaJMeP7YTkNsERx-7z0c2y5mmZQo

To claim this, I am signing this object:

@mpatek
mpatek / looker-pdf-usage.txt
Created May 29, 2019 17:59
looker-pdf.py Usage
Usage: looker-pdf.py [OPTIONS] CONFIG_FILE OUTPUT_FILE
Options:
—base-url TEXT [required]
—client-id TEXT [required]
—client-secret TEXT [required]
—debug Show logging output.
—help Show this message and exit.
@mpatek
mpatek / config.json
Created May 29, 2019 17:53
looker-pdf.py config file example
{
"dashboard_args": [
{
"dashboard_id": 1,
"dashboard_style": "single_column",
"dashboard_filters": "foo=bar&baz=qux"
},
{
"dashboard_id": 2
}
@mpatek
mpatek / api_client.py
Created January 17, 2019 17:38
Adding a decode parameter to Swagger-generated Looker API Python SDK
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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
@mpatek
mpatek / rq_deps_switch.py
Created January 19, 2017 16:24
Switch RQ job dependencies from one job to another
import functools
import os
import redis
import rq
from rq.job import Job
def _switch_job_dependencies(
pipeline,
@mpatek
mpatek / rq_multi.py
Last active January 18, 2017 13:53
Define multi-job dependencies in rq
import functools
import os
from typing import List
import uuid
import redis
import rq
def is_last_parent_job(
@mpatek
mpatek / engagement_api.py
Created November 3, 2016 13:19
Twitter data API client using tweepy
import json
from tweepy.binder import bind_api
from tweepy.parsers import JSONParser
class EngagementAPI:
def __init__(
self,
auth=None,
@mpatek
mpatek / counted.py
Last active December 23, 2015 13:06
Call count decorator
import functools
def counted(fn):
"""
Decorator for counting the number of calls to a function.
Parameters:
fn: A function
"""
@mpatek
mpatek / pickled.py
Created September 9, 2015 14:19
pickled decorator with path/key_fn options
from functools import wraps
import hashlib
import os
import pickle
def _key_fn(a, k):
return hashlib.md5(pickle.dumps((a, k))).hexdigest()