Skip to content

Instantly share code, notes, and snippets.

@mklymyshyn
mklymyshyn / .bash_profile
Created April 29, 2011 11:46
Activation/Deactivation of python virtualenv upon entering a directory
#!/bin/bash
PREVPWD=`pwd`
PREVENV_PATH=
PREV_PS1=
PREV_PATH=
handle_virtualenv(){
if [ "$PWD" != "$PREVPWD" ]; then
PREVPWD="$PWD";
#!/bin/bash
OPTS=--rest
MONGO=/opt/local/bin/mongod
DBPATH=/opt/local/data/db
PIDFILE=/var/run/mongo.pid
IP=127.0.0.1
LOGS=/var/log/mongo.log
case $1 in
@mklymyshyn
mklymyshyn / jqtfilter.py
Created December 12, 2011 11:47 — forked from dqminh/jqtfilter.py
JS template filter for webassets
"""
Webasset filter to combine JQuery Templates files into javascript-safe strings,
and put them into a namespace
"""
import os
from webassets.filter import Filter
class JqtFilter(Filter):
name = 'jqt'
@mklymyshyn
mklymyshyn / avocado.mk
Created April 10, 2012 17:25
Build AvocadoDB on Ubuntu
SHELL=/bin/bash
DST_ID=avocadodb
REPO=git://github.com/triAGENS/AvocadoDB.git
# defaults
BASE_DIR=$(HOME)/_build/$(DST_ID)
DST_DIR=/usr/local/_build/$(DST_ID)
DB_DIR=/tmp/vocabase
@mklymyshyn
mklymyshyn / __init__.py
Created August 19, 2012 08:37
Sphinx Doc JSON highlight extension
def setup(sphinx):
from pygson.json_lexer import JSONLexer
sphinx.add_lexer("json", JSONLexer())
@mklymyshyn
mklymyshyn / conf.py
Created August 19, 2012 08:39
Support of "ext" directory as directory with custom sphinx extension
sys.path.insert(0, os.path.join(os.path.abspath('.'), "ext"))
class PubSub(object):
"""
Very simple Pub/Sub pattern wrapper
using simplified Redis Pub/Sub functionality.
Usage (publisher)::
import redis
r = redis.Redis()
import sys
import time
from datetime import datetime
from arango import create
from arango.document import Document
from arango.clients import Client
try:
var n = 1000, cn = "testdocs_js";
db._drop(cn); db._create(cn); var c = db._collection(cn);
var t = new Date(); for (var i = 0; i < n; ++i) { c.save({ "value" : "test_" + i }); }; var e = new Date();
e.getMilliseconds() - t.getMilliseconds();
@mklymyshyn
mklymyshyn / couchdb-views.py
Last active January 16, 2018 01:49
Script to dump or restore CouchDB Design Documents
#!/usr/bin/env python
import argparse
import json
import sys
import StringIO
import couchdb