Skip to content

Instantly share code, notes, and snippets.

View leavesofgrass's full-sized avatar

Jon Pielaet leavesofgrass

View GitHub Profile
@leavesofgrass
leavesofgrass / gist:4711648
Created February 5, 2013 02:31
Validate XML with DTD using Python (lxml)
from lxml import etree
InXML = open('file.xml', 'r');
DefFile = open('def.dtd', 'r');
PostParse = etree.XML(InXML.read())
dtd = etree.DTD(DefFile)
print(dtd.validate(PostParse))
@leavesofgrass
leavesofgrass / MathJax.js
Created January 16, 2015 16:40
mathjax.js
/*
* /MathJax.js
*
* Copyright (c) 2009-2014 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
@leavesofgrass
leavesofgrass / .emacs
Last active August 24, 2017 06:39
my emacs init file
;; hide pesky warnings (the lazy way of supressing the pop-up debugger on init )
;; (setq warning-minimum-level :emergency)
;; the palette...
(deftheme wizard-flat "A flat, dark theme that plays nice with ample.")
(let ((wizard/green "#a9df90")
@leavesofgrass
leavesofgrass / Makefile
Created February 15, 2016 22:48 — forked from jesstelford/Makefile
nethack 3.6.0 hints file for debian: `sys/unix/hints/linux`. More: http://jes.st/2015/compiling-playing-nethack-360-on-ubuntu/
#
# NetHack 3.6 linux $NHDT-Date: 1432512814 2015/05/25 00:13:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
#-PRE
# Linux hints file
# This hints file provides a single-user tty build for Linux, specifically
# for Ubuntu dapper.
;;; emacspeak-mpg123.el --- Speech enable MP3 Player
;;; $Id$
;;; $Author: tv.raman.tv $
;;; Description: Emacspeak extension to speech-enable MP3 player
;;; Keywords: Emacspeak, WWW interaction
;;{{{ LCD Archive entry:
;;; LCD Archive Entry:
;;; emacspeak| T. V. Raman |raman@cs.cornell.edu
;;; A speech interface to Emacs |
break;
case MACRO_LOL:
if (keyToggledOn(keyState)) {
return MACRODOWN(I(25),
D(LeftAlt), T(F2), U(LeftAlt), I(25), T(G), T(N), T(O), T(M), T(E), T(Minus), T(T), T(E), T(R), T(M), T(I), T(N), T(A), T(L), I(200), T(Enter), I(200), T(F), T(O), T(R), T(T), T(U), T(N), T(E), I(25), T(Spacebar), T(Pipe), T(Spacebar), T(C), T(O), T(W), T(S), T(A), T(Y), I(25), T(Spacebar), T(Pipe), T(Spacebar), T(L), T(O), T(L), T(C), T(A), T(T), T(Enter));
}
@leavesofgrass
leavesofgrass / kaleidoscope-shell-flash.el
Last active December 17, 2017 19:23
Elisp function to flash Keyboardio Model 01 firmware in a shell.
(defun kaleidoscope-shell-flash ()
(interactive)
(shell "*kaleidoscope-shell*")
(goto-char (point-max))
(comint-kill-input)
(insert "cd ~/kaleidoscope/Kaleidoscope")
(comint-send-input)
(goto-char (point-max))
(comint-kill-input)
(insert "sudo make flash")
@leavesofgrass
leavesofgrass / chrysalis-shell-start.el
Last active December 17, 2017 19:24
Elisp function to start Chrysalis in a shell.
(defun chrysalis-shell-start ()
(interactive)
(shell "*chrysalis-shell*")
(goto-char (point-max))
(comint-kill-input)
(insert "cd ~/Chrysalis")
(comint-send-input)
(goto-char (point-max))
(comint-kill-input)
(insert "lein start")
@leavesofgrass
leavesofgrass / Kaleidoscope.ino
Last active December 20, 2017 22:16
My kaleidoscope sketch
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "custom built firmware"
#endif
#include "Kaleidoscope-MouseKeys.h"
@leavesofgrass
leavesofgrass / Kaleidoscope.sh
Last active December 29, 2017 04:25
Keyboardio Model 01 Setup Script
# Java JDK
sudo apt-get install openjdk-8-jdk -y
# Arduino IDE
## Replace "URL"
echo "fetching arduino"
curl -o URL/arduino-1.8.5-linux64.tar.xz
tar xvf arduino-1.8.5-linux64.tar.xz
sudo mkdir /usr/local/arduino
sudo chmod 755 /usr/local/arduino