Skip to content

Instantly share code, notes, and snippets.

View Barolina's full-sized avatar

꧁꧂Larisa Barolina

View GitHub Profile
@CBoJI
CBoJI / gist:3798516
Created September 28, 2012 07:51
sphinx
http://sphinxsearch.com/downloads/ - скачать tar.gz
tar -xzf
cd
1)
./configure --without-mysql --with-pgsql --prefix=/usr/local/sphinx --with-pgsql-libs=/usr/lib/postgresql-9.1/ --with-pgsql-includes=/usr/include/postgresql-9.1/
2) make
3) make install
4) cd /usr/local/sphinx/etc/
создаем sphinx.conf
прописываем
@pydanny
pydanny / api.group_permissions.py
Created December 31, 2011 20:30
django-rest-framework permissions by groups
""" User Django Rest Framework to check to see if an authenticated user
is in a particular group
Usage::
from api.group_permissions import GroupAPIGETPermission
class SearchProductView(View):
permissions = (IsAuthenticated, GroupAPIGETPermission,)
@evz
evz / LoadData.py
Created October 29, 2011 17:42
Making maps 101 - a few things I've picked up
#!/usr/bin/env python
# For this script to work you must set the Django settings file
# as an environment setting before importing LayerMapping
# Alternatively you can place
# export DJANGO_SETTINGS_MODULE=settings
# in your .bash_profile
# or paste this code into a $ manage.py shell
@k0emt
k0emt / DarkMatterLogger.py
Created September 15, 2011 04:00
Demo code for RabbitMQ Publish/Subscribe (fanout) exchange with Python
import sys
import pika
# prerequisites are that you have RabbitMQ installed
# create a "darkmatter" named VirtualHost (VHOST)
# rabbitmqctl.bat add_vhost darkmatter
# create a user APP_USER with associated APP_PASS word
# rabbitmqctl add_user darkmatteradmin <password>
# give the APP_USER the necessary permissions
# rabbitmqctl set_permissions -p darkmatter darkmatteradmin ".*" ".*" ".*"
@michiel
michiel / cors-nginx.conf
Created July 5, 2011 10:41
Wide-open CORS config for nginx
#
# Wide-open CORS config for nginx
#
location / {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
#
@avidal
avidal / get_permissions.py
Created January 14, 2011 21:26
This snippet will get all permission objects for a specific model.
from django.contrib.auth.models import Permission
from django.contrib.contenttypes.models import ContentType
from myapp.models import MyModel
content_type = ContentType.objects.get_for_model(MyModel)
permissions = Permission.objects.filter(content_type=content_type)