Skip to content

Instantly share code, notes, and snippets.

View gforcada's full-sized avatar
🌥️

Gil Forcada Codinachs gforcada

🌥️
View GitHub Profile
@rnixx
rnixx / zope.tac
Created February 10, 2023 10:16
Run Zope with Twisted WSGI server utilizing asyncio main loop
# Rationale:
#
# - Zope nowadays runs behind WSGI
# - Modern (web) applications might want to serve websockets
# - Tools utilizing asyncio are a common thing and some might want to use them
# - Having twisted and/or asyncio opens a new universe of computing next to serving a web application inside one process
#
# Discussion:
#
# - Any discussion about why to use twisted is pointless.
@rnixx
rnixx / volto-sandbox.rst
Last active February 10, 2023 10:32
Create and install an environment for volto development on a linux machine (debian based)

How to bootstrap a volto project

Install Node package manager (npm). It is the tool required to install JavaScript packages and libraries:

sudo apt install npm

Install Node version manager (nvm). Volto frontend requires a Node.js server for resource delivery and server side rendering. Node version manager is a tool which helps running the version of Node.js required by Volto:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
@rylev
rylev / learn.md
Created March 5, 2019 10:50
How to Learn Rust

Learning Rust

The following is a list of resources for learning Rust as well as tips and tricks for learning the language faster.

Warning

Rust is not C or C++ so the way your accustomed to do things in those languages might not work in Rust. The best way to learn Rust is to embrace its best practices and see where that takes you.

The generally recommended path is to start by reading the books, and doing small coding exercises until the rules around borrow checking become intuitive. Once this happens, then you can expand to more real world projects. If you find yourself struggling hard with the borrow checker, seek help. It very well could be that you're trying to solve your problem in a way that goes against how Rust wants you to work.

@mauritsvanrees
mauritsvanrees / towncrier-init.sh
Last active October 1, 2018 10:52
Make initial changes in a git project to use towncrier instead of manually editing CHANGES.rst
#!/bin/sh
# Latest public version:
# https://gist.github.com/mauritsvanrees/92c40bc16ceaf3c375d81c995b4552c4
# Goal:
# Make initial changes in a git project to use towncrier
# instead of manually editing CHANGES.rst.
# Create a standard pyproject.toml file.
TOML="pyproject.toml"
if ! test -e $TOML; then
@jensens
jensens / example-1-after.xml
Created March 6, 2015 21:33
xml_pp formatting examples
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:security="http://namespaces.zope.org/security"
xmlns:zmi="http://namespaces.zope.org/zmi">
<!-- Standard configuration directives -->
<include
file="configuration-meta.zcml"
package=".Configuration"
/>
@tisto
tisto / z3cform-p.a.controlpanel
Last active August 29, 2015 14:04
Howto move a Plone control panel from z3c.form to plone.app.registry
1) Move the Interface (e.g. ISecuritySchema) from z3cfrom-p.a.controlpanel branch into CMFPlone/interfaces/controlpanel.py:
- Code: https://github.com/plone/plone.app.controlpanel/blob/plip10359-z3cform/plone/app/controlpanel/interfaces.py#L430
(make sure the added interface is listen in P.CMFPlone/../profiles/dependencies/registry.xml)
- Tests: Copy https://github.com/plone/Products.CMFPlone/blob/master/Products/CMFPlone/controlpanel/tests/test_controlpanel_site.py and amend it
to test the settings in the interface. Do not directly copy the test from
the z3cform-p.a.controlpanel branch: https://github.com/plone/plone.app.controlpanel/blob/plip10359-z3cform/plone/app/controlpanel/tests/test_security.py
If you run into "KeyError: 'Interface `Products.CMFPlone.interfaces.controlpanel.IFilterSchema` defines a field `stripped_tags`, for which there is no record.'", make sure all registry lookups use prefix="plone" and that the ControlPanelForm has the schema_prefix="plone" attribute.
@rnixx
rnixx / gist:6027502
Created July 18, 2013 07:47
patch for plone.app.async providing REQUEST on context
"""plone.app.async patch to provide old school Zope2 REQUEST on context.
Contributions:
* Jean Jordaan
* Robert Niederreiter
"""
import Zope2
import sys
from AccessControl.SecurityManagement import (
@mgedmin
mgedmin / pov-update-ztk-py3-status.sh
Last active October 23, 2019 15:34
Daily cron script that updates dynamic data at https://zope3.pov.lt/py3/
#!/bin/sh
# update dynamic files in /var/www/zope3.pov.lt/py3/
# /opt/ztk-py3-status/ is a checkout of https://github.com/mgedmin/ztk-py3-status
# /opt/ztk-py3-status/*.py require python3
# sponge requires moreutils
# convert requires imagemagick
# dot and neato require graphviz
cache_dir=/stuff/pypi-cache