This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## This PowerShell function will create a federated user in Microsoft's directory, allowing | |
## you to create new users having your custom domain. | |
## | |
## First, I had already set up federated user ids, with SAML Auth setup on the Google Workspace | |
## side, and setting some things on the Microsoft Entra ID side. There is a Microsoft how-to | |
## document on setting this up, if you search for it. | |
## | |
## The problem was that in the MS Admin portal (https://admin.microsoft.com/Adminportal/Home?#/users) | |
## I could add new users, but I could not see our custom domain in the drop down list when specifying |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package io.javalin.rendering.template | |
import io.javalin.http.Context | |
import io.javalin.rendering.FileRenderer | |
import io.javalin.rendering.util.RenderingDependency.PEBBLE | |
import io.javalin.util.DependencyUtil | |
import io.javalin.util.OptionalDependency | |
import io.pebbletemplates.pebble.PebbleEngine | |
import io.pebbletemplates.pebble.loader.ClasspathLoader | |
import java.io.StringWriter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
## Re: https://stackoverflow.com/questions/48644841/multiple-addn-hosts-conf-in-dnsmasq | |
## | |
## You may specify multiple addn-hosts on dnsmasq.conf | |
addn-hosts=/srv/dnsmasq/dns-configs/db.10.0.31.hosts | |
addn-hosts=/srv/dnsmasq/dns-configs/db.10.0.32.hosts | |
## : | |
## : | |
## etc | |
## : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package bugs | |
import kotlin.random.Random.Default.nextBoolean | |
object IncorrectConditionIsAlwaysFalse { | |
private fun conditionA() = nextBoolean() | |
private fun conditionB() = nextBoolean() | |
data class Action(val list: List<Int>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Barcode Webfont Example</title> | |
<link href="https://fonts.googleapis.com/css2?family=Libre+Barcode+39+Extended+Text&display=swap" rel="stylesheet"> | |
<style type="text/css"> | |
.barcode39 { | |
font-family: 'Libre Barcode 39 Extended Text', cursive; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub investigatePrinterPaperSizeSituation() | |
Dim printerList As PrinterSettings.StringCollection = PrinterSettings.InstalledPrinters() | |
For Each printer As String In printerList | |
_logger.logInfo("found printer: " & printer) | |
Dim settings As PrinterSettings = new PrinterSettings() | |
'' So...., check this out: | |
settings.PrinterName = printer | |
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.DayOfWeek | |
import java.time.LocalDate | |
fun LocalDate.lastDayOfWeek(dow: DayOfWeek): LocalDate { | |
val minus = (this.dayOfWeek.value + 7 - dow.value) % 7 | |
return this.minusDays(minus.toLong()) | |
} | |
fun LocalDate.firstDayOfWeek(dow: DayOfWeek): LocalDate { | |
val plus = (dow.value + 7 - this.dayOfWeek.value) % 7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sealed class AccessRequirement<R> { | |
fun isSatisfiedByRoles(callerRoles: Set<R>): Boolean { | |
return when (this) { | |
is AlwaysAllow -> true | |
is NeverAllow -> false | |
is RequireRole -> callerRoles.contains(role) | |
is AnyOfRoles -> (callerRoles intersect anyOfRoles).isNotEmpty() | |
is AllOfRoles -> callerRoles.containsAll(allOfRoles) | |
is AnyOfAccessRequirements -> anyOf.any { it.isSatisfiedByRoles(callerRoles) } | |
is AllOfAccessRequirements -> allOf.all { it.isSatisfiedByRoles(callerRoles) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package testing | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import org.junit.jupiter.api.Assertions.assertEquals | |
import org.junit.jupiter.api.Test | |
import java.util.* | |
class TestJacksonWithOptional { | |
val defaultObjectMapper = ObjectMapper().apply { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun inputStreamToTrimmedString(inputStream: InputStream): String { | |
val baos = ByteArrayOutputStream() | |
val buffer = ByteArray(128) | |
inputStream.bufferedSequence(buffer) { bytesRead -> baos.write(buffer, 0, bytesRead) } | |
return baos.toString("UTF-8").trim() | |
} |
NewerOlder