Skip to content

Instantly share code, notes, and snippets.

View ianlintner's full-sized avatar
🛸

Ian Lintner ianlintner

🛸
  • Minneapolis, MN
View GitHub Profile
@ianlintner
ianlintner / CaseTransformer.scala
Created October 25, 2023 21:00
Scala Word case transformation (from json4s)
import java.util.Locale
/** Exposing privates from MonadicJValue
* https://github.com/json4s/json4s/blob/3daa876d2fdbc117f80cb1dfd65e7112eb109948/ast/shared/src/main/scala/org/json4s/MonadicJValue.scala#L411
*/
object CaseTransformer {
def camelize(word: String): String = {
if (word.nonEmpty) {
@ianlintner
ianlintner / kubectl.bash
Created February 20, 2023 17:22
Kubernetes Pod with Service Account for Troubleshooting
# Run locally to start
kubectl apply -f adhoc.yaml
@ianlintner
ianlintner / gcloud_backup.bash
Last active December 23, 2022 18:32
Google Cloud Sql Cross Project Restore Database with Curl
TOKEN=$(gcloud auth application-default print-access-token)
curl -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-X GET \
https://sqladmin.googleapis.com/sql/v1beta4/projects/example-project-1/instances/source-db/backupRuns
curl -H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json; charset=utf-8" \
-X POST \
@ianlintner
ianlintner / README.md
Created October 31, 2022 21:48
Google Cloud Logs for Scala ZIO2 Apps on Kubernetes

How to add Google Cloud Logging for Kubernetes to a Scala ZIO2 Application

This is based on the google logback appender docs: https://cloud.google.com/logging/docs/setup/java

  • Add the google-cloud-logging-logback to your sbt file see example.
    • If you don't already have the slf4j and zio logging libs add those as well.
  • Add the logback.xml appender below this has been scoped for k8s_container.
  • If you haven't use the slf4j appender ZLayer in your main application see the example for a ZIOAppDefault app below.
@ianlintner
ianlintner / retrty_functor.scala
Last active September 11, 2021 02:28
Retry a F (functor|future|cats) in Scala e.g. Cats F, EitherT
import cats.data.EitherT
import cats.effect.{Async}
import cats.implicits._
import kittys.{AsyncService}
val someAsyncService = AsyncService()
val key = "imma-key-1234"
case class SomeCaseClass(failure: String)
@ianlintner
ianlintner / keybase.md
Created June 22, 2021 14:00
keybase.md

Keybase proof

I hereby claim:

  • I am ianlintner on github.
  • I am ianlintner (https://keybase.io/ianlintner) on keybase.
  • I have a public key ASBhNZOvKwfTr8DdwonZd7iTrhwgn8w4mYCQctB5qe2IOwo

To claim this, I am signing this object:

#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -aes256 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@ianlintner
ianlintner / SCGEPExample
Created November 11, 2013 19:38
Self Contained Guitar Effects Package
{"effectPackage": {
"id": "globaly-unique-id-01",
"name": "Distortion",
"effects": [
{"Type": "Distorion", "Value": "Metal", "Gain" : "10"},
{"Type": "Chorus", "Value": "2"}
]
}
}