Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 06:26 (UTC +02:00)
View GitHub Profile
@nickcernis
nickcernis / brew-clang-loop.md
Created October 3, 2022 19:49
brew update && brew upgrade leads to “the "clang" command requires the command line developer tools” loop
View brew-clang-loop.md
@nickcernis
nickcernis / functions.php
Created November 29, 2021 17:21
Prevent footer text escaping in Genesis
View functions.php
<?php
// Omit the opening <?php above when adding this to your active theme's functions.php.
add_filter( 'genesis_footer_output', 'custom_genesis_do_footer_unmodified' );
/**
* Outputs Genesis footer text without calling `wp_kses_post()`
* to strip attributes for security purposes.
*/
function custom_genesis_do_footer_unmodified() {
$footer_text = genesis_get_option( 'footer_text' );
@nickcernis
nickcernis / intellij-transparent-mac.md
Last active June 7, 2022 08:22
IntelliJ IDEA JetBrains make Mac titlebar transparent
View intellij-transparent-mac.md

To make the Mac titlebar transparent in IntelliJ IDEA, CLion, Rider, PhpStorm, WebStorm, and other JetBrains products:

  1. Help → Edit Custom Properties…
  2. Add this line to the file, save, and restart: ide.mac.transparentTitleBarAppearance=true

It should then take on the base colour of your theme.

@nickcernis
nickcernis / old-version-homebrew.md
Last active December 8, 2020 00:50
Install an old version with homebrew for macOS
View old-version-homebrew.md
  1. Find the formula for the version you want to install:

    • Visit https://github.com/Homebrew/homebrew-core/tree/master/Formula
    • Click the file with your formula (e.g. “composer.rb”)
    • Click “History” (top right)
    • Click the commit hash for the version you want to download
    • Click the three dots (top right of diff) and choose “view file”
    • Click “Raw” and copy the raw URL from the browser address bar.

    For example, composer 1.10.15 lives here: https://github.com/Homebrew/homebrew-core/blob/9e6e6a1ca8551901bff69d329c7fbb9007064134/Formula/composer.rb

@nickcernis
nickcernis / docker-cleanup.md
Last active March 25, 2023 07:59
Docker commands to remove all containers and images
View docker-cleanup.md

docker kill $(docker ps -q) to kill all running containers
docker rm $(docker ps -a -q) to delete all stopped containers.
docker volume rm $(docker volume ls -q) to delete all volumes.
docker rmi $(docker images -q) to delete all images.

Run all commands:

docker kill $(docker ps -q) && docker rm $(docker ps -a -q) && docker volume rm $(docker volume ls -q) && docker rmi $(docker images -q)

For fish shell, remove the $:

@nickcernis
nickcernis / mariadb-brew-macos.md
Created July 13, 2020 15:13
Install MariaDB with brew on macOS and fix the “access denied” issue
View mariadb-brew-macos.md

Attempting mysql -u root fails with Access denied for user 'root'@'localhost immediately after doing brew install mariadb and starting mariadb with brew services start mariadb.

To fix it (with MariaDB still running):

  1. sudo mysql then enter your Mac user password
  2. ALTER USER 'root'@'localhost' IDENTIFIED BY 'newrootpassword'; replacing newrootpassword with the password you wish to use for the MariaDB root user.
  3. Ctrl-C to exit mysql.

You should then be able to connect to MariaDB with mysql -u root -p, then entering the root password when prompted.

View keybase.md

Keybase proof

I hereby claim:

  • I am nickcernis on github.
  • I am nickcernis (https://keybase.io/nickcernis) on keybase.
  • I have a public key ASBvU4zu6cS48NykeyxX4A6zupanqwouo_gAEMuMysQSBgo

To claim this, I am signing this object:

@nickcernis
nickcernis / functions.php
Last active May 12, 2020 12:47
Wrap Genesis titles with a link on singular posts and pages
View functions.php
<?php
add_filter( 'genesis_post_title_output', 'custom_wrap_singular_titles_with_links', 10, 3 );
/**
* Wrap the post title with a link on singular entries.
*
* @param string $output The original title output (title content and tags).
* @param string $wrap The title tag.
* @param string $title The content of the title tag.
* @return string The new title output.
*/
@nickcernis
nickcernis / wp-cli-snippets.md
Last active August 10, 2022 12:00
WP-CLI snippets
View wp-cli-snippets.md

Delete all menus

wp menu list --format=ids | xargs wp menu delete

Delete posts of one type in bulk

wp post list --post_type='post-type-here' --format=ids | xargs wp post delete --force
@nickcernis
nickcernis / functions.php
Created February 18, 2020 19:40
Show the day in the heading on Genesis archives, even if an archive has no posts
View functions.php
<?php
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_headline', 10, 3 );
add_action( 'genesis_archive_title_descriptions', 'custom_do_archive_headings_headline', 10, 3 );
/**
* Adapts archive title to display a date even for days in custom post types that have no posts.
*
* @param string $heading Optional. Archive heading, default is empty string.
* @param string $intro_text Optional. Archive intro text, default is empty string.
* @param string $context Optional. Archive context, default is empty string.
*/