Skip to content

Instantly share code, notes, and snippets.

Welcher Selemium Selektor findet das 2. div?

    <div class="hidden" id="foo">
        Ich bin unsichtbar.
    </div>

    <div id="foo">
        Hallo Robot
 
@tomgross
tomgross / README.md
Last active August 6, 2024 07:39
Homebrew Cask for installing pCloud on a Mac

Installing pCloud with Homebrew Cask

Since this recipe was rejected because of the volatile nature of pCloud links (see homebrew-cask#57634) I try to maintain this myself because it is useful to me and might be for others.

  • Download pcloud-drive.rb.
  • Run brew cask install pcloud-drive.rb.

To uninstall run brew cask uninstall pcloud-drive.rb.

# -*- coding: utf-8 -*-
from plone import api
from plone.behavior.interfaces import IBehaviorAssignable
from plone.dexterity.interfaces import IDexterityFTI
from plone.dexterity.interfaces import IDexteritySchema
from plone.namedfile.interfaces import INamedBlobFileField
from plone.namedfile.interfaces import INamedImageField
from z3c.caching.interfaces import IPurgePaths
from zope.component import adapter
from zope.component import getUtility
@tomgross
tomgross / plone_py3.sh
Last active June 15, 2017 19:01
Plone Python 3 coredev buildout
#!/bin/bash
git clone [email protected]:plone/buildout.coredev.git coredev-py3
cd coredev-py3
python3 -m venv .
bin/pip install -U setuptools==33.1.1 zc.buildout==2.8.0
./bin/buildout -c experimental/py3x-test.cfg
@tomgross
tomgross / phone.py
Last active March 17, 2017 21:36
Fairytale Phone
#!/usr/bin/python
import RPi.GPIO as GPIO
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(23, GPIO.IN, pull_up_down=GPIO.PUD_UP)
c = 0
last = 1
@tomgross
tomgross / check_coverage.py
Last active April 10, 2019 14:33
Check the coverage of Python tests and compare with previous run in gitlab
# This script checks the coverage and test if it keeps at least the same
# Add this to your .gitlab-ci.yml
#
# coveragetest:
# ...
# cache:
# paths:
# - coverage_value.txt
# script:
# - bin/coverage run bin/test
# dynamically get JAVA_HOME on Fedora, CentOS, RHEL
JAVA_HOME=`alternatives --display java | sed -n 's/^Current .best. version is \(.*\)\/bin\/java\.$/\1/p'`
@tomgross
tomgross / recreate.sh
Last active February 28, 2024 10:57
Recreating a messed up github pull request
# if some commits landed erroneous in a PR on github
# this commands help to start fresh from master
# replace `my_pr_branch` with the name of the branch of your pull request
git checkout my_pr_branch
git diff master > ../pr.patch
git checkout master
git branch -D my_pr_branch
# make sure it is the *SAME* name than the branch you deleted
@tomgross
tomgross / parse_token.sh
Last active August 25, 2016 08:02
Extract authenticator in Zope / Plone form
#!/bin/sh
curl -u admin:admin http://localhost:8080/Plone/portal_quickinstaller/manage_installProductsForm -q | grep -oP '_authenticator.*value="\K[a-z0-9]*' | head -1
@tomgross
tomgross / buildout.cfg
Last active August 29, 2015 14:23
Plone WSGI deployment
[buildout]
parts = instance wsgiconf app
extends = http://dist.plone.org/release/5-latest/versions.cfg
[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
http-address =
eggs =
Plone