Skip to content

Instantly share code, notes, and snippets.

@rougier
rougier / nano.el
Created February 4, 2025 18:48
NANO Emacs (minimal version: 256 lines)
;; nano-emacs.el --- NANO Emacs (minimal version) -*- lexical-binding: t -*-
;; Copyright (c) 2025 Nicolas P. Rougier
;; Released under the GNU General Public License 3.0
;; Author: Nicolas P. Rougier <nicolas.rougier@inria.fr>
;; URL: https://github.com/rougier/nano-emacs
;; This is NANO Emacs in 256 lines, without any dependency
;; Usage (command line): emacs -Q -l nano.el -[light|dark]
@swatson555
swatson555 / heap-lisp.c
Created February 17, 2023 12:42
Heap based scheme machine.
/* Heap based virtual machine described in section 3.4 of Three Implementation Models for Scheme, Dybvig
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
char token[128][32];
@LingDong-
LingDong- / core_midi_synth.mm
Last active May 19, 2023 08:23
a barebones midi synthesizer calling mac's low level API (CoreMIDI and CoreAudio) directly
//
// core_midi_synth.mm
//
// a barebones midi synthesizer demo that calls
// mac's low level API (CoreMIDI and CoreAudio) directly
// (because I can't be bothered to compile other people's libraries)
//
// with code fragments adapted from
// - https://stackoverflow.com/a/7964300
// - https://github.com/thestk/rtmidi
@dannyvelas
dannyvelas / checkers.wat
Created February 19, 2022 23:34
WebAssembly Text Format For a Simple Game of Checkers using Kevin Hoffman's "Programming WebAssembly with Rust"
(module
(import "events" "pieceMoved"
(func $notify_pieceMoved (param $fromX i32) (param $fromY i32) (param $toX i32) (param $toY i32))
)
(import "events" "pieceCrowned"
(func $notify_pieceCrowned (param $fromX i32) (param $fromY i32))
)
(memory $mem 1)
(global $currentTurn (mut i32) (i32.const 0))
(global $WHITE i32 (i32.const 2))
@ajnsit
ajnsit / dictionary.h
Last active August 26, 2023 08:18
Purescript to C++ compiler runtime from - https://github.com/andyarvanitis/purescript-native/
///////////////////////////////////////////////////////////////////////////////
//
// Module : dictionary.h
// Copyright : (c) Andy Arvanitis 2018
// License : BSD
//
// Maintainer : Andy Arvanitis
// Stability : experimental
// Portability :
//
@Whil-
Whil- / org-gkroam-link-to-from-id-link.el
Last active May 25, 2023 15:05
Helper functions to translate ID-links back and forth to gkroam-links
@LingDong-
LingDong- / findcontours.js
Last active March 20, 2025 22:29
Finding contours in binary images and approximating polylines. Implements the same algorithms as OpenCV's findContours and approxPolyDP.
/** Finding contours in binary images and approximating polylines.
* Implements the same algorithms as OpenCV's findContours and approxPolyDP.
* <p>
* Made possible with support from The Frank-Ratchye STUDIO For Creative Inquiry
* At Carnegie Mellon University. http://studioforcreativeinquiry.org/
* @author Lingdong Huang
*/
var FindContours = new function(){let that = this;
let N_PIXEL_NEIGHBOR = 8;
@iiLaurens
iiLaurens / code.js
Last active August 10, 2025 16:10
Get all clickable elements on a page
window.scrollTo(0, 0)
var bodyRect = document.body.getBoundingClientRect();
var items = Array.prototype.slice.call(
document.querySelectorAll('*')
).map(function(element) {
var rect=element.getBoundingClientRect();
return {
element: element,
include: (element.tagName === "BUTTON" || element.tagName === "A" || (element.onclick != null) || window.getComputedStyle(element).cursor == "pointer"),
@G33kDude
G33kDude / tooltips.py
Last active November 25, 2024 04:43
System wide tooltips using python 3
#!/usr/bin/env python3
import time
import ctypes
from ctypes import wintypes
import struct
import threading
# --- Windows API Setup ---
@ilomon10
ilomon10 / client.py
Created February 27, 2020 05:52
Send image as base64 buffer from client (python opencv) to server (nodejs) using SocketIO
import cv2
import socketio #python-socketio by @miguelgrinberg
import base64
sio = socketio.Client()
sio.connect('http://x.x.x.x:xxxx)
cam = cv2.VideoCapture(0)
while (True):