Skip to content

Instantly share code, notes, and snippets.

View Swiss-Mac-User's full-sized avatar
✍️
Blogging

Swiss Mac User  Swiss-Mac-User

✍️
Blogging
View GitHub Profile
@Swiss-Mac-User
Swiss-Mac-User / autoexec.cfg
Last active February 25, 2024 22:25
DOOM 3 on Mac – custom widescreen and high definition configurations for best visual quality (doom3, dhewm3). This config file is featured on https://swissmacuser.ch/doom3-hd-native-on-apple-arm-macos-120fps/
seta r_fullscreen "1" // Run game in fullscreen. 0=windowed
seta r_mode "-1" // Enable a custom resolution (width + height)
seta r_customWidth "2560" // Mac display resolution WIDTH
seta r_customHeight "1440" // Mac display resolution HEIGHT
seta r_aspectRatio "1" // Set aspect ratio: 0=4:3 (default), 1=16:9 (widescreen), 2=16:10 (ultrawide)
seta com_fixedTic "-1" // dhewm3-specific: uncapped FPS (>60 FPS)
seta com_showFPS "1" // Show the in-game FPS counter. 0=off
@Swiss-Mac-User
Swiss-Mac-User / add_alarms_to_ics.sh
Created January 16, 2024 20:47
Shell script to insert a VALARM block to every event in an iCalendar file (.ics), making imported events show an alert x hours before the event
#!/bin/bash
# Inspired from: https://x.com/SwissMacUser/status/1349065380514426883
# Personally used to add event reminders to the downloadabl iCalendar files
# of the yearly Stadt Zürich digital Entsorgungskalender at
# https://www.stadt-zuerich.ch/ted/de/index/entsorgung_recycling/entsorgen/persoenlicher_entsorgungskalender.html
# Check if the minimum number of arguments is provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <path-to-ics-file> <hours-to-alert-before> [backup]"
@Swiss-Mac-User
Swiss-Mac-User / Terminal.sh
Created June 22, 2023 21:07
Find non UTF-8 encoded files on macOS: a shell command to recursively list all non UTF-8 encoded files within a directory (and its subdirectories)
find /path/to/dir -maxdepth 2 -type f -exec sh -c 'iconv -f utf-8 -t utf-8 "{}" >/dev/null 2>&1 || echo "{}: Not UTF-8"' \;
@Swiss-Mac-User
Swiss-Mac-User / .env
Last active July 4, 2023 20:53
Docker Compose setup for a Wordpress blog using the official wordpress Docker image, compatible with macOS on Apple Silicon ARM. Full guide can be found here ➝ https://swissmacuser.ch/mamp-to-docker-mac-how-to-migrate/
COMPOSE_PROJECT_NAME="myblog"
OS_PLATFORM="linux/x86_64"
HTTP_PORT="80"
HTTPS_PORT="443"
WP_LOCALHOST="wordpress"
WP_HOST_WEBFILES="./public"
WP_HOST_DATABASEFILES="./mariadb"
WP_WEBROOT="/var/www/html"
WP_DB_NAME="wordpress"
WP_DB_USER="root"
@Swiss-Mac-User
Swiss-Mac-User / docker-compose.yaml
Last active July 4, 2023 21:38
Docker Compose YAML configuration for static webpages (supports macOS on Apple Silicon ARM Macs)
services:
apache-php:
platform: linux/x86_64
image: php:8.1-apache
container_name: my-website
restart: unless-stopped
environment:
- APACHE_DOCUMENT_ROOT=/var/www/html
hostname: mywebsite
domainname: mywebsite.local
@Swiss-Mac-User
Swiss-Mac-User / .gitignore
Created March 14, 2023 18:26
macOS .gitignore to exclude unwanted files and folders
# General
.DS_Store
.AppleDouble
.LSOverride
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
@Swiss-Mac-User
Swiss-Mac-User / .env
Last active July 27, 2023 18:15
Apple Silicon comaptible containerized LAMPP stack on Docker (Apache, PHP, MySQL, PhpMyAdmin) using only docker-compose | Works on ARM architecture
COMPOSE_PROJECT_NAME=“myapp"
OS_PLATFORM="linux/x86_64"
HTTP_PORT=80
HTTPS_PORT=443
DOMAINNAME="localhost" # With hosts entry, adjust accordingly like "myapp.local"
APACHE_WEBROOT="/var/www"
PHP_Version=7.4
MYSQL_TYPE="mariadb" # Use "mariadb" or "mysql"
MYSQL_VERSION="latest"
MYSQL_PORT=3306
@Swiss-Mac-User
Swiss-Mac-User / a_Docker setup.md
Last active March 20, 2024 16:35
Installing SonarQube on Docker and SonarScanner using Homebrew on macOS

Docker setup

Install the Docker UI application for macOS

brew install docker --cask

Open the Docker.app

from /Applications/Docker.app

Go to the Docker Dashboard

Wait until the "Docker Dashboard starting…"-message disappears (= Setup complete)

@Swiss-Mac-User
Swiss-Mac-User / .bash_profile
Created April 15, 2022 11:49
MAMP Apache, PHP and Composer configurations on macOS
# === MAMP App ===
# Start/Stop
alias mamp='/Applications/MAMP/bin/start.sh'
alias mamp_stop='/Applications/MAMP/bin/stop.sh'
# === MAMP Apache ===
alias apachectl='/Applications/MAMP/Library/bin/apachectl'
alias apache='apachectl'
@Swiss-Mac-User
Swiss-Mac-User / mysql57_convert_datetime_null.sql
Created March 23, 2021 20:19
MySQL 5.7 set datetime or date to NULL from 0000-00-00 00:00:00 - Fixes incorrect datetime value: '0000-00-00 00:00:00' (without NO_ZERO_DATE workaround)
/** ---
* To set an existing column in MySQL 5.7 from 0000-00-00 00:00:00 to NULL as default
* the following iterative 3 steps will get the job done.
* (Without just using the NO_ZERO_DATE compatibility mode-workaround)
--- */
/* Step 1) Set all 0000-00-00... to a valid but nonsense value: */
UPDATE my_table SET my_datetime_col = '1001-01-01 00:00:00' WHERE CAST(my_datetime_col AS CHAR(20)) = '0000-00-00 00:00:00';
/* Step 2) Modify the column to DEFAULT: NULL */