Skip to content

Instantly share code, notes, and snippets.

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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
*
@miguno
miguno / Mac Keyboard Symbols.md
Created September 9, 2019 19:28 — forked from Zenexer/Mac Keyboard Symbols.md
List of Mac/Apple keyboard symbols

Common symbols

Modifiers

When a key combination is displayed, the modifiers are written in the order presented here. For example, Control + Option + Shift + Command + Q would be written as ⌃⌥⇧⌘Q.

Sym Key Alt
Control
Option
@miguno
miguno / midipipe.applescript
Last active July 7, 2024 01:45
MidiPipe AppleScript for macOS to reconfigure the AKAI APC 40 mk2 MIDI controller to execute Undo (Cmd-Z) and Redo (Shift-Cmd-Z) in Ableton Live with the controller's 'NUDGE -' and 'NUDGE +' buttons, respectively, instead of nudging the tempo.
# MidiPipe: http://www.subtlesoft.square7.net/MidiPipe.html
#
# The APC 40 out-of-the-box is great for performing, but less useful for producing because it lacks
# frequently used functionality such as Undo/Redo (doh, made a mistake) or deleting clips, for which
# you are forced to go back to mouse and keyboard.
#
# This example AppleScript shows how to use MidiPipe to re-configure the AKAI APC 40 mk2 MIDI controller
# to execute Undo (Cmd-Z) and Redo (Shift-Cmd-Z) in Ableton Live with the controller's 'NUDGE -' and 'NUDGE +'
# buttons, respectively, instead of nudging the tempo.
#
@miguno
miguno / aggregation.sql
Last active January 9, 2020 22:15
ksqlDB example: Continuously aggregating a stream into a table with a push query
-- Continuously aggregating a stream into a table with a ksqlDB push query.
CREATE STREAM locationUpdatesStream ...;
CREATE TABLE locationsPerUser AS
SELECT username, COUNT(*)
FROM locationUpdatesStream
GROUP BY username
EMIT CHANGES;
@miguno
miguno / aggregation.java
Last active April 13, 2022 13:02
Kafka Streams Example: Continuously aggregating a stream into a table
// Continuously aggregating a KStream into a KTable.
KStream<String, String> locationUpdatesStream = ...;
KTable<String, Long> locationsPerUser
= locationUpdatesStream
.groupBy((k, v) -> v.username)
.count();
@miguno
miguno / topic-as-stream.java
Last active January 9, 2020 07:38
Kafka Streams Example: read a topic as a stream
// Create KStream from Kafka topic.
StreamsBuilder builder = new StreamsBuilder();
KStream<String, String> stream =
builder.stream("input-topic", Consumed.with(Serdes.String(), Serdes.String()));
@miguno
miguno / topic-as-stream.sql
Last active January 9, 2020 07:37
ksqlDB example: read topic as stream
-- Create ksqlDB stream from Kafka topic.
CREATE STREAM myStream (username VARCHAR, location VARCHAR)
WITH (KAFKA_TOPIC='input-topic', VALUE_FORMAT='...');
@miguno
miguno / topic-as-table.sql
Last active January 9, 2020 07:56
ksqlDB example: read topic as table
-- Create ksqlDB table from Kafka topic.
CREATE TABLE myTable (username VARCHAR, location VARCHAR)
WITH (KAFKA_TOPIC='input-topic', KEY='username', VALUE_FORMAT='...');
@miguno
miguno / topic-as-table.java
Last active January 9, 2020 07:56
Kafka Streams Example: read topic as table
// Create KTable from Kafka topic.
KTable<String, String> table = builder.table("input-topic", Consumed.with(Serdes.String(), Serdes.String()));