#Some discussions on logging from docker: Using logstash Using Papertrail
A lot of this boils down to whether you want a single or multi-process (systemd, supervisord etc.) container...
import java.util.Arrays; | |
public class Eratosthene{ | |
public static int[] byteEratosthenes(int cap) { | |
int[] result = new int[(int) Math.ceil(1.25 * cap / Math.log(cap))]; | |
int pos = 1; | |
result[0] = 2; | |
byte[] primes = new byte[(cap - 2 >> 4) + 1]; |
# Being executed in the dir with a list of files with names formed as | |
# 'AuthorName BookTitle.ext' or 'AuthorName,BookTitle.ext' | |
# creates dirs named by Author and moves author's books there | |
require 'fileutils' | |
PATH_D = File.expand_path(File.dirname(__FILE__)) + '/' #absolute path to current dir | |
FILE_BASE = File.basename(__FILE__) #script's filename | |
Dir.foreach("./") do |entry| | |
next if entry.start_with?('.') or entry == FILE_BASE |
#Some discussions on logging from docker: Using logstash Using Papertrail
A lot of this boils down to whether you want a single or multi-process (systemd, supervisord etc.) container...
Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.
A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.
val square : Int => Int = x => x * x
#!/bin/bash | |
SOURCE="$1" | |
if [ "${SOURCE}" == "" ]; then | |
echo "Must specify a source url" | |
exit 1 | |
fi | |
DEST="$2" | |
if [ "${DEST}" == "" ]; then |
-- View pg_stat_activity with temporary files informations (file list and total file size) | |
-- version 0.3 | |
SELECT | |
pg_stat_activity.pid AS pid, | |
CASE WHEN LENGTH(pg_stat_activity.datname) > 16 | |
THEN SUBSTRING(pg_stat_activity.datname FROM 0 FOR 6)||'...'||SUBSTRING(pg_stat_activity.datname FROM '........$') | |
ELSE pg_stat_activity.datname | |
END | |
AS database, |
import cats.implicits._ | |
//https://stackoverflow.com/questions/48744146/stacking-m-either-and-writer | |
object SafeLogWriter { | |
type FutureErrorOr[A] = EitherT[Future, Error, A] | |
type ErrorOr[A] = Either[Error, A] | |
type MyWriter[A] = WriterT[Future, Vector[String], A] | |
type MyStack[A] = EitherT[MyWriter, Error, A] |
import scala.reflect.macros.whitebox | |
import scala.language.experimental.macros | |
def symbolic_impl(c: whitebox.Context)(f: c.Expr[String]): c.Expr[scala.Symbol] = { | |
import c.universe._ | |
c.Expr(q"""scala.Symbol(${c.eval[String](f)})""") | |
} | |
def symbolic(f: String): scala.Symbol = macro symbolic_impl |