Skip to content

Instantly share code, notes, and snippets.

View esuomi's full-sized avatar

Esko Suomi esuomi

  • Helsinki, Finland
View GitHub Profile
@esuomi
esuomi / pom.xml
Created November 29, 2023 09:32
Maven local repository
<repositories>
<!-- local mirror for hard-to-get dependencies -->
<repository>
<id>local-dependencies</id>
<name>local-dependencies</name>
<url>file://${project.basedir}/local-dependencies</url>
</repository>
</repositories>
@esuomi
esuomi / mando_s3.md
Created August 8, 2023 10:53
Mandalorian season 3 reframed

Mandalorian season 3 reframed or what I think was the original story before executive meddling. Each paragraph is roughly one episode.

Season starts off with BOBF Chapter 5: Return of the Mandalorian and for the most part is exactly what happens in this episode, with the exception that Mando’s spear is not turned into chainmail. Whether this was meant to happen at the underside of Halo or not, who knows, but I’d say probably, since Mando isn’t very mobile at this point. Mando goes on a quest to redeem himself as he’s now an apostate. Because of his low interplanetary mobility, Mando takes the spacebus to Tatooine to visit Peli Motto and acquires the Hot Rod N-1, with R5-D4 as its astromech.

Mando goes to Kalevala to see Bo-Katan, as seen at end of Mandalorian s3e01. Nothing else is relevant from that episode, IG-11 plotline doesn’t exist, Grogu lives with Luke where he’s training his jedi powers, he’s not part of the show. Bo-Katan still sulks, but agrees to go to Mandalore just to prove a point abo

@esuomi
esuomi / log.clj
Created August 19, 2022 11:53
colored logging output for clojure.tools.logging using puget and aviso pretty
; deps:
[org.slf4j/slf4j-api "1.7.36"]
[ch.qos.logback/logback-classic "1.2.11"]
[org.clojure/tools.logging "1.2.4"]
[io.aviso/pretty "1.1.1"]
[mvxcvi/puget "1.3.2"]
; shim code:
(ns mantle.log
(:require [clojure.string :as str]
@esuomi
esuomi / update-poetry.py
Created August 31, 2020 14:05
Run this + poetry update after it in git post-merge hook to sync requirements.txt to working Poetry environment automatically
import tempfile
import re
def write_requirements(target_file):
with open("requirements.txt", "r") as deps:
for depline in deps:
m = re.search("^(.+)==(.+)$", depline)
target_file.write(m.group(1) + " = \"" + m.group(2) + "\"\n")
if __name__ == '__main__':
@esuomi
esuomi / Makefile
Last active October 19, 2017 07:09
# This top level Makefile runs make in all subdirectories with Makefiles in them
# Original taken from https://stackoverflow.com/a/17845120
#
# TOPTARGETS define all make commands which can be used in all Makefiles within this repo
TOPTARGETS := clean build test publish-dev publish-prod
SUBDIRS := $(shell find . -mindepth 2 -name "Makefile" | xargs dirname)
.PHONY: $(TOPTARGETS) $(SUBDIRS)
$(TOPTARGETS): $(SUBDIRS)
@esuomi
esuomi / Labels2.java
Created October 14, 2017 16:01
this is even worse
public class Labels {
public static void main(String[] args) {
http://example.org
for (int i = 0; i <= 3; ++i) {
System.out.println("i = " + i);
if (i == 2) {
System.out.println("*cough*");
i = 2;
continue http;
}
public class Labels {
public static void main(String[] args) {
http://example.org
for (int i = 0; i < 5; i++) {
System.out.println("i = " + i);
if (i == 3) {
break http;
}
}
}
@esuomi
esuomi / FizzBuzz8.java
Created February 15, 2014 12:53
Java 8 lambda syntax and then some to reinvent the FizzBuzz wheel.
package features;
import java.util.function.Function;
import java.util.stream.IntStream;
/**
* Just to prove that I'm not an idiot. Or maybe I am but haven't noticed it yet. Making seemingly simple tasks
* makes one really, really paranoid.
*
* @since 15.2.2014
@esuomi
esuomi / CodePointIterator.java
Created November 3, 2013 09:27
Iterates through a given `String` in unicode compatible way character by character.
package text;
import java.util.Iterator;
/**
* <p>Fun fact, this actually already exists in <code>sun.text.CodePointIterator</code></p>
*
* @author Esko Suomi <suomi.esko@gmail.com>
* @since 31.8.2013
*/
@esuomi
esuomi / gist:7180371
Last active December 26, 2015 16:29
UPDATE/CREATE REST-rajapinnoissa

simppeli POST

POST /collection/{resourceId} + request payload

  • Jos resurssi on uusi, luodaan resurssi. (=CREATE)
  • Jos resurssi on olemassa, asetetaan resurssin arvoksi annettu tieto. (=UPDATE) Osittainen resurssin päivitys mahdollista.

simppeli PUT

PUT /collection + request payload