Skip to content

Instantly share code, notes, and snippets.

View ale-rt's full-sized avatar

Alessandro Pisa ale-rt

View GitHub Profile
# coding=utf-8
from plone.app.blocks import utils
from plone.subrequest import subrequest
from zExceptions import NotFound
from zope.site.hooks import getSite
def resolveResource(url):
"""Resolve the given URL to a unicode string. If the URL is an absolute
path, it will be made relative to the Plone site root.
@ale-rt
ale-rt / vm-backup.sh
Created August 7, 2018 15:16 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@ale-rt
ale-rt / update_membrane_users.md
Created August 18, 2020 10:51
How to update membrane users

Change some properties

>>> profiles = app.quaive.profiles
>>> profiles["foo"].email = "foo.bar@example.com"
>>> from transaction import commit
>>> commit()

Set an encrypted password

from lxml import html
import requests
template = "https://distrowatch.com/search.php?pkg=Python&relation=greaterequal&pkgver={}&distrorange=InLatest#pkgsearch"
def get_distros(min_python_version):
response = requests.get(template.format(min_python_version))
distros = set()