Skip to content

Instantly share code, notes, and snippets.

@ul
ul / consult-jq.el
Last active January 3, 2023 01:40
Emacs: consult.el + jq
(defvar consult--jq-history nil)
(defun consult--jq-query (buffer query)
"Return jq candidates for the BUFFER.
QUERY is the jq query."
(with-temp-buffer
(insert-buffer buffer)
(call-process-region nil nil "jq" t t nil "-rM" query)
(mapcar
(lambda (s)
@ul
ul / KloudGen.scd
Created July 2, 2022 00:33 — forked from madskjeldgaard/KloudGen.scd
Sketch for a supercollider based cloud generator

/*

Sketch for a cloud generator

By Mads Kjeldgaard, 2020

*/ ( ~numChannels = 2; s.options.numOutputBusChannels_(~numChannels);

const backendData = [
{
id: "1",
name: "Office Map"
},
{
id: "2",
name: "New Employee Onboarding",
children: [
{
[
{
"id": "1",
"name": "Office Map"
},
{
"id": "2",
"name": "New Employee Onboarding",
"children": [
{
@ul
ul / hey_notmuch!
Created May 16, 2021 04:33 — forked from vedang/hey_notmuch!
Notmuch configuration for Hey.com Style workflows.
- Specific Notmuch filters (and saved-searches) for:
+ The Feed (newsletters, blogs)
+ The Paper trail (receipts, ledger)
+ Screened Inbox (mail from folks you actually want to read)
+ Previously Seen (important mail that you've already read)
+ Unscreened Inbox (potential spam / stuff you don't want)
- Elisp Functions to move / categorize emails from a particular sender.
+ Adds tags needed by filters defined above to all email sent by a particular sender
+ Creates an entry in a DB file, which is used by the Notmuch post-new script when indexing new email, to auto-add the relevant tags.
@ul
ul / coder.clj
Created February 23, 2020 21:37 — forked from mikeananev/coder.clj
Adaptive LZW compression on Clojure
(ns org.rssys.lzw.coder
(:require [clojure.java.io :as io])
(:import (java.io InputStream OutputStream)
(com.github.jinahya.bit.io StreamByteInput StreamByteOutput DefaultBitOutput DefaultBitInput)))
(def MAX-BITS-LENGTH 18)
(def EOF 256)
(defn lzw-encode-stream
[^InputStream in-stream ^OutputStream out-stream]
@ul
ul / Environment
Created September 20, 2019 07:08
`zig test dictionary.zig` dumps endless garbage into a terminal
❯ zig version
0.4.0+d60f9d0d
macOS Mojave
Version 10.14.6 (18G95)
@ul
ul / list.zig
Created September 16, 2019 07:42
const std = @import("std");
const mem = std.mem;
fn LinkedList(comptime T: type) type {
const Self = struct {
const Node = struct {
next: ?*Node,
data: T,
};
@ul
ul / cimport.zig
Last active April 9, 2019 10:53
libuv translate-c
pub const struct_uv_handle_s = extern struct {
data: ?*c_void,
loop: [*c]uv_loop_t,
type: uv_handle_type,
close_cb: uv_close_cb, // line 1736
handle_queue: [2](?*c_void),
u: extern union {
fd: c_int,
reserved: [4](?*c_void),
},