Skip to content

Instantly share code, notes, and snippets.

View jamesward's full-sized avatar

James Ward jamesward

View GitHub Profile
@jamesward
jamesward / boot-mvn.sh
Created May 4, 2021 18:09
Spring Boot Cloud Run Deploy
mkdir tmp
cd tmp
curl -sL https://start.spring.io/starter.zip -d bootVersion=2.4.5 -d dependencies=web -o demo.zip; unzip demo.zip; rm demo.zip
echo "hello, world" > src/main/resources/static/index.html
./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=gcr.io/jw-demo/springboot-demo -Dspring-boot.build-image.builder=gcr.io/buildpacks/builder:v1
docker push gcr.io/jw-demo/springboot-demo
sealed class Result<out V, out E> {
data class Failure<out FE>(val e: FE): Result<Nothing, FE>()
data class Success<out SV>(val v: SV): Result<SV, Nothing>()
companion object {
fun <PV> succeed(v: PV): Result<PV, Nothing> = Success(v)
fun <PE> fail(e: PE): Result<Nothing, PE> = Failure(e)
}
inline fun <MR> map(f: (V) -> MR): Result<MR, E> {
cat <<EOF | kubectl apply -f -
apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-server
spec:
  selector:
    matchLabels:
      run: hello-server
@jamesward
jamesward / nix_sane_install.md
Created January 17, 2024 20:45
Nix Sane Install
  1. Get the latest release: https://releases.nixos.org/?prefix=nix/
  2. Extract the release
  3. Setup /nix
    sudo mkdir /nix
    sudo chown $USER /nix
    
  4. Run installer

NIX_INSTALLER_NO_MODIFY_PROFILE=true ./install

./gradlew test

> Task :pkl-cli:test

CliDownloadPackageCommandTest > download multiple failing packages(Path) FAILED
    org.opentest4j.AssertionFailedError: 
    Expecting message to be:
      "Failed to download some packages.