This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Try and generate a unique username. Hopefully they never see this. | |
for count in itertools.count(1): | |
# Get the first part of the email and use 30 characters | |
username = request.POST['email'].split('@')[0][:30] | |
if not User.objects.filter(username = username).exists(): | |
break | |
else: | |
# Try and append a number in the last postion of the username | |
username = username[:30-len(str(count))] + str(count) | |
continue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export ARCHFLAGS="-arch x86_64" | |
export CLICOLOR=1 | |
export LSCOLORS=ExFxCxDxBxegedabagacad | |
# Path to oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
startdev() { | |
# Try installing the requirements | |
# Only check this directory or the one above it | |
if [ -e ./requirements.txt ]; then | |
${VIRTUAL_ENV}/bin/pip install -r ./requirements.txt || true | |
elif [ -e ../requirements.txt ]; then | |
${VIRTUAL_ENV}/bin/pip install -r ../requirements.txt || true | |
fi | |
MANAGE=`find . -name 'manage.py'` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getnums(): | |
for i in range(0, 101): | |
print i | |
yield i | |
if 4 in getnums(): | |
print('yes') | |
else: | |
print('no') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> def a(user, *args, **kwargs): | |
... print user | |
... | |
>>> b = {'user':'stuff'} | |
>>> a(**b) | |
stuff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: django-lms | |
# Recipe:: default | |
# | |
# Copyright 2012, Illinois Institute of Technology | |
# | |
# All rights reserved | |
packages = ["byobu", | |
"python-dev", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Downloading/unpacking requests==0.10.1 (from -r requirements/production.txt (line 19)) | |
Running setup.py egg_info for package requests | |
Traceback (most recent call last): | |
File "<string>", line 14, in <module> | |
File "/code/mayan/venv/build/requests/setup.py", line 10, in <module> | |
import requests | |
File "requests/__init__.py", line 25, in <module> | |
from . import utils | |
File "requests/utils.py", line 257 | |
return b"".join(L) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: website | |
# Recipe:: default | |
# | |
# Copyright 2012, YOUR_COMPANY_NAME | |
# | |
# All rights reserved - Do Not Redistribute | |
# | |
include_recipe "mysql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Cookbook Name:: flourish | |
# Recipe:: default | |
# | |
python_virtualenv "#{node[:flourish_dir]}" do | |
owner "#{node[:flourish_owner]}" | |
group "#{node[:flourish_group]}" | |
action :create | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import Group | |
group = Group.objects.all()[0] | |
application = IntranetApplication.objects.create(title = 'Test', groups = [group]) | |
application.save() |