Skip to content

Instantly share code, notes, and snippets.

@Christophe31
Christophe31 / gist:859222a9d83e74d3bb0a
Last active August 29, 2015 14:05 — forked from ramusus/gist:4343464
damn, it was app specific, how to find current field name?
"""
# Christophe31
Shamlessly taken from: https://gist.github.com/ramusus/4343464
adapted to dj1.7 and allow Inline class as field argument.
# Ramsus
adminreverse from here http://djangosnippets.org/snippets/2032/
changed for working with ForeignKeys
@Christophe31
Christophe31 / jinja_env.py
Created September 11, 2012 12:50
jinja2_rtf_ugly
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
usage:
from jinja_env import template_from_rtf
template = template_from_rtf(open("my.rtf", 'rb').read())
context = {"var1":5, "now":datetime.datetime.now()}
template.render(**context)
note: special opening and closing braces and ";" for required spaces
@Christophe31
Christophe31 / sendserver_info.py
Created June 25, 2012 22:25
take info from server
#! /usr/bin/env python
# -*- conding:utf8 -*-
# authors Julien Recurt
# Christophe Narbonne
import sys
import urllib
import commands
import collections
import socket
@Christophe31
Christophe31 / tornado_django_wrapper.py
Created February 29, 2012 10:43
tornado django wrapper
############# init parent django project settings
from os import path
import sys
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import settings
from django.core.management import setup_environ
setup_environ(settings)
###############
@Christophe31
Christophe31 / ovh.py
Created January 24, 2012 00:01
ovh api
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import settings
from SOAPpy import WSDL
ovh_server = WSDL.Proxy('https://www.ovh.com/soapi/soapi-re-1.26.wsdl')
def ovh_in_request(view_func):
"""django decorator"""
@Christophe31
Christophe31 / README.rst
Created August 30, 2011 20:58
IE log on gunicorn bug
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#
# Now this lib is on her own full repository and pypi page:
# http://github.com/Christophe31/screenutils
# http://pypi.python.org/pypi/screenutils
#
# This may not work with bpython, use python 2.6 or upper
#
# This program is free software. It comes without any warranty, to
#!/usr/bin/env python
# -*- coding:utf8 -*-
# This script will merge all json bookmarks files from current directory
import json
import os
mainjson={}
def merge(source,target=[]):
for child in source["children"]: