Skip to content

Instantly share code, notes, and snippets.

View nickcernis's full-sized avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 23:28 (UTC +02:00)
View GitHub Profile
@nickcernis
nickcernis / .zshrc
Created January 23, 2024 10:06
Simple zsh prompt
PS1='%F{blue}%~%(?.%F{green}.%F{red})>%f '
@nickcernis
nickcernis / zig-basic-types-cheatsheet.md
Last active January 18, 2024 21:37
Zig Cheatsheets

From Zigling 058.

//                          u8  single item
//                         *u8  single-item pointer
//                        []u8  slice (size known at runtime)
//                       [5]u8  array of 5 u8s
//                       [*]u8  many-item pointer (zero or more)
//                 enum {a, b}  set of unique values a and b
//                error {e, f}  set of unique error values e and f
@nickcernis
nickcernis / update-zig.sh
Last active June 18, 2023 09:11
Zig install/upgrade script, latest from master
#!/bin/bash
# Updates zig to the latest master version using the official binary,
# no compilation required.
#
# - Edit the ARCHITECTURE string to match your system.
# - Requires jq. `brew install jq` (macOS) or get it at https://jqlang.github.io/jq/.
# - Put the script in the directory you want zig to be installed below, such as ~/zig/bin.
# - Then run: chmod +x update-zig.sh && ./update-zig.sh
# - Zig will live in a subfolder named zig-master-latest.
# - Add that dir to your path, for example:
@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
@nickcernis
nickcernis / functions.php
Created November 29, 2021 17:21
Prevent footer text escaping in Genesis
<?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

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 March 4, 2024 23:49
Install an old version with homebrew for macOS
  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 1, 2024 10:37
Docker commands to remove all containers and images

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

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.

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: