Skip to content

Instantly share code, notes, and snippets.

View rayyildiz's full-sized avatar

Ramazan AYYILDIZ rayyildiz

View GitHub Profile
//usr/bin/env jbang "$0" "$@" ; exit $?
// JAVA 21
// DEPS org.springframework.boot:spring-boot-dependencies:4.0.0-M1@pom
// DEPS org.springframework.boot:spring-boot-starter-web
// DEPS org.springframework.boot:spring-boot-starter-actuator
//
// JAVA_OPTIONS -Dserver.port=8080
// JAVA_OPTIONS -Dmanagement.endpoints.web.exposure.include=health,env,loggers
// REPOS mavencentral
@rayyildiz
rayyildiz / README.md
Last active February 4, 2025 10:12
Middleware for handling HTMX-specific request and response processing.

Django HTMX Middleware

A simple middleware for Django applications to detect HTMX requests, adding an is_htmx attribute to the request object for convenient usage in views. It also includes a fix for handling redirects and works seamlessly with the django-template-partials.

Features

  • HTMX Detection: Automatically detects if a request originates from HTMX and adds an is_htmx attribute to the request object.
  • Redirect Fix: Includes a modification to correctly handle redirects during HTMX requests.
  • Integration: Works with django-template-partials for partial rendering support.
from typing import Optional
import aspose.words as aw
file = 'file.docx' # file
def ask_password() -> str:
"""
Ask the user to enter a password through a simple dialog window.
@rayyildiz
rayyildiz / merge.py
Created September 15, 2024 10:04
Merge files
import pandas as pd
from tqdm import tqdm
# List of file names to be processed
file_names = [
"2e522b3e-c97c-472f-9c75-83dec7217079.xlsx",
"2f6e37ac-9b52-4f86-a5dc-1b1cffdea581.xlsx",
"4b0ece5b-9800-4544-8d0b-d1cffa069ad0.xlsx",
"5bc0f302-d03e-444e-916a-61bb2bcde488.xlsx",
"99dceb6d-2ba2-4944-a4e7-dbd7c2994fc4.xlsx",
@rayyildiz
rayyildiz / README.md
Last active July 29, 2024 16:19
Find secrets and convert to CSV format

Detect Secrets

Install Detect Secrets. Run following command to detect the secrets:

detect-secrets scan --all-files  --disable-plugin Base64HighEntropyString --disable-plugin HexHighEntropyString   > secrets.json

Run scripts to convert to CSV format.

[package]
name = "http-req-count"
version = "0.1.0"
edition = "2021"
[dependencies]
axum = { version = "0.7" }
tokio = { version = "1.37", features = ["macros", "rt-multi-thread", "rt"] }
FROM python:3.10-slim
WORKDIR /apps
RUN apt-get update && apt-get install -y git
COPY ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
@rayyildiz
rayyildiz / README.md
Last active July 29, 2024 16:25
Chatgpt demo with OpenLLaMa

Chatgpt demo with OpenLLaMa

LLM chat example using llama_3b

Setup

Install Anaconda and create a new env.

@rayyildiz
rayyildiz / README.md
Last active December 31, 2023 16:12
docker-compose for elasticsearch

Elasticsearch version is 6.3.1

Setup

Install latest version of docker.

download docker-compose.yaml and start elasticsearch.

# The .editorconfig is used to maintain consistent code style.
# The .editorconfig file is supported by most text editors.
# See https://editorconfig.org
root = true
[*]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space