Skip to content

Instantly share code, notes, and snippets.

@ibeex
ibeex / auth.py
Created Oct 14, 2011
Python LDAP (ActiveDirectory) authentication
View auth.py
import ldap
def check_credentials(username, password):
"""Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
# Adapt to your needs
"""
LDAP_SERVER = 'ldap://xxx'
# fully qualified AD user name
LDAP_USERNAME = '%s@xxx.xx' % username
@ibeex
ibeex / gist:1400432
Created Nov 28, 2011
Simple web server watchdog
View gist:1400432
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Simple web server watchdog, edit constants and stop start commands
preferably run with daemon
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
"""
@ibeex
ibeex / sparks.py
Created Dec 7, 2011 — forked from stefanv/sparks.py
Command line sparks in Python
View sparks.py
#!/usr/bin/python
# coding=utf-8
# Python version of Zach Holman's "spark"
# https://github.com/holman/spark
# by Stefan van der Walt <stefan@sun.ac.za>
"""
USAGE:
@ibeex
ibeex / gist:1510386
Created Dec 22, 2011
Reliably run unreliable processes
View gist:1510386
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Run forking multiprocess workers with emphasis's on running reliably long running processes, that
are for one or other reason prone to random crashing. Can be demonised with
http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
"""
@ibeex
ibeex / FacebookWordCloud.py
Created Feb 14, 2012 — forked from bostwick/FacebookWordCloud.py
Facebook News Feed Word Cloud
View FacebookWordCloud.py
#!/usr/bin/env python
import sys
import urllib2
import json
from collections import defaultdict
from nltk import word_tokenize
IGNORED_WORDS = ["!", ".", ",", "(", ")", "'s", ":", "?", "...", "$",
@ibeex
ibeex / rc.d
Created Jul 18, 2012 — forked from jippi/rc.d
Logstash Init script
View rc.d
update-rc.d logstash-shipper defaults
update-rc.d logstash-reader defaults
@ibeex
ibeex / .gitignore
Created Jul 19, 2012 — forked from karmi/.gitignore
Import your Gmail messages into ElasticSearch and search them with a simple web application.
View .gitignore
.DS_Store
*.log
Gemfile.lock
@ibeex
ibeex / foo.log
Created Aug 4, 2012
Flask logging example
View foo.log
A warning occurred (42 apples)
An error occurred
@ibeex
ibeex / cli output
Created Dec 4, 2012
homebrew Issue #16269
View cli output
Mac7o% brew doctor
Your system is raring to brew.
Mac7o [brew doctor] ~ 12-12-04 9:26AM
Mac7o% brew --config
HOMEBREW_VERSION: 0.9.3
HEAD: fc7e4d799c4c212e0843b6ad3d3e72fc09fb4d34
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
View supervisord.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.