Skip to content

Instantly share code, notes, and snippets.

@cyrillbolliger
cyrillbolliger / apple-ubuntu-keymapping.md
Last active July 6, 2019 19:39
Apple Keymappings for Ubuntu 18.04

Apple Keymappings for Ubuntu 18.04

Customize the keymappgins for Ubuntu 18.04 (GNOME), to get more apple like shortcuts using xmodmap:

  • switch the left control and command keys
  • make the right command key behave like a control key
  • use the left and the right alt keys for special symbols (level 3 shift)

Create a new file called .xmodmap in your home directory with the following keymappings:

clear control
@cyrillbolliger
cyrillbolliger / wp-cli-multisite-command-to-every-subsite.md
Last active February 19, 2020 23:13
WP-CLI Multisite apply command to every subsite

WP-CLI Multisite apply command to every subsite

You need to apply a wp-cli command to every blog of a WordPress multisite installation?

List all pages and pipe the URLs using xargs to your wp command:

wp site list --field=url | xargs -n1 -I % wp --url=% YOUR_WP_COMMAND_HERE

Examples

  • Deativate plugin on every subsite:
@cyrillbolliger
cyrillbolliger / gist:e69fd6c8d7baa690e898ca1aa0148db5
Created December 3, 2019 10:52
Access Ubiquity Unify Network Manager on Debian based Linux'
@cyrillbolliger
cyrillbolliger / Free purgeable disk space - Delete local snapshots on apfs.md
Last active March 12, 2020 20:10
Free purgeable disk space - Delete local snapshots on apfs

Local snapshots beef up the disk space of your mac. If the diskspace is marked purgeable but isn't freed when you empty the trash, chances are high, that local timemachine snapshots are using it.

Delete local snapshots (on volumes formated with APFS)

  1. Open the terminal
  2. List the disks and partitions number using diskutil list.
  3. Watch out for disks marked as synthesized and the partitions of type APFS Container Scheme
  4. The PARTITION_IDENTIFIER used later on, is composed of disk concatenated with the disk number, an s and the partition number. So for the following diskutil list output it would be disk4s1:
@cyrillbolliger
cyrillbolliger / set-image-metadata-copyright.sh
Last active May 11, 2020 14:20
Set image EXIF copyright with exiftool
@cyrillbolliger
cyrillbolliger / gruene-theme-set-tribe-events.md
Created July 8, 2020 08:54
WordPress MultiSite set Tribe Events to List View

WordPress MultiSite set Tribe Events to List View

Set the tribe events settings for every site in the multisite network to list view with minimal styles on the default page template using the V1 view.

wp site list --field=url | xargs -I % wp --url="%" option patch update tribe_events_calendar_options tribeEventsTemplate default
wp site list --field=url | xargs -I % wp --url="%" option patch update tribe_events_calendar_options viewOption list
wp site list --field=url | xargs -I % wp --url="%" option patch --format=json insert tribe_events_calendar_options stylesheetOption false
wp site list --field=url | xargs -I % wp --url="%" option patch --format=json insert tribe_events_calendar_options views_v2_enabled false
@cyrillbolliger
cyrillbolliger / flameshot.ini
Last active August 10, 2021 22:18
Custom Colors in Flameshot UI
`echo 'userColors=#84B414, #FF0078, #800000, #ff0000, #ffff00, #008000, #00ffff, #0000ff' >> ~/.config/flameshot/flameshot.ini`
@cyrillbolliger
cyrillbolliger / wp_remove_gutenberg_tags.py
Last active October 6, 2020 13:29
Strip WordPress Block Editor Tags (Gutenberg) form WXR
### usage: python3 wp_remove_gutenberg_tags.py < wordpress-export-with-tags.xml > cleand.xml
import fileinput
import re
data = ''
m_start = 0
m_stop = 0
for line in fileinput.input():
@cyrillbolliger
cyrillbolliger / README.md
Last active January 17, 2023 16:10
WordPress Multisite: Map multiple domains to single blog / subsite

WordPress Multisite: Map multiple domains to single blog / subsite

As the WordPress core can only assign a single domain to a multisite blog, one must employ the very early called sunrise.php, to setup multiple domains for a single blog in a WordPress Multisite environment. One use case for such a setup is a multilingual blog with one domain per language (e.g. when using Polylang with language selection by domain).

How To

  1. Create wp-content/sunrise.php if it does not exist
  2. Paste the snipped below into the sunrise.php
  3. Configure your extra domains:
    • call cybo_add_extra_domain( $domain, $blog_id ) with the additional domain and the id of the blog it should point to
  • you can call it multiple times for multiple domains