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 / worklog.md
Last active August 20, 2024 07:14
Generate a simple worklog.

What

The following script will generate a simple markdown worklog in the format listed below. It correctly handles the partial weeks at the beginning and the end of the year.

# Worklog

## Week 1 [2025-01-01 - 2025-01-03]
@rednafi
rednafi / __init__.py
Last active August 9, 2024 11:20
Log context propagation in Python ASGI apps. Details here: https://rednafi.com/python/log_context_propagation/
from svc import log # noqa
@rednafi
rednafi / __init__.py
Created August 6, 2024 19:07
Log context propagation in Python ASGI apps.
from svc import log # noqa
@rednafi
rednafi / dysfunc.go
Last active October 30, 2024 07:31
Dysfunctional option pattern in Go
package src
import (
"testing"
)
// Apply functional options pattern
type config struct {
// Required
foo, bar string
@rednafi
rednafi / main.go
Last active February 23, 2024 11:58
Anemic stack traces in Go. Read the blog on https://rednafi.com/go/anemic_stack_traces/
package main
import (
"fmt"
"io"
"os"
"runtime"
"strings"
)
@rednafi
rednafi / main.go
Last active September 26, 2023 17:34
Dummy load balancer in a single Go script. Here's the full explanation: https://rednafi.com/go/dummy_load_balancer
/*
cc Redowan Delowar (rednafi.com)
+----------------------------------------+
| Load Balancer (8080) |
| +----------------------------------+ |
| | | |
| | Request from Client | |
| | | |
| +-----------------|----------------+ |
@rednafi
rednafi / getUrls.md
Last active May 20, 2023 07:10
Submit URLs for indexing via googleapis
@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