Skip to content

Instantly share code, notes, and snippets.

View furquanuddin94's full-sized avatar

Furquan Uddin furquanuddin94

View GitHub Profile
supplier_name: Vendor2
# All vendor endpoints that will be generated in the network client.
endpoints:
- Auth
- Search
# Endpoints that will be in the service, called sequentially in the given order
mapping:
Search:
supplier_name: Vendor1
# All vendor endpoints that will be generated in the network client.
endpoints:
- Search
# Endpoints that will be in the service, called sequentially in the given order
mapping:
Search:
- Search
package com.someRandomVendor.search
private[search] class SomeRandomVendorSearchService(
client: SomeRandomVendorClient,
requestMapper: Mapper[SearchRequest, SomeRandomVendorSearchRequest],
responseMapper: Mapper[SomeRandomVendorSearchResponse, SearchResponse]) extends SearchService {
override def search(request: SearchRequest): Future[SearchResponse] = {
for {
//validate request
package $package$.search
private[search] class $Supplier$SearchService(
client: $Supplier$Client,
requestMapper: Mapper[SearchRequest, $Supplier$SearchRequest],
responseMapper: Mapper[$Supplier$SearchResponse, SearchResponse]) extends SearchService {
override def search(request: SearchRequest): Future[SearchResponse] = {
for {
//validate request
//list of integers
val myList: List[Int] = List(1, 2, 7, 3, 6, 4)
//predicate function to check whether a number is odd or not
def isOdd: Int => Boolean = value => value % 2 == 1
//create a new list containing only odd elements
myList.filter(isOdd) //output: List(1, 7, 3)
//list of integers
val myList: List[Int] = List(1, 2, 7, 3)
//function to give neighbouring integers of an integer
def neighbourFunc: Int => List[Int] = value => List(value - 1, value + 1)
//using map() will give us an unflattened list
myList.map(neighbourFunc) //output: List(List(0, 2), List(1, 3), List(6, 8), List(2, 4))
//using map() + flatten() will give us a flattened list
List(1, 2, 7, 3).map(value => value * 2) //output: List(2, 4, 14, 6)
List(1, 2, 7, 3).map(_ * 2) //output: List(2, 4, 14, 6)
//list of integers
val myList: List[Int] = List(1,2,7,3)
//function to multiply an integer by 2
def doubleUpFunction: Int => Int = value => value*2
//creating a new list multiplying each element by 2
myList.map(element => doubleUpFunction(element)) //output: List(2, 4, 14, 6)
//or simply
@furquanuddin94
furquanuddin94 / portkey
Last active April 26, 2019 10:51
Utility to access server boxes (over SSH) via IP or ELB (specifically for AWS).
#!/bin/bash
#Script to access server boxes
#Put the script in any directory present on system's $PATH. Make the file executable via "chmod +x portkey". Then use "portkey help" for instructions on how to use.
#Prerequirements: Install JQ and Sponge
homeDir=$( echo $HOME )
configFile="${homeDir}/portkey.conf"
paramCount="$#"
if [ "$paramCount" = "0" ] || [ "$1" = "help" ]