Skip to content

Instantly share code, notes, and snippets.

import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Random;
(**********************************************)
(* Initial predicate and next-state relation. *)
(* Alternatively, you can comment out these *)
(* and use SPECIFICATION. *)
(**********************************************)
SPECIFICATION Spec
(**********************************************)
(* Specify the values of declared constants. *)
(**********************************************)
# A script to record and dump midi notes as a stringified Sonic Pi note-array
# which is ready to be played by `play RECORDED.tick; sleep INTERVAL`.
# Usage:
# - 1. Connect midi device and adjust `midi_key` in the config
# - 2. Run the script
# - 3. After the count_in (4 clicks by default), play a phrase you want
# - 4. Stop the script and check the log pane.
# * Note array is logged every measure.
# - 5. Copy & paste the logged array in another editor buffer and play it
# * By default, the resolution is 16th notes (tick_per_beat = 4)

Build Sonic Pi on Apple Silicon

Some tweaks are needed though, Sonic Pi is already ready to build and run natively on Apple Silicon.

This document describes the steps how to build.

Environment

I checked on the following environment.

(**********************************************)
(* Initial predicate and next-state relation. *)
(* Alternatively, you can comment out these *)
(* and use SPECIFICATION. *)
(**********************************************)
SPECIFICATION Spec
(**********************************************)
(* Specify the values of declared constants. *)
(**********************************************)
@ocadaruma
ocadaruma / README.md
Last active March 7, 2023 14:41
Decaton PerKeyQuota

Per topic quota enforcement flow

image

Threading model

image

Experiment

import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.nio.file.Paths;
import java.time.LocalDateTime;
public class LongTTSP {
public static void main(String[] args) throws Exception {
import java.io.IOException;
import java.io.UncheckedIOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.concurrent.atomic.AtomicReference;
public class WallclockTest {
[package]
name = "sighandler-study"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
signal-hook = "0.3.14"
libc = "0.2.126"
INIT Init
NEXT Next
CONSTANTS
NULL = NULL
Partitions = {1,2,3}
MaxPendingRecords = 2
INVARIANTS
NoRecordsAddedMoreThanMaxPendingRecords