Skip to content

Instantly share code, notes, and snippets.

View kitsu's full-sized avatar

Ed Blake kitsu

View GitHub Profile
@kitsu
kitsu / parse_lisp.py
Last active May 30, 2016 22:16
Flaky Autolisp parser with stats collection/reporting. See blog series starting at http://kitsu.github.io/2016/05/27/autolisp_parse_01/
"""Process a lisp file to extract useful data."""
import sys, os
from collections import namedtuple
substitutions = (
# Expand quote literal to quote fn
("'(", "(quote "),
# Expand parens with white-space for splitting
(')', ' ) '),
('(', ' ( '),
@kitsu
kitsu / html.py
Last active May 23, 2016 16:48
HTML generation in Python for Lister. See post: http://kitsu.github.io/2016/05/18/functional-html/
"""Some composable HTML functions, and pre-built widgets."""
from functools import partial
from itertools import chain
#---------------------------- Generic HTML ------------------------------------
self_closing = ["area", "base", "br", "col", "command", "embed", "hr", "img",
"input", "keygen", "link", "meta", "param", "source", "track",
"wbr"]
@kitsu
kitsu / simple_slice.py
Created May 22, 2015 18:24
Old Blender 3d slice experiment (circa 2010)
import bpy
target = bpy.context.object
mesh = target.data
#tmat = target.matrix_world
#bpy.ops.object.visual_transform_apply()
#bpy.ops.ed.undo()
# Get a list of the objects bounding box z-coords
zs = [point[2] for point in target.bound_box]
bottom = min(zs)
@kitsu
kitsu / anders.clj
Created June 27, 2014 17:23
the snake game with core.async and swing
(ns my-test
(use [midje.sweet])
(require [clojure.core.async :as async :refer :all])
(import [javax.swing JFrame JButton JPanel SwingUtilities])
(import [java.awt Color Dimension])
(import [java.awt.event ActionListener WindowAdapter KeyListener]))
(defn map-chan [f in]
(let [c (chan)]