Skip to content

Instantly share code, notes, and snippets.

View agumonkey's full-sized avatar

gum agumonkey

  • NONE
  • Dark side of the moon @ ['tkf8-2-1', 'ay21-3', '3263-827']
View GitHub Profile
@agumonkey
agumonkey / oosax.py
Created August 19, 2021 19:55
oosax.py -- trying to play with sax again to make DOM tooling [WIP]
import xml
from xml import sax
class Todo:
pass
class Node:
def __init__(self, name, attrs):
self.name = name
self.attrs = attrs
@agumonkey
agumonkey / zap-to-over.el
Last active July 18, 2021 16:51
zap-to-over
"
Bline lineM line lineE
K C D
D = C + BM - KC
asks for a template
finds M and yields M - C as offset
TODO: only moves to the first match.
@agumonkey
agumonkey / package-plus.el
Created June 9, 2021 10:23
quick hydra for package.el
(defhydra package-plus (:exit t)
("r" package-refresh-contents "Refresh" :column "Archives")
("a" package-autoremove "Auto-Remove")
("l" package-list-packages "List")
("u" package-list-packages "Mark and Update")
("i" package-install "Install" :column "Packages" :exit nil)
("d" package-delete "Delete"))
@agumonkey
agumonkey / ov1.el
Last active May 27, 2021 14:57
ov1 -- overlay helper lib #emacs #elisp #ux
;;; ov1 -- overlay helper lib -*- lexical-binding: t; -*-
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-x C-f and enter text in its buffer.
;;; MORE: https://www.youtube.com/watch?v=IWxCj5cr8rY (eieio font-lock Kitchin)
;;; TODO: use magit command minibuffer
;;; TODO: extend overlay
;;; TODO: adjoint overlay (f (ov-substring))
;;; have an overlay monad ? ov = Ov id , compose Ov f Ov g = shift (l|r|u|d) Ov g (f (ov-substring))
@agumonkey
agumonkey / cc.lisp
Created May 14, 2021 08:55
;;; coin-change problem in common-lisp
;;; coin-change problem in common-lisp
(defun remove-first (e l)
(cond ((null l) '())
(t (if (equal e (car l))
(cdr l)
(cons (car l) (remove-first e (cdr l)))))))
(remove-if (lambda (e) (equal e 1)) '(1 1 2 3 4))
;; (2 3 4)
#!/usr/bin/env python
import tkinter
import os
import re
##################################################################### prelude
def always(v):
'''function always returning the same value (see clojure `constantly`)'''
@agumonkey
agumonkey / tcpcs.py
Last active September 27, 2019 18:48
Learning
'''
tcpcs
'''
import sys
import time
import threading
import socket
from urllib.parse import urlparse, urlunparse
"""
url helpers
"""
def isurl(o):
return o.startswith('http://') \
or o.startswith('https://')
## based on airbnb proto interview
def rev(s):
return s[::-1]
# a .. b
# (a,b) .. (b,a)
def mir(a,b):
i = a
j = b
@agumonkey
agumonkey / fmt.el
Created March 14, 2019 21:44
fmt.el - ala python string formatting
;;; ala python string formatting
;;;
;;; (let ((some "Object") (i 1)) (f "<{some}... [{i}:{i}>")) => "<Object... [1:1]>
;;;
;;; todo: {...} parser
;;; todo: wrapping defmacro
;;; todo: wrapping defun
;;;
;;; state: alpha²