java -version
wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-x64.rpm"
sudo rpm -i jdk-8u11-linux-x64.rpm
java -version
wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-x64.rpm"
sudo rpm -i jdk-8u11-linux-x64.rpm
Get Git log in JSON format
git log --pretty=format:'{%n "commit": "%H",%n "abbreviated_commit": "%h",%n "tree": "%T",%n "abbreviated_tree": "%t",%n "parent": "%P",%n "abbreviated_parent": "%p",%n "refs": "%D",%n "encoding": "%e",%n "subject": "%s",%n "sanitized_subject_line": "%f",%n "body": "%b",%n "commit_notes": "%N",%n "verification_flag": "%G?",%n "signer": "%GS",%n "signer_key": "%GK",%n "author": {%n "name": "%aN",%n "email": "%aE",%n "date": "%aD"%n },%n "commiter": {%n "name": "%cN",%n "email": "%cE",%n "date": "%cD"%n }%n},'
The only information that aren't fetched are:
%B
: raw body (unwrapped subject and body)%GG
: raw verification message from GPG for a signed commit//////////////////////////////////////////// Option //////////////////////////////////////////////////////////////////////// | |
obj.fold(defaultVal)(func) | |
obj.map(func).getOrElse(defaultVal) | |
obj match { | |
case Some(x) => func(x); | |
case None => defaultVal | |
} | |
// composed Option[A] | |
val oa: Option[String] = Some("a") |
I hereby claim:
To claim this, I am signing this object:
/* proof of concept for non atomic method */ | |
/* to fix this the call should be wrapped */ | |
/* inside a synchronized block */ | |
private var uidCount = 0L | |
def getUniqueId(): Long = { | |
uidCount = uidCount + 1 | |
uidCount | |
} |
package akka.http.scaladsl | |
import java.io.File | |
import akka.http.scaladsl.unmarshalling.Unmarshal | |
import akka.util.ByteString | |
import scala.concurrent.duration._ | |
import akka.actor.ActorSystem |
// The collect method takes a PartialFunction as argument and maps the | |
// values defined for this partial function over it, skipping those | |
// outside the definition domain. | |
// Given a partial function pf, the following code: | |
// | |
// val pf: PartialFunction[A, B] = | |
// coll.collect(pf) | |
// | |
// is roughly equivalent to |
Latency Comparison Numbers | |
-------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
#include "WiFi.h" | |
#include "ESPAsyncWebServer.h" | |
int analogPin = A0; | |
const char* ssid = "SOME_SSID"; | |
const char* passwd = "SOME_PASSWD"; | |
AsyncWebServer server(80); | |
float readTemp() { |
/* Procedural endpoint */ | |
@GetMapping("/users/{id}") | |
ResponseEntity<User> get(@PathVariable long id) { | |
User user = repository.findById(id); | |
if(user != null) { | |
return ok(user); | |
} else { | |
return notFound(); | |
} | |
} |