Skip to content

Instantly share code, notes, and snippets.

View nickcernis's full-sized avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 08:42 (UTC +01:00)
View GitHub Profile
@nickcernis
nickcernis / .clang-format
Last active January 21, 2025 20:41
Minimal .clang-format, requires clang-format 16+
---
BasedOnStyle: LLVM
IndentWidth: 4
UseTab: Never
ColumnLimit: 135
PointerAlignment: Left
AllowShortFunctionsOnASingleLine: None
InsertNewlineAtEOF: true
NamespaceIndentation: All
FixNamespaceComments: false
@nickcernis
nickcernis / TokyoNight.xccolortheme
Last active December 11, 2024 11:27
Xcode Toyko Night theme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DVTConsoleDebuggerInputTextColor</key>
<string>0.754 0.774 0.96 1</string>
<key>DVTConsoleDebuggerInputTextFont</key>
<string>SFMono-Medium - 14.0</string>
<key>DVTConsoleDebuggerOutputTextColor</key>
<string>0.754 0.774 0.96 1</string>
@nickcernis
nickcernis / .zshrc
Created January 23, 2024 10:06
Simple zsh prompt
PS1='%F{blue}%~%(?.%F{green}.%F{red})>%f '

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 November 6, 2024 14:59
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 February 3, 2025 11:13
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 $: