This file contains hidden or 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
| import BaseHTTPServer | |
| port = 9999 | |
| class HttpHandler(BaseHTTPServer.BaseHTTPRequestHandler): | |
| def do_GET(self): | |
| self.send_response(200) | |
| self.send_header('Content-Type', 'text/plain') | |
| self.end_headers() |
This file contains hidden or 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
| package directory | |
| import akka.stream._ | |
| import akka.stream.scaladsl._ | |
| import akka.{Done, NotUsed} | |
| import akka.actor.ActorSystem | |
| import scala.concurrent.ExecutionContext.Implicits.global | |
| import scala.util.Random | |
| object AkkaStreamSimulink extends App { |
This file contains hidden or 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
| import akka.typed._ | |
| import akka.typed.ScalaDSL._ | |
| import akka.typed.AskPattern._ | |
| import scala.concurrent.Future | |
| import scala.concurrent.duration._ | |
| import scala.concurrent.Await | |
| sealed trait PingPong |
This file contains hidden or 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
| from enum import Enum | |
| State = Enum("State", "Locked Unlocked Working") | |
| Event = Enum("Event", "Push Coin Nop") | |
| class Turnstile(): | |
| def __init__(self): |
This file contains hidden or 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
| struct Server{ | |
| out_buffer: Vec<String>, | |
| in_buffer: Vec<String>, | |
| ... | |
| } | |
| impl Server { | |
| fn send(&mut self, msg: String){ | |
| self.in_buffer.push(msg); | |
| } |