Skip to content

Instantly share code, notes, and snippets.

class Scratch3ML4KMap {
constructor() {
this.EARTH_RADIUS = 6371;
this.TOP_LEFT = {
mapCoordsX : -240, mapCoordsY : 180,
lat : 40.0, lon : -123.5
};
this.BOTTOM_RIGHT = {
@dalelane
dalelane / send-folder.sh
Created March 13, 2024 20:22
Using the Event Streams Producer API to produce data from a folder, one message per file
#!/bin/sh
# the URL from Step 1
URL=https://my-kafka-cluster-ibm-es-recapi-external-event-automation.apps.15eb31a112f5c312116f22c1.cloud.techzone.ibm.com
# the credentials from Step 2
USERNAME=demo-username
PASSWORD=tfmA896q8l3rCcbqa15k4NOcbn8Zm5ir
# the folder with test files you created in Step 3
@dalelane
dalelane / send-file.sh
Created March 13, 2024 20:20
Using the Event Streams Producer API to produce data from a file, one message per line
#!/bin/sh
# the URL from Step 1
URL=https://my-kafka-cluster-ibm-es-recapi-external-event-automation.apps.15eb31a112f5c312116f22c1.cloud.techzone.ibm.com
# the credentials from Step 2
USERNAME=demo-username
PASSWORD=tfmA896q8l3rCcbqa15k4NOcbn8Zm5ir
# the file you created in Step 3
asyncapi: 3.0.0
id: 'https://github.com/dalelane/my-first-asyncapi-v3-doc'
info:
title: 'Title of my app'
version: '0.0.1'
description: 'This is what **my app** does. It uses `code`.'
termsOfService: https://dalelane.co.uk/asyncapi/terms-of-service
contact:
name: Dale Lane
url: https://dalelane.co.uk
@dalelane
dalelane / nodejs_simple_inmemory_db.js
Created June 15, 2014 20:49
Node.js with an SQLite in-memory database (from https://github.com/mapbox/node-sqlite3)
var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database(':memory:');
db.serialize(function() {
db.run("CREATE TABLE lorem (info TEXT)");
var stmt = db.prepare("INSERT INTO lorem VALUES (?)");
for (var i = 0; i < 10; i++) {
stmt.run("Ipsum " + i);
}
@dalelane
dalelane / setup-eem-truststore.sh
Last active October 12, 2023 07:39
set up a truststore for Kafka clients connecting to the Event Gateway in Event Endpoint Management (using the keystore retrieved from the API Manager)
# -------------------------------------------------------------------
# update these to match your Event Endpoint Management instance
# -------------------------------------------------------------------
NAMESPACE=eventendpointmanagement
INSTANCE=eem
echo "\n\033[1;33m getting SSL/TLS details for Event Gateway in...\033[0m"
echo "namespace : $NAMESPACE"
echo "instance : $INSTANCE"
@dalelane
dalelane / proposal.md
Last active September 20, 2023 02:50
Describing Kafka schema usage using AsyncAPI
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:books"
xmlns:bks="urn:books">
<xsd:element name="books" type="bks:BooksForm"/>
<xsd:complexType name="BooksForm">
<xsd:sequence>
<xsd:element name="book"
type="bks:BookForm"
<?xml version="1.0"?>
<x:books xmlns:x="urn:books">
<book id="bk001">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<price>44.95</price>
<pub_date>2000-10-01</pub_date>
<review>An amazing story of nothing.</review>
</book>
asyncapi: 2.6.0
id: https://github.com/dalelane/my-asyncapi-v2-doc
info:
title: Modo Jeans order system
description: >
Need to write something here
### Using headers