Skip to content

Instantly share code, notes, and snippets.

View maethu's full-sized avatar
😎

Mathias Leimgruber maethu

😎
View GitHub Profile
#!/usr/bin/python
#
# fakemail (Python version)
#
# $Id: fakemail.py,v 1.1 2005/08/29 22:04:55 lastcraft Exp $
#
# usage: fakemail --host=localhost --port=25 --path=./mails --background
import asyncore
import getopt
##############################################################################
#
# Copyright (c) 2001 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
JPEG_START_BYTE = '\xff\xd8'
JPEG_END_BYTE = '\xff\xd9'
def get_jpeg(stream):
start_pos = None
end_pos = None
while True:
frame_bytes = stream.read(1024)
>>> plone = app.platform
>>> from zope.component.hooks import setSite
>>> setSite(plone)
>>> from plone import api
>>> import csv
>>> from StringIO import StringIO
>>> handler = open('user.csv', 'r')
>>> data = handler.read().decode("utf-8-sig").encode("utf-8")
>>> csv_data = csv.DictReader(StringIO(data), delimiter=';')
>>> for item in csv_data:
from Acquisition import aq_inner
from Acquisition import aq_parent
from bumblebee.file import _
from bumblebee.file.utils import format_filesize
from collective.prettydate.interfaces import IPrettyDate
from ftw.bumblebee.mimetypes import get_mimetype_image_url
from ftw.bumblebee.mimetypes import get_mimetype_title
from ftw.bumblebee.mimetypes import is_mimetype_supported
from ftw.bumblebee.utils import get_fallback_url
from ftw.bumblebee.utils import get_representation_url_by_object
# NGINX CONFIG
upstream plone {
server cms:8080;
}
server {
listen 80;
server_name dev-backend.webcloud7.ch;
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from AccessControl.SecurityManagement import newSecurityManager
plone = app.Plone
user = plone.getOwner()
newSecurityManager(app, user)