Skip to content

Instantly share code, notes, and snippets.

View empiricalthought's full-sized avatar
🎵

Steven Huwig empiricalthought

🎵
View GitHub Profile
@empiricalthought
empiricalthought / spinner.py
Created July 30, 2012 19:11
Python 3 ASCII spinner for progress feedback
import itertools
import sys
def spinner(granularity):
"""Wraps a function in an ASCII spinner display loop. granularity
represents the number of times the function should be called
before moving the spinner."""
spinner_chars = itertools.cycle("\|/-")
def make_spinner(f):
calls = 0
(defun huwigs-build-ipregistry (clean)
"Build the IP Registry UI project.
Argument CLEAN if prefix arg is given, clean and then build."
(interactive "P")
(let ((default-directory *ipregistry-project-directory*)
(command (if clean
"/home/huwigs/bin/mvn -B clean pmd:check tomcat6:run"
"/home/huwigs/bin/mvn -DskipTests=true tomcat6:run"))
(tags-revert-without-query t))
@empiricalthought
empiricalthought / gist:2712855
Created May 16, 2012 18:33
PL/Python exception bug
create function python_exception_bug()
returns void as $$
raise plpy.spiexceptions.InvalidParameterValue()
$$ language 'plpython3u';
create function python_exception_sql()
returns text as $$
begin
select python_exception_bug();
return 'cannot happen';