Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • aix-marseille university
  • here
View GitHub Profile
"""
Cleaner interaction with class.
Make sure to set the run-time path:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$matlabroot/bin/$arch:$matlabroot/sys/os/$arch
"""
# import the FFI
#!/bin/bash
mkdir old_bundles
for dir in $(ls vim/bundle)
do
url=$(cat vim/bundle/$dir/.git/config | grep url | cut -d= -f2)
echo "found $url"
mv vim/bundle/$dir old_bundle
git submodule add $url vim/bundle/$dir
done
How easy is it to publish from VIM?
# coding: utf-8
import xml.dom.minidom as md
import sys; sys.path.append('/usr/local/lib/python2.7/dist-packages')
import whoosh
from whoosh.index import create_in
from whoosh.fields import *
posts = md.parse('Posts.xml')
nontext = [n for n in posts.childNodes[0].childNodes if not isinstance(n, md.Text)]
# coding: utf-8
import xml.dom.minidom as md
import sys; sys.path.append('/usr/local/lib/python2.7/dist-packages')
import whoosh
from whoosh.index import create_in
from whoosh.fields import *
posts = md.parse('Posts.xml')
nontext = [n for n in posts.childNodes[0].childNodes if not isinstance(n, md.Text)]
import cStringIO
import sqlite3
import mailbox
def index_mailbox(db, mailbox, tablename):
# create table
q = "create virtual table %s using fts4(content text);"
q %= tablename
db.execute(q)
# coding: utf-8
"""
tbl_name messages
sql CREATE TABLE messages (date text, sender text, subject text, headers text,
tags text)
tbl_name parts
sql CREATE TABLE parts
(
import cherrypy
import StringIO
js = """
function image_adder(xhr, out) {
return function() {
if (xhr.readyState == 4 && xhr.status == 200) {
var img = document.createElement('img')
img.src = 'data:image/png;base64,' + xhr.responseText;
out.insertBefore(img, out.children[0]);
import sqlite3
import json
def queued(f):
return f
class TableStore(object):
def __init__(self, db, name):
self.db = db
@maedoc
maedoc / surf.html
Created September 3, 2013 07:09
WebGL surface
<html>
<script src="tvbsurf.json"></script>
<script src="three.min.js"></script>
<script src="threetrackballcontrols.js"></script>
<script>
function go() {
geo = new THREE.Geometry();
var i, vi, fi;
for (i=0; i<SURF.vertices.length; i++) {
vi = SURF.vertices[i];