Skip to content

Instantly share code, notes, and snippets.

@hohonuuli
hohonuuli / fathomnet_upload_csv.py
Last active April 9, 2025 17:05
An example script to upload a CSV file to FathomNet
#!/usr/bin/env python
import requests
import argparse
import uuid
import json
from io import BytesIO
from typing import Dict
from datetime import datetime, timezone
@hohonuuli
hohonuuli / http-demo.sc
Last active April 9, 2025 17:46
Example of using Circe with java.net.http
#!/usr/bin/env -S scala
// Brian Schlining. 2024-12-22
//> using dep "io.circe::circe-core:0.14.10"
//> using dep "io.circe::circe-generic:0.14.10"
//> using dep "io.circe::circe-parser:0.14.10"
import io.circe.Decoder
import io.circe.generic.semiauto.deriveDecoder
import io.circe.parser.decode
@hohonuuli
hohonuuli / IO.scala
Last active November 19, 2024 19:40
import scala.concurrent.{ExecutionContext, Future}
/**
* Poor-man's IO
*/
type IO[A, B] = A => Either[Throwable, B]
type AsyncIO[A, B] = A => Future[B]
object IO:
@hohonuuli
hohonuuli / WarpHere.scpt
Created February 19, 2024 01:06
AppleScript to open a Warp tab at the current location in the finder
(*
WarpHere by Brian Schlining
2024-02-18
*)
-- when the toolbar script icon is clicked
--
on run
tell application "Finder"
try
@hohonuuli
hohonuuli / auto-analyze.sc
Created June 28, 2023 18:31
Proof of concept script to analyze video using ML via beholder and pythia services
#!/usr/bin/env -S scala-cli shebang
//> using scala "3.3.0"
//> using dep "com.lihaoyi::requests:0.8.0"
//> using dep "com.lihaoyi::mainargs:0.5.0"
//> using dep "com.lihaoyi::upickle:3.1.0"
import requests.*
import mainargs.{main, arg, ParserForMethods, Flag}
import upickle.default.*
import java.nio.file.{Files, Paths}
@hohonuuli
hohonuuli / Material.cottheme
Created June 25, 2023 19:16
Material Theme for Cot Editor
{
"attributes" : {
"color" : "#b97ae5"
},
"background" : {
"color" : "#1c252b"
},
"characters" : {
"color" : "#7b9c55"
},
@hohonuuli
hohonuuli / PlayContextSampleQuery.sql
Last active April 11, 2023 18:35
Initial Test Output
SELECT play_context_responses.created_at,
play_context_responses.updated_at,
play_context_responses.id,
play_context_responses.details,
play_context_responses.user_id,
play_context_responses.play_context_id,
bounding_box_specs_1.created_at AS created_at_1,
bounding_box_specs_1.updated_at AS updated_at_1,
bounding_box_specs_1.id AS id_1,
bounding_box_specs_1.description,
@hohonuuli
hohonuuli / Makefile
Created December 12, 2022 16:33 — forked from GavinRay97/Makefile
A Makefile to compile a Maven/Gradle-style project layout using a custom JDK (for use w/ IE, Valhalla)
# Makefile to compile and run Java sources manually
# because JDK 20 Valhalla support is not yet available in IntelliJ IDEA
JAVA_VERSION = 20
JAVAC = /home/user/downloads/jdk-20-vahalla-20-75/bin/javac
JAVA = /home/user/downloads/jdk-20-vahalla-20-75/bin/java
JAVA_COMPILE_OPTIONS = --enable-preview --release $(JAVA_VERSION)
JAVA_OPTIONS = --enable-preview
JAVA_MAIN_CLASS = org.example.Database
@hohonuuli
hohonuuli / Go to folder in Warp.applescript
Last active December 5, 2022 17:19
Script for CotEditor. Opens the parent directory of the currently edited file in Warp
property showAlertDialog : true
-- get file path from CotEditor
tell application "CotEditor"
if not (exists front document) then return
set theFile to file of front document
end tell
-- end script if no file path is specified
@hohonuuli
hohonuuli / loom.sc
Created October 19, 2022 04:12
Scala/Loom example for a medium article
#!/usr/bin/env -S scala-cli shebang --scala-version 3.2.0 -J --enable-preview -J --add-modules=jdk.incubator.concurrent
import scala.util.Using
import java.util.concurrent.ScheduledThreadPoolExecutor
import jdk.incubator.concurrent.StructuredTaskScope
Thread.startVirtualThread(() => println("Hello from virtual thread"))
println("Hello from main thread")