Skip to content

Instantly share code, notes, and snippets.

Johannes Raggam thet

View GitHub Profile
@thet
thet / package.json
Created Feb 5, 2019
my current account-wide package.json
View package.json
{
"name": "npm-tools",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"@angular/cli": "*",
"@vue/cli": "*",
"babel-eslint": "",
"bash-language-server": "",
@thet
thet / earchwallpaper.sh
Created Nov 9, 2018
World Sunlight Map Wallpaper
View earchwallpaper.sh
#!/bin/bash
#
# Changes the wallpaper hourly and displays a projection of the earth with
# a semi-realistic rendered sunglight mapping.
#
# This script will download hourly the "World Sunlight Map" by die.net.
# You can choose the world_sunlight_wallpaper.jpg picture as background image for your Desktop.
# Gnome recognizes file changes and updates the background accordingly.
#
# See:
@thet
thet / remove-broken-contentrule.py
Created Mar 15, 2018
Remove a broken contentrule after deinstalling ``collective.contentrules.comingsoon``
View remove-broken-contentrule.py
"""Remove a broken contentrule after deinstalling ``collective.contentrules.comingsoon``
"""
# Create Fake Interface
from zope.component.interfaces import IObjectEvent
class IComingSoon(IObjectEvent): pass
# Create Fake Module
import sys
@thet
thet / registry.xml
Last active Jan 15, 2018
Plone: Add ``object_provides`` criteria to query string for use in collections. Put code in ``registry.xml`` and create a .tar.gz, then upload it via portal_setup and make sure to untick "Purge existing settings".
View registry.xml
<registry xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<!-- Add ``object_provides`` criteria to query string for use in collections.
Put code in ``registry.xml`` and create a .tar.gz, then upload it via
portal_setup and make sure to untick "Purge existing settings". -->
<records interface="plone.app.querystring.interfaces.IQueryField"
prefix="plone.app.querystring.field.object_provides">
<value key="title">object_provides</value>
<value key="description">Search for provided interfaces</value>
<value key="enabled">True</value>
<value key="sortable">True</value>
@thet
thet / upgrades.py
Created Jun 12, 2017
Plone / Zope Component Architecture: Unregister all broken persistent utilities
View upgrades.py
# -*- coding: utf-8 -*-
from zope.component.hooks import getSite
import logging
log = logging.getLogger(__name__)
def unregister_broken_persistent_components(context):
portal = getSite()
sm = portal.getSiteManager()
@thet
thet / earthwallpaper.sh
Created Feb 17, 2017
Live Earth Wallpaper Changer for Linux
View earthwallpaper.sh
#!/bin/bash
#
# Changes the wallpaper hourly and displays a projection of the earth with
# a semi-realistic rendered sunglight mapping.
#
# Via: http://www.webupd8.org/2009/09/real-time-earth-wallpaper-for-linux.html
# More Info:
# - https://www.die.net/earth/rectangular.html
# - https://www.die.net/earth/how.html
#
@thet
thet / togglescrolling.sh
Created Jan 14, 2016
Toggle touchpad scrolling on Gnome 3 via dconf
View togglescrolling.sh
#!/bin/sh
# Toggle touchpad scrolling on Gnome 3 via dconf/gsettings between
# 'two-finger-scrolling' and 'edge-scrolling'.
# This can be useful for touchpad users using two-finger-scoll and want
# to open the context menu via two-finger-click on the right position.
CURRENT=$(gsettings get org.gnome.desktop.peripherals.touchpad scroll-method)
echo $CURRENT
View github_watch.py
"""Set all repositories of a given GitHub organization name for a given user
to watching.
"""
import argparse
import json
import requests
def get_repos(url, repo_list=[], auth=None):
@thet
thet / fix_image_scales.py
Created Dec 8, 2015
fix image scales from archetypes scales to dx scales, old scale names to new scale names
View fix_image_scales.py
# -*- coding: utf-8 -*-
from Products.CMFCore.utils import getToolByName
from plone.app.textfield.value import RichTextValue
from zope.component.hooks import getSite
import logging
log = logging.getLogger(__name__)
View imports sorted on the last word
from Products.Archetypes.Field import *
from Products.Archetypes.Storage import *
from Products.Archetypes.Widget import *
from Products.Archetypes.fieldproperty import ATDateTimeFieldProperty
from Products.Archetypes.fieldproperty import ATFieldProperty
from Products.Archetypes.athistoryaware import ATHistoryAwareMixin
from Products.Archetypes.fieldproperty import ATReferenceFieldProperty
from Products.Archetypes.annotations import AT_ANN_STORAGE
from Products.Archetypes.annotations import AT_FIELD_MD
from Products.Archetypes.ClassGen import AT_GENERATE_METHOD
You can’t perform that action at this time.