- https://dzone.com/articles/postgres-autovacuum-is-not-the-enemy
- https://aws.amazon.com/blogs/database/a-case-study-of-tuning-autovacuum-in-amazon-rds-for-postgresql/
- https://blog.newrelic.com/product-news/tuning-postgresql-autovacuum/
- https://www.cybertec-postgresql.com/en/autovacuum-wraparound-protection-in-postgresql/
- https://info.crunchydata.com/blog/managing-transaction-id-wraparound-in-postgresql
- https://www.2ndquadrant.com/en/blog/autovacuum-tuning-basics/
- https://www.keithf4.com/per-table-autovacuum-tuning/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val combinationsLetters = (for { | |
(i, idi) <- List("A", "B", "C", "D", "E").zipWithIndex | |
(j, idj) <- List("A", "B", "C", "D", "E").zipWithIndex.take(idi) | |
(k, _) <- List("A", "B", "C", "D", "E").zipWithIndex.take(idj) | |
} yield (i, j, k)) | |
val combinationsNumbers = (for { | |
(i, idi) <- List("1", "2", "3").zipWithIndex | |
(j, _) <- List("1", "2", "3").zipWithIndex.take(idi) | |
} yield (i, j)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
(data->'backofficeInformation'->'customerNumber')::int, | |
identities->'countryCode' | |
FROM customers | |
cross join lateral jsonb_array_elements(data->'personalInformation'->'identities') identities | |
WHERE (data->'backofficeInformation'->'customerNumber')::int = 900198808 | |
and (identities->>'isTaxCountry')::boolean = true | |
--same as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List(("A", 1), ("B", 2)).map(second) | |
def second[A, B](a: (A, B)) = (a._2, a._1) | |
def second2[A, B](a: (A, B)) = a match { | |
case (x, y) => (y, x) | |
} | |
def second3[A, B]: (A, B) => (B, A) = { case(a, b) => (b, a) } | |
def second4[A, B]: (A, B) => (B, A) = { case(a, b) => b -> a } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void test() { | |
loadName(1) | |
.onSuccess(n -> log(format("onSuccess before recovery: %s", n))) | |
.andThen(n -> log(format("and then log this before recovery: %s", n))) | |
.onFailure(e -> log("error before recovery")) | |
.recoverWith(IllegalArgumentException.class, e -> loadNameFromFallback()) | |
.onSuccess(n -> log(format("onSuccess after recovery: %s", n))) | |
.onSuccess(n -> log(format("another onSuccess: %s", n))) | |
.andThen(n -> log(format("and then log this after recovery: %s", n))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List(1, 2, 3, 4, 5) match { | |
case (a1 @ 1) :: (a2 @ 2 ):: c :: _ => c | |
case List(a1 @ 1, a2 @ 2, c) => c | |
case _ => "no" | |
} | |
sealed trait State | |
case class WithOffer(offer: Offer) extends State |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import re | |
import csv | |
p = re.compile(ur'[^\s+\,\.\!\?\:\;\"\(\)\<\>\#\$\=\-\/]+') | |
reader = csv.reader(sys.stdin, delimiter='\t') | |
next(reader, None) # skip headers | |
for line in reader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://content.udacity-data.com/course/hadoop/forum_data.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn letras-faltantes [palavra acertos] | |
(remove (fn [letra] | |
(contains? acertos (str letra))) palavra)) | |
(defn acertou-a-palavra-toda? [palavra acertos] | |
(empty? (letras-faltantes palavra acertos))) | |
(defn le-letra! [] (read-line)) | |
(defn acertou-chute? [letra palavra] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
Optional<String> mapped = getMerchantOrderIdFromUrl("haveId").map(orderId -> { | |
return orderId + " mapped"; | |
}); | |
System.out.println(mapped); | |
Optional<Optional<String>> merchant = getMerchantOrderIdFromUrl("haveId").map(orderId -> { | |
return getMerchant(orderId); | |
}); |