Skip to content

Instantly share code, notes, and snippets.

View miguelemosreverte's full-sized avatar
🏠
Working from home

Miguel Lemos miguelemosreverte

🏠
Working from home
  • Cordoba,Argentina
View GitHub Profile
{-# LANGUAGE FlexibleInstances, UndecidableInstances, DuplicateRecordFields #-}
module Main where
import Control.Monad
import Data.Array
import Data.Bits
import Data.List
import Data.List.Split
--import Data.Set
ItemId:ID :LABEL value
item1 Item some
item2 Item other
item3 Item another
trait Recursion[Elem] {
val list: List[Elem] // bag
val zero: List[Elem]
// pasos recursivos
def cases: PartialFunction[(List[Elem], Elem), List[Elem]]
// cannot be overrided
final def recursion: List[Elem] = list.foldLeft(zero) { case (acc, elem) =>
allcases.apply((acc, elem))
// Recursion made simple
val dataset = List(5, 4, 3, 1, 8, 7) // dataset to use in below examples
// using inline bag
val firstResult = dataset.foldLeft((Int.MinValue, Int.MaxValue)) { case ((max, min), elem) =>
if (elem > max) (elem, min)
else if (elem < min) (max, elem)
else (max, min)
}
println(firstResult)
// using outside bag for better mantainability
I wanted for the server to run on DEV or PROD enviroments seammesly.
For that it was necessary for it to know which enviroment it was running on.
And that could be done in many ways, being a modification to the Dockerfile the most elegant.
Now since 3:46 PM I have been dealing with this bug, mainly because each time I make a change I need to rebuild the docker image.
Error:
sagas/index.js tries to connect to the Express server by calling localhost:3000
This works as long as the server is running on the same machine.
Hypothesis:
Calling IP_SERVER:3000 instead would solve the problem
Shallow Solution:
Hardcode the server public IP to the code, build a Docker Image, push and create a Kubernetes app
Usuario@ftestagrossa MINGW64 /d/Usuario/Desktop/SuraSeguros/mytodo (master)
$ npm install
> appmetrics@3.1.3 install D:\Usuario\Desktop\SuraSeguros\mytodo\node_modules\appmetrics
> node extract_all_binaries.js || node-gyp rebuild
Wed, 16 May 2018 19:01:58 GMT
********************************************************************************
You are installing the Node Application Metrics monitoring and profiling module.
Here is a tutorial on IBM and Kubernetes. It suggests the repository from https://github.com/lionelmace/mytodo
https://github.com/lionelmace/ibmcloud-labs/tree/master/labs/Lab%20Kubernetes%20-%20Orchestrate%20your%20docker%20containers
Where this can be found.
https://github.com/lionelmace/mytodo/blob/master/Dockerfile
Inside, it can be observed that lionel adds the following line:
RUN mkdir -p /usr/src/app
This CREATES a directory in case it does not exists, which is apparently the case with IBM.
The push refers to repository [registry.ng.bluemix.net/suraseguros/v4]
3c90744c5b23: Retrying in 2 seconds
f3851451fe19: Retrying in 2 seconds
2b398a8d0a45: Retrying in 2 seconds
6a9ed9f70227: Retrying in 3 seconds
dfcb046892ec: Retrying in 3 seconds
37f043756873: Waiting
c0cd119f9646: Waiting
23044129c2ac: Waiting
8b229ec78121: Waiting
$ docker push registry.ng.bluemix.net/suraseguros/v4:surareact
The push refers to repository [registry.ng.bluemix.net/suraseguros/v4]
3c90744c5b23: Pushing [==================================================>] 8.913MB/8.913MB
f3851451fe19: Pushing [> ] 2.56kB/397.9MB
2b398a8d0a45: Pushing [==================================================>] 524.8kB/524.8kB
6a9ed9f70227: Pushing [> ] 1.536kB/5.243MB
dfcb046892ec: Pushing [==================================================>] 110.4MB/110.4MB
37f043756873: Waiting
c0cd119f9646: Waiting
23044129c2ac: Waiting