Skip to content

Instantly share code, notes, and snippets.

View vyzo's full-sized avatar

vyzo vyzo

  • Internet
  • Planet Earth
View GitHub Profile
@vyzo
vyzo / gxwc15.ss
Created October 27, 2019 10:05
some minor tweaks over gxwc13
(import :std/net/bio
:std/net/bio/output
:std/net/bio/file
:std/os/fdio
:std/os/fcntl
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
@vyzo
vyzo / gxwc13.ss
Last active October 26, 2019 23:32
wc with direct input buffer processing
(import :std/net/bio
:std/net/bio/output
:std/net/bio/file
:std/os/fdio
:std/os/fcntl
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
@vyzo
vyzo / gxwc11.ss
Created October 26, 2019 21:11
wc using a string buffer and all the other tricks
(import :std/net/bio
:std/net/bio/output
:std/net/bio/file
:std/os/fdio
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
;; shim to use an output buffer on raw file descriptors
@vyzo
vyzo / gxwc9.ss
Created October 25, 2019 10:46
wc with hand-rolled vector-backed string hash table (that doesn't resize)
(import :std/net/bio
:std/net/bio/output
:std/net/bio/file
:std/os/fdio
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
;; shim to use an output buffer on raw file descriptors
@vyzo
vyzo / gxwc6.ss
Created October 25, 2019 09:01
wc with raw fd output
(import :std/net/bio
:std/net/bio/output
:std/net/bio/file
:std/os/fdio
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
;; shim to use an output buffer on raw file descriptors
@vyzo
vyzo / gxwc5.ss
Created October 25, 2019 08:59
wc with presized (huge) hash table
(import :std/net/bio
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
(def (read-next-word buf)
(let lp ((chars []))
(let (next (bio-read-char buf))
(cond
@vyzo
vyzo / gxwc4.ss
Created October 24, 2019 23:02
wc with tries and raw devices; atrocities!
(import :gerbil/gambit/ports
:std/net/bio
:std/sort)
(export main)
(declare (not safe))
(def +nl+
(char->integer #\newline))
(def +space+
(char->integer #\space))
@vyzo
vyzo / group-in.ss
Last active April 25, 2019 20:49
import nesting for gerbil
(import (for-syntax :std/misc/list))
(export group-in)
(defsyntax-for-import (group-in stx)
(def (expand-path top mod)
(syntax-case mod ()
((nested mod ...)
(map (lambda (mod) (stx-identifier top top "/" mod))
(flatten (map (cut expand-path #'nested <>) #'(mod ...)))))
(id
(identifier? #'id)
@vyzo
vyzo / gxwc2.ss
Last active April 24, 2019 15:51
wc with raw devices
(import :std/net/bio
:std/sort
:std/srfi/1)
(export main)
(declare (not safe))
(def (read-next-word buf)
(let lp ((chars []))
(let (next (bio-read-char buf))
(cond
@vyzo
vyzo / ips.txt
Created April 5, 2019 12:52
relay ips
35.175.201.95
18.232.56.199
35.172.224.10
18.188.53.89
18.224.32.43
18.191.192.216
18.236.86.245
34.209.142.65
54.191.81.56
34.251.29.51