Skip to content

Instantly share code, notes, and snippets.

View roshane's full-sized avatar
🤘

roshane roshane

🤘
View GitHub Profile
@roshane
roshane / README.md
Created January 26, 2018 04:16 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


@roshane
roshane / validation-engine.scala
Last active June 20, 2019 15:50
validation engine template
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
trait Request
case class AdhocCreateRequest(name: String) extends Request
case class RegularCreateRequest(name: String) extends Request
class Repository {
@roshane
roshane / PagedRequest.scala
Last active March 19, 2020 09:07
custom akka-http directive for pagination
//request response model
case class PageRequest(page: Int, size: Int)
case class PageResponse[T](page: Int, size: Int, totalPages: Int, data: Seq[T])
//sample routes
private val routes = path("echo") {
@roshane
roshane / Mi_Js_CheatSheet.js
Last active April 11, 2023 12:55
javascript cheats
//flatten array (if `flat` is missing)
const flatten = (input) => {
return input.reduce((a,c)=>{
return util.isArray(c) ? a.concat(flatten(c)) : a.concat(c);
},[]);
}
//module exports shortcut
@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
}
}
}
@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 / 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 / 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
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 / 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)