Skip to content

Instantly share code, notes, and snippets.

View thet's full-sized avatar

Johannes Raggam thet

View GitHub Profile
@thet
thet / earthwallpaper.sh
Created February 17, 2017 10:55
Live Earth Wallpaper Changer for Linux
#!/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 / this_test.js
Created December 15, 2020 11:11
The this context and inner functions
const this_test = {
returns_global_this() {
function inner() {
// even unbound inner function's
// this context is globalThis.
return this;
}
return inner();
},
returns_local_this() {
@thet
thet / memoize.py
Created November 30, 2020 10:36
plone.memoize helpers with support for plone.subrequest
# -*- coding: utf-8 -*-
# memoize support for plone.subrequest subrequests.
# usage:
# >>> import ./memoize
# >>> from ./memoize import instance_memoize
# >>> @memoize.parent_request_memoize
# >>> def _results(self):
# >>> return "expensive calculation"
# >>>
@thet
thet / validitytest.js
Last active July 20, 2020 15:43
input type date validity test
let form = document.createElement('form');
let el = document.createElement('input');
el.setAttribute('type', 'date');
el.setAttribute('name', 'okay');
form.appendChild(el);
document.body.appendChild(form);
let input = document.querySelector('form input');
input.value = 'lsk';
console.log(input.validity.valid); // says ``true``, should be ``false``
"""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 / upgrades.py
Created June 12, 2017 13:53
Plone / Zope Component Architecture: Unregister all broken persistent utilities
# -*- 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 / package.json
Created February 5, 2019 20:14
my current account-wide 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 November 9, 2018 08:13
World Sunlight Map Wallpaper
#!/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 / collective-repos.txt
Last active July 11, 2018 15:19
list of all plone collective repositories per 2018-07-11
actionbar.babble
actionbar.panel
alm.solrindex
anz.casclient
archetypes.clippingimage
archetypes.datetimewidget
archetypes.linguakeywordwidget
archetypes.pfgextender
archetypes.testcase
archetypes.uploadreferencewidget
@thet
thet / remove-broken-contentrule.py
Created March 15, 2018 12:30
Remove a broken contentrule after deinstalling ``collective.contentrules.comingsoon``
"""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