This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| portal = app['Plone'] | |
| catalog = portal['portal_catalog'] | |
| src = portal['src_folder'] | |
| dst = portal['dst_folder'] | |
| orig = [ | |
| 'name1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> app._p_jar | |
| <Connection at 7f22fc01cb50> | |
| >>> conn.root() | |
| {'Application': <Application at >, 'zc.async': <zc.async.queue.Queues object at 0x7f22f757d320>} | |
| >>> conn.root()['zc.async'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [pip-requirements] | |
| recipe = plone.recipe.command | |
| command = ${buildout:bin-directory}/buildout annotate |\ | |
| sed -n -e '1,/^\[versions\]$/d' -e '/^\[/,$d' -e '/^ /d' -e 's/= /==/' -e 'p' > requirements.txt | |
| update-command = ${:command} | |
| stop-on-error = false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nginx: | |
| image: nginx:1.13-alpine | |
| environment: | |
| TZ: "Europe/Bucharest" | |
| NGINX_CONF: |- | |
| server { | |
| listen 80; | |
| location / { | |
| proxy_pass http://remote; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pprint import pprint | |
| import zope.component | |
| gsm = zope.component.getGlobalSiteManager() | |
| from zope.lifecycleevent import IObjectModifiedEvent | |
| from Products.Archetypes.interfaces import IObjectEditedEvent | |
| select = set([ | |
| IObjectEditedEvent, | |
| IObjectModifiedEvent, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # to test: | |
| # pip install Cython | |
| # run with CYTHON_BUILD=true setup.py bdist_wheel | |
| def ext_modules(): | |
| from setuptools import Extension | |
| from setuptools.extension import _have_cython | |
| cython_build = os.environ.get('CYTHON_BUILD') | |
| if not _have_cython() or not cython_build: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Progressive images | |
| window.loadProgressive = (function(){ | |
| function fetchAndUpdateTarget(target, url, doneClass) { | |
| var img = new Image(); | |
| img.onload = function() { | |
| if (target.tagName === 'IMG') { | |
| target.src = url; | |
| } | |
| else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Install uwsgi>=2.0.15 (requires build-essential and python-dev) | |
| # adding it to eggs should also work, assuming you have gcc | |
| [buildout] | |
| parts += | |
| instance | |
| uwsgi-app | |
| uwsgi-run | |
| [uwsgi-run] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ssh -f -g -L 3689:127.0.0.1:3689 -N username@hostname | |
| avahi-publish-service sharename _daap._tcp 3689 & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from functools import reduce | |
| from functools import wraps | |
| def log_in_out(func): | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): | |
| result = func(*args, **kwargs) | |
| print('{} in: {}, out: {}'.format(func.__name__, args, result)) | |
| return result |