Skip to content

Instantly share code, notes, and snippets.

dev:
quarkus dev
jshell:
#!/usr/bin/env jbang --jsh
//DEPS com.github.javafaker:javafaker:1.0.2
var faker = new com.github.javafaker.Faker();
println(faker.nation().nationality());
java:
@visortelle
visortelle / README.md
Last active July 2, 2023 07:12
Aliases for Apache Pulsar CLI tools with JWT auth. Add it to your ~/.bashrc or ~/.zshrc.

Aliases for Apache Pulsar CLI tools with JWT auth

Usage

  • Add the pulsar-cli-aliases.shfile content to your ~/.bashrc or ~/.zshrc.
  • Fill pulsar_jwt, pulsar_url, pulsar_admin_url with your values.
  • Then use short commands like pa topics stats public/default/topic-a instead of
pulsar-admin \
@andrewrk
andrewrk / build.zig
Created February 20, 2023 16:20
sprinkling a little zig into a C project to help with debugging
const std = @import("std");
pub fn build(b: *std.Build) void {
// Standard target options allows the person running `zig build` to choose
// what target to build for. Here we do not override the defaults, which
// means any target is allowed, and the default is native. Other options
// for restricting supported target set are available.
const target = b.standardTargetOptions(.{});
// Standard optimization options allow the person running `zig build` to select
@dustingetz
dustingetz / a.md
Last active September 12, 2022 13:32
Photon demo: database branching (time travel)

Photon demo: database branching (time travel)

  • This demo uses DataScript's API for speculative transactions, not sure if can be done with sql read transactions.
  • DataScript is on the server; code is network-transparent.
  • 100 LOC for everything (table, query, popover, css, page)
20220910.branched.popover.staging.area.2.mp4
@otobrglez
otobrglez / Main.scala
Last active May 27, 2021 06:35
Exploring Cats Effect and sttp
// Oto Brglez - <otobrglez@gmail.com> - May 2021
package com.pinkstack.gen4
import cats.effect.implicits._
import cats.effect.{ExitCode, IO, IOApp}
import cats.implicits._
import com.pinkstack.gen1.CoinMarketCap.Implicits._
import com.pinkstack.gen1.CoinMarketCap._
import sttp.client3._
import sttp.client3.circe._
@kubukoz
kubukoz / http4s-onEmptyOrNonEmpty.scala
Last active April 2, 2021 14:24
Return NotFound if http4s response stream is empty, wrap it in a different status otherwise
/*
Copyright 2021 Jakub Kozłowski
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@serras
serras / variants.md
Created August 31, 2020 19:37
Variants: the ultimate frontier

Variants: the ultimate frontier

Most data serialization formats, like JSON, YAML, and EDN, feature a similar set of basic building blocks, namely:

  • Some primitive values, like numbers, strings, and booleans;
  • Key-value pairs, also known as maps, dictionaries, or objects;
  • Sequences, usually in the form of lists or arrays, and sometimes also sets.

I completely agree with the fact that those are basic building blocks for data inside any information system. However, as a Haskeller I always miss one additional part of my toolbox: variants. Variants are essentially tagged values which contain further values inside.

@dacr
dacr / index.md
Last active June 28, 2024 23:14
David's programming examples knowledge base / published by https://github.com/dacr/code-examples-manager #fecafeca-feca-feca-feca-fecafecafeca/207c50c8da525812363701a12ee72e8eb9151628

David's programming examples knowledge base

akka-pekko

@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@edefazio
edefazio / swar.subword.SWARIntro_NoComments.java
Last active January 22, 2024 09:48
using SWAR (SIMD Within A Register) in Java using general purpose registers
package swar.subword;
public class SWAR_Intro_NoComments
{
public static void main ( String[] args )
{
int x = 12345678;
int y = 9012345;
long xyCompound = as2x32BitCompound ( x, y );