This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require("express"); | |
const app = express(); | |
console.log("initializing") | |
app.get("/foo", (req, res) => { | |
const abort = new AbortController() | |
console.log("entered /foo") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
const Transform = require("stream").Transform; | |
function getArgValue(argName, defaultValue) { | |
const argIndex = process.argv.findIndex(arg => arg.indexOf(argName) !== -1); | |
const argValue = argIndex >= 0 && process.argv.length >= argIndex + 1 | |
? process.argv[argIndex] | |
: defaultValue; | |
return argValue ? (/--[\w-]+=/.test(argValue) ? argValue.split("=")[1] : process.argv[argIndex + 1]) : argValue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env kscript | |
//DEPS org.jetbrains.kotlin:kotlin-reflect:1.3.72,com.fasterxml.jackson.module:jackson-module-kotlin:2.11.2,com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.2 | |
import Config_sealed_classes.Configuration.Greeting.SayHello | |
import com.fasterxml.jackson.core.JsonParser | |
import com.fasterxml.jackson.core.type.TypeReference | |
import com.fasterxml.jackson.databind.DeserializationContext | |
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.databind.deser.std.StdDeserializer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tweetEditor = openTweetEditor(); | |
tweetEditor.addTextContent("..."); | |
r = Random(0, 1); | |
if (r <= 0.2) { | |
tweetEditor.attachImage(); | |
} else if (r <= 0.25) { | |
tweetEditor.attachVideo(); | |
} else if (r <= 0.3) { | |
tweetEditor.attachGif(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
searchResult = searchFor(searchTerm); | |
finished = false; | |
do | |
r = Random(0, 1); | |
if (r <= 0.7) { | |
searchResult.getHit(0).follow(); | |
finished = true; | |
} else if (r <= 0.9) { | |
// there are different categories of results: people, tweets, photos, .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
############################################################################################################ | |
# # | |
# To run this script on startup (tested on Raspbian), do the following: # | |
# # | |
# 1. add /lib/systemd/system/quiz-bot-telegram.service file using `sudo` # | |
# ``` # | |
# Description=Quiz-Bot for Telegram # | |
# After=multi-user.target # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
actAsContributor(previousSession) { | |
r = Random(0, 1) | |
currentSession = null | |
if (r <= 0.7 && previousSessions != Sessions.ScrollTimeline) { | |
currentSession = Sessions.ScrollTimeline | |
scrollTimelineSession() | |
} else if (r <= 0.9 && previousSessions != Sessions.Posting) { | |
currentSession = Sessions.Posting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while( timeOfUseLessThan(30minutes) && endOfTimelineNotReached() ) { | |
currentTweet = scrollOverTweets(Random(1, 10)) | |
// simulate reading current tweet | |
waitRandomBetween(1second, 10seconds) | |
// click depending on kind of tweet | |
// not always clicking, since seeing the preview might be enough | |
if (currentTweet.contains(Images) && Random(0, 1) <= 0.5 ) { |