Skip to content

scramjetorg/platform-samples

Repository files navigation

Samples

Try out our samples prepared for you. We differentiated them according to the language in which they were written.

Every sample contains a short readme with a guidance describing the procedure for running the example. The execution will be performed from the command line using our CLI, which full description and documentation you will find here.

Python samples

Python packages work in a similar way to all the others. They need to pack the dependencies and carry over anything they may need to run the program. They also need a package.json file.

JavaScript samples

JavaScript packages are pretty straight forward in use. After the dependency installation is performed inside the Sequence package it is ready to be compressed and sent to STH.

  • hello - Sequence that modifies incoming stream of strings by saying "Hello".
  • hello-snowman - Sequence that reads incoming stream, and modifies it by adding a text message according to the incoming data.
  • simple-counter-js - Sequence, that counts to 1000, and logs the number in one-second intervals.
  • test-output - Sequence that simply writes random values to the output stream.
  • json-url-stdout - Make a real-time JSON API scraper (stdout version)
  • json-url-output - Make a real-time JSON API scraper (output version)
  • pokemon - Sequence that takes any pokemon name as an input and scrapes data from the Pokemon API, writes it to the output and stdout stream.

TypeScript samples

TypeScript compiles to JavaScript. It means that TypeScript packages except dependency installation also need to be compiled. We added a build and postbuild scripts to every package.json in TypeScript packages, which are responsible for compiling files into a dist folder and coping package.json file into the dist folder. In effect, it is the dist folder, that becomes the Sequence package, ready to be compressed and sent to STH.

  • crypto-prices - Sequence that keeps printing current crypto prices for a provided pair of currencies every 3s.
  • slack-write - Write incoming data to a slack channel
  • slack-read - Read data from Slack
  • discord-write - Write to Discord
  • discord-read - Read from Discord
  • mediawiki - Sequence that keeps printing mediawiki event stream.
  • rss - Sequence that gets a list of RSS and then retrieves each feed and passes links to scraper.
  • write-to-database - Write incoming data to a database table
  • scraping - Sequence that scrapes web pages.
  • stack-overflow - Sequence that gets a number of changes in Stack Overflow tag count.
  • transform-string-stream - Sequence that modifies incoming stream of strings by adding a prefix and a suffix.
  • read-targz-stats - Stream through tar.gz file and output stats
  • send-to-github - Write incoming data to a file on github
  • linkedin - Enrich csv data with Linkedin via RapidAPI
  • hexdump -Sequence returns input in hex format.

Guides and complex examples

  • kafka-setup - how to set up a kafka instance and consume data from it with Scramjet Cloud Platform
  • discord-slack-connection - how to interconnect discord and slack with Scramjet Cloud Platform