Skip to content

Instantly share code, notes, and snippets.

/*
smtpd.js is SMTP server written for node.js
MIT License
*/
var tcp = require('tcp');
var sys = require('sys');
@theladyjaye
theladyjaye / traversals.py
Created February 19, 2012 21:08
Neo4j REST Traversals Approximating embedded syntax for https://github.com/versae/neo4j-rest-client/
# http://docs.neo4j.org/chunked/snapshot/rest-api-traverse.html#rest-api-traversal-returning-nodes-below-a-certain-depth
try:
import simplejson as json
except ImportError:
import json
from neo4jrestclient import client
from neo4jrestclient.request import Request
from neo4jrestclient.request import NotFoundError
@theladyjaye
theladyjaye / fizzbuzz.py
Created August 3, 2012 14:13
Functional-ish fizzbuzz in python
from itertools import cycle, izip
import operator import add
fizz = cycle(['', '', 'fizz'])
buzz = cycle(['','','','','buzz'])
r = izip(fizz, buzz)
index = 1
while index < 101:
print("{}: {}".format(index, add(*r.next())))
index = index + 1
@theladyjaye
theladyjaye / build_gitolite_deb.sh
Created October 4, 2012 21:49 — forked from justone/build_gitolite_deb.sh
gitolite v3 debian package
#!/bin/bash
# install rvm
aptitude install -y curl libz-dev
curl -L https://get.rvm.io | bash -s stable --ruby
source /usr/local/rvm/scripts/rvm
gem install fpm
# git clone
aptitude install -y git
@theladyjaye
theladyjaye / demo.py
Created October 27, 2012 16:55
Python appending lists vs adding lists
from timeit import Timer
from itertools import islice
from itertools import cycle
def add_list_small(target, source):
target += source
def add_list_large(target, source):
@theladyjaye
theladyjaye / datetime.js
Created August 19, 2013 22:09
datetime module for ISO8601 UTC Dates
define([
], function(){
var months = ['January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October',
'November', 'December'];
// All values assumed to be ISO 8601 and in UTC
// 2013-08-29T14:29Z
@theladyjaye
theladyjaye / logging.js
Last active December 21, 2015 18:19
Simple port of python's std logging module.
define(function(require, exports, module){
var test = {};
var _ = require('underscore'),
_loggers = {},
_levelNames = {
0: 'NOTSET',
1: 'TRACE',
2: 'DEBUG',
3: 'INFO',
@theladyjaye
theladyjaye / jasmine-karma.js
Created October 13, 2013 18:53
Karma with Jasmine and Require (and jasmine-jquery)
define(function(require, exports, module) {
// Imports
// make require load jquery and jasmine-jquery
require('jquery');
require('jasmine/jasmine-jquery');
// jquery-jasmine
// now getFixtures() will be available.
@theladyjaye
theladyjaye / cmd.sh
Created October 18, 2013 21:06
clear salt minion cache
salt '*' cmd.run 'rm -rm /var/cache/salt/minion/files/base/*'
salt '*' saltutil.sync_all
@theladyjaye
theladyjaye / _install.md
Last active August 29, 2015 14:07
django-oauth2-provider scheme patch

How to Install

New files:

  • There are 3 new files you will need to add.
  • You will need to vendor in django-oauth2-provider into your project.

Once done, add a folder in provider/oauth2 called ext. In the end this path will exist: provider/oauth2/ext.

Place the 3 files below into that folder with an __init__.py