Skip to content

Instantly share code, notes, and snippets.

View jaylett's full-sized avatar

James Aylett jaylett

View GitHub Profile
@jaylett
jaylett / findsphinx.patch
Last active August 29, 2015 14:02
Find sphinx-build in configure, and explicitly invoke under python2 or python3 as required
diff --git a/xapian-bindings/configure.ac b/xapian-bindings/configure.ac
index 89b3f8c..c9c316d 100644
--- a/xapian-bindings/configure.ac
+++ b/xapian-bindings/configure.ac
@@ -483,6 +483,15 @@ if test x$USE_MAINTAINER_MODE = xyes; then
test -z "$PYTHON" && AC_MSG_ERROR([python is required in maintainer mode])
fi
+dnl If we're building documentation for either python version,
+dnl we need sphinx-build
@jaylett
jaylett / py3docs.patch
Created May 30, 2014 09:53
python3 docs building, but Debian/Ubuntu-specific
diff --git a/xapian-bindings/python3/Makefile.am b/xapian-bindings/python3/Makefile.am
index 1b714bc..50561cb 100755
--- a/xapian-bindings/python3/Makefile.am
+++ b/xapian-bindings/python3/Makefile.am
@@ -163,8 +163,10 @@ dist-hook: $(sphinxdocs)
test -d $(distdir)/docs || mkdir $(distdir)/docs
cp -R -p docs/html $(distdir)/docs
+SPHINX_BUILD = /usr/share/sphinx/scripts/python3/sphinx-build
+
@jaylett
jaylett / docs-2.patch
Created May 30, 2014 09:48
Don't emphasise lines in the examples; put python3 documentation in a different place to python(2)
diff --git a/xapian-bindings/python/docs/examples.rst b/xapian-bindings/python/docs/examples.rst
index d1ee064..d2e2974 100644
--- a/xapian-bindings/python/docs/examples.rst
+++ b/xapian-bindings/python/docs/examples.rst
@@ -8,7 +8,6 @@ simplesearch.py
.. literalinclude :: examples/simplesearch.py
:language: python
- :emphasize-lines: 12,15-18
:linenos:
@jaylett
jaylett / docs.patch
Last active August 29, 2015 14:01
Distribution and installation for new documentation; apply with patch -p1 in xapian/ (and similar changes are needed for xapian-bindings/python3/Makefile.am)
--- a/xapian-bindings/python/Makefile.am
+++ b/xapian-bindings/python/Makefile.am
@@ -29,7 +29,7 @@ EXTRA_DIST = python.i util.i extra.i extracomments.i except.i \
testsuite.py \
test_xapian_star.py \
replicationtest.py \
- build-sphinx-doc \
+ docs/conf.py \
$(TESTS) $(BUILT_SOURCES)
@jaylett
jaylett / gist:6730838
Created September 27, 2013 15:57
restpose build error
make[2]: Entering directory `/media/fort/7e6babdb-eb0b-4e79-b97e-cab980e57e92/wikipedia/restpose/restpose'
/bin/bash ./libtool --tag=CXX --mode=link g++ -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-self -Wlogical-op -Wmissing-declarations -g -O2 -o restpose src/restpose.o libmongoimporter.a libhttpserver.a librest.a libfeatures.a libserver.a libjsonxapian.a libjsonmanip.a libngramcat.a libcjktokenizer.a liblogger.a libdbgroup.a libutils.a libpostingsources.a libmatchspies.a libgeospatial.a libxapiancommon.a libmongocdriver.a libcli.a libjsoncpp.a libs/libmicrohttpd/src/daemon/libmicrohttpd.la -lxapian
libtool: link: g++ -Wall -W -Wredundant-decls -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wformat-security -fno-gnu-keywords -Wundef -Wshadow -Woverloaded-virtual -Wstrict-null-sentinel -Wshadow -Wstrict-overflow=1 -Winit-s
(function() {
var menuOpen = false;
$('.hamburger').click(function(){
if( menuOpen ) {
menuOpen = false;
$('#header ul').slideUp(function() {
$('#header ul').removeAttr("style");
});
} else {
menuOpen = true;
@jaylett
jaylett / equi2.py
Last active December 12, 2015 09:39 — forked from tomwolber/equi2.py
tests = [
([-7, 1, 5, 2, -4, 3, 0], [3,6]),
([1, 2, 3, 4, 3, 2, 1], [3]),
([99, 0, 66, 32, 1] , [1]),
([1, -1, 1, -1, 1, -1, 1], [0,1,2,3,4,5,6]),
([0,0,0], [0,1,2]),
([0,53,9], -1),
([0,1,-1], [0]),
([-1, 0, 1], -1),
]
@jaylett
jaylett / elb_status.plugin.py
Created July 27, 2012 10:25
ELB status plugin for munin
#!/usr/bin/python
# -*- python-mode -*-
import boto.ec2.elb
import sys
elbs = [ 'my_elb' ] # or whatever
AWS_ACCESS_KEY_ID = '' # fill this out!
AWS_SECRET_ACCESS_KEY = '' # this too!
@jaylett
jaylett / redis.plugin.py
Created July 27, 2012 10:24
Redis plugin for munin
#!/usr/bin/python
# -*- python-mode -*-
import sys
import redis
c = redis.Redis() # if you need a password or to monitor non-defaults...
# We draw a number of graphs:
#
@jaylett
jaylett / djcelery.plugin.py
Created July 27, 2012 10:24
Django-celery plugin for munin
#!/usr/bin/python
# -*- python-mode -*-
import datetime
import sys
import os
import os.path
if os.path.isdir('/home/af-web/releases/current'):
# live