Skip to content

Instantly share code, notes, and snippets.

View szhajdu's full-sized avatar

Szabolcs Hajdu szhajdu

View GitHub Profile
@szhajdu
szhajdu / sphp.sh
Last active February 3, 2024 13:27
Simplified version of rhukster/sphp.sh focusing only on PHP switch
#!/bin/bash
# Original version: https://raw.githubusercontent.com/rhukster/sphp.sh/main/sphp.sh
script_version=1.0.0
# Supported PHP versions
brew_array=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3" "8.4")
target_version=$1
php_version="php@$target_version"
@szhajdu
szhajdu / plexupdate.sh
Last active October 31, 2019 22:56
Download and update Plex on Synology NAS
#!/bin/bash
mkdir -p /volume1/tmp/plex/ > /dev/null 2>&1
token=$(cat /volume1/Plex/Library/Application\ Support/Plex\ Media\ Server/Preferences.xml | grep -oP 'PlexOnlineToken="\K[^"]+')
url=$(echo "https://plex.tv/api/downloads/5.json?channel=plexpass&X-Plex-Token=$token")
jq=$(curl -s "${url}")
newversion=$(echo $jq | jq -r .nas.Synology.version)
echo "Latest Version: $newversion"
@szhajdu
szhajdu / dnsmasq-init.sh
Last active October 9, 2016 16:15
Wildcard forwarding of all *.dev DNS names to localhost. Setup dnsmasq on Mac OS.
# Install dnsmasq.
brew install dnsmasq
# Setup *.dev.
echo 'address=/.dev/127.0.0.1' > /usr/local/etc/dnsmasq.conf
# Start it and ensure it auto-starts on reboot in the future
sudo brew services start dnsmasq
# Setup dns resovler.