Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"sync"
)
type bot_instance struct {
running bool
deaded bool
@madper
madper / test.go
Created August 21, 2017 14:12
read len first.
package main
import "net"
import "io"
import "encoding/binary"
import "fmt"
func handleConnection(conn net.Conn) {
defer conn.Close()
p := make([]byte, 4)
@madper
madper / boom.scala
Created November 29, 2021 13:08
downloader
def run(args: List[String]): URIO[Random with Console with Console,ExitCode] = {
HttpClientZioBackend().flatMap { backend =>
for {
_ <- random.nextIntBetween(0, urist.length - 1).flatMap( i => quickRequest.get(urist(i)).send(backend)).catchAll(e => putStrLn(e.getMessage())).forever.fork
r <- r.join
_ <- backend.close()
} yield ()
}.exitCode
}
def run(args: List[String]): URIO[Random with Console with Console,ExitCode] = {
HttpClientZioBackend().flatMap { backend =>
for {
r <- random.nextIntBetween(0, urist.length - 1).flatMap( i => quickRequest.get(urist(i)).send(backend)).catchAll(e => putStrLn(e.getMessage())).forever.fork
_ <- r.join
_ <- backend.close()
} yield ()
}.exitCode
}