Skip to content

Instantly share code, notes, and snippets.

View erkin's full-sized avatar

Lulu Cathrinus Grimalkin erkin

View GitHub Profile
@erkin
erkin / issue
Created December 8, 2018 07:51

This is \l on \n, running \s on \m,
with kernel \r.
\\ /
-->*<--
/o\\
/_\\_\\
/_/_0_\\
/_o_\\_\\_\\
/_/_/_/_/o\\

Keybase proof

I hereby claim:

  • I am erkin on github.
  • I am erkinb (https://keybase.io/erkinb) on keybase.
  • I have a public key ASAc4RSCeufWknLV_H9Cmb6bYPis3q4Pab6z7vRxfvBX8go

To claim this, I am signing this object:

@erkin
erkin / gopher.rkt
Last active June 2, 2020 11:50
Minimal gopher client in Racket
#lang racket
(define (gopher host (port "70") (path "/"))
(define-values (in out) (tcp-connect host (string->number port)))
(display (string-append path "\r\n") out)
(flush-output out)
(for-each displayln (port->lines in #:line-mode 'return-linefeed))
(close-output-port out))
(module+ main
#lang racket/base
(define-syntax-rule (assert expr)
(unless expr
(raise-user-error "Assertion failed: " (quote expr))))
(define (factorial n)
(if (zero? n)
1
(* n (factorial (sub1 n)))))
@erkin
erkin / pride.rkt
Last active January 14, 2022 18:13
Print pride flags to your terminal
#lang racket ; -*- racket -*-
(define gay
'((228 003 003) ; red
(255 140 000) ; orange
(255 237 000) ; yellow
(000 128 038) ; green
(000 077 255) ; blue
(117 007 135) ; purple
))
@erkin
erkin / pure-mlang.rkt
Created January 9, 2020 08:46
`racket/base` sans mutative procedures
#lang racket/base
(provide
(except-out
(all-from-out racket/base)
set!
set!-values
box-cas!
bytes-copy!
bytes-fill!
bytes-set!
@erkin
erkin / docker-compose.yaml
Created May 29, 2020 12:40
SchemeBBS with Traefik
version: "3.3"
services:
bbs:
image: erkin/schemebbs
container_name: sbbs
labels:
- "traefik.enable=true"
- "traefik.http.services.bbs.loadbalancer.server.port=80"
- "traefik.http.routers.bbs.rule=Host(`example-bbs.org`)"
- "traefik.http.routers.bbs.entrypoints=websecure"
@erkin
erkin / docker-compose.yaml
Created May 29, 2020 12:42
SchemeBBS with Varnish
version: "3.3"
services:
bbs:
image: erkin/schemebbs
container_name: sbbs
ports:
- '8080'
volumes:
- ${SBBS_DATADIR}:/opt/schemebbs/data
proxy:
@erkin
erkin / webhook.rkt
Last active July 22, 2020 17:00
Minimal Discord webhook client (text-only)
#lang racket/base
(require net/http-client json)
(define webhook-id "foo")
(define webhook-token "bar")
(module+ main
(http-conn-send!
(http-conn-open "discord.com" #:ssl? #t)
(string-append "/api/webhooks/" webhook-id "/" webhook-token)
@erkin
erkin / get-pass.ss
Last active October 5, 2020 02:52
getpass in Chez Scheme
;;; Chez Scheme clone of Python `getpass'
;;; Based on github.com/smitchell556/get-pass
(library (get-pass)
(export get-pass)
(import (chezscheme))
;;; FFI portion
;;; See termios(3) for more info
(define-ftype termios
(struct