Skip to content

Instantly share code, notes, and snippets.

@manelclos
manelclos / resources.py
Last active Nov 13, 2018
Django Import Export: Excel (XLS) date import
View resources.py
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:
View Atom removes trailing whitespace of lines you haven't edited
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 / s3signurl.py
Last active Feb 9, 2018 — forked from obeattie/s3signurl.py
Quick, dirty Python script that spits out a signed url for Amazon S3
View s3signurl.py
#!/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):
View django-settings.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 / uwsgi_ondemand.ini
Last active Aug 1, 2017
uwsgi ondemand config
View uwsgi_ondemand.ini
[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
@manelclos
manelclos / AuthenNTLM.pm
Created Jan 7, 2015
AuthenNTLM.pm modified to work with the new Apache 2.4 API. Keywords: NTLM Ubuntu 14.04
View AuthenNTLM.pm
###################################################################################
#
# 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 / bad_map.png
Last active Aug 29, 2015
django-leaflet map initialization problem
@manelclos
manelclos / .gitignore
Last active Aug 29, 2015
Test case for uwsgi not serving requests with django 1.7
@manelclos
manelclos / README.md
Last active Dec 29, 2015
Test case for Mapnik's Bug #2084
View README.md