Skip to content

Instantly share code, notes, and snippets.

View nickcernis's full-sized avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 10:27 (UTC +01:00)
View GitHub Profile
@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.

@nickcernis
nickcernis / readme.md
Last active March 7, 2024 01:43
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@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 / .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 / dnsmasq.md
Last active July 6, 2023 13:11
dnsmasq

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@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 / functions.php
Created December 4, 2014 13:04
Add or edit the notes before the WordPress comments form
<?php // remove this line
// Add or edit the notes before the comments form
add_filter( 'comment_form_defaults', 'sp_add_comment_form_before' );
function sp_add_comment_form_before( $defaults ) {
$defaults['comment_notes_before'] = '<p class="comment-notes">Your email address will not be published. Required fields are marked <span class="required">*</span></p>';
return $defaults;
}
@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