Samples 📚
We have prepared some samples for you that show the different uses of a Sequence. Some are super simple, some are a little more advanced. They show the use of data from various resources, such as local disk, external API, or plain keyboard input. The samples are differentiated according to language in which they were written. Every sample contains a short readme with a guidance describing the procedure for running the example as well as is linked to its source code on GitHub. Please take a look at our samples and if you have any questions or difficulties, feel free to ask us on Discord.
The execution will be performed using Scramjet's command-line interface CLI.
Prerequisites​
Sample execution requires prior environment preparation and installations.
Environment​
You can run each sample either on your Self Hosted Hub or Scramjet Cloud Platform. Choose the most suitable for you and follow the link that provides installation tips and guidelines:
- Scramjet Transform Hub installation
- Scramjet Cloud Platform installation
Command Line Interface​
Samples execution will be performed from the command line using our CLI, which full description you will find in our official documentation website in
CLI Reference section, or run si --help
command where you have everything in a nutshell.
You can install the si
command from npm using the following command:
npm i -g @scramjet/cli
Repository​
Please clone Scramjet's platform-samples GitHub repository:
git clone https://github.com/scramjetorg/platform-samples.git
- JavaScript
- TypeScript
- Python
Hello-World-Js
Simple Sequence that prints out 'Hello World!' to the Instance output.
Json-Url-Output
Sequence that pulls data from JSON url every x seconds and writes it to Instance output endpoint.
Json-Url-Stdout
Sequence that pulls data from JSON url every x seconds and writes it to Instance stdout endpoint.
Pokemon
A Sequence that reads incoming data via input stream, then based on that data, a request is sent to external API.
Simple-Counter-Js
A simple Sequence, that counts and logs the number in 1s intervals.
Python-Co2-Emission
Sequent Python-CO2-Emission is a Python library that fetches CO2 emission information from an API, enabling easy access and analysis of carbon dioxide data.
Hello-World-Py
Simple Sequence that prints out 'Hello World!' to the Instance output.
Python-Kafka-Consumer
Sequence that can retrieve data from Kafka topic and show the result on 'output'.
Python-Markdown-Keywords
Sequence that suggests keywords for header in *.md. This is also an easy example of usage Kaffka with Scramjet platform.
Python-Voice-Recognition
This Sequence is a trivial example of voice recognition with Scramjet and speech_recognition Python library.
Text2audio-Events
Sequence that uses AssemblyAi to transcript Audio sent by input channel
Audio2text-Input
Sequence that uses AssemblyAi to transcript Audio sent by input channel
Crypto-Prices
Sequence that keeps printing current crypto prices for a provided pair of currencies every 1s.
Discord-Read
Sequence that reads messages from Discord channel and writes to topic.
Discord-Write
Sequence that reads messages from topic and writes to Discord via webhook.
Hello-World-Ts
Simple Sequence that prints out 'Hello World!' to the Instance output.
Hexdump
A simple Sequence that takes file as an input and returns a hexadecimal view of this file on output.
This sequence processes CSV input and retrieves additional company data from LinkedIn via RapidAPI
Read-Targz-Stats
Sequence that reads tar.gz file from input and returns JSON containing basic information about archived files along with unpacked data.
Repo-Checker
Sequence which get info for repos on various platforms and send it to topic
Stack-Overflow
This a Sequence that gets the number of changes in Stack Overflow tag count. This queries SO API every x minutes, gathers, compares and outputs result as difference.
Transform-String-Stream
Sequence that modifies incoming stream of strings by adding a prefix and a suffix.