Skip to content

Instantly share code, notes, and snippets.

View martinbutt's full-sized avatar

Martin Butt martinbutt

View GitHub Profile

You can add a regular spacer or a small spacer. Copy and paste one of the scripts into your Terminal.

Regular spacer script:

defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock

Small spacer script:

@martinbutt
martinbutt / crontab
Created November 12, 2022 21:34
Crontab to allow output, but only email it if the script fails
* * * * * script.sh &> tmp_file || (echo Script failed with exit code $?; cat tmp_file); rm -f tmp_file > /dev/null
@martinbutt
martinbutt / ip-validator.bash
Created September 29, 2022 15:46
BASH IP address (IPv4 and IPv6) validator
[[ $IP =~ ^([1-9]?[0-9]\.|1[0-9]{2}\.|2[0-4][0-9]\.|25[0-5]\.){3}([1-9]?[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{0,4}$ ]] || >&2 echo "Error: IP address '${IP}' is not valid"
@martinbutt
martinbutt / INSTALL.md
Created March 27, 2022 20:32
Install Express VPN on ARM64 Gemini PDA Debian 9 (Gemian Linux)

Configure system to allow installation of armhf (32-bit) packages

sudo dpkg --add-architecture armhf
sudo apt-get update

Change [arch=arm64] to [arch=arm64,armhf] in all locations

sudo vi /etc/apt/sources.list.d/multistrap-debian.list

Install the cross compatibility libraries

<?php
include("vendor/autoload.php");
class ClassWithStaticMethod {
public static function staticMethod(): string
{
return "hello";
}