Welcome to the CHICKEN Scheme pasting service

awful-stress.scm added by mario-goulart on Sat Jul 18 16:16:19 2026

(import (chicken io)
        (chicken irregex))
(import awful base64)

(define (read-random num)
  (with-input-from-file "/dev/urandom"
    (lambda ()
      (read-string num))))

(define (random-path)
  (string-append
   "/"
   (irregex-replace/all "/"  (base64-encode (read-random 32)) "_")))

(define (define-random-page path)
  (define-page path
    (lambda ()
      `(div
        (p ,(read-random 1024))))))

(define random-paths
  (let loop ((num-urls 1500))
    (if (zero? num-urls)
        '()
        (let ((path (random-path)))
          (define-random-page path)
          (cons path (loop (sub1 num-urls)))))))

(with-output-to-file "urls.txt"
  (lambda ()
    (for-each (lambda (path)
                (print (string-append "http://localhost:8080" path)))
              random-paths)))

(print "urls.txt is ready")

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which egg provides `string-pad-right'?
Visually impaired? Let me spell it for you (wav file) download WAV