Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

WITH
preprocessed_orders AS (
SELECT
*
FROM (
SELECT
nozzle_customer_name,
customer_id,
amazon_order_id,
item_promotion_discount,
import requests
from datetime import datetime
from requests_aws4auth import AWS4Auth
endpoint = "https://sellingpartnerapi-na.amazon.com"
TOKEN_URL = "https://sellingpartnerapi-na.amazon.com/authorization/v1/authorizationCode"
ACCESS_ID = ""
SECRET_ID = ""
if __name__ == "__main__":
#!/usr/bin/env python
from nozzle.spapi.client import MARKETPLACES, REGIONS, create_sigv4_session
NA_AUTH_URI = "https://api.amazon.com/auth/o2/token"
EU_AUTH_URI = "https://api.amazon.co.uk/auth/o2/token"
FE_AUTH_URI = "https://api.amazon.co.jp/auth/o2/token"
REGION = "NA"
ACCESS_KEY = ""
SECRET_KEY = ""
#!/usr/bin/env python
import os
from urllib.parse import urlencode
import requests
from nozzle.spapi.client import REGIONS, create_sigv4_session
NA_AUTH_URI = "https://api.amazon.com/auth/o2/token"
EU_AUTH_URI = "https://api.amazon.co.uk/auth/o2/token"
FE_AUTH_URI = "https://api.amazon.co.jp/auth/o2/token"
@chespinoza
chespinoza / weather_polybar.py
Created December 1, 2021 00:06
Python script for fetching openweathermap data for polybar
#!/usr/bin/env python
# Author: chespinoza@gmail.com @2021
import argparse
import urllib.request as request
import urllib.parse as parse
import json
import subprocess
ICON_MAP = {
@chespinoza
chespinoza / i3-shortcuts-screenshot.md
Created November 10, 2021 18:14 — forked from dianjuar/i3-shortcuts-screenshot.md
My i3 shortcuts to take screenshots

Requirements

  • maim
  • xclip

Set-up

Set this on your i3 config file ~/.i3/config

# Screenshots
@chespinoza
chespinoza / gator.md
Created September 3, 2021 12:10
Gator

What is Gator?

Gator is a convenient wrapper around procrastinate which provides a basic web UI through a starlette app which can be used to extend functionality, for instance adding endpoints to trigger tasks asynchronously.

What is a task in Gator's terms?

Gator Tasks are basically a Python script file which lives into the task/ folder, they share the same Gator's namespace, therefore dependencies for new tasks will be installed as Gator dependencies, a nozzle_vendorised folder is included on Gator's namespace so the python modules it contains can be shared between tasks, in the same way it could be added other folders to share common code between tasks.

Once a new task is added, Gator needs to be restarted in order to load it.

Add the following in .zshrc:
...
plugins=(osx git zsh-autosuggestions zsh-syntax-highlighting zsh-nvm docker kubectl)
...
### Fix slowness of pastes with zsh-syntax-highlighting.zsh
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
from __future__ import annotations
import functools
import gzip
import json
from time import sleep, time as now
from typing import List
import requests
import os
from urllib import parse
import boto3
import requests
from aws_requests_auth.aws_auth import AWSRequestsAuth
from dotenv import load_dotenv
NA_AUTH_URI = "https://api.amazon.com/auth/o2/token"