Skip to content

Instantly share code, notes, and snippets.

View pepe's full-sized avatar

Josef Pospíšil pepe

View GitHub Profile
@sogaiu
sogaiu / gist:b96d62095d453a29033ebae6f07890c2
Last active September 14, 2020 07:53
janet abstract and marshal / unmarshal
https://github.com/janet-lang/janet/blob/master/src/include/janet.h
https://github.com/janet-lang/janet/blob/master/src/core/abstract.c
https://github.com/janet-lang/janet/blob/master/src/core/marsh.c
https://github.com/janet-lang/janet/blob/master/src/core/typedarray.c
https://github.com/janet-lang/janet/blob/master/src/core/peg.c
/* A context for marshaling and unmarshaling abstract types */
typedef struct {
void *m_state;
void *u_state;
@cellularmitosis
cellularmitosis / Makefile
Last active August 5, 2020 00:19
Trivial Janet project with a bundled native C module
default: test-foo test-baz
build/foo.a: foo.c
jpm --verbose build
test-foo: build/foo.a
test 42 = $(shell janet -e '(import build/foo :as foo) (print (foo/bar))')
repl-foo: build/foo.a
janet -e '(import build/foo :as foo)' -r
@cellularmitosis
cellularmitosis / README.md
Last active August 10, 2020 19:14
Janet 1.10.1 Stdlib, organized by topic
@sogaiu
sogaiu / peg-exercises.janet
Last active November 11, 2022 00:27
janet peg exercises
# find * and + to be confusing, trying to use sequence and choice instead
(def peg-simple
~{:main (capture (some :S))})
(peg/match peg-simple "hello") # => @["hello"]
# from:
# https://janet-lang.org/docs/peg.html
(defn finder
@yogthos
yogthos / clojure-beginner.md
Last active May 6, 2024 08:11
Clojure beginner resources

Introductory resources

@bakpakin
bakpakin / utf8.janet
Last active January 19, 2022 11:34
Use pegs to parse utf8
###
### utf8.janet
###
### Pure janet utf8 utils. You should probably just use C.
###
(defn utf8-encode
"Convert a sequence of codepoints to a string."
[x]
(def buf @"")
@lilactown
lilactown / ueaq.cljs
Last active November 14, 2019 11:58
(ns ueaq.core
(:require
[goog.object :as gobj]
["react" :as r]
["react-dom/server" :as rds]))
(defn unwrap
[^js p]
(.-__unwrap p))
@bahamas10
bahamas10 / README.md
Last active November 22, 2022 00:26
Void Linux on Raspberry Pi 4

Summary

I'm able to get a Void Linux image (32bit, raspberry pi 2 image) to boot on the raspberry pi 4. Currently, I can get it to boot and even handle upgrading via xbps-install -Su (networked over ethernet), however I can't seem to get it to see the internal wlan (wifi) device.

huge shout out to kodifies on this reddit post for helping me to get this going.

@Jonarod
Jonarod / README.md
Last active April 20, 2024 19:27
Install Alpine Linux on Hetzner cloud
  1. Create an hetzner server using Ubuntu
  2. Go to the Hetzner's Server dashboard > Images
  3. Click on "Mount" over the alpine-linux-extended.iso image
  4. Shutdown the server
  5. Start the server
  6. Click the "Console" icon from the dashboard to open an interactive terminal session
  7. Login is root
  8. Configure the interface using the command setup-interfaces
  9. Pick to setup default eth0
  10. Custom config: no
jdoc() {
export JANET_PATH=/usr/local/lib/janet
janet -l ~/scripts/misc/import-all -e '(import-all) (each b (all-bindings) (print b))' \
| fzf --preview "echo {} | xargs -I[] \
janet -l ~/scripts/misc/import-all \
-e '(import-all) \
(def is-fun (let [t (type [])] (or (= t :function) (= t :cfunction)))) \
(if is-fun (doc []) (do (pp (type []))(pp [])))' \
| sed 's/^\s*//g' \
| awk NF" \