Skip to content

Instantly share code, notes, and snippets.

@digikar99
digikar99 / why-coalton-is-a-language.org
Last active November 5, 2023 07:26
An attempt at introducing Coalton to lispers without a background in ML-like languages

Coalton: Why is the interop not easier, and why might it be necessary for Coalton to be an entire language in itself?

If you came here searching for the context in which some reddit comments were written, you might want to check out this previous version of the article.

Several blog posts have been written about Coalton, about how it can be useful and what it brings to the table. However, to me, it hasn’t been clear why Coalton is the way to solve the problems that it does solve. Isn’t a simpler solution possible without making a full embedded language, and giving users the cognitive overhead of thinking about interop between normal lisp and coalton?

I have been thinking about this for a while as one of my pasttimes, and below I’ll summarize the better reasons why coalton might be the way it is. Perhaps, I couldn’t se

@CarlFK
CarlFK / utils.py
Created May 16, 2023 01:05
my first webserver
# veyepar/dj/googauth/utils.py
import argparse
import json
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from pprint import pprint
from urllib.parse import urlparse, parse_qs
@Gavinok
Gavinok / AOC-d1.el
Created December 15, 2022 00:23
Emacs lisp solution for day one of advent of code 2022
(defun cals-per-elf ()
(with-temp-buffer
(progn (insert "((")
(insert-file-contents "~/res.txt")
(while (re-search-forward "^$" nil t)
(replace-match ")(" nil nil))
(end-of-buffer)(insert "))")
(goto-char 0))
(mapcar (lambda (food-carried)
(cl-reduce #'+ food-carried))
@Gavinok
Gavinok / chatgpt.el
Last active June 4, 2023 22:22
chatgpt client for emacs WIP (Now Async!)
;;; chatgpt.el --- Simple ChatGPT frontend for Emacs -*- lexical-binding: t -*-
;; Copyright (C) Gavin Jaeger-Freeborn
;; This package is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This package is distributed in the hope that it will be useful,
(require :vis)
;; `WIN_OPEN' will be converted to `win_open'
(vis.events.subscribe vis.events.WIN_OPEN
(defun [win]
(vis@command "set number on")
(vis@command "set autoindent on")
(vis@command "set tabwidth 4")
(vis@command "set theme dark-16")
(vis@command "set expandtab on")
@Xophmeister
Xophmeister / __main__.py
Last active January 25, 2023 08:02
Python metaclass to enforce "good behaviour" from simulated sum type class hierarchies
from math import pi
from .shape import Shape, Circle, Rectangle
def area(shape: Shape) -> float:
"""
Calculate the area of the given shape
"""
match shape:
@laanwj
laanwj / easyrpc.py
Last active April 5, 2024 12:53
Bitcoind RPC example from Python
'''
Convenience utility for connecting to a bitcoind instance through RPC.
'''
# W.J. van der Laan 2021 :: SPDX-License-Identifier: MIT
import base64
import decimal
from http import HTTPStatus
import http.client
import json
import logging
@matu3ba
matu3ba / zig_cache.md
Last active January 4, 2023 08:43
Big picture of the Zig caching system.

This is outdated now. Compilation does not use the tmp directory anymore.

** Big picture of the Zig caching system. ** This is a big picture of the Zig caching system, mostly motivated for me to understand the necessary bits to solve ziglang/zig#11643. It reflects the status quo of commit fcfeafe99a3ecc694a3475735c81a0d75b6da6d0. The core logic is defined in src/Cache.zig.

zig-cache/h contains the manifest files with varying content.

@thrau
thrau / convert_assert.py
Last active June 14, 2022 04:02
script to covert unittest asserts to plain asserts
"""
Script to convert unittest asserts into plain asserts.
Either reads the file from the path passed as first parameter, or reads from stdin if no parameter is given.
"""
import functools
import sys
import libcst as cst
@rougier
rougier / nano-minibuffer.el
Created March 25, 2022 09:54
Minibuffer frame for Nano Emacs
;; Nicolas .P Rougier emacs configuration - mini-frame configuration
;; ---------------------------------------------------------------------
(require 'vertico)
(require 'marginalia)
(require 'mini-frame)
(defun minibuffer-setup ()
;; This prevents the header line to spill over second line
(let ((inhibit-message t))