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 symbolValueType(using Quotes)( | |
sym: quotes.reflect.Symbol | |
): quotes.reflect.TypeRepr = | |
import quotes.reflect.* | |
val TermRef(tr, _) = sym.termRef: @unchecked | |
// widen is important here otherwise you may get singleton or by-name types | |
tr.memberType(sym).widen |
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 java.lang.{ClassLoader, Package} | |
def allDefinedPackages(loader: ClassLoader): Vector[Package] = | |
if (loader == null) | |
Vector.empty[Package] | |
else | |
allDefinedPackages(loader.getParent()) ++ loader.getDefinedPackages() | |
def allClassPathURLs(loader: ClassLoader): Vector[java.net.URL] = | |
loader match |
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
object code: | |
import scala.quoted.* | |
trait Context[T]: | |
val t: Int | |
given Context[Int] with | |
val t = 7 | |
transparent inline def aMacro[T]: Int = ${ aMacroImpl[T] } |
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 ray_pi(n = 1000, k = 10): | |
c = SimpleRDD(range(n*k), k=k) \ | |
.map(lambda _: (random.uniform(-1,1), random.uniform(-1,1))) \ | |
.filter(lambda p: p[0]*p[0] + p[1]*p[1] <= 1) \ | |
.count() | |
return 4 * c / (n*k) |
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 repro | |
trait ResZero[V]: | |
type Res | |
object ResZero: | |
transparent inline given [V]: ResZero[V] = ${ macros.resZeroImpl[V] } | |
end ResZero | |
trait SomeTrait[V]: | |
type Res |
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
// This module isn't really a ScalaModule, but we use it to generate | |
// consolidated documentation using the Scaladoc tool. | |
object docs extends ScalaModule { | |
def scalaVersion = "3.0.0-M3" | |
def docSource = T.source(millSourcePath) | |
def moduleDeps = Seq( | |
... | |
) |
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
#!/bin/bash | |
set -e | |
if [ $# -lt 2 ]; then | |
echo "usage: $0 <src-dir> <img-tag> [ <s2i-args> ... ]" | |
exit 1 | |
fi | |
fail() { | |
echo $1 |
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
apiVersion: radanalytics.io/v1 | |
kind: SparkCluster | |
metadata: | |
name: spark-cluster-example | |
spec: | |
customImage: 'quay.io/radanalyticsio/openshift-spark-py36:2.4.5-2' | |
env: | |
- name: SPARK_METRICS_ON | |
value: prometheus | |
master: |
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
apiVersion: image.openshift.io/v1 | |
kind: ImageStream | |
metadata: | |
name: spark-app-s2i | |
spec: | |
lookupPolicy: | |
local: true | |
tags: | |
- name: latest | |
from: |
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
# https://github.com/opendatahub-io/odh-manifests/blob/master/jupyterhub/jupyterhub/base/jupyterhub-spark-operator-configmap.yaml#L6-L19 | |
notebookPodServiceTemplate: | | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
name: "jupyterhub-nb-{{ user }}" | |
spec: | |
clusterIP: None | |
selector: |
NewerOlder