Skip to content

Instantly share code, notes, and snippets.

View theferrit32's full-sized avatar

Kyle Ferriter theferrit32

View GitHub Profile
@alpox
alpox / example.clj
Last active November 21, 2023 20:29
Clojure -> Python Async
(defn sleep [s]
(-> (asyncio/sleep s)
(pp/then (fn [_] s))))
(defn fun []
(pp/let [x (sleep 1)
z (pp/resolved 5)
y (sleep 2)]
(+ x y z)))
@ddevault
ddevault / Makefile
Last active February 20, 2024 14:17
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@teknoraver
teknoraver / unixhttpc.go
Last active March 21, 2024 11:48
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@defrex
defrex / pretty_request.py
Last active September 8, 2023 14:33
A simple function to print a Django request the way requests are meant to be printed.
def pretty_request(request):
headers = ''
for header, value in request.META.items():
if not header.startswith('HTTP'):
continue
header = '-'.join([h.capitalize() for h in header[5:].lower().split('_')])
headers += '{}: {}\n'.format(header, value)
return (
@daviesian
daviesian / gist:4517859
Last active November 17, 2022 20:16
Code to redirect output nrepl output to a particular client repl.
;; After connecting an nrepl client repl to an nrepl server, some
;; output will still appear on stdout from the server.
;; Try these snippets - they will both produce output on the nrepl server
;; Java libraries commonly do both these things.
(.println System/out "Hello stdout.")
(.start (Thread. #(println "Hello from a new thread.")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;