Skip to content

Instantly share code, notes, and snippets.

View rednafi's full-sized avatar
🏠
Working from home

Redowan Delowar rednafi

🏠
Working from home
View GitHub Profile
@rednafi
rednafi / src.js
Last active December 22, 2022 20:25
Get provider attributes from GET orders/ endpoint
// Must update the USERNAME, PASSWORD, and ORDER_CODE variables.
const USERNAME = "<your-username>"; // Has to be an email.
const PASSWORD = "<your-password>";
const ORDER_CODE = "KI00000133"; // Collect this from zapier panel.
const ROOT_DOMAIN = "https://kiyatec.dendisoftware.com";
// Cache the token.
let config = { token: "" };
async function getToken() {
This file has been truncated, but you can view the full file.
JVBERi0xLjMKJeLjz9MKMSAwIG9iago8PAovVHlwZSAvUGFnZXMKL0NvdW50IDEzCi9LaWRzIFsgMyAwIFIgNCAwIFIgNSAwIFIgNiAwIFIgNyAwIFIgOCAwIFIgOSAwIFIgMTAgMCBSIDExIDAgUiAxMiAwIFIgMTMgMCBSIDE0IDAgUiAxNSAwIFIgXQo+PgplbmRvYmoKMiAwIG9iago8PAovUHJvZHVjZXIgKFB5UERGMykKPj4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL0NvbnRlbnRzIDE3IDAgUgovUmVzb3VyY2VzIDw8Ci9Gb250IDw8Ci9GMTMzIDE4IDAgUgovRjEzNCAyNCAwIFIKL0YxMzggMzAgMCBSCi9GMTY4IDM2IDAgUgovUjcgNDEgMCBSCj4+Ci9YT2JqZWN0IDw8Ci9JbTEgNTAgMCBSCj4+Ci9Db2xvclNwYWNlIDw8Ci9wZ2ZwcmdiIFsgL1BhdHRlcm4gL0RldmljZVJHQiBdCj4+Ci9Qcm9jU2V0IFsgL1BERiAvSW1hZ2VDIC9UZXh0IF0KPj4KL01lZGlhQm94IFsgMCAwIDYxMiA3OTIgXQovUGFyZW50IDEgMCBSCi9Bbm5vdHMgWyA1MiAwIFIgNTMgMCBSIDU0IDAgUiA1NSAwIFIgNTYgMCBSIDU3IDAgUiA1OCAwIFIgNTkgMCBSIDYwIDAgUiA2MSAwIFIgNjIgMCBSIDYzIDAgUiA2NCAwIFIgNjUgMCBSIDY2IDAgUiA2NyAwIFIgXQo+PgplbmRvYmoKNCAwIG9iago8PAovVHlwZSAvUGFnZQovQ29udGVudHMgNjggMCBSCi9SZXNvdXJjZXMgPDwKL0ZvbnQgPDwKL0YxMzQgMjQgMCBSCi9GMTY4IDM2IDAgUgovRjEzOCAzMCAwIFIKL0YxODAgNjkgMCBSCi9SNyA3NSAwIFIKPj4KL1Byb2NTZXQgWyAvUERGIC9UZXh0IF0KPj4KL01l
@rednafi
rednafi / docker-compose.yml
Last active July 24, 2022 21:54
Single node kafka, zookeeper, and schema-registry with docker compose 3
---
version: '3.9'
services:
zoo1:
image: confluentinc/cp-zookeeper:7.2.0
container_name: zoo1
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
@rednafi
rednafi / flipFlop.ts
Last active June 7, 2022 22:24
A simple two bit flip flop adder in TypeScript
type Bit = 0 | 1;
type Zero = Extract<Bit, 0>;
type One = Exclude<Bit, Zero>;
type Flip<T extends Bit> = T extends Zero ? One : Zero;
type Add<T extends Bit, U extends Bit> = T extends Zero
? U extends Zero
? Zero
@rednafi
rednafi / mutator.py
Created March 18, 2022 20:32
Mutate the fields of a dataclass by applying ad-hoc mutation callables.
from __future__ import annotations
import json
from collections.abc import Mapping
from dataclasses import dataclass
from typing import Callable
class Mutator:
def __init_subclass__(
"""
Django settings for main project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
WITH foreign_keys
     AS (SELECT conname,
                conrelid,
                confrelid,
                Unnest(conkey)  AS CONKEY,
                Unnest(confkey) AS CONFKEY
 FROM pg_constraint
@rednafi
rednafi / arch.md
Last active November 4, 2021 01:18
Django Init Model for Bro

Directory Structure

.
β”œβ”€β”€ app             # I know this app name sucks.
β”‚   β”œβ”€β”€ migrations
β”‚   β”‚   β”œβ”€β”€ 0001_initial.py
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ admin.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rednafi
rednafi / asyncio_limit_concurrency.py
Last active April 18, 2021 16:19
Python Asyncio MRE scripts.
import asyncio
import httpx
MAX_CONSUMERS = 50
async def make_request(url):
async with httpx.AsyncClient(http2=True) as client:
response = await client.get(url)