This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml | |
from xml import sax | |
class Todo: | |
pass | |
class Node: | |
def __init__(self, name, attrs): | |
self.name = name | |
self.attrs = attrs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import tkinter | |
import os | |
import re | |
##################################################################### prelude | |
def always(v): | |
'''function always returning the same value (see clojure `constantly`)''' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
tcpcs | |
''' | |
import sys | |
import time | |
import threading | |
import socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.parse import urlparse, urlunparse | |
""" | |
url helpers | |
""" | |
def isurl(o): | |
return o.startswith('http://') \ | |
or o.startswith('https://') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; 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² |
NewerOlder