Skip to content

Instantly share code, notes, and snippets.

@cpatrick
cpatrick / runsearch.py
Last active October 3, 2021 15:18
Sample Python for running a full-text search using PyMongo
from pymongo import Connection
if __name__ == '__main__':
# Connect to mongo
conn = Connection()
db = conn['canepi']
# Set the search term
term = 'foo'
@eculver
eculver / htpasswd.py
Created December 1, 2011 22:04
htpasswd script in python (no need to install apache utils)
#!/usr/local/bin/python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find