Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python2.7
import cProfile
import pstats
import StringIO
import logging
import os
import time
PROFILE_LIMIT = int(os.environ.get("PROFILE_LIMIT", 30))
class PubSub(object):
"""
Very simple Pub/Sub pattern wrapper
using simplified Redis Pub/Sub functionality.
Usage (publisher)::
import redis
r = redis.Redis()
@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
import sys
import networkx as nx
import matplotlib.pyplot as plt
from arango import create
from arango.aql import F, V
import sys
import requests
from arango import create
from bs4 import BeautifulSoup
HEADERS = {
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5)",
from py2neo import neo4j, node
graph_db = neo4j.GraphDatabaseService(
"http://localhost:7474/db/data/")
alice, bob, carol = node(name="Alice"), \
node(name="Bob"), \
node(name="Carol")
abc = neo4j.Path(
alice, "KNOWS", bob, "KNOWS", carol)
from arango import create
from arango.aql import F, V
def dataset():
"""
Basic dataset
"""
a.database.create()
a.users.create()
// service to display *bootstrap modal* popups
// - `display` method return **promise** which
// contain `resolve` or `cancel` handlers (eq buttons)
common.service('confirmService', ["$q", function($q) {
var that = this;
var deferred = null;
// default state for the modal
this.state = {
message: null,
FILES := $(shell find . | grep '\.coffee$$')
TARGETS := $(patsubst %.coffee, %.js, $(FILES))
cleanup:
@echo $(FILES) to cleanup
@echo perl -i.bak -ne 'print if /\S/' $(FILES)
build: $(TARGETS)
%.js: %.coffee
(function (g) {
var VERSION = "0.1.1";
var PREFIX = "___scope_cleaner__";
// check is some variable is array or not
var isArray = function (obj) {
return obj.constructor === Array;
};
// wrapper on Array.indexOf for old browser