Skip to content

Instantly share code, notes, and snippets.

@j-thepac
j-thepac / kafka.md
Last active November 18, 2024 00:03

Kafka

kafkaSample

Docker YML

## docker-compose.yml (start kafka Broker and Zookeeper)

    #docker-compose up -d #detach mode
	version: '3'
	services:
 zookeeper:
@j-thepac
j-thepac / progressbar.py
Last active July 8, 2022 10:01
Python progress bar
for i in range(1,10):
print("Progress: "+i*"#" , end="\r")
time.sleep(1)
@j-thepac
j-thepac / downloadstream.py
Last active July 8, 2022 09:12
download huge file as zip
from http.client import IncompleteRead
import requests
path="/Documents/test.zip"
with requests.get(url, headers=headers, stream=True) as r:
with open(path, 'wb') as f:
while(True):
try:
f.write(r.content)
break
import scala.concurrent.{Await, Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import java.util.Calendar
object FutureCleint extends App{
val start =Calendar.getInstance().getTime.getSeconds
val fx :String => String = (name:String)=>{
@j-thepac
j-thepac / multiprocess.py
Created July 3, 2022 13:30
multiprocess
import concurrent.futures
import time ,datetime
start = datetime.datetime.now()
def do_something(seconds):
print(f'Sleeping {seconds}')
time.sleep(seconds)
return f'Done Sleeping...{seconds}'
with concurrent.futures.ProcessPoolExecutor() as executor:
results = executor.map(do_something, [1,1])
@j-thepac
j-thepac / multithread.py
Created July 3, 2022 13:20
multithread
import concurrent.futures
import time ,datetime
start = datetime.datetime.now()
def do_something(seconds):
print(f'Sleeping {seconds}')
time.sleep(seconds)
return f'Done Sleeping...{seconds}'
with concurrent.futures.ThreadPoolExecutor() as executor:
results = executor.map(do_something, [1,1])

Dataset : IMDB Movies dataset

  1. Ranking of movies for each Decade based on Gross
@j-thepac
j-thepac / docker.md
Last active August 4, 2024 11:44
Docker

DOCKER

Env : https://labs.play-with-docker.com/

  • Docker = Container and Images
  • Docker Can be executed as
    • command line
    • dockerfile
    • docker-compose.yml

Image

Snapshot of the application containing all the libraries , supporting files etc.,

@j-thepac
j-thepac / Synapse.md
Last active May 20, 2025 02:15
Azure Synapse

Synapse

Note :

  • For JSON file make sure all new lines , blank spaces are removed.
  • Dataflow , Notebooks etc - names has to start with String.
  • blob = flat namespace , Gen2 = directories
  • Azure Active Directory (Entra ID) : Used to Create 1 Functional ID (secret ) called Serive Principle across all applications to communicate with each other
  • SP ( serivce Principle) : Managed by User ie., renew etc.,-
  • Managed identity (service principal) : managed by Azure

Kubernetes

Problem with VM:

  • Virtual machines comes with unwanted apps and services Eg: Browser
  • All process / Threads were not is user control .
  • Memory allocation was not in user control.
  • Syncing Virtual machines is not easy
  • Lot of configuration was needed
  • To delete and reconfigure was a nightmare.

Kubernetes

  • configure, automate, and manage applications using containers Image