Skip to content

Instantly share code, notes, and snippets.

package core.dao
import scala.concurrent.Future
import play.api.Logger
import reactivemongo.core.commands.LastError
import reactivemongo.core.errors.DatabaseException
import core.db.MongoHelper

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

import mesosphere.mesos.util.FrameworkInfo
import org.apache.mesos.MesosSchedulerDriver
/**
* @author Tobi Knaup
*/
object Main extends App {
@yujikiriki
yujikiriki / UnaMejorForma?
Last active August 29, 2015 14:04
Hay alguna forma de hacerlo mejor?
case class OrderIncomeReportEntry( month: String, value: Double )
private def sumValues( entries: List[ OrderIncomeReportEntry ] ): List[OrderIncomeReportEntry] = {
val byMonth: Map[ String, List[ OrderIncomeReportEntry ] ] = entries.groupBy( e => e.month )
byMonth.foldLeft( List[OrderIncomeReportEntry]() ) {
( list, value ) =>
val sum = value._2.foldLeft( 0.0 )( ( acc, oire ) => acc + oire.value )
list.+:( OrderIncomeReportEntry( value._1, sum ) )
}
}

Keybase proof

I hereby claim:

  • I am yujikiriki on github.
  • I am yujikiriki (https://keybase.io/yujikiriki) on keybase.
  • I have a public key whose fingerprint is C4E8 CAB6 1837 0D10 29F2 988E D9B1 D1F7 0678 BA42

To claim this, I am signing this object:

@yujikiriki
yujikiriki / gist:12a3dc9465aa50cd7fe6
Created September 18, 2014 14:49
ReactiveMongo aggregation pipeline example #2
collection.db.command(Aggregate(collection.name, Seq(
Match(toBSON(jsonQuery)).get.asInstanceOf[BSONDocument]),
Project(convertProjectionJsonForAggregate(projectionJson):_*),
Sort(convertSortJsonForAggregate(versionDescendingSort))
))) map { stream =>
stream.toList map { doc =>
toJSON(doc).asInstanceOf[JsObject]
}
}
@yujikiriki
yujikiriki / blog-review.md
Last active August 29, 2015 14:08
Review blog Felipe

a) Acá encuentro un primer mal entendido.

Dentro de los elementos de este estilo arquitectural a mí entender dos de ellos son fundamentales:

Proceso de negocio: es un conjunto de tareas que se relacionan lógicamente para conseguir un resultado bien definido dentro de un negocio. Por ejemplo uno puede pensar en el proceso de: comprar libro en un ecommerce. Si no estoy mal aquí hay lenguajes como BPMN que permiten describir un proceso de negocio.

Servicio: Esos son los que implementamos los desarrolladores normalmente y corresponden a definiciones de software concretas de los conceptos de negocio.

Los procesos NO hacen parte de SOA. Sí es un estilo arquitectónico, pero le falta apellido: es un estilo arquitectónico para sistemas distribuidos.

@yujikiriki
yujikiriki / gist:65bf00d105613e203184
Created December 22, 2014 19:09
Referencias a tolerancia a fallas
The bizantine generals problem - Lamport
Why Do Computers Stop and What Can Be Done About It? - Jim Gray
Why do Internet services fail, and what can be done about it? - Oppenheimer
Lightweight Recoverable Virtual Memory - M. Satyanarayana
Principles of Antifragile Software - Martin Monperrus
Building on Quicksand - Helland, Campbell
Crash-Only Software - Candea, Fox
Fault Tolerance via Idempotence - Ramalingam, Vaswani
Fundamental Concepts of Dependability - Avizienis, Laprie, Randell
How Complex Systems Fail - Richard I. Cook, MD
@yujikiriki
yujikiriki / psauxww
Created April 21, 2015 22:42
jtune-psauxww
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 33792 4412 ? Ss Apr20 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S Apr20 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Apr20 0:11 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Apr20 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S Apr20 0:59 [rcu_sched]
root 8 0.0 0.0 0 0 ? S Apr20 0:00 [rcu_bh]
root 9 0.0 0.0 0 0 ? S Apr20 0:00 [migration/0]
root 10 0.0 0.0 0 0 ? S Apr20 0:00 [watchdog/0]
root 11 0.0 0.0 0 0 ? S Apr20 0:00 [watchdog/1]
@yujikiriki
yujikiriki / lsproc
Created April 21, 2015 22:43
jtune-lsproc
1
10
1000
1020
1024
1044
1052
1062
107
108