This file contains 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
proxmox / local / CT Templates | |
------------------------------ | |
Download from URL: https://images.linuxcontainers.org/images/openwrt/23.05/amd64/default/20240316_11%3A57/rootfs.tar.xz | |
SHA-256: d6df8e1abeb24965146e22186b7aa767e3d42fac7fd71be0805cbc0c82377917 | |
proxmox console | |
--------------- | |
pct create 201 /var/lib/vz/template/cache/openwrt-20240316.tar.xz --arch amd64 --hostname openwrt --rootfs local-lvm:201 --memory 1024 --cores 2 --ostype unmanaged --unprivileged 1 --net0 name=eth0 --net1 name=eth1 --storage local-lvm |
This file contains 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
import scala.reflect.runtime.universe._ | |
import scala.reflect.api | |
def runtimeTypeTagOf(name: String, parent: ClassLoader, url: java.net.URL): TypeTag[_] = | |
runtimeTypeTagOf(name, parent, Seq(url)) | |
def runtimeTypeTagOf(name: String, parent: ClassLoader, urls: Seq[java.net.URL]): TypeTag[_] = | |
runtimeTypeTagOf(name, new java.net.URLClassLoader(urls.toArray, parent)) | |
def runtimeTypeTagOf(name: String, cl: ClassLoader): TypeTag[_] = { | |
val c = Class.forName(name, true, cl) | |
val mirror: Mirror = runtimeMirror(cl) |
This file contains 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
import reflect.runtime.universe._ | |
import reflect.ClassTag | |
def typeTag2ClassTag[T: TypeTag]: ClassTag[T] = { | |
ClassTag[T]( typeTag[T].mirror.runtimeClass( typeTag[T].tpe ) ) | |
} |
This file contains 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
package object spark { | |
import org.apache.spark.sql.types.StructType | |
implicit class StructTypeExtension(schema: StructType) { | |
import org.apache.spark.sql.types.StructField | |
implicit def similar(other: StructType): Boolean = _similar(schema, other) | |
implicit val fieldOrdering: Ordering[StructField] = Ordering.by(field => field.name) | |
private final def _similar(_this: StructType, _other: StructType): Boolean = |
This file contains 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
import scala.reflect.runtime.universe.TypeTag | |
implicit class ProductExtension[T <: Product : TypeTag](o: T) { | |
def productElementNames: Iterator[String] = { | |
import scala.reflect.runtime.universe._ | |
typeOf[T].members | |
.collect { case m: MethodSymbol if m.isCaseAccessor => m.name.toString } | |
.toList.reverse.toIterator | |
} | |
This file contains 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
package com.example | |
import utest._ | |
object SparkExampleTests extends TestSuite { | |
import scala.util.{Try,Success,Failure} | |
import org.apache.spark.sql.SparkSession | |
val _spark: Try[SparkSession] = | |
Try { |
This file contains 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
//file: project/Configs.scala | |
import sbt._ | |
object Configs { | |
val FunctionalTest = config("ft") extend (Test) | |
val AcceptanceTest = config("at") extend (Test) | |
val PerformanceTest = config("pt") extend (Test) | |
val Tools = config("tools") extend (Test) | |
} |
This file contains 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
def disablePublishing: Seq[Setting[_]] = | |
Seq( | |
publish/skip := true, | |
publishLocal/skip := true | |
) |
This file contains 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
trait SlickConfig { | |
import scala.util.{Try, Success, Failure} | |
private val RegexDB2 = "^jdbc:(db2):.*//(.*):(.*)/([^;]*)[?:;](.*)".r | |
private val RegexDerby = "^jdbc:(derby):.*//(.*):(.*)/([^;]*)[?:;](.*)".r | |
private val RegexH2 = "^jdbc:(h2):(?:mem):()()([^;]*)[?:;](.*)".r | |
private val RegexHsqlDB = "^jdbc:(hsqldb):.*//(.*):(.*)/([^;]*)[?:;](.*)".r | |
private val RegexSqlServer = "^jdbc:(sqlserver)://(.*):(.*);DatabaseName=([^;]*)[?:;](.*)".r | |
private val RegexjTDS = "^jdbc:(jtds):sqlserver://(.*):(.*)/([^;]*)[?:;](.*)".r | |
private val RegexMySQL = "^jdbc:(mysql):.*//(.*):(.*)/([^;]*)[?:;](.*)".r |
This file contains 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
import scala.util.Try | |
implicit class SeqTryExtension[T](seq: Seq[Try[T]]) { | |
def sequence: Try[Seq[T]] = | |
seq | |
.foldRight(Try(List.empty[T])) { | |
case (item, acc) => for { a <- acc; i<- item } yield i :: a | |
} | |
} |
NewerOlder