Skip to content

Instantly share code, notes, and snippets.

View tanvirraj's full-sized avatar
🚢
coding

Tanvir Raj tanvirraj

🚢
coding
View GitHub Profile
@pytest.mark.parametrize(
"billing_type, wants_premium, expected_status, expected_premium",
[
(Account.BillingType.V1, True, 400, False),
(Account.BillingType.GIFT, True, 200, True),
],
)
def test_update_account_wanting_premium(
url,
client,
@tanvirraj
tanvirraj / compress_video
Created August 23, 2024 06:55 — forked from trvswgnr/compress_video
portable shell script to compress videos with ffmpeg
#!/bin/sh
print_usage() {
echo "usage: compress_video <input_file>"
echo "supported formats: mp4, webm, mkv, mov, avi, flv"
}
get_extension() {
f="${1##*/}"
case "$f" in
app-web |
app-web | ====
app-web | Contents of self.request:
app-web | _request: <WSGIRequest: POST '/api/emails/register/'>
app-web | parsers: [<rest_framework.parsers.JSONParser object at 0x10e497ad0>, <rest_framework.parsers.FormParser object at 0x10e494a70>, <rest_framework.parsers.MultiPartParser object at 0x10e4947d0>]
app-web | authenticators: [<rest_framework.authentication.SessionAuthentication object at 0x10e4975f0>, <rest_framework.authentication.BasicAuthentication object at 0x10e4941d0>]
app-web | negotiator: <rest_framework.negotiation.DefaultContentNegotiation object at 0x10e497650>
app-web | parser_context: {'view': <emails.views.rest.auth.RegistrationUserViewSet object at 0x10e496780>, 'args': (), 'kwargs': {}, 'request': <rest_framework.request.Request: POST '/api/emails/register/'>, 'encoding': 'utf-8'}
app-web | _data: {'username': 'raqib', 'password': 'raqib!@#password', 'email': 'raqib@gmail.com'}
@tanvirraj
tanvirraj / mathpix2gpt.py
Created June 13, 2023 07:04 — forked from danielgross/mathpix2gpt.py
mathpix2gpt.py
import requests
import time
import os
import sys
import openai
import tiktoken
from termcolor import colored
openai.api_key = open(os.path.expanduser('~/.openai')).read().strip()
package main
import (
"fmt"
"math/rand"
"net/http"
"github.com/gin-gonic/gin"
"gorm.io/driver/sqlite"
"gorm.io/gorm"

DDD is a way to build computer programs that helps make them easier to understand and use. It's like building with blocks: you start with small, simple blocks and put them together to make bigger, more complex structures.

In DDD, we use something called "domains" to organize our blocks. A domain is like a group of blocks that all have something in common. For example, if we were building a program about pets, we might have a domain for dogs, a domain for cats, and a domain for birds.

Inside each domain, we use something called "entities" to represent the things in our program. An entity is like a specific block that has its own unique properties. For example, in the dog domain, we might have an entity for a specific dog with properties like its name, breed, and age.

We also use "value objects" to represent things that don't have a unique identity, but are still important. For example, in the dog domain, we might have a value object for a dog's collar, which would have properties like its color and size.

F

@tanvirraj
tanvirraj / dependencyInjection.md
Created March 17, 2023 13:26
dependency injection typescript example with classes this file is generated by chatGPT

First, create an interface for the dependency you want to inject, for example:

interface Logger {
  log(message: string): void;
}

Next, create a class that implements the interface:

https://thoughtbot.com/
https://fintory.com/en
https://www.metalab.co/
https://focuslabllc.com/
https://underbelly.is/
https://unfold.co/
https://www.ramotion.com/
https://www.strv.com/
https://tubikstudio.com/
https://cuberto.com/

Go's for-range loop has two form of syntax and two different semantics value semantics and pointer semantics. before sharing details let's first 2 small code snippets one form of for-range loop

package main

import "fmt"

func main() {
@tanvirraj
tanvirraj / Dockerfile
Created January 26, 2023 09:22 — forked from tobi/Dockerfile
# Rails production setup via SQLite3 made durable by https://litestream.io/
# Copy this to Dockerfile on a fresh rails app. Deploy to fly.io or any other container engine.
#
# try locally: docker build . -t rails && docker run -p3000:3000 -it rails
#
# in production you might want to map /data to somewhere on the host,
# but you don't have to!
#
FROM ruby:3.0.2