Skip to content

Instantly share code, notes, and snippets.

View mick-t's full-sized avatar
🎯
Compiling https://www.xkcd.com/303/

Mick T. mick-t

🎯
Compiling https://www.xkcd.com/303/
View GitHub Profile
#!/bin/sh -x ## or just ` curl -Ls http://git.io/vRozn | sh `.
## Downloads the Mac OS X 10.10 Recovery Partition update,
## Copy's over the 10.10 version of Disk Utility.app, then
## use git to apply a binary patch so it will run on 10.11+.
cd /tmp
rm -rf DU1010
mkdir DU1010
@mick-t
mick-t / gist:85fc40d1acaf5e98cad9
Created June 18, 2015 20:19
Python-LDAP: find the groups a user is a member of.
LDAP_SERVER = "ldaps://my-ldap-server.com/"
LDAP_BASE = "dc=my-ldap-server,dc=com"
def users_ldap_groups(uid):
""" Returns a list of the groups that the uid is a member of.
Returns False if it can't find the uid or throws an exception.
It's up to the caller to ensure that the UID they're using exists!
"""
logger.debug("uid: ", uid)
@mick-t
mick-t / gist:11231602
Last active August 29, 2015 14:00
Django Settings file
# things I keep forgetting to do in new Django projects.
import os
# put settings common to all environment in a file called base.py:
from .base import *
# example here: https://github.com/twoscoops/django-twoscoops-project/tree/develop/project_name/project_name/settings
########## PATH CONFIGURATION
# sets the root of the project, useful for setting relative paths:
SITE_ROOT = os.path.realpath(os.path.dirname(__file__) + "/../")