Skip to content

Instantly share code, notes, and snippets.

View d0r1h's full-sized avatar
🎯
Focusing

Pawan Trivedi d0r1h

🎯
Focusing
View GitHub Profile
@d0r1h
d0r1h / Chunking.py
Created April 29, 2026 10:43
File Chunking
"""
csv_chunk_processor.py
======================
Production-ready, memory-efficient CSV processor with UUID-aware chunking.
Core guarantee
--------------
ALL rows belonging to a single UUID are ALWAYS written to the same chunk file.
A UUID's rows are NEVER split across two chunks.
@d0r1h
d0r1h / SparkML_Titanic.py
Created March 4, 2022 16:24
Performing Spark Machine Learning on Titanic DataSet
from pyspark.sql import SparkSession
from pyspark.sql.functions import col, mean
from pyspark.sql.types import DoubleType
from pyspark.ml import Pipeline
from pyspark.ml.feature import VectorAssembler, StringIndexer
from pyspark.ml.classification import LogisticRegression
from pyspark.ml.evaluation import BinaryClassificationEvaluator, MulticlassClassificationEvaluator
spark = SparkSession.builder.getOrCreate()
print(f" spark version {spark.version}")
@d0r1h
d0r1h / venv.md
Created November 22, 2021 00:28
Creating Virtual Environment for Python application

Using Python3

sudo apt install python3.8-venv
python3 -m venv env_name

source env_name/bin/activate
@d0r1h
d0r1h / index.html
Last active May 20, 2021 15:30
flask application html file for c02 emission by car
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>C02</title>
</head>
@d0r1h
d0r1h / app.py
Created May 20, 2021 15:26
flask application file for c02 emission by car
import pickle
import jsonify
import requests
import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression
from flask import Flask, render_template, request
from sklearn.model_selection import train_test_split
@d0r1h
d0r1h / haproxy.cfg.j2
Created December 9, 2020 12:40
Haproxy configuration file for Ansible
#---------------------------------------------------------------------
# Example configuration for a possible web application. See the
# full configuration options online.
#
# https://www.haproxy.org/download/1.8/doc/configuration.txt
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# Global settings
@d0r1h
d0r1h / reverseproxy.yml
Last active January 8, 2022 17:08
Haproxy - Reverse Proxy and Load Balancer using Ansible
- hosts: proxyserver
tasks:
- name: installing haproxy program
package:
name: haproxy
- name: configuring hapoxy
template:
dest: /etc/haproxy/haproxy.cfg