Skip to content

Instantly share code, notes, and snippets.

@manelclos
manelclos / README.md
Last active December 29, 2015 12:49
Test case for Mapnik's Bug #2084
@manelclos
manelclos / .gitignore
Last active August 29, 2015 14:06
Test case for uwsgi not serving requests with django 1.7
*~
*.pyc
@manelclos
manelclos / bad_map.png
Last active August 29, 2015 14:12
django-leaflet map initialization problem
bad_map.png
@manelclos
manelclos / AuthenNTLM.pm
Created January 7, 2015 12:30
AuthenNTLM.pm modified to work with the new Apache 2.4 API. Keywords: NTLM Ubuntu 14.04
###################################################################################
#
# Apache2::AuthenNTLM - Copyright (c) 2002 Gerald Richter / ECOS
#
# You may distribute under the terms of either the GNU General Public
# License or the Artistic License, as specified in the Perl README file.
#
# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
@manelclos
manelclos / uwsgi_ondemand.ini
Last active August 1, 2017 10:06
uwsgi ondemand config
[uwsgi]
procname-prefix-spaced=/apps/%c
chdir = %d/app
need-app = true
touch-reload = %d/uwsgi.ini
# old way
# module = wsgi
# new way
mount = /apps/appname=djangoapp/wsgi.py
APPNAME = 'foobar'
# Overwrite settings depending on environment
# include at end of settings.py to overwrite settings in a per environment way
ENVIRONMENT_NAME = os.environ.get('ENVIRONMENT_NAME', 'production')
extra_settings = 'settings-%s.py' % ENVIRONMENT_NAME
extra_settings_path = os.path.join(BASE_DIR, APPNAME, extra_settings)
if os.path.exists(extra_settings_path):
print 'Try to load extra settings: %s' % extra_settings
@manelclos
manelclos / s3signurl.py
Last active February 9, 2018 19:23 — forked from obeattie/s3signurl.py
Quick, dirty Python script that spits out a signed url for Amazon S3
#!/usr/bin/env python
import optparse
import sys
import os
os.environ['S3_USE_SIGV4'] = 'True'
from boto.s3.connection import S3Connection
def sign(bucket, path, access_key, secret_key, https, expiry, host=None):
https://github.com/atom/whitespace/issues/10
from @hbirch:
Atom->Preferences then search for Whitespace on the left to get to the whitespae package's preferenes. Then unclick "remove trailing whitespace."
@manelclos
manelclos / resources.py
Last active November 13, 2018 13:34
Django Import Export: Excel (XLS) date import
from import_export import fields, resources
from .models import MyModel
from .xls import ExcelDateWidget
class MyModelResource(resources.ModelResource):
# Other fields here...
my_date = fields.Field(attribute='my_date', column_name='MY_DATE', widget=ExcelDateWidget())
class Meta: