Skip to content

Instantly share code, notes, and snippets.

View stefanozanella's full-sized avatar

Stefano Zanella stefanozanella

View GitHub Profile
package me.stefanozanella.sampleapp
import com.sksamuel.avro4k.Avro
import org.apache.avro.generic.GenericRecord
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.kafka.core.KafkaTemplate
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.ModelAttribute
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Add stock purchase</title>
</head>
<body>
<h2>Add a stock purchase</h2>
<form method="post" th:action="@{/stock_purchase}" th:object="${stockPurchase}">
<p>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Stock purchase created</title>
</head>
<body>
<p>Stock purchase created.</p>
<p th:text="${stockPurchase.ticker}" />
<p th:text="${stockPurchase.purchaseDate}" />
package me.stefanozanella.sampleapp
import org.springframework.stereotype.Controller
import org.springframework.ui.Model
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.ModelAttribute
import org.springframework.web.bind.annotation.PostMapping
@Controller
class StockPurchaseController {
package me.stefanozanella.sampleapp
import com.sksamuel.avro4k.serializer.LocalDateSerializer
import kotlinx.serialization.Serializable
import java.time.LocalDate
@Serializable
data class StockPurchase(
val ticker: String = "",
@Serializable(with = LocalDateSerializer::class) val purchaseDate: LocalDate = LocalDate.now(),
package me.stefanozanella.sampleapp
import java.time.LocalDate
data class StockPurchase(
val ticker: String = "",
val purchaseDate: LocalDate = LocalDate.now(),
)
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.springframework.boot") version "2.4.1"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version "1.4.21"
kotlin("plugin.spring") version "1.4.21"
kotlin("plugin.serialization") version "1.4.21" // <-- (1)
idea
}
@stefanozanella
stefanozanella / html5mathjax.cfg
Last active March 7, 2023 22:10
Custom tex4ht (htlatex) configuration, so that it generates HTML5 code with MathJax rendering
% We are generating HTML + MathML code
\Preamble{xhtml,mathml}
% We don't want to translate font suggestions with ugly wrappers like
% <span class="cmti-10"> for italic text
\NoFonts
% Don't output xml version tag
\Configure{VERSION}{}
@stefanozanella
stefanozanella / tip.md
Created November 27, 2013 12:57
How to improve UX during kickstart installations with long `%post` sections

From here

%post
# change to new vt and set stout/stdin
exec < /dev/tty6 > /dev/tty6
chvt 6
# run post-install

# write/call scripts here
@stefanozanella
stefanozanella / botchagalupe_research.md
Last active November 10, 2023 01:16 — forked from botchagalupe/gist:7423501
Resources about SDN by John Willis

The Network The Next Frontier for Devops http://www.slideshare.net/botchagalupe/sdn-and-devops

Cumulus Networks: A Sneak Preview of One of My Favorite Startups - James Hamilton Blog http://perspectives.mvdirona.com/2013/06/18/CumulusNetworksASneakPreviewOfOneOfMyFavoriteStartups.aspx

Stanford Seminar - Software-Defined Networking at the Crossroads http://www.youtube.com/watch?v=WabdXYzCAOU

NetworkStatic | Brent Salisbury Blog http://networkstatic.net/

Network World: A conversation with Kelly Wanser, CEO of Stateless Networks http://www.statelessnetworks.com/network-world-a-conversation-with-kelly-wanser-ceo-of-stateless-networks/