Skip to content

Instantly share code, notes, and snippets.

View roshane's full-sized avatar
🤘

roshane roshane

🤘
View GitHub Profile
@roshane
roshane / Dockerfile
Created March 24, 2024 22:06
spring application custom docker build multistage
ARG ARTIFACT_NAME=application.jar
ARG BUILD_DIR=/usr/app
# Use an appropriate base image
FROM azul/zulu-openjdk-alpine:17.0.8.1-17.44.53 AS build
ARG ARTIFACT_NAME
ARG BUILD_DIR
# Set working directory
WORKDIR $BUILD_DIR
@roshane
roshane / Booking.java
Created March 22, 2023 04:13
Booking Algo
import java.time.*;
import java.time.format.*;
import java.util.*;
public class BookingAlgorithm {
public static void main(String[] args) {
// Example inputs
LocalDateTime startTime = LocalDateTime.of(2023, 3, 22, 9, 0);
LocalDateTime endTime = LocalDateTime.of(2023, 3, 22, 17, 0);
@roshane
roshane / application.yaml
Created July 14, 2022 23:36
DGS dynamic GraphQL schema
server:
port: 9000
dgs:
graphql:
schema-locations:
- "file:///D:/IdeaProjects/Temp/schema.graphqls"
spring:
application:
@roshane
roshane / system-design-interview.md
Last active June 8, 2022 12:04
system design interview short notes

horizontal vs vertical scalign

single server design

  • why
    • no much traffic
    • database/application-server/fron-end all deployed in one box
    • low budget
    • easy to maintain
  • if this is a commercial software system very bad
  • single point of failure
@roshane
roshane / logger.py
Created March 5, 2022 09:42
python std out logger
import logging
import sys
log_format = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG, format=log_format)
def get_logger(name):
return logging.getLogger(name)
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class RocketStages {
static final int N = 11000;
static final double G = 9.8;
static double A[] = new double[N + 100];
@roshane
roshane / docker-container-in.sh
Last active March 4, 2021 01:50
login to docker container as root user #containerlogin #docker #root #container #root login
#!/bin/bash
usageMessage="Usage: $> docker-container-in.sh {container name}"
if [[ -z $1 ]]
then
echo $usageMessage
exit 1
fi
#get running container id
@roshane
roshane / download-github-repository.sh
Last active May 24, 2022 01:25
download git repository as a zip file via curl
#!/bin/bash
curl https://[email protected]/Redmart/$REPOSITORY/zip/master --output $REPOSITORY.zip
@roshane
roshane / Generator.scala
Created June 6, 2020 03:09
Cousera Reactive Programming Generators
package com.aeon
trait Generator[+T] {
self =>
def generate: T
def map[S](f: T => S): Generator[S] = new Generator[S] {
def generate = f(self.generate)
}
@roshane
roshane / Managed.scala
Last active May 24, 2022 01:26
AutoCloseable resource with Scala
object ManagedResource {
def withResource[R <: java.io.Closeable, T](resource: R)(consumer: R => T) = {
try {
consumer(resource)
} finally {
resource.close
}
}
}